--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AbstractJavaTestCase.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,354 @@
+"
+ 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:#AbstractJavaTestCase
+ instanceVariableNames:'exceptionThrowerBackup'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!AbstractJavaTestCase 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.
+
+"
+! !
+
+!AbstractJavaTestCase class methodsFor:'resources'!
+
+resources
+ ^ Array with: JavaInitializedResource with: JavaTestsResource.
+
+ "Created: / 26-04-2011 / 13:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!AbstractJavaTestCase methodsFor:'cp creation helpers'!
+
+getClassRefNamed: name
+ "creates classRef with correctly prepared constant pool"
+
+ | cp |
+
+ cp := JavaConstantPool new:2.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: name.
+
+ ^ cp at: 1.
+
+ "Created: / 23-05-2011 / 16:17:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getFieldRefNamed: name typed: type inClass: classString
+ "creates fieldRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getFieldRefIn: cp
+ withNameAndTypeAt: 6 andClassAt: 1).
+ cp at: 6 put: (self getNameAndTypeIn: cp withNameAt: 3 andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 15:56:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getInterfaceMethodRefNamed: name typed: type inClass: classString
+ "creates interfaceMethodRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getInterfaceMethodRefIn: cp
+ withNameAndTypeAt: 6
+ andClassAt: 1).
+ cp at: 6
+ put: (self
+ getNameAndTypeIn: cp
+ withNameAt: 3
+ andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 16:15:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getMethodRefNamed: name typed: type inClass: classString
+ "creates methodRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getMethodRefIn: cp
+ withNameAndTypeAt: 6
+ andClassAt: 1).
+ cp at: 6
+ put: (self
+ getNameAndTypeIn: cp
+ withNameAt: 3
+ andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 16:00:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!AbstractJavaTestCase methodsFor:'helpers'!
+
+disableMockedExceptionThrowing
+ JavaResolver uniqueInstance exceptionThrower: exceptionThrowerBackup.
+
+ "Created: / 13-04-2011 / 14:11:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+enableMockedExceptionThrowing
+ exceptionThrowerBackup := JavaResolver uniqueInstance exceptionThrower.
+ JavaResolver uniqueInstance exceptionThrower: JavaExceptionThrowerMock new.
+
+ "Created: / 13-04-2011 / 14:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getCrateClassReadStream
+ ^ ((Filename named: UserPreferences current javaTestsDirectory)
+ / 'libjava' / 'bin'
+ / 'stx' / 'libjava'
+ / 'tests' / 'mocks'
+ / 'Crate.class') readStream.
+
+ "Created: / 10-05-2011 / 12:13:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 16:26:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getPrettyBigConstantPool
+ | cp |
+
+ cp := JavaConstantPool new: 20.
+ cp at: 1 put: 6.
+ cp at: 2 put: 'Ljava/lang/Object;'.
+ cp at: 3 putClassRefWithNameAt: 2.
+ cp
+ at: 4
+ putMethodRefWithClassAt: 3
+ andNameAndTypeAt: 5.
+ cp
+ at: 5
+ putNameAndTypeWithNameAt: 6
+ andDescriptorAt: 7.
+ cp at: 6 put: '<init>'.
+ cp at: 7 put: '()V'.
+ cp at: 8 put: 'Ljava/lang/String;'.
+ cp at: 9 putClassRefWithNameAt: 8.
+ cp
+ at: 10
+ putMethodRefWithClassAt: 9
+ andNameAndTypeAt: 13.
+ cp at: 11 put: 'length'.
+ cp at: 12 put: '()I'.
+ cp
+ at: 13
+ putNameAndTypeWithNameAt: 11
+ andDescriptorAt: 12.
+ cp at: 14 putClassRefWithNameAt: 15.
+ cp at: 15 put: 'Ljava/lang/Runnable;'.
+ cp at: 16 put: 'run'.
+ cp at: 17 put: '()V'.
+ cp
+ at: 18
+ putNameAndTypeWithNameAt: 16
+ andDescriptorAt: 17.
+ cp at: 19 putClassRefWithNameAt: 15.
+ cp
+ at: 20
+ putInterfaceMethodRefWithClassAt: 19
+ andNameAndTypeAt: 18.
+ ^ cp
+
+ "Modified: / 23-05-2011 / 15:16:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaLangObject
+^Java classForName:'java.lang.Object'.
+
+ "Created: / 12-05-2011 / 19:09:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!AbstractJavaTestCase methodsFor:'refs creation'!
+
+getClassRefIn: aJavaConstantPool withNameAt: nameCPIndex
+ | result |
+
+ result := JavaClassRef2 in: aJavaConstantPool withNameAt: nameCPIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 12-05-2011 / 19:14:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:24:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getFieldRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result := JavaFieldRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 16:01:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getInterfaceMethodRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result:= JavaInterfaceMethodRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 15:58:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getMethodRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result := JavaMethodRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 15:58:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getNameAndTypeIn: cp withNameAt: nameIndex andTypeAt: typeIndex
+ |result|
+
+ result := JavaNameAndType2
+ in: cp
+ withNameAt: nameIndex
+ andDescriptorAt: typeIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 16:00:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!AbstractJavaTestCase methodsFor:'running'!
+
+setUp
+ self enableMockedExceptionThrowing.
+
+ "Created: / 12-05-2011 / 17:30:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 18:02:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+tearDown
+
+ self disableMockedExceptionThrowing.
+
+ "Created: / 12-05-2011 / 17:30:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractJavaTestCase class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Byte.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,166 @@
+"
+ 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' }"
+
+Integer subclass:#Byte
+ instanceVariableNames:'value'
+ classVariableNames:'Instances'
+ poolDictionaries:''
+ category:'Magnitude-Numbers'
+!
+
+!Byte 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'm a fake class representing a byte value.
+ I've no behavior (for now), I exists only as
+ type placeholder for stx:libjava
+
+ [author:]
+ Jan Vrany (jan.vrany@fit.cvut.cz)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!Byte class methodsFor:'accessing'!
+
+javaArrayClass
+ ^ ByteArray
+
+ "Created: / 11-02-2011 / 10:42:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaName
+
+ ^'byte'.
+
+ "Modified: / 25-02-2011 / 18:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Byte class methodsFor:'autoboxing support'!
+
+javaBox:anObject
+
+ | wrapper |
+
+ wrapper := (Java classForName: 'java.lang.Byte') new.
+ wrapper perform: #'<init>(B)V' with: anObject.
+ ^wrapper
+
+ "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaUnbox:anObject
+ self assert:anObject class isJavaClass message:'Not a java object'.
+ self assert:anObject class name = 'java/lang/Byte'
+ message:'Invalid java wrapper class'.
+ ^ anObject instVarNamed:#value
+
+ "Created: / 05-08-2011 / 19:08:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Byte class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+ ^true
+
+ "Created: / 20-12-2010 / 22:31:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Byte class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JUnitTestCaseProxy.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,202 @@
+"
+ 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' }"
+
+JavaTestCaseProxy subclass:#JUnitTestCaseProxy
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-Proxies'
+!
+
+!JUnitTestCaseProxy 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.
+
+"
+! !
+
+!JUnitTestCaseProxy class methodsFor:'initialization'!
+
+initialize
+
+ TestCases := Dictionary new.
+
+ "Created: / 01-03-2011 / 10:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JUnitTestCaseProxy class methodsFor:'accessing'!
+
+lookupHierarchyRoot
+
+ ^JUnitTestCaseProxy
+
+ "Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JUnitTestCaseProxy class methodsFor:'private'!
+
+testSelectors
+ | javaClass |
+
+ self == JUnitTestCaseProxy ifTrue:[ ^ #() ].
+ javaClass := self javaClass.
+ (javaClass includesBehavior:(JavaVM classForName:'junit.framework.TestCase'))
+ ifTrue:[ ^ javaClass selectors select:[:sel | sel startsWith:'test' ]. ].
+
+ ^ (javaClass
+ selectMethodsAnnotatedWith:(JavaVM classForName:'org.junit.Test') typeName)
+ collect:[:method | method selector ]
+
+ "
+ (JUnitTestCase for: JAVA::stx::libjava::tests::junit::JUnit3Tests)
+ testSelectors"
+
+ "Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 04-03-2011 / 00:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JUnitTestCaseProxy class methodsFor:'subclass creation'!
+
+for:javaClass
+ "Answers a new (anonymous) testcase proxy for
+ given javaClass"
+
+ self assert:javaClass isJavaClass description:'Not a java class'.
+ self assert:javaClass isTestCaseLike
+ description:'Not a testcase-like class'.
+ ^self forClassNamed: javaClass name
+
+ "Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 21-06-2011 / 17:08:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JUnitTestCaseProxy methodsFor:'accessing'!
+
+nameForHDTestReport
+
+ ^self class javaClassName copyReplaceAll:$/ with: $.
+
+ "Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+!
+
+selectorForHDTestReport
+
+ ^testSelector upTo:$(
+
+! !
+
+!JUnitTestCaseProxy methodsFor:'private'!
+
+performTest
+
+ <resource: #skipInDebuggersWalkBack>
+
+ [
+ self javaClass new perform: testSelector sunitAsSymbol
+ ] on: JavaError do: [:ex|
+ "This is the tricky part. We have to auto-magically convert
+ jUnit's AssertionFailedError to sUnits TestFailure's"
+
+ "Bad, bad, I know..."
+ (ex parameter class name == #'junit/framework/AssertionFailedError')
+ ifTrue:
+ [ TestResult failure sunitSignalWith: ex description ]
+ ifFalse:
+ [ ex pass ]
+ ]
+
+ "Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-03-2011 / 00:07:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JUnitTestCaseProxy class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JUnitTestCaseProxy initialize!
\ No newline at end of file
--- a/Java.st Thu Sep 23 13:52:13 2010 +0000
+++ b/Java.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,14 +12,42 @@
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:#Java
instanceVariableNames:''
- classVariableNames:'Classes UnresolvedClassRefs ClassPath SourceDirectories JavaHome
- InternedStrings Java_lang_String Java_lang_Class PrettyPrintStyle
- LastArgumentString Threads ExcludedClassPath FailedToLoadClasses'
+ classVariableNames:'Classes UnresolvedClassRefs Release ClassPath SourceDirectories
+ CacheDirectory JavaHome InternedStrings Java_lang_String
+ Java_lang_Class PrettyPrintStyle LastArgumentString Threads
+ ExcludedClassPath FailedToLoadClasses SourceCache
+ SourceArchiveCache'
poolDictionaries:''
category:'Languages-Java-Support'
!
@@ -24,8 +56,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,9 +69,43 @@
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
+"Java class is main entry point or - you might say -
+facade to the Java world inside Smalltalk. It also
+serves as configuration entity - e.g. controlling
+classpath, source paths, etc. Java class is responsible
+for correct initialization and glueing other classes.
+"
! !
!Java class methodsFor:'accessing'!
@@ -43,7 +113,7 @@
classForName:aString
"return a javaClass - either existing or loaded"
- |cls loader classURL|
+ |cls loader|
cls := self at:aString.
cls isNil ifTrue:[
@@ -54,7 +124,7 @@
]
].
- ('JAVA [info]: late class loading: ' , aString) infoPrintCR.
+ "/('JAVA [info]: late class loading: ' , aString) infoPrintCR.
loader := JavaClassReader classLoaderQuerySignal query.
loader isNil ifTrue:[
"/ load using default (ST/X) loader
@@ -77,8 +147,9 @@
].
^ cls
- "Created: / 18.3.1997 / 16:45:57 / cg"
- "Modified: / 27.4.1998 / 15:00:52 / cg"
+ "Created: / 18-03-1997 / 16:45:57 / cg"
+ "Modified: / 27-04-1998 / 15:00:52 / cg"
+ "Modified: / 18-08-2011 / 19:30:50 / jv"
!
classNamed:aString
@@ -123,6 +194,27 @@
"Created: 1.8.1997 / 10:37:57 / cg"
!
+release
+
+ ^Release
+
+ "Created: / 22-11-2010 / 12:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+release: aJavaRelease
+
+ Release := aJavaRelease.
+
+ "
+ Java release: JavaRelease openJDK6.
+ Java release: JavaRelease sunJDK6.
+
+ "
+
+ "Created: / 22-11-2010 / 12:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2010 / 11:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
systemPropertyAt:key put:something
JavaVM systemProperties at:key put:something
@@ -142,29 +234,109 @@
!Java class methodsFor:'accessing paths'!
addToClassPath:aPath
- (ClassPath includes:aPath) ifFalse:[
- ClassPath add:aPath.
- FailedToLoadClasses := nil
+
+ | path |
+ path := aPath asFilename.
+
+ (aPath asString includes: $*) ifTrue:[
+ self addToClassPathFilesMatching: path baseName
+ in: path directoryName.
+ ] ifFalse:[
+ (ClassPath includes:aPath asString) ifFalse:[
+ ClassPath add:aPath asString.
+ self addToClassPathInRuntime:aPath.
+ FailedToLoadClasses := nil
+ ]
]
- "Created: / 1.8.1997 / 21:10:07 / cg"
- "Modified: / 17.9.1998 / 20:43:55 / cg"
+ "Created: / 01-08-1997 / 21:10:07 / cg"
+ "Modified: / 17-09-1998 / 20:43:55 / cg"
+ "Modified: / 07-08-2011 / 14:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addToClassPathFilesMatching: pattern in: path
+
+ | dir |
+ dir := path asFilename.
+ dir directoryContents do:
+ [:fname|
+ (fname matches: pattern) ifTrue:
+ [| p |
+ p := (dir / fname) pathName.
+ (ClassPath includes:p) ifFalse:
+ [ClassPath add:p.
+ self addToClassPathInRuntime:p.
+ FailedToLoadClasses := nil]]].
+
+ "Created: / 20-12-2010 / 17:26:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addToClassPathInRuntime:aPath
+
+ | path file url scl |
+ "Java might not be loaded/or initialized, in this case
+ there is no no need to inform java about new entry in classpath"
+
+ JavaVM booted ifFalse:[^self].
+ scl := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl.
+ scl ifNil:[
+ scl := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'.
+ ].
+ path := Java as_String: aPath asString.
+ file := (Java at:'java.io.File') new perform: #'<init>(Ljava/lang/String;)V' with: path; yourself.
+ url := file perform: #'toURL()Ljava/net/URL;'.
+ scl perform: #'addURL(Ljava/net/URL;)V' with: url.
+
+ "Created: / 01-08-1997 / 21:10:07 / cg"
+ "Modified: / 17-09-1998 / 20:43:55 / cg"
+ "Created: / 07-08-2011 / 14:01:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
addToSourcePath:aPath
+ SourceDirectories ifNil:[SourceDirectories := OrderedCollection new].
(SourceDirectories includes:aPath) ifFalse:[
SourceDirectories add:aPath
]
- "Modified: 7.2.1997 / 19:23:55 / cg"
- "Created: 2.8.1997 / 14:12:31 / cg"
+ "Created: / 02-08-1997 / 14:12:31 / cg"
+ "Modified: / 06-02-2011 / 22:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cacheDirectory
+
+ CacheDirectory ifNil:[
+ CacheDirectory := Filename homeDirectory / '.smalltalk' / 'libjava' / 'caches' /
+ (((Smalltalk at:#stx_libjava) svnRepositoryUrlBase copyReplaceAll:$/ with:$_) replaceAll:$: with:$_)
+ ].
+ ^CacheDirectory
+
+ "Created: / 08-04-2011 / 15:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-04-2011 / 16:58:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
classPath
- ^ ClassPath
+
+ | CLASSPATH |
+ CLASSPATH := ((OperatingSystem getEnvironment: 'CLASSPATH') ? '')
+ tokensBasedOn: OperatingSystem pathSeparator.
- "Created: 7.2.1997 / 19:23:45 / cg"
- "Modified: 7.2.1997 / 19:23:55 / cg"
+ ^
+ "for testing only"
+ "/Release classPath,
+ (Array
+ with: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-projects' / 'Conversion' / 'bin' ) pathName
+ with: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-support' / 'bin' ) pathName
+ ),
+
+ (ClassPath ? #()),
+ CLASSPATH
+
+ "
+ Java classPath
+ "
+
+ "Created: / 07-02-1997 / 19:23:45 / cg"
+ "Modified: / 12-08-2011 / 08:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
classPath:aCollectionOfPaths
@@ -175,6 +347,31 @@
"Modified: / 17.9.1998 / 20:44:09 / cg"
!
+effectiveClassPath
+
+ ^self release classPath , self classPath
+
+ "
+ Java effectiveClassPath
+ "
+
+ "Created: / 22-11-2010 / 13:03:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 17-01-2011 / 09:44:16 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 12-08-2011 / 08:57:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+effectiveSourceDirectories
+
+ ^Release sourcePath ,
+ (SourceDirectories ? #())
+
+ "
+ Java effectiveSourceDirectories
+ "
+
+ "Created: / 30-11-2010 / 11:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
excludedClassPath
^ ExcludedClassPath
@@ -195,15 +392,22 @@
!
javaHome
- ^ JavaHome
+ ^ JavaHome ifNil:[Release javaHome]
- "Created: 6.8.1997 / 00:53:19 / cg"
+ "Created: / 06-08-1997 / 00:53:19 / cg"
+ "Modified: / 22-11-2010 / 12:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
javaHome:aPath
+
+ <resource: #obsolete>
+
+ self obsoleteMethodWarning: 'javaHome is now controlled by java release'.
+
JavaHome := aPath
- "Created: 6.8.1997 / 00:53:23 / cg"
+ "Created: / 06-08-1997 / 00:53:23 / cg"
+ "Modified: / 22-11-2010 / 12:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
newJavaHome:newJavaHome
@@ -252,6 +456,17 @@
"Created: / 16.1.1998 / 13:26:55 / cg"
! !
+!Java class methodsFor:'change & update'!
+
+update: what with: param from: sender
+
+ what == #restarted ifTrue:[
+ self reinitialize.
+ ]
+
+ "Created: / 14-12-2010 / 21:00:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Java class methodsFor:'class initialization'!
initAllClasses
@@ -316,305 +531,22 @@
!
initialize
- |tryJDK1_22 tryJDK1_21 tryJDK1_2 tryJDK1_2beta tryJDK1_18 tryJDK1_17 tryJDK1_16 tryJDK1_15 tryJDK1_13 tryJDK1_11 tryJDK1_03
- tryJDK1_02 directoriesToSearch possibleJavaDirs
- jHome jClasses jSources mozillaHome tryNetscape4_0
- tryMS tryBorland tryVA tryJRE1_1 fn d classPath tryJRE6|
-
JavaNativeMethod flushAllCachedNativeMethods.
InternedStrings := Dictionary new.
FailedToLoadClasses := nil.
- classPath := OperatingSystem getEnvironment:'CLASSPATH'.
- "/ those dirs are tried to search for a java system ...
- OperatingSystem isUNIXlike ifTrue:[
- possibleJavaDirs := #(
- '/opt'
- '/opt/java'
- '/home/java'
- '/home2/java'
- '/phys/exept/home/java'
- '/phys/exept/home2/java'
- '/usr/local/java'
- '/usr/local/lib'
- '/usr/local'
- '/usr/lib'
- '/usr/java'
- '/usr'
- ).
- classPath notNil ifTrue:[
- classPath := classPath asCollectionOfSubstringsSeparatedBy:$:.
- ].
- ].
- OperatingSystem isMSWINDOWSlike ifTrue:[
- possibleJavaDirs := #(
- 'c:\'
- 'c:\java\'
- 'c:\Programs\'
- 'c:\Programme\'
- 'c:\Program Files\'
- 'c:\Program Files\JavaSoft\'
- 'c:\Program Files\JavaSoft\JRE\'
- 'd:\'
- 'd:\java\'
- 'd:\Programs\'
- 'd:\Programme\'
- 'd:\Program Files\'
- 'd:\Program Files\JavaSoft\'
- 'd:\Program Files\JavaSoft\JRE\'
- 'C:\Program Files\Java\'
- '\\exept\home\java\'
- '\\exept\home2\java\'
- '\\exept\cg\home\java\'
- '\\exept\cg\home2\java\'
- ).
- "/ TODO: look in the registry ...
- classPath notNil ifTrue:[
- classPath := classPath asCollectionOfSubstringsSeparatedBy:$;.
- ].
- ].
-
- possibleJavaDirs := possibleJavaDirs collect:[:dirName | dirName asFilename].
- possibleJavaDirs := possibleJavaDirs select:[:dir | dir exists].
- possibleJavaDirs := possibleJavaDirs select:[:dir | dir isDirectory].
-
- classPath notNil ifTrue:[
- classPath := classPath collect:[:dirName | dirName asFilename].
- classPath := classPath select:[:dir | dir exists].
- possibleJavaDirs := classPath , possibleJavaDirs.
- ].
-
- FailedToLoadClasses := nil.
-
- "/ cannot use JDK1.2 yet (they made so many changes ...)
-"/ tryJDK1_22 := true.
-"/ tryJDK1_21 := true.
-"/ tryJDK1_2 := true.
-"/ tryJDK1_2beta := true.
-
- "/ cannot use those yet (they also made changes ...)
-"/ tryVA := true. "/ visualAge-java
-"/ tryNetscape4_0 := true. "/ netscape-java
-
-"/ tryMS := true. "/ MS-java; not really working
-"/ tryBorland := true. "/ borland jbuilder-java; not really working
-
- tryJDK1_18 := true. "/ standard sun jdk's - work more or less
- tryJDK1_17 := true.
- tryJDK1_16 := true.
- tryJDK1_15 := true.
- tryJDK1_13 := true.
- tryJDK1_11 := true.
-"/ tryJDK1_03 := true.
-"/ tryJDK1_02 := true.
-
- tryJRE1_1 := true.
- tryJRE6 := true.
-
+ ClassPath := OrderedCollection new.
ExcludedClassPath := OrderedCollection new.
- directoriesToSearch := OrderedCollection new.
-
- tryJRE1_1 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'JRE\1.1').
- directoriesToSearch add:(d construct:'JRE/1.1').
- ]
- ].
- tryJRE6 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jre6\').
- directoriesToSearch add:(d construct:'jre6\lib').
- directoriesToSearch add:(d construct:'jre6\lib\rt.jar').
- ]
- ].
- tryVA == true ifTrue:[
- directoriesToSearch add:('C:\IBMVJava\EAB\jdk' asFilename).
- ].
- tryBorland == true ifTrue:[
- directoriesToSearch add:('c:\jbuilder2\java' asFilename).
- ].
-
- tryMS == true ifTrue:[
-"/ (fn := 'c:\windows\java\classes' asFilename) exists ifTrue:[
-"/ directoriesToSearch add:('c:\windows\java\classes' asFilename).
-"/ fn directoryContents do:[:f |
-"/ (f asFilename hasSuffix:'zip') ifTrue:[
-"/ directoriesToSearch add:(fn construct:f)
-"/ ]
-"/ ]
-"/ ].
-
- (fn := 'c:\windows\java\packages' asFilename) exists ifTrue:[
- fn directoryContents do:[:f |
- (f asFilename hasSuffix:'zip') ifTrue:[
- directoriesToSearch add:(fn construct:f)
- ]
- ]
- ].
- (fn := 'c:\windows\java\trustlib' asFilename) exists ifTrue:[
- fn directoryContents do:[:f |
- (f asFilename hasSuffix:'zip') ifTrue:[
- directoriesToSearch add:(fn construct:f)
- ]
- ]
- ]
- ].
-
- tryJDK1_22 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk1.2.2').
- directoriesToSearch add:(d construct:'jdk122').
- ]
- ].
-
- tryJDK1_21 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk1.2.1_win').
- directoriesToSearch add:(d construct:'jdk1.2.1').
- directoriesToSearch add:(d construct:'jdk121').
- ]
- ].
-
- tryJDK1_2 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk1.2.0').
- directoriesToSearch add:(d construct:'jdk120').
- directoriesToSearch add:(d construct:'jdk1.2').
- directoriesToSearch add:(d construct:'jdk12').
- ]
- ].
-
- tryJDK1_2beta == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk12beta2').
- directoriesToSearch add:(d construct:'jdk1.2beta2').
- ]
- ].
-
- tryJDK1_18 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk118').
- directoriesToSearch add:(d construct:'jdk1.1.8').
- ]
- ].
-
- tryJDK1_17 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk117').
- directoriesToSearch add:(d construct:'jdk1.1.7').
- ]
- ].
-
- tryJDK1_16 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk116').
- directoriesToSearch add:(d construct:'jdk1.1.6').
- ]
- ].
+ SourceCache := CacheDictionary new: 32.
+ SourceArchiveCache := CacheDictionary new: 32.
- tryJDK1_15 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk115').
- directoriesToSearch add:(d construct:'jdk1.1.5').
- ]
- ].
-
- tryJDK1_13 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk113').
- directoriesToSearch add:(d construct:'jdk1.1.3').
- ]
- ].
-
- tryJDK1_11 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk111').
- directoriesToSearch add:(d construct:'jdk1.1.1').
- ]
- ].
-
- tryJDK1_03 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk103').
- directoriesToSearch add:(d construct:'jdk1.0.3').
- ]
- ].
-
- tryJDK1_02 == true ifTrue:[
- possibleJavaDirs do:[:d |
- directoriesToSearch add:(d construct:'jdk102').
- directoriesToSearch add:(d construct:'jdk1.0.2').
- ]
- ].
- directoriesToSearch := directoriesToSearch collect:[:dirName | dirName asFilename].
- directoriesToSearch := directoriesToSearch select:[:dir | dir exists].
- directoriesToSearch := directoriesToSearch select:[:dir |
- ((dir hasSuffix:'jar')
- or:[(dir hasSuffix:'zip')
- or:[dir isDirectory]]).
- ].
-
- self initializeForNewClassPath:directoriesToSearch.
-
-
- "/ kludge - add individual jar files ...
+ self initializeRelease. "lazy initialization of Release"
- directoriesToSearch := OrderedCollection new.
- directoriesToSearch add:'/usr/local/java/moz3_0/lib_unix'.
- directoriesToSearch add:'..\..\..\cg\java\java\ns30_unix.zip'.
- d := Smalltalk projectDirectoryForClass:self.
- d notNil ifTrue:[
- directoriesToSearch add:((d asFilename construct:'java') constructString:'ns30_unix.zip').
- ].
-
- tryVA == true ifTrue:[
- directoriesToSearch add:'C:\IBMVJava\EAB\bdk'.
- ].
- tryNetscape4_0 == true ifTrue:[
- directoriesToSearch add:'C:\Programme\Netscape\Communicator\Program\Java\Classes\java40.jar'.
- ].
- tryBorland == true ifTrue:[
- directoriesToSearch addAll:#(
- 'C:\jbuilder2\lib\jbuilder.zip'
- 'C:\jbuilder2\lib\jbcl2.0.jar'
- 'C:\jbuilder2\lib\jbcl2.0-res.jar'
- 'C:\jbuilder2\lib\swingall.jar'
- 'C:\jbuilder2\lib\jgl3.1.0.jar'
- 'C:\jbuilder2\lib\jctable.jar'
- 'C:\jbuilder2\lib\jcchart.jar'
- 'C:\jbuilder2\lib\jcbwt.jar'
- )
- ].
+ self initializePrettyPrintStyle.
- directoriesToSearch do:[:aPath |
- |dir classDir|
-
- dir := aPath asFilename.
- (dir exists) ifTrue:[
- ((dir hasSuffix:'jar')
- or:[dir hasSuffix:'zip']) ifTrue:[
- Transcript showCR:'Adding to classPath: ' , dir pathName.
- Java addToClassPath:aPath.
- ] ifFalse:[
- mozillaHome := dir.
- classDir := (dir construct:'classes').
- classDir exists ifTrue:[
- Transcript showCR:'Adding to classPath: ' , classDir pathName.
- Java addToClassPath:classDir pathName.
- ].
-
- "/
- "/ care to only load mozilla classes from there ...
- "/ i.e. ignore the java/sun stuff found there.
- "/
- ExcludedClassPath add:(classDir construct:'java') pathName.
- ExcludedClassPath add:(classDir construct:'sun') pathName.
- ]
- ]
- ].
- self initializePrettyPrintStyle.
+ ObjectMemory addDependent: self.
"
Java flushAllJavaResources.
@@ -623,7 +555,10 @@
Java classPath inspect
"
- "Modified: / 6.11.2001 / 09:24:12 / cg"
+ "Modified: / 06-11-2001 / 09:24:12 / cg"
+ "Created: / 03-10-2010 / 15:54:02 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 15-10-2010 / 17:37:20 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 10-02-2011 / 23:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeForNewClassPath:directoriesToSearch
@@ -653,6 +588,10 @@
jHome := aPath.
toAdd := (libDir constructString:'classes.zip').
] ifFalse:[
+ (libDir construct:'rt.jar') exists ifTrue:[
+ jHome := aPath.
+ toAdd := (libDir constructString:'rt.jar').
+ ].
(libDir construct:'rt.zip') exists ifTrue:[
jHome := aPath.
toAdd := (libDir constructString:'rt.zip').
@@ -686,7 +625,6 @@
self javaHome:jHome.
self classPath:(jClasses collect:[:f | f asFilename name]).
-
jHome isNil ifTrue:[
Transcript showCR:'no java home directory found'.
] ifFalse:[
@@ -715,6 +653,9 @@
self initializeForNewClassPath:(Java classPath)
self initializeForNewClassPath:(Array with:'/home/java/jdk113')
"
+
+ "Modified: / 03-10-2010 / 15:49:02 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 19-10-2010 / 10:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializePrettyPrintStyle
@@ -733,6 +674,19 @@
"Modified: 1.8.1997 / 11:09:58 / cg"
!
+initializeRelease
+
+ Release ifNil:[Release := JavaRelease any].
+
+ "
+ Release := nil.
+ self initializeRelease.
+ Release
+ "
+
+ "Created: / 22-11-2010 / 13:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
reinitAllClasses
self markAllClassesUninitialized.
self initAllClasses
@@ -750,12 +704,21 @@
FailedToLoadClasses := nil.
Threads := nil.
+ "Kludge"
+ JavaMethod reinitialize.
+ JavaMethodWithException reinitialize.
+ JavaMethodWithHandler reinitialize.
+ JavaNativeMethod reinitialize.
+ JavaNativeMethod flushAllCachedNativeMethods.
+
+
"
Java reinitialize
"
- "Created: / 26.8.1997 / 20:07:00 / cg"
- "Modified: / 27.4.1998 / 14:57:23 / cg"
+ "Created: / 26-08-1997 / 20:07:00 / cg"
+ "Modified: / 27-04-1998 / 14:57:23 / cg"
+ "Modified: / 14-12-2010 / 21:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
startupJavaSystem
@@ -958,37 +921,46 @@
"Modified: 7.8.1997 / 21:20:07 / cg"
!
-as_ST_String:aJavaString
+as_ST_String: aJavaString
"hard-coding internas of java.lang.String here is bad ..."
-
- |str count offs start stop|
-
- aJavaString isNil ifTrue:[^ nil].
-
- "/ count := aJavaString instVarNamed:'count'.
- count := aJavaString instVarAt:3. "/ (JavaSlotIndexCache string_slot_count).
-
- "/ str := aJavaString instVarNamed:'value'
- str := aJavaString instVarAt:1. "/ (JavaSlotIndexCache string_slot_value).
+
+ | str count offs start stop |
- str size == count ifTrue:[
- ^ str asOneByteString
- ].
-
+ aJavaString isNil ifTrue: [ ^ nil ].
+
+ "/ count := aJavaString instVarNamed:'count'.
+
+ count := aJavaString instVarAt: 3.
+
+ "/ str := aJavaString instVarNamed:'value'
+
+ str := aJavaString instVarAt: 1.
+ str size == count
+ ifTrue:
+ [ "cos I don't see any reason to do this"
+ "/ ^ str asOneByteString.
+ ^ str ].
+
"/ offs := (aJavaString instVarNamed:'offset').
- offs := aJavaString instVarAt:2. "/ (JavaSlotIndexCache string_slot_offset).
-
+
+ offs := aJavaString instVarAt: 2.
+
"/ start := offs + 1.
+
start := offs + 1.
-
+
"/ stop := start + (aJavaString instVarNamed:'count') - 1.
+
stop := start + count - 1.
-
+
"/ ^ ((aJavaString instVarNamed:'value') copyFrom:start to:stop) asString
- ^ (str copyFrom:start to:stop) asOneByteString
+
+ ^ (str copyFrom: start to: stop) asOneByteString
- "Created: / 8.8.1997 / 12:02:55 / cg"
- "Modified: / 4.1.1999 / 23:55:08 / cg"
+ "Created: / 08-08-1997 / 12:02:55 / cg"
+ "Modified: / 04-01-1999 / 23:55:08 / cg"
+ "Modified: / 22-03-2011 / 17:21:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 10-08-2011 / 23:32:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
as_String:aString
@@ -1002,14 +974,15 @@
s instVarNamed:'value' put: aString.
s instVarNamed:'offset' put: 0.
s instVarNamed:'count' put: aString size.
+ s instVarNamed:'hash' put: 0.
^ s
"
Java as_String:'hello world'
"
- "Created: 7.8.1997 / 21:15:49 / cg"
- "Modified: 7.8.1997 / 21:19:37 / cg"
+ "Created: / 07-08-1997 / 21:15:49 / cg"
+ "Modified: / 03-02-2011 / 23:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
as_URL:aString
@@ -1154,6 +1127,9 @@
flushAllJavaResources
self flushClasses.
+ SourceCache := CacheDictionary new: 32.
+ SourceArchiveCache := CacheDictionary new: 32.
+
ObjectMemory allObjectsDo:[:someObject |
someObject isBehavior ifTrue:[
someObject isJavaClass ifTrue:[
@@ -1163,13 +1139,6 @@
'JAVA [info]: flushing ' print. someObject fullName printCR.
]
].
-"/ (someObject isKindOf:JavaMethod) ifTrue:[
-"/ someObject setJavaClass:nil.
-"/ someObject setExceptionTable:nil.
-"/ ].
- (someObject isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- someObject constantPool:nil
- ].
].
JavaClass flushClassesInitOrder.
@@ -1179,7 +1148,8 @@
Java flushAllJavaResources
"
- "Modified: / 6.11.2001 / 09:49:37 / cg"
+ "Modified: / 06-11-2001 / 09:49:37 / cg"
+ "Modified: / 26-07-2011 / 17:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
flushClasses
@@ -1187,12 +1157,12 @@
Smalltalk keys copy do:[:aKey |
(aKey startsWith:'JAVA::') ifTrue:[ Smalltalk removeKey:aKey ]
].
- Smalltalk removeKey:'JAVA'.
+ Smalltalk removeKey:#'JAVA'.
Java_lang_String := Java_lang_Class := nil.
JavaVM releaseAllJavaResources.
JavaUnresolvedConstant flushPatchLists.
- Debugger newDebugger.
+ Debugger == DebugView ifTrue:[Debugger newDebugger].
ObjectMemory flushCaches.
"
@@ -1301,13 +1271,68 @@
!Java class methodsFor:'source management'!
+classSource:filename package:package in:dirOrZipFile
+ |fn zar f |
+
+ fn := dirOrZipFile asFilename.
+ fn isDirectory
+ ifTrue:
+ [ package notNil
+ ifTrue:[ (f:= fn / package / filename) exists ifTrue:[ ^ f contents asString ]. ].
+ (f := fn / filename) exists ifTrue:[ ^ f contents asString ]. ]
+ ifFalse:
+ [ (dirOrZipFile last == $p and: [fn hasSuffix:'zip'])
+ ifTrue:
+ [ zar := SourceArchiveCache
+ at: dirOrZipFile
+ ifAbsentPut:[ZipArchive oldFileNamed:fn pathName].
+ zar notNil
+ ifTrue:
+ [ package notNil
+ ifTrue:[
+ OperatingSystem fileSeparator ~~ $/ ifTrue: [
+ f := (package copyReplaceAll: OperatingSystem fileSeparator with: $/) , '/' , filename
+ ] ifFalse:[
+ f := package , '/' , filename.
+ ]]
+ ifFalse:[ f := filename].
+ (zar findMember: f) ifNotNil:
+ [
+ "Kludge because of broken ZipArchive"
+ | cache |
+ cache := Java cacheDirectory / Release name / 'src'.
+ cache exists ifFalse:[cache recursiveMakeDirectory].
+ (cache / f) exists ifTrue:[^(cache / f) contents asString].
+ OperatingSystem
+ executeCommand:('unzip "%1" "%2"' bindWith: fn asAbsoluteFilename asString
+ with: f asString)
+ inDirectory: cache asString.
+ (f := cache / f) exists ifTrue:[^f contents asString]
+ ]
+ ]]].
+
+ ^ nil
+
+ "
+ Java classSource: 'Object.java' package:'java/lang' in:'/home/jv/Projects/JavaX/java-6-openjdk/src'
+ Java classSource: 'Object.java' package:'java/lang' in:'/usr/lib/jvm/java-6-openjdk/src.zip'
+
+ "
+
+ "Modified: / 29-03-1998 / 21:46:40 / cg"
+ "Created: / 30-11-2010 / 12:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-04-2011 / 15:01:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
classSourceOf:aClass
- |package dirName binary sourceFileName sourceFile dirHolder fileName path
- loader codeBaseURL protocol dir file codeBaseURLIdx zar src|
+ |package dirName binary sourceFileName sourceFile loader codeBaseURL protocol codeBaseURLIdx src|
aClass isNil ifTrue:[
^ nil
].
+ "/ look at the cache"
+ SourceCache at: aClass ifPresent: [:src|^src].
+
"/ first, look in the directory, where the binary
"/ was loaded from.
@@ -1376,105 +1401,24 @@
"/ if that fails, look in standard places
(sourceFile isNil or:[sourceFile exists not]) ifTrue:[
- package := aClass package.
-
- sourceFileName := aClass sourceFile.
- sourceFileName isNil ifTrue:[^nil].
-
- sourceFile := sourceFileName asFilename.
- sourceFile exists ifFalse:[
- "/
- "/ mhmh - look for its directory
- "/
- dirName := sourceFile directory.
- fileName := sourceFile baseName.
-
- (dirName exists
- and:[(dirName construct:(package , '/' , fileName)) exists])
- ifFalse:[
- (dirName exists
- and:[(dirName construct:(fileName)) exists])
- ifFalse:[
- dirName := self findSourceDirOf:fileName inPackage:package.
-
- "/ [dirName isNil] whileTrue:[
- "/ dirName := Dialog requestDirectoryName:'top directory for ' , package , '/' , fileName.
- "/ (dirName isNil or:[dirName isEmpty]) ifTrue:[^ self].
- "/ ].
- ].
- ].
+ sourceFile := aClass sourceFile.
+ package := aClass javaPackageAsDirname.
+ self effectiveSourceDirectories do:[:dir|
+ src := self classSource: sourceFile package: package in: dir.
+ src ifNotNil:[^src]
+ ]
- (dirName notNil and:[dirName exists]) ifTrue:[
- dirName isDirectory ifTrue:[
- path := dirName construct:(package , '/' , fileName).
- path exists ifFalse:[
- path := dirName construct:(fileName).
- ].
- ] ifFalse:[
- "/ a zip-file ?
- (dirName hasSuffix:'zip') ifTrue:[
- zar := ZipArchive oldFileNamed:dirName pathName.
- src := zar extract:(package , '/' , fileName).
- src isNil ifTrue:[
- src := zar extract:fileName.
- ].
- src notNil ifTrue:[
- ^ src asString.
- ]
- ]
- ]
- ].
- (path notNil and:[path exists]) ifFalse:[
- ^ nil
- ].
-
- sourceFile := path.
- ].
].
+ sourceFile isFilename ifFalse:[^nil].
^ (sourceFile contentsOfEntireFile).
- "Modified: / 27.1.1999 / 20:40:30 / cg"
-!
-
-findSourceDirOf:fileName inPackage:aPackage
- "return a directory-fileName, a zip-file fileName or nil"
-
- SourceDirectories notNil ifTrue:[
- SourceDirectories do:[:aDirOrZipFile |
- |fn zar|
+ "
+ Java classSourceOf: JAVA::java::lang::Object
+ "
- fn := aDirOrZipFile asFilename.
- fn isDirectory ifTrue:[
- aPackage notNil ifTrue:[
- (fn construct:('/' , aPackage , '/' , fileName)) exists ifTrue:[
- ^ fn
- ].
- ].
- (fn construct:('/' , fileName)) exists ifTrue:[
- ^ fn
- ].
- ] ifFalse:[
- (fn hasSuffix:'zip') ifTrue:[
- zar := ZipArchive oldFileNamed:fn pathName.
- zar notNil ifTrue:[
- aPackage notNil ifTrue:[
- (zar findMember:(aPackage , '/' , fileName)) notNil ifTrue:[
- ^ fn
- ]
- ] ifFalse:[
- (zar findMember:fileName) notNil ifTrue:[
- ^ fn
- ]
- ]
- ]
- ]
- ]
- ]
- ].
- ^ nil
-
- "Modified: / 29.3.1998 / 21:46:40 / cg"
+ "Modified: / 27-01-1999 / 20:40:30 / cg"
+ "Modified: / 10-02-2011 / 23:10:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Java class methodsFor:'starting apps'!
@@ -1552,7 +1496,11 @@
!Java class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: Java.st,v 1.134 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: Java.st,v 1.134 2011/08/18 18:42:48 vrany Exp $'
! !
-Java initialize!
+Java initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotation.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,201 @@
+"
+ 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:#JavaAnnotation
+ instanceVariableNames:'nameIndex name valuesCount values parent'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotation 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
+"hi there"
+! !
+
+!JavaAnnotation class methodsFor:'instance creation'!
+
+for:parent
+ "Create & return a new instance for given parent."
+
+ ^ self basicNew initializeFor:parent
+
+ "
+ JavaAnnotation for: nil.
+ "
+
+ "Modified: / 17-12-2010 / 16:32:46 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotation methodsFor:'accessing'!
+
+constantPool
+ ^parent constantPool.
+
+ "Created: / 17-12-2010 / 14:21:59 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+name
+ name isNil ifTrue: [self constantPool at: nameIndex] ifFalse: [^name].
+
+ "Modified: / 17-12-2010 / 18:01:14 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+name: something
+ name := something.
+
+ "Created: / 17-12-2010 / 18:02:30 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+nameIndex
+ ^ nameIndex
+!
+
+nameIndex: something
+ nameIndex := something.
+ name := self constantPool at: nameIndex.
+
+ "Created: / 17-12-2010 / 18:02:14 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-12-2010 / 19:47:41 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+parent
+ ^ parent
+!
+
+parent:something
+ parent := something.
+!
+
+valueAt: anIndex
+
+^ values at: anIndex value.
+
+ "Created: / 17-12-2010 / 14:26:38 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+values
+ ^ values
+!
+
+values:something
+ values := something.
+!
+
+valuesCount
+ ^ valuesCount
+!
+
+valuesCount:something
+ valuesCount := something.
+! !
+
+!JavaAnnotation methodsFor:'initialization'!
+
+initialize
+
+ values := Dictionary new.
+
+ "Created: / 17-12-2010 / 16:35:08 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+initializeFor:aParent
+ "Invoked when a new instance is created for aParent."
+
+ parent := aParent.
+ self initialize.
+
+ "Modified: / 17-12-2010 / 16:33:59 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotation class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationArrayValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,138 @@
+"
+ 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' }"
+
+JavaAnnotationValue subclass:#JavaAnnotationArrayValue
+ instanceVariableNames:'count valueIndex values'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotationArrayValue 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.
+
+"
+! !
+
+!JavaAnnotationArrayValue methodsFor:'accessing'!
+
+count
+ ^ count
+!
+
+count:something
+ count := something.
+ values := Array new:count.
+
+ "Modified: / 25-02-2011 / 12:14:05 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+value
+ "superclass JavaAnnotationValue says that I am responsible to implement this method"
+
+ ^ self values.
+
+ "Modified: / 25-02-2011 / 12:12:31 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+valueIndex
+ ^ valueIndex
+!
+
+valueIndex:something
+ valueIndex := something.
+!
+
+values
+ values ifNil: [self halt: 'you should set count before calling me!!'].
+ ^ values.
+
+ "Created: / 25-02-2011 / 12:12:31 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotationArrayValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationClassValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,120 @@
+"
+ 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' }"
+
+JavaAnnotationValue subclass:#JavaAnnotationClassValue
+ instanceVariableNames:'classIndex'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotationClassValue 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.
+
+"
+! !
+
+!JavaAnnotationClassValue methodsFor:'accessing'!
+
+classIndex
+ ^ classIndex
+!
+
+classIndex:something
+ classIndex := something.
+!
+
+value
+ "superclass JavaAnnotationValue says that I am responsible to implement this method"
+
+ ^ self constantPool at:classIndex.
+
+ "Modified: / 17-12-2010 / 14:42:17 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotationClassValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationContainer.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,192 @@
+"
+ 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:#JavaAnnotationContainer
+ instanceVariableNames:'runtimeVisible runtimeInvisible parent'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+JavaAnnotationContainer class instanceVariableNames:'empty'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaAnnotationContainer 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.
+
+"
+! !
+
+!JavaAnnotationContainer class methodsFor:'instance creation'!
+
+for:parent
+ ^self new initializeFor:parent.
+
+ "Created: / 28-02-2011 / 16:33:00 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-03-2011 / 22:49:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!JavaAnnotationContainer class methodsFor:'accessing'!
+
+empty
+ empty ifNil: [ empty := self new ].
+ ^ empty.
+
+ "Created: / 03-03-2011 / 22:45:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 17:43:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 16:49:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAnnotationContainer methodsFor:'accessing'!
+
+ensureRuntimeInvisible
+ runtimeInvisible size = 0
+ ifTrue: [ runtimeInvisible := JavaAnnotationDictionary new. ].
+ ^ runtimeInvisible.
+
+ "Created: / 16-03-2011 / 16:56:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ensureRuntimeVisible
+ runtimeVisible size = 0
+ ifTrue: [ runtimeVisible := JavaAnnotationDictionary new. ].
+ ^ runtimeVisible.
+
+ "Created: / 16-03-2011 / 16:56:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+runtimeInvisible
+ ^ runtimeInvisible
+!
+
+runtimeInvisible:something
+ runtimeInvisible := something.
+!
+
+runtimeVisible
+ ^ runtimeVisible
+!
+
+runtimeVisible:something
+ runtimeVisible := something.
+! !
+
+!JavaAnnotationContainer methodsFor:'initialization'!
+
+initialize
+
+ "Do not remove this method, is reqired for proper
+ initialization of 'empty' containers!!!!!!"
+
+ runtimeVisible := JavaAnnotationDictionary empty.
+ runtimeInvisible := JavaAnnotationDictionary empty.
+
+ "Modified: / 16-03-2011 / 17:11:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 16-03-2011 / 16:50:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeFor: aParent
+
+ self initialize.
+ parent := aParent.
+
+ "Modified: / 16-03-2011 / 17:11:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 16:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAnnotationContainer class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationDefault.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,137 @@
+"
+ 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:#JavaAnnotationDefault
+ instanceVariableNames:'bytes value'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+JavaAnnotationDefault class instanceVariableNames:'empty'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaAnnotationDefault 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.
+
+"
+! !
+
+!JavaAnnotationDefault class methodsFor:'accessing'!
+
+empty
+
+ empty ifNil:[empty := self new].
+ ^empty
+
+ "Created: / 03-03-2011 / 22:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAnnotationDefault methodsFor:'accessing'!
+
+bytes
+ ^ bytes
+!
+
+bytes:something
+ bytes := something.
+!
+
+value
+ ^ value
+!
+
+value:something
+ value := something.
+! !
+
+!JavaAnnotationDefault class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationDictionary.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,141 @@
+"
+ 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' }"
+
+Dictionary subclass:#JavaAnnotationDictionary
+ instanceVariableNames:'bytes'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+JavaAnnotationDictionary class instanceVariableNames:'empty'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaAnnotationDictionary 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.
+
+"
+! !
+
+!JavaAnnotationDictionary class methodsFor:'accessing'!
+
+empty
+ empty ifNil: [ empty := self new ].
+ empty beImmutable.
+ ^ empty.
+
+ "Created: / 03-03-2011 / 22:46:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 17:42:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaAnnotationDictionary methodsFor:'accessing'!
+
+bytes
+
+ ^bytes
+
+ "Created: / 06-02-2011 / 12:41:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+bytes:something
+ bytes := something.
+!
+
+rawAnnotations
+ ^ bytes
+!
+
+rawAnnotations:something
+ bytes := something.
+! !
+
+!JavaAnnotationDictionary class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationEnumValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,140 @@
+"
+ 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' }"
+
+JavaAnnotationValue subclass:#JavaAnnotationEnumValue
+ instanceVariableNames:'nameIndex valueIndex'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+JavaAnnotationEnumValue comment:'Watch out!!!! name in this class represents type.
+'
+!
+
+!JavaAnnotationEnumValue 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.
+
+"
+! !
+
+!JavaAnnotationEnumValue methodsFor:'accessing'!
+
+name
+ "superclass JavaAnnotationValue says that I am responsible to implement this method"
+
+ ^self constantPool at: nameIndex.
+
+ "Created: / 17-12-2010 / 14:40:42 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+nameIndex
+ ^ nameIndex
+!
+
+nameIndex:something
+ nameIndex := something.
+!
+
+value
+ "superclass JavaAnnotationValue says that I am responsible to implement this method"
+
+ ^self constantPool at: valueIndex.
+
+ "Modified: / 17-12-2010 / 14:40:01 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+valueIndex
+ ^ valueIndex
+!
+
+valueIndex:something
+ valueIndex := something.
+! !
+
+!JavaAnnotationEnumValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationNestedAnnotationValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,120 @@
+"
+ 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' }"
+
+JavaAnnotationValue subclass:#JavaAnnotationNestedAnnotationValue
+ instanceVariableNames:'annotationIndex'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotationNestedAnnotationValue 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.
+
+"
+! !
+
+!JavaAnnotationNestedAnnotationValue methodsFor:'accessing'!
+
+annotationIndex
+ ^ annotationIndex
+!
+
+annotationIndex:something
+ annotationIndex := something.
+!
+
+value
+ "superclass JavaAnnotationValue says that I am responsible to implement this method"
+
+ ^ self constantPool at: annotationIndex.
+
+ "Modified: / 17-12-2010 / 14:44:38 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotationNestedAnnotationValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationPrimitiveValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,124 @@
+"
+ 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' }"
+
+JavaAnnotationValue subclass:#JavaAnnotationPrimitiveValue
+ instanceVariableNames:'valueIndex value'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotationPrimitiveValue 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.
+
+"
+! !
+
+!JavaAnnotationPrimitiveValue methodsFor:'accessing'!
+
+value
+ value isNil ifTrue: [^self constantPool at: valueIndex].
+ ^value.
+
+ "Created: / 17-12-2010 / 14:31:10 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-12-2010 / 19:10:19 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+valueIndex
+ ^ valueIndex
+!
+
+valueIndex:something
+ valueIndex := something.
+ "/value := self constantPool at: something.
+
+ "Modified: / 17-12-2010 / 19:10:46 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 27-07-2011 / 09:35:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAnnotationPrimitiveValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAnnotationValue.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,148 @@
+"
+ 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:#JavaAnnotationValue
+ instanceVariableNames:'name parent'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support'
+!
+
+!JavaAnnotationValue 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.
+
+"
+! !
+
+!JavaAnnotationValue class methodsFor:'instance creation'!
+
+for:arg
+ "Create & return a new instance for arg."
+
+ ^ self basicNew initializeFor:arg
+! !
+
+!JavaAnnotationValue methodsFor:'accessing'!
+
+constantPool
+^parent constantPool.
+
+ "Created: / 17-12-2010 / 14:40:22 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+isArrayValue
+^ false.
+
+ "Created: / 17-12-2010 / 14:51:34 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+name
+ ^ name
+!
+
+name:something
+ name := something.
+!
+
+value
+self subclassResponsibility.
+
+ "Created: / 17-12-2010 / 14:38:44 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotationValue methodsFor:'initialization'!
+
+initializeFor:arg
+
+ parent := arg.
+ self initialize.
+
+ "Modified: / 17-12-2010 / 14:28:40 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaAnnotationValue class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaAntProjectResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,211 @@
+"
+ 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:#JavaAntProjectResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+JavaAntProjectResource class instanceVariableNames:'built'
+
+"
+ The following class instance variables are inherited by this class:
+
+ TestResource - current
+ TestAsserter -
+ Object -
+"
+!
+
+!JavaAntProjectResource 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.
+
+"
+! !
+
+!JavaAntProjectResource class methodsFor:'accessing'!
+
+antBuildDotXml
+
+ ^self antProjectDir / 'build.xml'
+
+ "Created: / 18-07-2011 / 15:21:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+built
+ ^ built == true
+
+ "Modified: / 18-07-2011 / 14:48:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+built:aBoolean
+ built := aBoolean.
+!
+
+classpath
+
+ ^ Array with: (self antProjectDir / 'bin')
+
+ "Created: / 18-07-2011 / 15:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAntProjectResource class methodsFor:'accessing - ant project'!
+
+antProjectDir
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+! !
+
+!JavaAntProjectResource class methodsFor:'running'!
+
+build
+ "
+ JavaTestsResource build: true.
+ JavaTestsResource build: false.
+ "
+
+ built == true
+ ifFalse:
+ [ "Check for ant"
+ self assert:(OperatingSystem canExecuteCommand:'ant')
+ description:'Cannot execute ant'.
+ self assert:self antBuildDotXml exists
+ description:'No build.xml in ' , self antProjectDir asString.
+ "Launch ant"
+ Transcript
+ show:'Running ant in ';
+ showCR:self antProjectDir asString.
+ OperatingSystem
+ executeCommand:'ant -f build.xml'
+ inputFrom:nil
+ outputTo:Stdout
+ errorTo:Stderr
+ inDirectory:self antProjectDir
+ onError:
+ [:status |
+ Transcript showCR:'ANT FAILED!!!!!!'.
+ self error:'ant failed'.
+ ^ self ].
+ Transcript showCR:'Ant finished'.
+ built := true. ].
+ ^ built.
+
+ "Modified: / 16-03-2011 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:03:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified (format): / 18-07-2011 / 15:05:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAntProjectResource methodsFor:'running'!
+
+setUp
+ self class build.
+ self class classpath do:[:each | Java addToClassPath:each ].
+
+ "
+ JavaTestsResource basicNew setUp
+ Java classPath
+ "
+
+ "Modified: / 07-05-2011 / 18:19:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 18-07-2011 / 15:04:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAntProjectResource methodsFor:'testing'!
+
+isAvailable
+
+ ^self class antProjectDir exists and:
+ [self class antBuildDotXml exists]
+
+ "Created: / 18-07-2011 / 15:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaAntProjectResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaArray.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,282 @@
+"
+ 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' }"
+
+Array variableSubclass:#JavaArray
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Classes'
+!
+
+JavaArray class instanceVariableNames:'componentClass'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaArray 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.
+
+"
+! !
+
+!JavaArray class methodsFor:'initialization'!
+
+setComponentClass:aClass
+ componentClass := aClass.
+
+ "Created: / 17-12-2010 / 13:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaArray class methodsFor:'accessing'!
+
+javaClass
+ ^ self
+
+ "Created: / 19-12-2010 / 17:09:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaComponentClass
+ ^ componentClass
+
+ "Created: / 20-12-2010 / 22:02:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaName
+ ^'[L' , componentClass javaName, ';'
+
+ "Created: / 25-02-2011 / 19:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaPackage
+
+ ^componentClass javaPackage
+
+ "Created: / 22-05-2011 / 18:07:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupMethodByNameAndType: aJavaNameAndType
+
+ "Trick, since java arrays should respond to all messages
+ understood by java.lang.object"
+ ^ (Java at:'java.lang.Object') lookupMethodByNameAndType: aJavaNameAndType
+
+ "Created: / 22-05-2011 / 18:03:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaArray class methodsFor:'class creation'!
+
+javaArrayClass
+
+ ^self javaArrayClassFor: self.
+
+ "Created: / 11-06-2011 / 23:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaArrayClassFor: aJavaClass
+
+ | meta cls |
+
+ meta := Metaclass new.
+ meta setSuperclass: JavaArray class.
+ meta instSize: JavaArray class instSize.
+ cls := meta new.
+ cls setSuperclass: JavaArray.
+ cls flags: JavaArray flags.
+ cls instSize: JavaArray instSize.
+ cls setComponentClass: aJavaClass.
+ cls setName: (aJavaClass name , '[]') asSymbol.
+ "Kludge, spec says"
+ "All methods of class Object may be invoked on an array."
+ cls setMethodDictionary: (Java classForName: 'java.lang.Object') methodDictionary.
+
+ ^cls
+
+ "
+ JavaArray javaArrayClassFor: Object
+ "
+
+ "Created: / 17-12-2010 / 13:45:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-03-2011 / 14:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaArray class methodsFor:'queries'!
+
+hasInterface:aJavaInterface
+ "return true, if I respond to all methods as
+ aJavaInterface"
+
+ ^false
+
+ "Modified: / 19-12-2010 / 16:45:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isAbstract
+ "return true, if the receiver is abstract
+ (i.e. may not have instances)"
+
+ ^ false
+
+ "Modified: / 19-12-2010 / 16:45:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isFinal
+ "return true, if the receiver is final
+ (i.e. may not be subclassed)"
+
+ ^ false
+
+ "Modified: / 19-12-2010 / 16:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isInitialized
+ "return true, if the receiver is initialized"
+
+ ^ true
+
+ "Modified: / 07-05-1998 / 12:23:54 / cg"
+ "Modified: / 19-12-2010 / 16:45:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isInterface
+ "return true, if the receiver is an interface"
+
+ ^ false
+
+ "Modified: / 07-05-1998 / 12:23:39 / cg"
+ "Modified: / 19-12-2010 / 16:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaArrayClass
+
+ ^true
+
+ "Created: / 19-12-2010 / 17:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaReferenceType
+
+ ^true
+
+ "Created: / 20-12-2010 / 21:58:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaType
+
+ ^true
+
+ "Created: / 20-12-2010 / 21:58:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isObsolete
+ "return true, if the receiver is obsolete
+ Java classes are never."
+
+ ^ false
+
+ "Modified: / 07-08-1997 / 19:04:28 / cg"
+ "Modified: / 19-12-2010 / 16:45:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isPublic
+ "return true, if the receiver is public"
+
+ ^ true
+
+ "Modified: / 19-12-2010 / 16:45:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isUnresolved
+
+ ^false
+
+ "Created: / 21-12-2010 / 12:51:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaArray class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaArrayTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaArrayTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaArrayTypeNode 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.
+
+"
+! !
+
+!JavaArrayTypeNode methodsFor:'accessing'!
+
+selector
+ ^ '['
+
+ "Created: / 17-12-2010 / 16:37:59 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaArrayTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaBehavior.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaBehavior.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 2005 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,6 +12,32 @@
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' }"
@@ -24,8 +54,12 @@
copyright
"
- COPYRIGHT (c) 2005 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,6 +67,33 @@
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.
+
"
!
@@ -137,6 +198,10 @@
!JavaBehavior methodsFor:'accessing'!
+accessFlags
+ ^ accessFlags
+!
+
constantPool
^ constantPool
!
@@ -154,6 +219,15 @@
^ interfaces
! !
+!JavaBehavior methodsFor:'compiler interface'!
+
+programmingLanguage
+
+ ^JavaLanguage instance
+
+ "Created: / 26-10-2010 / 23:42:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaBehavior methodsFor:'private accessing'!
makeObsolete
@@ -174,10 +248,12 @@
"Created: 15.4.1996 / 16:42:52 / cg"
!
-setConstantPool:anArray
- constantPool := anArray.
+setConstantPool: aJavaConstantPool
+ constantPool := aJavaConstantPool.
+ constantPool ifNotNil:[constantPool owner: self].
- "Created: 15.4.1996 / 16:42:52 / cg"
+ "Created: / 15-04-1996 / 16:42:52 / cg"
+ "Modified: / 22-05-2011 / 13:16:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setInterfaces:i
@@ -273,11 +349,15 @@
!JavaBehavior class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: /cvs/stx/stx/libjava/JavaBehavior.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
!
version_CVS
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaBehavior.st,v 1.3 2009/10/09 14:04:26 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id: JavaBehavior.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaBehavior initialize!
+JavaBehavior initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaBooleanTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaBooleanTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaBooleanTypeNode 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.
+
+"
+! !
+
+!JavaBooleanTypeNode methodsFor:'accessing'!
+
+selector
+ ^ $b
+
+ "Created: / 17-12-2010 / 18:07:12 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaBooleanTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaBothOldAndNewClassRef.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,146 @@
+"
+ 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' }"
+
+JavaClassRef2 subclass:#JavaBothOldAndNewClassRef
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaBothOldAndNewClassRef 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.
+
+"
+! !
+
+!JavaBothOldAndNewClassRef methodsFor:'compatibility - oldJavaClassRef'!
+
+class: aJavaClass nameandType: aJavanameAndType
+ self breakPoint: #mh.
+
+ "Created: / 13-05-2011 / 14:25:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isUnresolved
+ ^ self isResolved not.
+
+ "Created: / 13-05-2011 / 14:27:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaClass
+^self resolve.
+
+ "Created: / 13-05-2011 / 14:26:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaClassForLDC
+ ^ self resolve.
+
+ "Created: / 13-05-2011 / 14:26:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+nameandType
+ self breakPoint:#mh.
+
+ "Created: / 13-05-2011 / 14:27:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+preResolve
+^ self.
+
+ "Created: / 13-05-2011 / 16:48:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+validateClass
+ self breakPoint: #mh.
+
+ "Created: / 13-05-2011 / 14:29:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaBothOldAndNewClassRef class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeDisassembler.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,1897 @@
+"
+ 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' }"
+
+JavaByteCodeProcessor subclass:#JavaByteCodeDisassembler
+ instanceVariableNames:'outStream placeholders format lastLno'
+ classVariableNames:'StandardFormat ExtendedFormat'
+ poolDictionaries:''
+ category:'Languages-Java-Bytecode'
+!
+
+!JavaByteCodeDisassembler 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.
+
+"
+! !
+
+!JavaByteCodeDisassembler class methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ Verbose := false.
+ StandardFormat := ' %(PC) %(ISN) %(OPERANDS)'.
+ ExtendedFormat := ' %(PC) [%(OPCODE)] %(ISN) %(OPERANDS) %(STACK)'.
+
+ "Modified: / 22-03-2011 / 17:07:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 20:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler class methodsFor:'instance creation'!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!JavaByteCodeDisassembler class methodsFor:'disassembling'!
+
+diassemble:aMethod
+ ^ self new diassemble:aMethod.
+
+ "Created: / 17-03-2011 / 17:41:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+diassemble:aMethod to: aStream
+ ^ self new diassemble:aMethod to: aStream
+
+ "Created: / 22-03-2011 / 21:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'disassembling'!
+
+diassemble:aJavaMethod
+ self diassemble:aJavaMethod to:Transcript.
+
+ "Created: / 17-03-2011 / 17:42:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 22:43:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+diassemble:aJavaMethod to:aStream
+ |fakeArgArray size|
+
+ outStream := aStream.
+ size := aJavaMethod javaNumArgs.
+ fakeArgArray := Array new:size.
+ 1 to:size
+ do:[:index | fakeArgArray at:index put:('Arg ' , index printString) ].
+ self prettyPrintHeaderFor:aJavaMethod.
+ self
+ process:aJavaMethod
+ receiver:aJavaMethod javaClass
+ arguments:fakeArgArray.
+
+ "Created: / 17-03-2011 / 22:21:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 15:59:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'helpers - constants'!
+
+address
+^ 'address'.
+
+ "Created: / 20-03-2011 / 21:20:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+arrayLength
+ ^ 'arrayLength'
+
+ "Created: / 20-03-2011 / 18:31:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+arrayRef
+ ^ 'arrayRef'
+
+ "Created: / 20-03-2011 / 18:24:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dimensions
+^'count1, [count2,...]'.
+
+ "Created: / 20-03-2011 / 21:26:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+empty
+ ^ 'EMPTY'
+
+ "Created: / 20-03-2011 / 18:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+excRef
+ ^ 'exceptionRef'
+
+ "Created: / 20-03-2011 / 18:36:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+index
+ ^ 'index'
+
+ "Created: / 20-03-2011 / 18:28:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+key
+^'key'.
+
+ "Created: / 20-03-2011 / 21:24:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+nothing
+ ^ ''
+
+ "Created: / 20-03-2011 / 18:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+null
+ ^ 'null'
+
+ "Created: / 20-03-2011 / 18:29:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+objRef
+^ 'objectRef'
+
+ "Created: / 20-03-2011 / 18:24:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+result
+ ^ 'result'
+
+ "Created: / 20-03-2011 / 18:40:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+sep
+^ ', '.
+
+ "Created: / 20-03-2011 / 18:28:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+size
+ ^ 'size'
+
+ "Created: / 20-03-2011 / 18:30:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+stackGroupClose
+ ^ '}'.
+
+ "Created: / 20-03-2011 / 21:02:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+stackGroupOpen
+^'{'.
+
+ "Created: / 20-03-2011 / 21:02:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+value
+ ^ 'value'
+
+ "Created: / 20-03-2011 / 18:24:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueMarked
+ ^ 'valueX'
+
+ "Created: / 20-03-2011 / 20:58:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueMarked2
+ ^ 'valueY'
+
+ "Created: / 20-03-2011 / 21:33:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+varArgs
+^'[arg1, arg2, ...] '.
+
+ "Created: / 20-03-2011 / 21:16:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+whatever
+ ^ '..'
+
+ "Created: / 20-03-2011 / 18:31:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'helpers - instruction groups'!
+
+arrayValueLoader
+self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self arrayRef , self sep , self index
+ after: self value.
+
+ "Created: / 20-03-2011 / 19:58:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+arrayValueStorer
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self arrayRef , self sep , self index , self sep , self value
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 20:01:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+constPusher: const
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: const.
+
+ "Created: / 20-03-2011 / 20:39:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fieldLoader: index
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: (self prettyPrintField: index).
+
+ "Created: / 20-03-2011 / 20:43:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:23:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fieldStorer: index
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: (self prettyPrintField: index)
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 20:53:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:23:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+indexedFieldLoader
+ | index |
+
+ wide
+ ifTrue:
+ [ index := self fetchIndex2.
+ wide := false. ]
+ ifFalse: [ index := self fetchIndex ].
+ self
+ writeInstructionWithArgs: (self prettyPrintField: index)
+ stackBefore: self whatever
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 20:44:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 19-05-2011 / 10:38:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+indexedFieldStorer
+ | index |
+
+ wide
+ ifTrue:
+ [ index := self fetchIndex2.
+ wide := false. ]
+ ifFalse: [ index := self fetchIndex ].
+ self
+ writeInstructionWithArgs: (self prettyPrintField: index)
+ stackBefore: (self prettyPrintValue:'newVal')
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 20:53:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 19-05-2011 / 13:04:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+returnIfFinished
+ (pc >= byteCode size) ifTrue: [ self leaveProcessorWith: nil ].
+
+ "Created: / 21-03-2011 / 14:54:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+twoValuesBasedJumper
+ self
+ writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2)
+ stackBefore: self value , self sep , self value
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 21:10:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 23:03:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+twoValuesManipulator
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value , self sep , self value after: self result.
+
+ "Created: / 20-03-2011 / 20:31:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueBasedJumper
+ self
+ writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2)
+ stackBefore: self value
+ after: self whatever.
+
+ "Created: / 20-03-2011 / 21:09:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 13:03:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueLoader
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: self value.
+
+ "Created: / 20-03-2011 / 20:25:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueManipulator
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value
+ after: self result.
+
+ "Created: / 20-03-2011 / 20:27:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueReturner
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value
+ after: self empty.
+ self returnIfFinished.
+
+ "Created: / 20-03-2011 / 20:48:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 14:55:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'helpers - printing'!
+
+prettyPrintArgs: argsString
+ ^argsString printString
+
+ "Created: / 20-03-2011 / 17:30:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 20:42:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prettyPrintByte: val
+ ^ self prettyPrintValue: val.
+
+ "Created: / 20-03-2011 / 21:46:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintExceptionTable: table
+ table isNil ifTrue: [ ^ '' ].
+ ^ 'Throws:'
+ , (table inject: '' into: [:acc :each | acc , ' ' , each name ]).
+
+ "Created: / 22-03-2011 / 16:16:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 20:59:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:19:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintField: fieldIndex
+ ^ 'FIELD ' , fieldIndex printString , ': '
+ , (context at: fieldIndex + 1) displayString.
+
+ "Created: / 20-03-2011 / 17:31:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:57:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintHeaderFor: javaMethod
+ outStream
+ cr;
+ print: (javaMethod signatureNameWithModifiers);
+ cr;
+ print: ('defined in: ' , javaMethod javaClass printString);
+ cr;
+ print: '# args: ' , javaMethod javaNumArgs printString , ', ';
+ print: '# vars: ' , javaMethod numVars printString , ', ';
+ print: 'stack depth: ', javaMethod stackSize printString , ' ';
+ cr;
+ print: (self prettyPrintExceptionTable: javaMethod exceptionTable);
+ cr.
+
+ "Created: / 22-03-2011 / 15:59:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 21:02:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prettyPrintIndex: index
+ ^ (constantPool at: index) displayString , ' [' , index printString
+ , '@CP]'.
+
+ "Created: / 20-03-2011 / 17:20:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 16:48:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintJump: jmpNum
+ ^ 'JMP to: ' , (instrPointer + jmpNum ) printString.
+
+ "Modified: / 21-03-2011 / 14:25:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintLineNumber
+ |lineNumber|
+ lineNumber := method quickLineNumberForPC: instrPointer.
+ lineNumber isNil ifTrue: [^''].
+ ^ (lineNumber printString leftPaddedTo: 4
+ with: Character space)
+
+ "Modified: / 22-03-2011 / 17:04:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintLookupSwitchMadness
+ | paddingSize default npairs result |
+ result := TextStream on: ''.
+ paddingSize := self skipPadding.
+ default := self fetchBytes4.
+ npairs := self fetchBytes4.
+ result
+ print: 'PADDING: ';
+ print: paddingSize printString;
+ print: ' NPAIRS: ';
+ print: npairs printString;
+ cr.
+ result
+ print: (' [ ');
+ cr.
+ npairs timesRepeat:
+
+ [ result
+ print: ' ';
+ print: (self fetchBytes4 printString);
+ print: ': ';
+ print: (self prettyPrintJump: self fetchBytes4);
+ cr. ].
+ result
+ print: (' default');
+ print: ': ';
+ print: (self prettyPrintJump: default);
+ cr.
+ result
+ print: (' ]');
+ cr.
+ ^ result stringContents.
+
+ "Created: / 20-03-2011 / 21:23:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 15:03:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:31:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prettyPrintRef: ref
+
+ ^ ref prettyPrintString.
+
+ "Created: / 20-03-2011 / 17:20:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-08-2011 / 21:12:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prettyPrintStackBefore: beforeString after: afterString
+ ^ 'STACK: [' , beforeString printString , ' -> ' , afterString printString , ']'.
+
+ "Created: / 20-03-2011 / 17:24:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintTableSwitchMadness
+ | paddingSize default low high result |
+
+ result := TextStream on: ''.
+ paddingSize := self skipPadding.
+ default := self fetchBytes4.
+ low := self fetchBytes4.
+ high := self fetchBytes4.
+ result
+ print: 'PADDING: ';
+ print: paddingSize printString;
+ print: ' LOW: ';
+ print: low printString;
+ print: ' HIGH: ';
+ print: high printString;
+ cr.
+ result
+ print: (' [ ');
+ cr.
+ low to: high
+ do:
+ [:index |
+ result
+ nextPutAll:' '; print: (index printString);
+ print: ': ';
+ print: (self prettyPrintJump: self fetchBytes4);
+ cr. ].
+ result
+ print: (' default');
+ print: ': ';
+ print: (self prettyPrintJump: default);
+ cr.
+ result
+ print: (' ]');
+ cr.
+ ^ result stringContents.
+
+ "Created: / 20-03-2011 / 21:34:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:29:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+prettyPrintType: type
+ type = 4 ifTrue: [ ^ 'boolean'].
+ type = 5 ifTrue: [ ^'char'].
+ type = 6 ifTrue: [ ^ 'float' ].
+ type = 7 ifTrue: [ ^'double' ].
+ type = 8 ifTrue: [ ^ 'byte' ].
+ type = 9 ifTrue: [ ^ 'short' ].
+ type = 10 ifTrue: [ ^'int' ].
+ type = 11 ifTrue: [ ^ 'long' ].
+
+ "Created: / 20-03-2011 / 20:12:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+prettyPrintValue: val
+ ^ val printString.
+
+ "Created: / 20-03-2011 / 18:16:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+writeInstructionWithArgs: argsString stackBefore: stackBefore after: stackAfter
+ placeholders
+ at: 'PC'
+ put: (instrPointer printString leftPaddedTo: 3 with: Character space);
+ at: 'LINENUMBER' put: self prettyPrintLineNumber;
+ at: 'OPCODE' put: (op printString leftPaddedTo: 3 with: Character space);
+ at: 'ISN'
+ put: ((OpSwitchTable at: op + 1) asUppercase printString paddedTo: 10);
+ at: 'OPERANDS' put: ((self prettyPrintArgs: argsString) paddedTo: 25);
+ at: 'STACK'
+ put: (self prettyPrintStackBefore: stackBefore after: stackAfter).
+ format expandPlaceholdersWith: placeholders on: outStream.
+ outStream cr.
+
+ "Created: / 20-03-2011 / 19:56:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 20:56:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+writeLine: lno
+
+ outStream nextPutAll: 'LINE '.
+ lno printOn: outStream.
+ outStream cr.
+
+ "Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 22-03-2011 / 20:53:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'initialization'!
+
+initialize
+ "Invoked when a new instance is created."
+
+ "/ please change as required (and remove this comment)
+ "/ outStream := nil.
+ placeholders := Dictionary new.
+ format := StandardFormat.
+ "/ExtendedFormat.
+
+ "/ super initialize. -- commented since inherited method does nothing
+
+ "Modified: / 22-03-2011 / 20:53:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'instructions'!
+
+aaload
+ self
+ arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 19:59:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:01:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aconst_null
+ self
+ constPusher: 'null'.
+
+ "Modified: / 20-03-2011 / 20:39:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload
+
+ self
+ writeInstructionWithArgs: (self prettyPrintField: self fetchIndex)
+ stackBefore: self whatever
+ after: self objRef.
+
+ "Modified: / 21-03-2011 / 15:45:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload: arg
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: (self prettyPrintField: arg).
+
+ "Modified: / 21-03-2011 / 16:30:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+anewarray
+self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self size
+ after: self arrayRef.
+
+ "Modified: / 20-03-2011 / 20:09:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+areturn
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self objRef
+ after: self empty.
+ self returnIfFinished.
+
+ "Modified: / 21-03-2011 / 14:55:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+arraylength
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self arrayRef
+ after: self arrayLength.
+
+ "Modified: / 20-03-2011 / 20:16:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex)
+ stackBefore: self objRef
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 20:19:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore: arg
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self objRef
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 20:19:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+athrow
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self objRef
+ after: self empty , self sep , self excRef.
+ self returnIfFinished.
+
+ "Modified: / 22-03-2011 / 14:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+baload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 19:59:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+bastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+bipush
+ self
+ writeInstructionWithArgs: (self prettyPrintByte: self fetchByte)
+ stackBefore: self whatever
+ after: self value.
+
+ "Modified: / 20-03-2011 / 21:32:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+breakpoint
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 20:26:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+caload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 19:59:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+castore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:02:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+checkcast
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self objRef
+ after: self objRef.
+
+ "Modified: / 20-03-2011 / 20:23:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2f
+ self
+ valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:27:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2i
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:27:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2l
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dadd
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+daload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 19:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dcmpg
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dcmpl
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dconst: arg
+ self constPusher: arg.
+
+ "Modified: / 20-03-2011 / 20:39:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ddiv
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload
+ self indexedFieldLoader.
+
+ "Modified: / 20-03-2011 / 20:44:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload: arg
+self fieldLoader: arg.
+
+ "Modified: / 20-03-2011 / 20:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dmul
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dneg
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+drem
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:31:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dreturn
+ self valueReturner.
+
+ "Modified: / 20-03-2011 / 20:47:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore
+ self indexedFieldStorer.
+
+ "Modified: / 20-03-2011 / 20:54:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore: arg
+self fieldStorer: arg.
+
+ "Modified: / 20-03-2011 / 20:55:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dsub
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value
+ after: self valueMarked , self sep , self valueMarked.
+
+ "Modified: / 20-03-2011 / 20:58:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self stackGroupOpen , self value , self sep , self value , self stackGroupClose
+ after: self stackGroupOpen , self value , self sep , self value , self stackGroupClose , self sep , self stackGroupOpen , self value , self sep , self value , self stackGroupClose.
+
+ "Modified: / 20-03-2011 / 21:03:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2_x1
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self stackGroupOpen , self value , self sep , self value
+ , self stackGroupClose
+ after: self stackGroupOpen , self value , self sep , self value
+ , self stackGroupClose , self sep
+ , self stackGroupOpen , self value
+ , self sep , self value
+ , self stackGroupClose.
+
+ "Modified: / 20-03-2011 / 21:06:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2_x2
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self stackGroupOpen , self value , self sep , self value
+ , self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked
+ , self stackGroupClose
+ after: self stackGroupOpen , self valueMarked , self sep , self valueMarked
+ , self stackGroupClose , self sep
+ , self stackGroupOpen , self value
+ , self sep , self value
+ , self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked
+ , self stackGroupClose.
+
+ "Modified: / 20-03-2011 / 21:07:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup_x1
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value , self sep , self valueMarked
+ after: self valueMarked , self sep , self value , self sep
+ , self valueMarked.
+
+ "Modified: / 20-03-2011 / 21:00:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup_x2
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value , self sep , self value , self sep , self valueMarked
+ after: self valueMarked , self sep , self value , self sep , self value , self sep ,
+ self valueMarked.
+
+ "Modified: / 20-03-2011 / 21:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+f2d
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+f2i
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+f2l
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fadd
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+faload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 20:00:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:01:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fcmpg
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fcmpl
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fconst: arg
+ self constPusher: arg.
+
+ "Modified: / 20-03-2011 / 20:39:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fdiv
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload
+self indexedFieldLoader.
+
+ "Modified: / 20-03-2011 / 20:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload: arg
+self fieldLoader: arg.
+
+ "Modified: / 20-03-2011 / 20:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fmul
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fneg
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+frem
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+freturn
+ self valueReturner.
+
+ "Modified: / 20-03-2011 / 20:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore
+self indexedFieldStorer.
+
+ "Modified: / 20-03-2011 / 20:54:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore: arg
+ self fieldStorer: arg.
+
+ "Modified: / 20-03-2011 / 20:55:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fsub
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:32:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getfield
+ | index |
+
+ index := self fetchIndex2.
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: index)
+ stackBefore: self objRef
+ after: self objRef.
+
+ "Modified: / 21-03-2011 / 16:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getstatic
+ | index |
+
+ index := self fetchIndex2.
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: index)
+ stackBefore: self whatever
+ after: self objRef.
+
+ "Modified: / 21-03-2011 / 16:25:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+goto
+
+ self
+ writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2)
+ stackBefore: self whatever
+ after: self whatever.
+ self returnIfFinished.
+
+ "Modified: / 22-03-2011 / 14:30:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+goto_w
+ self
+ writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes4)
+ stackBefore: self whatever
+ after: self whatever.
+ self returnIfFinished.
+
+ "Modified: / 22-03-2011 / 14:30:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2d
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:28:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2f
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2l
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i_dup
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+iadd
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iaload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 20:00:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iand
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:02:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst: arg
+self constPusher: arg.
+
+ "Created: / 20-03-2011 / 20:41:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+idiv
+self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifacmpeq
+ self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifacmpne
+ self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifeq
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifge
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifgt
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpeq
+ self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:10:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpge
+self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpgt
+self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmple
+self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmplt
+self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpne
+self twoValuesBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifle
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iflt
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifne
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifnonnull
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:11:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifnull
+self valueBasedJumper.
+
+ "Modified: / 20-03-2011 / 21:12:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iinc
+
+ wide
+ ifTrue:
+ [ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ , self sep , (self prettyPrintByte: self fetchBytes2)
+ stackBefore: self objRef
+ after: self result.
+ wide := false. ]
+ ifFalse:
+ [ self
+ writeInstructionWithArgs: (self prettyPrintField: self fetchIndex)
+ , self sep , (self prettyPrintByte: self fetchByte)
+ stackBefore: self objRef
+ after: self result. ].
+
+ "Modified: / 21-03-2011 / 16:23:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload
+self indexedFieldLoader.
+
+ "Modified: / 20-03-2011 / 20:44:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload: index
+ self fieldLoader: index.
+
+ "Modified: / 20-03-2011 / 20:45:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+imul
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ineg
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:30:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+instanceof
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self objRef
+ after: self result.
+
+ "Modified: / 20-03-2011 / 20:21:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2byte
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2char
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2short
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invinterface
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) , self sep , ( self prettyPrintByte: self fetchByte) , self sep , 0 printString
+ stackBefore: self objRef , self sep , self varArgs
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:15:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invnonvirt
+self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+
+ stackBefore: self objRef , self sep , self varArgs
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:17:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invstatic
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self varArgs
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:17:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invvirt
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self objRef , self sep , self varArgs
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:18:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ior
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+irem
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:33:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ireturn
+ self valueReturner.
+
+ "Modified: / 20-03-2011 / 20:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ishl
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:34:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ishr
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:34:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore
+self indexedFieldStorer.
+
+ "Modified: / 20-03-2011 / 20:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore: arg
+self fieldStorer: arg.
+
+ "Modified: / 20-03-2011 / 20:55:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isub
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:34:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iushr
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ixor
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:34:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+jsr
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self whatever
+ after: self address.
+
+ "Modified: / 20-03-2011 / 21:20:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+jsr_w
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchBytes4)
+ stackBefore: self whatever
+ after: self address.
+
+ "Modified: / 21-03-2011 / 13:03:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2d
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2f
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2i
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ladd
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+laload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 20:00:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+land
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:35:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:02:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lcmp
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:35:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lconst: arg
+ self constPusher: arg.
+
+ "Modified: / 20-03-2011 / 20:41:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc1
+self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex)
+ stackBefore: self whatever
+ after: self value.
+
+ "Modified: / 20-03-2011 / 21:21:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc2
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self whatever
+ after: self value.
+
+ "Modified: / 20-03-2011 / 21:21:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc2w
+self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self whatever
+ after: self value.
+
+ "Modified: / 22-03-2011 / 14:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldiv
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload
+self indexedFieldLoader.
+
+ "Modified: / 20-03-2011 / 20:44:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload: arg
+self fieldLoader: arg.
+
+ "Modified: / 20-03-2011 / 20:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lmul
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lneg
+ self valueManipulator.
+
+ "Modified: / 20-03-2011 / 20:29:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lookupswtch
+ self
+ writeInstructionWithArgs: (self prettyPrintLookupSwitchMadness)
+ stackBefore: self key
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:24:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lor
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lrem
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lreturn
+ self valueReturner.
+
+ "Modified: / 20-03-2011 / 20:48:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lshl
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lshr
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore
+self indexedFieldStorer.
+
+ "Modified: / 20-03-2011 / 20:54:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore: arg
+ self fieldStorer: arg.
+
+ "Modified: / 20-03-2011 / 20:55:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lsub
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lushr
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lxor
+ self twoValuesManipulator.
+
+ "Modified: / 20-03-2011 / 20:36:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+monenter
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self objRef
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 20:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+monexit
+self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self objRef
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 20:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+multianewarray
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ , self sep , (self prettyPrintByte: self fetchByte)
+ stackBefore: self dimensions
+ after: self arrayRef.
+
+ "Modified: / 20-03-2011 / 21:25:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+new
+self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self whatever
+ after: self objRef.
+
+ "Modified: / 20-03-2011 / 20:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+newarray
+self
+ writeInstructionWithArgs: (self prettyPrintType: self fetchByte)
+ stackBefore: self size
+ after: self arrayRef.
+
+ "Modified: / 20-03-2011 / 20:10:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+nop
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:26:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop1
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:27:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop2
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self value , self sep , self value
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:27:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+putfield
+ | index |
+
+ index := self fetchIndex2.
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: index)
+ stackBefore: self objRef , self sep , self value
+ after: self whatever.
+
+ "Modified: / 21-03-2011 / 16:26:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+putstatic
+ | index |
+
+ index := self fetchIndex2.
+ self
+ writeInstructionWithArgs: (self prettyPrintIndex: index)
+ stackBefore: self value
+ after: self whatever.
+
+ "Modified: / 21-03-2011 / 16:26:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ret
+ wide
+ ifTrue:
+ [ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2)
+ stackBefore: self whatever
+ after: self whatever.
+ wide := false. ]
+ ifFalse:
+ [ self
+ writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex)
+ stackBefore: self whatever
+ after: self whatever. ].
+ self returnIfFinished.
+
+ "Modified: / 21-03-2011 / 14:57:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ret_w
+ self halt: 'spec doesnt know about me, what shall I do?'.
+
+ "Modified: / 20-03-2011 / 21:31:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+return
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: self empty.
+ self returnIfFinished.
+
+ "Modified: / 21-03-2011 / 14:56:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+saload
+self arrayValueLoader.
+
+ "Modified: / 20-03-2011 / 20:00:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+sastore
+ self
+ arrayValueStorer.
+
+ "Modified: / 20-03-2011 / 20:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+sipush
+ self
+ writeInstructionWithArgs: (self prettyPrintByte: self fetchBytes2)
+ stackBefore: self whatever
+ after: self value.
+
+ "Modified: / 20-03-2011 / 21:33:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+swap
+ self
+ writeInstructionWithArgs: (self prettyPrintByte: self fetchByte)
+ stackBefore: self valueMarked , self sep , self valueMarked2
+ after: self valueMarked2 , self sep , self valueMarked.
+
+ "Modified: / 20-03-2011 / 21:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+tableswtch
+ self
+ writeInstructionWithArgs: (self prettyPrintTableSwitchMadness)
+ stackBefore: self index
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:34:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+wide
+ wide := true.
+ self
+ writeInstructionWithArgs: self nothing
+ stackBefore: self whatever
+ after: self whatever.
+
+ "Modified: / 20-03-2011 / 21:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler methodsFor:'processing loop'!
+
+handleAbstractMethod
+^nil.
+
+ "Created: / 22-03-2011 / 14:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+initializeContextVars
+ 1 to: numVars
+ do: [:idx | context at: (numArgs + idx) put: 'Var ' , idx printString. ]
+
+ "Modified: / 21-03-2011 / 15:28:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+switch: op
+
+ | lno |
+ lno := method quickLineNumberForPC: instrPointer.
+ lastLno ~~ lno ifTrue:[self writeLine: (lastLno := lno)].
+ ^super switch: op
+
+ "Created: / 22-03-2011 / 20:57:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassembler class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaByteCodeDisassembler initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeDisassemblerTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,876 @@
+"
+ 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' }"
+
+JavaByteCodeProcessorTests subclass:#JavaByteCodeDisassemblerTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaByteCodeDisassemblerTests 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.
+
+"
+! !
+
+!JavaByteCodeDisassemblerTests class methodsFor:'resources'!
+
+resources
+
+ ^ Array with: JavaInitializedResource with: JavaTestsResource.
+
+ "Created: / 15-03-2011 / 17:29:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 14:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassemblerTests methodsFor:'tests'!
+
+testAnd
+ | result |
+ self shouldnt:
+ [ result := self
+ invoke: #'and(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 255 149 )]raise: Error.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 iand
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 17:02:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:49:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testBitShiftLeft
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'bitShiftLeft(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 21 4 )]
+ raise: Error.
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 ishl
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:56:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:50:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testBitShiftRight
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'bitShiftRight(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 439 4 )]
+ raise: Error.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 ishr
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:57:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:50:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDec2
+ self shouldnt:
+
+
+ [ self
+ invoke: #'dec2(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 3 ). ] raise: Error.
+
+
+ "static method
+
+ 0 iinc 0 -1
+ 3 iinc 0 -1
+ 6 iload_0
+ 7 ireturn"
+
+ "Created: / 14-03-2011 / 16:58:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 22:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDiv
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'div(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 101 10 ) ]
+ raise: Error.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 irem
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:54:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:51:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDivision
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'division(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 101 10 ) ]
+ raise: Error.
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 idiv
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:57:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:51:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInc2
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'inc2(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 3 ) ]
+ raise: Error.
+ "static method
+
+ 0 iinc 0 1
+ 3 iinc 0 1
+ 6 iload_0
+ 7 ireturn"
+
+ "Created: / 14-03-2011 / 16:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:51:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInheritedMethodCall
+ self shouldnt: [
+
+ self
+ invoke: #'foo()Ljava/lang/String;'
+ class: self loadSimpleInheritingJavaClass
+ args: nil.
+
+ ] raise: Error.
+ "0 ldc1 2 ['foo']
+ 2 areturn"
+
+ "Created: / 14-03-2011 / 16:21:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 23:01:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testJustLoadConstants
+ self shouldnt: [
+
+ self
+ invoke: #'justUseConstants()V'
+ class: self loadSimpleMathJavaClass
+ args: #().
+
+ ] raise: Error.
+ "static method
+
+ 0 lconst_0
+ 1 lstore_0
+ 2 lconst_1
+ 3 lstore_2
+ 4 fconst_0
+ 5 fstore 4
+ 7 fconst_1
+ 8 fstore 5
+ 10 fconst_2
+ 11 fstore 6
+ 13 dconst_0
+ 14 dstore 7
+ 16 dconst_1
+ 17 dstore 9
+ 19 return"
+
+ "Created: / 14-03-2011 / 17:05:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 23:02:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testLookupSwitch
+ self shouldnt: [
+
+ self
+ invoke: #'switchInt(I)I'
+ class: self loadSwitchExamplesClass
+ receiver: self loadSwitchExamplesClass new
+ args: #( -1000 )
+
+ ] raise: Error.
+
+ "Created: / 21-03-2011 / 13:51:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:12:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMultipy
+ self shouldnt:
+ [ self
+ invoke: #'multiply(II)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 20 with: 10)]
+ raise: Error.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 imul
+ 3 ireturn"
+
+ "Created: / 06-03-2011 / 14:17:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:53:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testNegateInt
+ self shouldnt:
+ [ self
+ invoke: #'negateInt(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 55 )]
+ raise: Error.
+
+ "0 iload_0
+ 1 iconst_m1
+ 2 ixor
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:55:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:53:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testOr
+ | |
+
+ self shouldnt:
+ [ self
+ invoke: #'or(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 55 66 )]
+ raise: Error.
+
+ "0 iload_0
+ 1 iload_1
+ 2 ior
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 17:02:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:53:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testOverridenMethodCall
+ self shouldnt:
+ [ self
+ invoke: #'bar()Ljava/lang/String;'
+ class: self loadSimpleInheritingJavaClass
+ args: nil.]
+ raise: Error.
+
+ "0 ldc1 2 ['bar']
+ 2 areturn"
+
+ "Modified: / 20-03-2011 / 21:53:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testPower
+ self shouldnt:
+ [ self
+ invoke: #'power(II)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 2 with: 10)]
+ raise: Error.
+
+ "0 iload_0
+ 1 iload_1
+ 2 iconst_1
+ 3 invokestatic 2 [JavaMethod(stx.libjava.tests.simpleClasses.SimpleMath::int powerAcc (int int int))]
+ 6 ireturn"
+
+ "Created: / 06-03-2011 / 14:18:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:54:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testReturnArrayOfLongs
+
+
+ self shouldnt:
+ [ self
+ invoke: #'giveMeArrayOfLongs()[J'
+ class: self loadSimpleMathJavaClass
+ args: #(). ]
+ raise: Error.
+
+ "0 bipush 100
+ 2 newarray 11 [T_LONG]
+ 4 areturn"
+
+ "Created: / 14-03-2011 / 17:08:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSimpleAdd
+ self shouldnt:
+ [ self
+ invoke: #'add2To2000Expect2002()I'
+ class: self loadSimpleMathJavaClass
+ args: nil ]
+ raise: Error.
+
+ "static method
+
+ 0 iconst_2
+ 1 istore_0
+ 2 sipush 2000
+ 5 istore_1
+ 6 iload_0
+ 7 iload_1
+ 8 iadd
+ 9 istore_2
+ 10 iload_2
+ 11 ireturn"
+
+ "Created: / 06-03-2011 / 14:18:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:55:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSimpleAdd2
+ self shouldnt:
+ [ self
+ invoke: #'addMinus5ToArg(I)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 10) ]
+ raise: Error.
+
+ "static method
+
+ 0 iload_0
+ 1 bipush -5
+ 3 iadd
+ 4 ireturn"
+
+ "Created: / 06-03-2011 / 14:18:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:55:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testStackCreation
+ self shouldnt:
+ [ self
+ invoke: #'isYourStackCreatedCorrectly()I'
+ class: self loadSimpleMathJavaClass
+ args: #()]
+ raise: Error.
+
+ "0 iconst_0
+ 1 istore_0
+ 2 iconst_1
+ 3 istore_1
+ 4 iconst_2
+ 5 istore_0
+ 6 iconst_3
+ 7 istore_1
+ 8 iconst_4
+ 9 istore_0
+ 10 iconst_5
+ 11 istore_0
+ 12 bipush 6
+ 14 istore_1
+ 15 bipush 7
+ 17 istore_0
+ 18 bipush 8
+ 20 istore_1
+ 21 bipush 9
+ 23 istore_1
+ 24 iload_0
+ 25 ireturn"
+
+ "Created: / 14-03-2011 / 17:03:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:55:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSumArray
+ self shouldnt: [
+
+ self
+ invoke: #'sumArray([I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( #(1 2 3 4 5) )
+
+ ] raise: Error.
+ "
+ Decompiled source:
+ Static method
+ 0 iconst_0
+ 1 istore_1
+ 2 iconst_0
+ 3 istore_2
+ 4 iload_2
+ 5 aload_0
+ 6 arraylength
+ 7 if_icmpge 15 [22]
+ 10 iload_1
+ 11 aload_0
+ 12 iload_2
+ 13 iaload
+ 14 iadd
+ 15 istore_1
+ 16 iinc 2 1
+ 19 goto -15 [4]
+ 22 iload_1
+ 23 ireturn"
+
+ "Created: / 14-03-2011 / 17:06:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 23:05:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSumArrayOfDoubles
+ self shouldnt:
+ [self
+ invoke: #'sumArrayOfDoubles([D)D'
+ class: self loadSimpleMathJavaClass
+ args: #( #(1.1 2.2 3.3 4.4 5.5) ) ]
+ raise: Error.
+ "0 dconst_0
+ 1 dstore_1
+ 2 iconst_0
+ 3 istore_3
+ 4 iload_3
+ 5 aload_0
+ 6 arraylength
+ 7 if_icmpge 15 [22]
+ 10 dload_1
+ 11 aload_0
+ 12 iload_3
+ 13 daload
+ 14 dadd
+ 15 dstore_1
+ 16 iinc 3 1
+ 19 goto -15 [4]
+ 22 dload_1
+ 23 dreturn"
+
+ "Created: / 14-03-2011 / 17:07:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:55:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testTableSwitch
+ self shouldnt: [
+
+ self
+ invoke: #'switchChar(C)I'
+ class: self loadSwitchExamplesClass
+ receiver: self loadSwitchExamplesClass new
+ args: #( $b ).
+
+ ] raise: Error.
+
+ "Created: / 21-03-2011 / 13:51:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:02:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testUnsignedBitShiftLeft
+ self shouldnt:
+ [ self
+ invoke: #'unsignedBitShiftRight(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 1234 5 ) ]
+ raise: Error.
+
+ "0 iload_0
+ 1 iload_1
+ 2 iushr
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 17:01:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:56:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testXor
+ self shouldnt:
+ [ self
+ invoke: #'xor(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 1234 5 )]
+ raise: Error.
+
+ "0 iload_0
+ 1 iload_1
+ 2 ixor
+ 3 ireturn"
+
+ "Modified: / 06-03-2011 / 15:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 14-03-2011 / 17:02:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 21:56:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassemblerTests methodsFor:'tests - manual'!
+
+diassembleAll
+ | fails |
+
+ fails := OrderedCollection new.
+ JavaMethod allSubInstances do:
+ [:method |
+ method isNative
+ ifFalse:
+ [ [ JavaByteCodeDisassembler new diassemble: method to: String new writeStream ]
+ on: Error
+ do: [ fails add: method ] ] ].
+ fails size ~~ 0
+ ifTrue: [ self error: 'Some java methods failed to disassemble' ].
+
+ "
+ JavaByteCodeDisassemblerTests new diassembleAll"
+
+ "Created: / 21-03-2011 / 21:13:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 22-03-2011 / 21:05:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-03-2011 / 16:54:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassemblerTests methodsFor:'tests-helpers'!
+
+invoke:methodName class:aClass receiver:receiver args:args
+ |method result|
+
+ method := aClass lookupMethodFor:methodName.
+ result := JavaByteCodeDisassembler diassemble:method.
+
+ "Created: / 10-03-2011 / 23:30:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 17:42:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 21:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeDisassemblerTests methodsFor:'tests2'!
+
+testGetBoolean
+
+ self
+ invoke: #'getBoolean()Z'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+
+ "
+ Deassembling getBoolean
+ 1: ALOAD_0 (42) ARGS: [] STACK: [.. -> FIELD 0: stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences]
+ 2: GETFIELD (180) ARGS: [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] STACK: [objectRef -> objectRef]
+ 5: BIPUSH (16) ARGS: [9] STACK: [.. -> value]
+ 7: AALOAD (50) ARGS: [] STACK: [arrayRef, index -> value]
+ 8: CHECKCAST (192) ARGS: [java.lang.Boolean] STACK: [objectRef -> objectRef]
+ 11: INVVIRT (182) ARGS: [JavaMethodRef (java.lang.Boolean 'booleanValue'()Z)] STACK: [objectRef, [arg1, arg2, ...] -> ..]
+ 14: IRETURN (172) ARGS: [] STACK: [value -> EMPTY]
+"
+
+ "Created: / 14-03-2011 / 21:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 16:06:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetByte
+ self shouldnt:[ self
+ invoke: #'getByte()B'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 bipush 7
+ 6 aaload
+ 7 checkcast 17 [java.lang.Byte]
+ 10 invokevirtual 31 [JavaMethodRef (java.lang.Byte 'byteValue'()B)]
+ 13 ireturn"
+
+ "Created: / 14-03-2011 / 21:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:38:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetChar
+ self shouldnt:[ self
+ invoke: #'getChar()C'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_3
+ 5 aaload
+ 6 checkcast 25 [java.lang.Character]
+ 9 invokevirtual 26 [JavaMethodRef (java.lang.Character 'charValue'()C)]
+ 12 ireturn"
+
+ "Created: / 14-03-2011 / 21:31:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:39:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetDateArray
+ self shouldnt:[ self
+ invoke: #'getDateArray()[Ljava/util/Date;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 bipush 8
+ 6 aaload
+ 7 checkcast 32 [UnresolvedClass([Ljava.util.Date;)]
+ 10 checkcast 32 [UnresolvedClass([Ljava.util.Date;)]
+ 13 areturn"
+
+ "Created: / 14-03-2011 / 21:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:39:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetDouble
+ self shouldnt:[ self
+ invoke: #'getDouble()Ljava/lang/Double;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_2
+ 5 aaload
+ 6 checkcast 24 [java.lang.Double]
+ 9 areturn"
+
+ "Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:39:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetInt
+ self shouldnt:[ self
+ invoke: #'getInt()I'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_1
+ 5 aaload
+ 6 checkcast 13 [java.lang.Integer]
+ 9 invokevirtual 23 [JavaMethodRef (java.lang.Integer 'intValue'()I)]
+ 12 ireturn"
+
+ "Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:39:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetIntArray
+self shouldnt:[ self
+ invoke: #'getIntArray()[I'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ ] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_5
+ 5 aaload
+ 6 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')]
+ 9 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')]
+ 12 areturn"
+
+ "Created: / 14-03-2011 / 21:33:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:40:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetLong
+ self shouldnt:[ self
+ invoke: #'getLong()J'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_4
+ 5 aaload
+ 6 checkcast 27 [java.lang.Long]
+ 9 invokevirtual 28 [JavaMethodRef (java.lang.Long 'longValue'()J)]
+ 12 lreturn"
+
+ "Created: / 14-03-2011 / 21:32:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:40:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetShort
+ self shouldnt:[ self
+ invoke: #'getShort()S'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 bipush 6
+ 6 aaload
+ 7 checkcast 14 [java.lang.Short]
+ 10 invokevirtual 30 [JavaMethodRef (java.lang.Short 'shortValue'()S)]
+ 13 ireturn"
+
+ "Created: / 14-03-2011 / 21:33:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:40:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetString
+ self shouldnt:[ self
+ invoke: #'getString()Ljava/lang/String;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil] raise: Error.
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_0
+ 5 aaload
+ 6 checkcast 22 [java.lang.String]
+ 9 areturn"
+
+ "Created: / 14-03-2011 / 21:27:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:40:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMultiBytePrintString
+|badClass|
+badClass := Java classForName: 'java.nio.charset.CharsetDecoder'.
+
+
+self
+ invoke: #'<init>(Ljava/nio/charset/Charset;FF)V'
+ class: badClass
+ args: #( 21 4 ).
+
+ "Created: / 23-03-2011 / 16:58:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetBoolean
+ self shouldnt: [
+
+ self
+ invoke: #'setBoolean(I)V'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+
+ ] raise: Error.
+
+ "Created: / 22-03-2011 / 12:17:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeDisassemblerTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaByteCodeEnumerator.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaByteCodeEnumerator.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,3 +1,44 @@
+"
+ 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' }"
JavaDecompiler subclass:#JavaByteCodeEnumerator
@@ -7,6 +48,52 @@
category:'Languages-Java-Support-Decompiling'
!
+!JavaByteCodeEnumerator 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.
+
+"
+! !
!JavaByteCodeEnumerator methodsFor:'accessing'!
@@ -95,5 +182,9 @@
!JavaByteCodeEnumerator class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaByteCodeEnumerator.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaByteCodeEnumerator.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeInterpreter.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,3058 @@
+"
+ 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' }"
+
+JavaByteCodeProcessor subclass:#JavaByteCodeInterpreter
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Bytecode'
+!
+
+!JavaByteCodeInterpreter 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
+"
+ Base class for intepreting Java bytecode.
+ This class is based on NewCompiler::JavaByteCodeInterpreter
+ written originally by Claus Gittinger
+
+
+ [author:]
+ Jan Vrany (jan.vrany@fit.cvut.cz)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavaByteCodeInterpreter class methodsFor:'interpretation'!
+
+interpret:aMethod receiver:aReceiver arguments:argArray
+ ^ self new interpret:aMethod receiver:aReceiver arguments:argArray
+! !
+
+!JavaByteCodeInterpreter methodsFor:'instructions'!
+
+aaload
+ "loads onto the stack a reference from an array
+ stack: arrayref, index -> value
+ args: nothing"
+
+ | arrayref index |
+
+ index := self pop.
+ arrayref := self pop.
+ arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
+ ^ self pushRef: (arrayref at: index + 1).
+
+ "
+ The arrayref must be of type reference and must refer to an array whose
+ components are of type reference. The index must be of type int. Both arrayref
+ and index are popped from the operand stack. The reference value in the component
+ of the array at index is retrieved and pushed onto the operand stack.
+
+ If arrayref is null, aaload throws a NullPointerException.
+ Otherwise, if index is not within the bounds of the array referenced by arrayref,
+ the aaload instruction throws an ArrayIndexOutOfBoundsException."
+
+ "Modified: / 16-03-2011 / 15:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-03-2011 / 17:20:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aastore
+ "stores into a reference in an array
+ stack: arrayref, index, value -> nothing
+ args: nothing"
+
+ | arrayref index value |
+ value := self pop.
+ index := self pop.
+ arrayref := self pop.
+ arrayref ifNil: [ ^ JavaVM throwNullPointerException ].
+ arrayref at: index + 1 put: value.
+
+ "
+ The arrayref must be of type reference and must refer to an array whose components are of
+ type reference. The index must be of type int and value must be of type reference. The arrayref,
+ index, and value are popped from the operand stack. The reference value is stored as the
+ component of the array at index.
+
+ The type of value must be assignment compatible (§2.6.7) with the type of the components
+ of the array referenced by arrayref. Assignment of a value of reference type S (source)
+ to a variable of reference type T (target) is allowed only when the type S supports all
+ the operations defined on type T. The detailed rules follow:
+
+ If S is a class type, then:
+ If T is a class type, then S must be the same class (§2.8.1) as T, or S must be a subclass of T;
+ If T is an interface type, S must implement (§2.13) interface T.
+ If S is an interface type, then:
+ If T is a class type, then T must be Object (§2.4.7).
+ If T is an interface type, then T must be the same interface as S or a superinterface of S (§2.13.2).
+
+ If S is an array type, namely, the type SC[], that is, an array of components of type SC, then:
+ If T is a class type, then T must be Object (§2.4.7).
+ If T is an array type TC[], that is, an array of components of type TC, then one of the following must be true:
+ TC and SC are the same primitive type (§2.4.1).
+ TC and SC are reference types (§2.4.6), and type SC is assignable to TC by these runtime rules.
+ If T is an interface type, T must be one of the interfaces implemented by arrays (§2.15).
+
+
+ If arrayref is null, aastore throws a NullPointerException.
+ Otherwise, if index is not within the bounds of the array referenced by arrayref,
+ the aastore instruction throws an ArrayIndexOutOfBoundsException.
+ Otherwise, if arrayref is not null and the actual type of value is not assignment
+ compatible (§2.6.7) with the actual type of the components of the array, aastore
+ throws an ArrayStoreException."
+
+ "Modified: / 22-03-2011 / 12:27:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aconst_null
+ "
+ Push null
+ stack: nothing -> null
+ args: nothing"
+
+ self pushConstant: nil.
+
+"
+Description
+Push the null object reference onto the operand stack.
+
+Notes
+The Java virtual machine does not mandate a concrete
+value for null."
+
+ "Created: / 24-02-2011 / 22:40:50 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 24-02-2011 / 22:07:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-03-2011 / 20:55:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+aload: idx
+ "Load reference from local variable
+ nothing -> objectRef
+ args: index"
+
+ self pushRef: (context at: idx + 1).
+
+ "Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The local variable at
+ index must contain a reference. The objectref in the local variable
+ at index is pushed onto the operand stack.
+
+ Notes
+ The aload instruction cannot be used to load a value of type returnAddress
+ from a local variable onto the operand stack. This asymmetry with the
+ astore instruction is intentional.
+ The aload opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Modified: / 13-03-2011 / 20:59:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+anewarray
+ "
+ Create new array of reference
+ stack: count -> arrayRef
+ args: arrayType"
+
+ | type size |
+
+ type := constantPool at: self fetchIndex2.
+ size := self pop.
+
+ self pushNewArrayOf: type sized: size.
+
+ "
+ Description
+ The count must be of type int. It is popped off the operand stack. The count
+ represents the number of components of the array to be created. The unsigned
+ indexbyte1 and indexbyte2 are used to construct an index into the runtime
+ constant pool of the current class (§3.6), where the value of the index is
+ (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
+ must be a symbolic reference to a class, array, or interface type. The named
+ class, array, or interface type is resolved (§5.4.3.1). A new array with components
+ of that type, of length count, is allocated from the garbage-collected heap,
+ and a reference arrayref to this new array object is pushed onto the operand
+ stack. All components of the new array are initialized to null, the default
+ value for reference types (§2.5.1).
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the class, array, or interface
+ type, any of the exceptions documented in §5.4.3.1 can be thrown.
+
+ Runtime Exception
+ Otherwise, if count is less than zero, the anewarray instruction throws a
+ NegativeArraySizeException.
+
+ Notes
+ The anewarray instruction is used to create a single dimension of an array of
+ object references or part of a multidimensional array."
+
+ "Created: / 14-03-2011 / 18:24:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 27-03-2011 / 21:12:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+areturn
+ "
+ Return reference from method
+ stack: objectRef -> empty
+ args: nothing"
+
+ self leaveProcessorWith: (self pop).
+
+ "
+ Description
+ The objectref must be of type reference and must refer to an object of a type
+ that is assignment compatible (§2.6.7) with the type represented by the return
+ descriptor (§4.3.3) of the current method. If the current method is a synchronized
+ method, the monitor acquired or reentered on invocation of the method is released
+ or exited (respectively) as if by execution of a monitorexit instruction. If no
+ exception is thrown, objectref is popped from the operand stack of the current
+ frame (§3.6) and pushed onto the operand stack of the frame of the invoker. Any
+ other values on the operand stack of the current method are discarded.
+ The interpreter then reinstates the frame of the invoker and returns control to
+ the invoker.
+
+ Runtime Exceptions
+ If the current method is a synchronized method and the current thread is not the
+ owner of the monitor acquired or reentered on invocation of the method, areturn
+ throws an IllegalMonitorStateException. This can happen, for example, if a synchronized
+ method contains a monitorexit instruction, but no monitorenter instruction, on the object
+ on which the method is synchronized.
+ Otherwise, if the virtual machine implementation enforces the rules on structured use
+ of locks described in §8.13 and if the first of those rules is violated during invocation
+ of the current method, then areturn throws an IllegalMonitorStateException."
+ "Created: / 14-03-2011 / 13:45:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+arraylength
+ "
+ Get length of array
+ stack: arrayRef -> length
+ args: nothing"
+ self pushInt: self pop size.
+
+ "
+ Description
+ The arrayref must be of type reference and must refer to an array. It is
+ popped from the operand stack. The length of the array it references is
+ determined. That length is pushed onto the operand stack as an int.
+
+ Runtime Exception
+ If the arrayref is null, the arraylength instruction throws a NullPointerException."
+
+ "Created: / 14-03-2011 / 18:41:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+astore: idx
+ "
+ stores a reference into a local variable #index
+ stack: objectref -> nothing
+ args: index"
+
+ context at: idx + 1 put: (self pop).
+
+ "Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The objectref on the
+ top of the operand stack must be of type returnAddress or of type
+ reference. It is popped from the operand stack, and the value of
+ the local variable at index is set to objectref.
+
+ Notes
+ The astore instruction is used with an objectref of type returnAddress
+ when implementing the finally clauses of the Java programming language
+ (see Section 7.13, Compiling finally). The aload instruction cannot be
+ used to load a value of type returnAddress from a local variable onto
+ he operand stack. This asymmetry with the astore instruction is intentional.
+ The astore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Modified: / 13-03-2011 / 16:57:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+athrow
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+baload
+ self halt
+!
+
+bastore
+ self halt
+!
+
+bipush
+ "
+ pushes a byte onto the stack as an integer value
+ stack: nothing -> value
+ args: byte"
+
+ self pushInt: (self fetchByte).
+
+ "
+ The immediate byte is sign-extended to an int value. That value is pushed onto the operand stack.
+"
+
+ "Modified: / 13-03-2011 / 16:58:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+breakpoint
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+caload
+ self halt
+!
+
+castore
+ self halt
+!
+
+checkcast
+ "
+ Check whether object is of given type
+ stack: objref -> objRef
+ args: indexByte1 indexByte2"
+
+ | ref objRef |
+
+ ref := constantPool at: self fetchIndex2.
+ ref isUnresolved
+ ifTrue:
+ [ ref := ref javaClass
+ ].
+ objRef := self pop.
+ (objRef isNil or: [ (JavaVM canCast: objRef class to: ref) ])
+ ifTrue: [ self pushRef: objRef. ]
+ ifFalse: [ JavaVM throwClassCastException ].
+
+ "
+ Description
+ The objectref must be of type reference. The unsigned indexbyte1 and indexbyte2 are used to
+ construct an index into the runtime constant pool of the current class (§3.6), where the value
+ of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at the index
+ must be a symbolic reference to a class, array, or interface type. The named class, array,
+ or interface type is resolved (§5.4.3.1).
+ If objectref is null or can be cast to the resolved class, array, or interface type, the
+ operand stack is unchanged; otherwise, the checkcast instruction throws a ClassCastException.
+ The following rules are used to determine whether an objectref that is not null can be cast
+ to the resolved type: if S is the class of the object referred to by objectref and T is the
+ resolved class, array, or interface type, checkcast determines whether objectref can be cast
+ to type T as follows:
+ If S is an ordinary (nonarray) class, then:
+ If T is a class type, then S must be the same class (§2.8.1) as T, or a subclass of T.
+ If T is an interface type, then S must implement (§2.13) interface T.
+ If S is an interface type, then:
+ If T is a class type, then T must be Object (§2.4.7).
+ If T is an interface type, then T must be the same interface as S or a superinterface
+ of S (§2.13.2).
+ If S is a class representing the array type SC[], that is, an array of components of
+ type SC, then:
+ If T is a class type, then T must be Object (§2.4.7).
+ If T is an array type TC[], that is, an array of components of type TC, then one of the
+ following must be true:
+ TC and SC are the same primitive type (§2.4.1).
+ TC and SC are reference types (§2.4.6), and type SC can be cast to TC by recursive
+ application of these rules.
+ If T is an interface type, T must be one of the interfaces implemented by arrays (§2.15).
+ Linking Exceptions
+ During resolution of the symbolic reference to the class, array, or interface type, any of the
+ exceptions documented in Section 5.4.3.1 can be thrown.
+
+ Runtime Exception
+ Otherwise, if objectref cannot be cast to the resolved class, array, or interface type,
+ the checkcast instruction throws a ClassCastException.
+
+ Notes
+ The checkcast instruction is very similar to the instanceof instruction. It differs in
+ its treatment of null, its behavior when its test fails (checkcast throws an exception,
+ instanceof pushes a result code), and its effect on the operand stack."
+
+ "Modified: / 21-03-2011 / 18:15:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+d2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+d2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dadd
+ "
+ adds two doubles together
+ stack: value1, value2 -> result
+ args: nothing"
+
+ self pushDouble: (self pop + self pop).
+
+"
+Description
+Both value1 and value2 must be of type double. The values are popped from the operand
+stack and undergo value set conversion (§3.8.3), resulting in value1' and value2'.
+The double result is value1' + value2'. The result is pushed onto the operand stack.
+The result of a dadd instruction is governed by the rules of IEEE arithmetic:
+If either value1' or value2' is NaN, the result is NaN.
+The sum of two infinities of opposite sign is NaN.
+The sum of two infinities of the same sign is the infinity of that sign.
+The sum of an infinity and any finite value is equal to the infinity.
+The sum of two zeroes of opposite sign is positive zero.
+The sum of two zeroes of the same sign is the zero of that sign.
+The sum of a zero and a nonzero finite value is equal to the nonzero value.
+The sum of two nonzero finite values of the same magnitude and opposite sign is
+positive zero.
+In the remaining cases, where neither operand is an infinity, a zero, or NaN and
+the values have the same sign or have different magnitudes, the sum is computed
+and rounded to the nearest representable value using IEEE 754 round to nearest mode.
+If the magnitude is too large to represent as a double, we say the operation overflows;
+the result is then an infinity of appropriate sign. If the magnitude is too small to
+represent as a double, we say the operation underflows; the result is then a zero of
+appropriate sign.
+The Java virtual machine requires support of gradual underflow as defined by IEEE 754.
+Despite the fact that overflow, underflow, or loss of precision may occur, execution
+of a dadd instruction never throws a runtime exception.
+"
+
+ "Created: / 14-03-2011 / 20:53:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+daload
+ "
+ Load double from array
+ stack: arrayRef index -> value
+ args: nothing"
+
+ self swap.
+ self pushDouble: (self pop at: (self pop + 1)).
+
+"
+Description
+The arrayref must be of type reference and must refer to an array whose components are of
+type double. The index must be of type int. Both arrayref and index are popped from the
+operand stack. The double value in the component of the array at index is retrieved and
+pushed onto the operand stack.
+
+Runtime Exceptions
+If arrayref is null, daload throws a NullPointerException.
+Otherwise, if index is not within the bounds of the array referenced by arrayref, the
+daload instruction throws an ArrayIndexOutOfBoundsException.
+"
+
+ "Modified: / 14-03-2011 / 20:52:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dastore
+ self halt
+!
+
+dcmpg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dcmpl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dconst: arg
+ self pushDouble: arg.
+
+ "Created: / 14-03-2011 / 18:01:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ddiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dload: idx
+"
+Load double from local variable
+stack: nothing -> value
+args: index
+"
+ self pushDouble: (context at: idx + 1).
+
+"
+Description
+The index is an unsigned byte. Both index and index + 1 must be indices into the local
+variable array of the current frame (§3.6). The local variable at index must contain a
+double. The value of the local variable at index is pushed onto the operand stack.
+
+Notes
+The dload opcode can be used in conjunction with the wide instruction to access a local
+variable using a two-byte unsigned index.
+"
+
+ "Modified: / 13-03-2011 / 16:59:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+drem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dreturn
+ "
+ Return double from method
+ stack: value -> empty
+ args: nothing"
+
+ self leaveProcessorWith: (self popDouble).
+
+ "
+ Description
+ The current method must have return type double. The value must be of
+ type double. If the current method is a synchronized method, the monitor
+ acquired or reentered on invocation of the method is released or exited
+ (respectively) as if by execution of a monitorexit instruction. If no
+ exception is thrown, value is popped from the operand stack of the current
+ frame (§3.6) and undergoes value set conversion (§3.8.3), resulting in
+ value'. The value' is pushed onto the operand stack of the frame of the
+ invoker. Any other values on the operand stack of the current method are
+ discarded.
+ The interpreter then returns control to the invoker of the method,
+ reinstating the frame of the invoker.
+
+ Runtime Exceptions
+ If the current method is a synchronized method and the current thread
+ is not the owner of the monitor acquired or reentered on invocation of
+ the method, dreturn throws an IllegalMonitorStateException. This can
+ happen, for example, if a synchronized method contains a monitorexit
+ instruction, but no monitorenter instruction, on the object on which
+ the method is synchronized.
+ Otherwise, if the virtual machine implementation enforces the rules
+ on structured use of locks described in §8.13 and if the first of
+ those rules is violated during invocation of the current method,
+ then dreturn throws an IllegalMonitorStateException."
+ "Created: / 14-03-2011 / 13:33:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-03-2011 / 18:04:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: index"
+
+ context at: self fetchIndex put: (self popDouble).
+
+ "
+ Description
+ The index is an unsigned byte. Both index and index + 1 must be indices
+ into the local variable array of the current frame (§3.6). The value on
+ the top of the operand stack must be of type double. It is popped from
+ the operand stack and undergoes value set conversion (§3.8.3), resulting
+ in value'. The local variables at index and index + 1 are set to value'.
+
+ Notes
+ The dstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 18:04:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore: idx
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: index"
+
+ context at: idx + 1 put: (self popDouble).
+
+ "
+ Description
+ The index is an unsigned byte. Both index and index + 1 must be indices
+ into the local variable array of the current frame (§3.6). The value on
+ the top of the operand stack must be of type double. It is popped from
+ the operand stack and undergoes value set conversion (§3.8.3), resulting
+ in value'. The local variables at index and index + 1 are set to value'.
+
+ Notes
+ The dstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Modified: / 14-03-2011 / 18:04:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+dup
+"
+Duplicate the top operand stack value
+stack: value -> value value
+args: nothing
+"
+self pushRef: self tos.
+
+"
+Description
+Duplicate the top value on the operand stack and push the duplicated value onto the operand stack.
+The dup instruction must not be used unless value is a value of a category 1 computational type (§3.11.1).
+"
+
+ "Modified: / 27-03-2011 / 21:19:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2
+"
+Duplicate the top one or two operand stack values
+stack v 1: value2 value1 -> value2 value 1 value2 value1 where both value1 and value2 are values of a category 1 computational type (§3.11.1).
+stack v 2: value1 -> value1 value1 where value is a value of a category 2 computational type (§3.11.1).
+args: nothing
+"
+ | tos |
+
+ tos := self popLong.
+ self pushLong: tos.
+ self pushLong: tos.
+ self breakPoint:#mh_instructions.
+"
+Description
+Duplicate the top one or two values on the operand stack and
+push the duplicated value or values back onto the operand
+stack in the original order.
+"
+
+ "Modified: / 13-03-2011 / 17:03:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2_x1
+ self halt
+!
+
+dup2_x2
+ self halt
+!
+
+dup_x1
+ self halt
+!
+
+dup_x2
+ self halt
+!
+
+f2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+f2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+f2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fadd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+faload
+ self halt
+!
+
+fastore
+ self halt
+!
+
+fcmpg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fcmpl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fconst: arg
+ self pushFloat: arg.
+
+ "Created: / 14-03-2011 / 17:57:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fdiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fload: idx
+"
+Load float from local variable
+stack: nothing -> value
+args: index
+"
+ self pushFloat: (context at: idx + 1).
+
+"
+Description
+The index is an unsigned byte that must be an index into the local
+variable array of the current frame (§3.6). The local variable at
+index must contain a float. The value of the local variable at index
+is pushed onto the operand stack.
+
+Notes
+The fload opcode can be used in conjunction with the wide instruction
+to access a local variable using a two-byte unsigned index.
+"
+
+ "Modified: / 13-03-2011 / 17:05:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+frem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+freturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fstore
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+
+ self fstore: self fetchIndex.
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 18:01:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore: idx
+"
+Store float into local variable
+stack: value -> nothing
+args: index
+"
+ context at: idx + 1 put: (self pop).
+
+"
+Description
+The index is an unsigned byte that must be an index into the local
+variable array of the current frame (§3.6). The value on the top of
+the operand stack must be of type float. It is popped from the operand
+stack and undergoes value set conversion (§3.8.3), resulting in value'.
+The value of the local variable at index is set to value'.
+
+Notes
+The fstore opcode can be used in conjunction with the wide instruction
+to access a local variable using a two-byte unsigned index.
+"
+
+ "Modified: / 13-03-2011 / 17:06:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+getfield
+ "gets a field value of an object objectref, where the field is
+ identified by field reference in the constant pool index (index1 << 8 + index2)
+ stack: objectRef -> value
+ args: indexByte1 indexByte2"
+
+ | fieldref fieldOwner |
+
+ fieldOwner := self pop.
+ fieldref := constantPool at: self fetchIndex2.
+fieldref resolve.
+ self pushConstant: (fieldref offset).
+
+ "
+ Description
+ The objectref, which must be of type reference, is popped from the operand stack.
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
+ runtime constant pool of the current class (§3.6), where the value of the index
+ is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
+ must be a symbolic reference to a field (§5.1), which gives the name and
+ descriptor of the field as well as a symbolic reference to the class in which
+ the field is to be found. The referenced field is resolved (§5.4.3.2). The value
+ of the referenced field in objectref is fetched and pushed onto the operand stack.
+ The class of objectref must not be an array. If the field is protected (§4.6),
+ and it is either a member of the current class or a member of a superclass of
+ the current class, then the class of objectref must be either the current class
+ or a subclass of the current class.
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the field, any of the errors
+ pertaining to field resolution documented in Section 5.4.3.2 can be thrown.
+ Otherwise, if the resolved field is a static field, getfield throws an
+ IncompatibleClassChangeError.
+
+ Runtime Exception
+ Otherwise, if objectref is null, the getfield instruction throws a NullPointerException.
+
+ Notes
+ The getfield instruction cannot be used to access the length field of an array.
+ The arraylength instruction is used instead."
+
+ "Created: / 10-03-2011 / 23:34:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 15:22:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:12:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getstatic
+ "
+ Get static field from class
+ stack: .. -> value
+ args: indexByte1 indexByte2"
+
+ | fieldref |
+
+ fieldref := constantPool at: self fetchIndex2.
+ fieldref resolveStatic.
+ self pushConstant: (fieldref offset).
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
+ runtime constant pool of the current class (§3.6), where the value of the index
+ is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
+ must be a symbolic reference to a field (§5.1), which gives the name and descriptor
+ of the field as well as a symbolic reference to the class or interface in which the
+ field is to be found. The referenced field is resolved (§5.4.3.2).
+ On successful resolution of the field, the class or interface that declared the
+ resolved field is initialized (§5.5) if that class or interface has not already
+ been initialized.
+ The value of the class or interface field is fetched and pushed onto the operand stack.
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the class or interface field,
+ any of the exceptions pertaining to field resolution documented in Section 5.4.3.2
+ can be thrown.
+ Otherwise, if the resolved field is not a static (class) field or an interface field,
+ getstatic throws an IncompatibleClassChangeError.
+
+ Runtime Exception
+ Otherwise, if execution of this getstatic instruction causes initialization of the
+ referenced class or interface, getstatic may throw an Error as detailed in Section 2.17.5."
+
+ "Modified: / 04-06-2011 / 18:15:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+goto
+ "
+ Branch always
+ stack: nothing -> nothing
+ args: branchByte1 branchByte2"
+
+ self relativeJump: self fetchBytes2.
+
+ "
+ Description
+ The unsigned bytes branchbyte1 and branchbyte2 are used to construct a signed 16-bit
+ branchoffset, where branchoffset is (branchbyte1 << 8) | branchbyte2. Execution proceeds
+ at that offset from the address of the opcode of this goto instruction. The target
+ address must be that of an opcode of an instruction within the method that contains
+ this goto instruction."
+
+ "Created: / 14-03-2011 / 20:21:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+goto_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+i2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+i2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+i2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+i_dup
+ self pushInt: (self tos).
+
+ "Modified: / 13-03-2011 / 16:40:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iadd
+ "
+ adds two ints together
+ stack: value1, value2 -> result
+ args: nothing"
+ self pushInt: (self pop + self pop).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped
+ from the operand stack. The int result is value1 + value2. The result
+ is pushed onto the operand stack.
+ The result is the 32 low-order bits of the true mathematical result
+ in a sufficiently wide two's-complement format, represented as a value
+ of type int. If overflow occurs, then the sign of the result may not be
+ the same as the sign of the mathematical sum of the two values.
+ Despite the fact that overflow may occur, execution of an iadd instruction
+ never throws a runtime exception."
+
+ "Created: / 06-03-2011 / 21:23:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 21:51:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iaload
+ "
+ Load int from array
+ stack: arrayRef index -> value
+ args: nothing"
+
+ self swap.
+ self pushInt: (self pop at: (self pop + 1)).
+
+ "
+ Description
+ The arrayref must be of type reference and must refer to an array whose
+ components are of type int. The index must be of type int. Both arrayref
+ and index are popped from the operand stack. The int value in the
+ component of the array at index is retrieved and pushed onto the operand
+ stack.
+
+ Runtime Exceptions
+ If arrayref is null, iaload throws a NullPointerException.
+ Otherwise, if index is not within the bounds of the array referenced by
+ arrayref, the iaload instruction throws an ArrayIndexOutOfBoundsException."
+
+ "Modified: / 14-03-2011 / 20:20:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iand
+"
+Boolean AND int
+stack: val1 val2 -> result
+args: nothing
+"
+self pushInt:(self pop bitAnd: self pop).
+"
+Both value1 and value2 must be of type int. They are popped from the
+operand stack. An int result is calculated by taking the bitwise AND
+(conjunction) of value1 and value2. The result is pushed onto the
+operand stack.
+"
+
+ "Created: / 14-03-2011 / 17:10:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iastore
+ self halt
+!
+
+iconst: arg
+ self pushInt: arg.
+
+ "Created: / 20-03-2011 / 23:35:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+idiv
+ "
+ Divide int
+ stack: value1 value2 -> result
+ args: nothing"
+ self swap.
+ self pushInt: (self pop // self pop).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped from the operand stack.
+ The int result is the value of the Java programming language expression value1 / value2.
+ The result is pushed onto the operand stack.
+ An int division rounds towards 0; that is, the quotient produced for int values in n/d is
+ an int value q whose magnitude is as large as possible while satisfying . Moreover, q is
+ positive when and n and d have the same sign, but q is negative when and n and d have
+ opposite signs.
+ There is one special case that does not satisfy this rule: if the dividend is the negative
+ integer of largest possible magnitude for the int type, and the divisor is -1, then overflow
+ occurs, and the result is equal to the dividend. Despite the overflow, no exception is thrown
+ in this case.
+
+ Runtime Exception
+ If the value of the divisor in an int division is 0, idiv throws an ArithmeticException."
+
+ "Created: / 14-03-2011 / 17:50:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifacmpeq
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+ifacmpne
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+ifeq
+ "
+ if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop = 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:47:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifge
+ "
+ if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop >= 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:48:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifgt
+ "
+ if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop > 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:48:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpeq
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ (self pop = self pop) ifTrue: [ self relativeJump: dest ].
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:49:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpge
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self swap.
+ (self pop >= self pop) ifTrue: [ self relativeJump: dest ]
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 <= value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 >= value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:52:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpgt
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self swap.
+ (self pop > self pop) ifTrue: [ self relativeJump: dest ]
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 <= value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 >= value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 21:00:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmple
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self swap.
+ (self pop <= self pop) ifTrue: [ self relativeJump: dest ]
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 <= value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 >= value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 21:00:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmplt
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self swap.
+ (self pop < self pop) ifTrue: [ self relativeJump: dest ]
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 <= value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 >= value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 21:00:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ificmpne
+ "
+ Branch if int comparison succeeds
+ stack: value1 value2 -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ (self pop ~= self pop) ifTrue: [ self relativeJump: dest ].
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are both popped from
+ the operand stack and compared. All comparisons are signed. The results
+ of the comparison are as follows:
+ eq succeeds if and only if value1 = value2
+ ne succeeds if and only if value1 ~= value2
+ lt succeeds if and only if value1 < value2
+ le succeeds if and only if value1 value2
+ gt succeeds if and only if value1 > value2
+ ge succeeds if and only if value1 value2
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2 are
+ used to construct a signed 16-bit offset, where the offset is calculated
+ to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds at that
+ offset from the address of the opcode of this if_icmp<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if_icmp<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if_icmp<cond> instruction."
+
+ "Created: / 14-03-2011 / 20:59:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifle
+ "
+ if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop <= 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:48:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iflt
+ "
+ if true, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop < 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 14-03-2011 / 18:47:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifne
+ "
+ if value is not 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes branchbyte1 << 8 + branchbyte2)
+ stack: value -> nothing
+ args: branchByte1 branchByte2"
+ "/ -1 in block - because we already increased pc to point to the next instruction
+
+ | dest |
+
+ dest := self fetchBytes2.
+ self pop ~= 0 ifTrue: [ self relativeJump: dest ].
+
+ "
+ The value must be of type int. It is popped from the operand stack and
+ compared against zero. All comparisons are signed. The results of the
+ comparisons are as follows:
+ eq succeeds if and only if value = 0
+ ne succeeds if and only if value ~= 0
+ lt succeeds if and only if value < 0
+ le succeeds if and only if value <= 0
+ gt succeeds if and only if value > 0
+ ge succeeds if and only if value >= 0
+ If the comparison succeeds, the unsigned branchbyte1 and branchbyte2
+ are used to construct a signed 16-bit offset, where the offset is
+ calculated to be (branchbyte1 << 8) | branchbyte2. Execution then proceeds
+ at that offset from the address of the opcode of this if<cond> instruction.
+ The target address must be that of an opcode of an instruction within the
+ method that contains this if<cond> instruction.
+ Otherwise, execution proceeds at the address of the instruction following
+ this if<cond> instruction."
+
+ "Created: / 06-03-2011 / 22:57:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:20:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifnonnull
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+ifnull
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+iinc
+"
+Increment local variable by constant
+stack: nothing -> nothing
+args: index const
+"
+| index const |
+
+ index := self fetchIndex.
+ const := self fetchByte.
+ context at: index + 1 put: ((context at: index + 1) + const).
+"
+Description
+The index is an unsigned byte that must be an index into the local variable
+array of the current frame (§3.6). The const is an immediate signed byte.
+The local variable at index must contain an int. The value const is first
+sign-extended to an int, and then the local variable at index is incremented
+by that amount.
+
+Notes
+The iinc opcode can be used in conjunction with the wide instruction to access
+a local variable using a two-byte unsigned index and to increment it by a two-byte
+immediate value.
+"
+
+ "Created: / 14-03-2011 / 17:22:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+iload: idx
+ "
+ loads an int value from a local variable #index
+ stack: nothing -> value
+ args: index"
+
+ self pushInt: (context at: idx + 1).
+
+ "
+ The index is an unsigned byte that must be an index into the local variable array
+ of the current frame (§3.6). The local variable at index must contain an int.
+ The value of the local variable at index is pushed onto the operand stack.
+
+ Notes
+ The iload opcode can be used in conjunction with the wide instruction to
+ access a local variable using a two-byte unsigned index."
+
+ "Modified: / 17-03-2011 / 17:33:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+imul
+ "multiply two integers
+ stack: value1, value2 -> result
+ args: nothing"
+
+ self pushInt: (self pop * self pop).
+
+"
+Both value1 and value2 must be of type int. The values are popped
+from the operand stack. The int result is value1 * value2. The result
+is pushed onto the operand stack.
+The result is the 32 low-order bits of the true mathematical result
+in a sufficiently wide two's-complement format, represented as a value
+of type int. If overflow occurs, then the sign of the result may not
+be the same as the sign of the mathematical sum of the two values.
+Despite the fact that overflow may occur, execution of an imul
+instruction never throws a runtime exception."
+
+ "Created: / 06-03-2011 / 22:42:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 17:24:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ineg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+instanceof
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+int2byte
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+int2char
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+int2short
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+invinterface
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+invnonvirt
+ "
+ Invoke instance method; special handling for superclass, private, and instance initialization method invocations
+ stack: objRef [args] -> ..
+ args: indexByte1 indexByte2"
+
+ | methodToBeInvoked methodReceiver methodNumArgs methodArgs result |
+
+ methodToBeInvoked := constantPool at: self fetchIndex2.
+ methodReceiver := self pop.
+ methodNumArgs := methodToBeInvoked javaNumArgs.
+ methodArgs := Array new: methodNumArgs.
+ methodNumArgs to: 1
+ by: -1
+ do: [:index | methodArgs at: index put: self pop ].
+ result := self
+ interpretInner: methodToBeInvoked
+ receiver: methodReceiver
+ arguments: methodArgs.
+ self pushRef: result.
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into the runtime constant pool
+ of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The
+ runtime constant pool item at that index must be a symbolic reference to a method (§5.1), which gives
+ the name and descriptor (§4.3.3) of the method as well as a symbolic reference to the class in which
+ the method is to be found. The named method is resolved (§5.4.3.3). Finally, if the resolved method
+ is protected (§4.6), and it is either a member of the current class or a member of a superclass of
+ the current class, then the class of objectref must be either the current class or a subclass of the
+ current class.
+ Next, the resolved method is selected for invocation unless all of the following conditions are true:
+ The ACC_SUPER flag (see Table 4.1, Class access and property modifiers) is set for the current class.
+ The class of the resolved method is a superclass of the current class.
+ The resolved method is not an instance initialization method (§3.9).
+ If the above conditions are true, the actual method to be invoked is selected by the following lookup
+ procedure. Let C be the direct superclass of the current class:
+ If C contains a declaration for an instance method with the same name and descriptor as the resolved
+ method, then this method will be invoked. The lookup procedure terminates.
+ Otherwise, if C has a superclass, this same lookup procedure is performed recursively using the direct
+ superclass of C. The method to be invoked is the result of the recursive invocation of this lookup
+ procedure.
+ Otherwise, an AbstractMethodError is raised.
+ The objectref must be of type reference and must be followed on the operand stack by nargs argument
+ values, where the number, type, and order of the values must be consistent with the descriptor of the
+ selected instance method.
+ If the method is synchronized, the monitor associated with objectref is acquired or reentered.
+ If the method is not native, the nargs argument values and objectref are popped from the operand stack.
+ A new frame is created on the Java virtual machine stack for the method being invoked. The objectref
+ and the argument values are consecutively made the values of local variables of the new frame, with
+ objectref in local variable 0, arg1 in local variable 1 (or, if arg1 is of type long or double, in
+ local variables 1 and 2), and so on. Any argument value that is of a floating-point type undergoes
+ value set conversion (§3.8.3) prior to being stored in a local variable. The new frame is then made
+ current, and the Java virtual machine pc is set to the opcode of the first instruction of the method
+ to be invoked. Execution continues with the first instruction of the method.
+ If the method is native and the platform-dependent code that implements it has not yet been bound (§5.6)
+ into the Java virtual machine, that is done. The nargs argument values and objectref are popped from
+ the operand stack and are passed as parameters to the code that implements the method. Any argument
+ value that is of a floating-point type undergoes value set conversion (§3.8.3) prior to being passed
+ as a parameter. The parameters are passed and the code is invoked in an implementation-dependent
+ manner. When the platform-dependent code returns, the following take place:
+ If the native method is synchronized, the monitor associated with objectref is released or exited as
+ if by execution of a monitorexit instruction.
+ If the native method returns a value, the return value of the platform-dependent code is converted in
+ an implementation-dependent way to the return type of the native method and pushed onto the operand stack.
+ Linking Exceptions
+ During resolution of the symbolic reference to the method, any of the exceptions pertaining to method
+ resolution documented in Section 5.4.3.3 can be thrown.
+ Otherwise, if the resolved method is an instance initialization method, and the class in which it is
+ declared is not the class symbolically referenced by the instruction, a NoSuchMethodError is thrown.
+ Otherwise, if the resolved method is a class (static) method, the invokespecial instruction throws an
+ IncompatibleClassChangeError.
+ Otherwise, if no method matching the resolved name and descriptor is selected, invokespecial throws
+ an AbstractMethodError.
+ Otherwise, if the selected method is abstract, invokespecial throws an AbstractMethodError.
+
+ Runtime Exceptions
+ Otherwise, if objectref is null, the invokespecial instruction throws a NullPointerException.
+ Otherwise, if the selected method is native and the code that implements the method cannot be bound,
+ invokespecial throws an UnsatisfiedLinkError.
+
+ Notes
+ The difference between the invokespecial and the invokevirtual instructions is that invokevirtual
+ invokes a method based on the class of the object. The invokespecial instruction is used to invoke
+ instance initialization methods (§3.9) as well as private methods and methods of a superclass of
+ the current class.
+ The invokespecial instruction was named invokenonvirtual prior to Sun's JDK release 1.0.2.
+ The nargs argument values and objectref are not one-to-one with the first nargs + 1 local variables.
+ Argument values of types long and double must be stored in two consecutive local variables, thus more
+ than nargs local variables may be required to pass nargs argument values to the invoked method."
+
+ "Modified: / 31-03-2011 / 16:34:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invstatic
+ "
+ Invoke a class (static) method
+ stack: [arg1 [args2 ...]] -> nothing
+ args: indexByte1 indexByte2"
+
+ | methodToBeInvoked methodNumArgs args argSignatures result |
+
+ methodToBeInvoked := (constantPool at: self fetchIndex2) resolve.
+ methodToBeInvoked ifNil: [self halt].
+ methodNumArgs := methodToBeInvoked javaNumArgs.
+ argSignatures := methodToBeInvoked argSignature.
+ args := Array new: methodNumArgs.
+ methodNumArgs to: 1 by: -1 do: [
+ :index |
+ args at: index put: self pop
+ ].
+ result := self
+ interpretInner: methodToBeInvoked
+ receiver: receiver
+ arguments: args.
+ methodToBeInvoked returnsVoid ifFalse: [
+ self pushConstant: result
+ ].
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
+ runtime constant pool of the current class (§3.6), where the value of the index is
+ (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index must
+ be a symbolic reference to a method (§5.1), which gives the name and descriptor (§4.3.3)
+ of the method as well as a symbolic reference to the class in which the method is to
+ be found. The named method is resolved (§5.4.3.3). The method must not be the class
+ or interface initialization method (§3.9). It must be static, and therefore cannot be
+ abstract.
+ On successful resolution of the method, the class that declared the resolved field is
+ initialized (§5.5) if that class has not already been initialized.
+ The operand stack must contain nargs argument values, where the number, type, and order
+ of the values must be consistent with the descriptor of the resolved method.
+ If the method is synchronized, the monitor associated with the resolved class is acquired
+ or reentered.
+ If the method is not native, the nargs argument values are popped from the operand stack.
+ A new frame is created on the Java virtual machine stack for the method being invoked.
+ The nargs argument values are consecutively made the values of local variables of the
+ new frame, with arg1 in local variable 0 (or, if arg1 is of type long or double, in local
+ variables 0 and 1) and so on. Any argument value that is of a floating-point type undergoes
+ value set conversion (§3.8.3) prior to being stored in a local variable. The new frame is
+ then made current, and the Java virtual machine pc is set to the opcode of the first
+ nstruction of the method to be invoked. Execution continues with the first instruction
+ of the method.
+ If the method is native and the platform-dependent code that implements it has not yet
+ been bound (§5.6) into the Java virtual machine, that is done. The nargs argument values
+ are popped from the operand stack and are passed as parameters to the code that
+ implements the method. Any argument value that is of a floating-point type undergoes
+ value set conversion (§3.8.3) prior to being passed as a parameter. The parameters are
+ passed and the code is invoked in an implementation-dependent manner. When the
+ platform-dependent code returns, the following take place:
+ If the native method is synchronized, the monitor associated with the resolved class
+ is released or exited as if by execution of a monitorexit instruction.
+ If the native method returns a value, the return value of the platform-dependent code
+ is converted in an implementation-dependent way to the return type of the native
+ method and pushed onto the operand stack.
+ Linking Exceptions
+ During resolution of the symbolic reference to the method, any of the exceptions
+ pertaining to method resolution documented in Section 5.4.3.3 can be thrown.
+ Otherwise, if the resolved method is an instance method, the invokestatic instruction
+ throws an IncompatibleClassChangeError.
+
+ Runtime Exceptions
+ Otherwise, if execution of this invokestatic instruction causes initialization of the
+ referenced class, invokestatic may throw an Error as detailed in Section 2.17.5.
+ Otherwise, if the resolved method is native and the code that implements the method
+ cannot be bound, invokestatic throws an UnsatisfiedLinkError.
+
+ Notes
+ The nargs argument values are not one-to-one with the first nargs local variables.
+ Argument values of types long and double must be stored in two consecutive local variables,
+ thus more than nargs local variables may be required to pass nargs argument values to
+ the invoked method."
+
+ "Created: / 24-02-2011 / 10:37:05 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 25-02-2011 / 00:18:30 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 24-02-2011 / 22:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:13:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invvirt
+ "
+ Invoke instance method; dispatch based on class
+ stack: objRef args -> ..
+ args: indexByte1 indexByte2"
+
+ | methodOwner methodRef resolvedMethod methodNumArgs args result |
+
+ methodRef := constantPool at: self fetchIndex2.
+ methodOwner := self pop.
+ resolvedMethod := methodRef resolve.
+ methodNumArgs := resolvedMethod javaNumArgs.
+ args := Array new: methodNumArgs.
+ methodNumArgs to: 1 by: -1 do: [
+ :index |
+ args at: index put: self pop
+ ].
+ result := self
+ interpretInner: (methodOwner class lookupMethodFor: resolvedMethod selector)
+ receiver: methodOwner
+ arguments: args.
+ resolvedMethod returnsVoid ifFalse: [
+ self pushConstant: result
+ ].
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into the
+ runtime constant pool of the current class (§3.6), where the value of the index
+ is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item at that index
+ must be a symbolic reference to a method (§5.1), which gives the name and descriptor
+ (§4.3.3) of the method as well as a symbolic reference to the class in which the
+ method is to be found. The named method is resolved (§5.4.3.3). The method must
+ not be an instance initialization method (§3.9) or the class or interface
+ initialization method (§3.9). Finally, if the resolved method is protected (§4.6),
+ and it is either a member of the current class or a member of a superclass of the
+ current class, then the class of objectref must be either the current class or a
+ subclass of the current class.
+ Let C be the class of objectref. The actual method to be invoked is selected by
+ the following lookup procedure:
+ If C contains a declaration for an instance method with the same name and descriptor
+ as the resolved method, and the resolved method is accessible from C, then this is
+ the method to be invoked, and the lookup procedure terminates.
+ Otherwise, if C has a superclass, this same lookup procedure is performed recursively
+ using the direct superclass of C ; the method to be invoked is the result of the
+ recursive invocation of this lookup procedure.
+ Otherwise, an AbstractMethodError is raised.
+ The objectref must be followed on the operand stack by nargs argument values,
+ where the number, type, and order of the values must be consistent with the descriptor
+ of the selected instance method.
+ If the method is synchronized, the monitor associated with objectref is acquired or
+ reentered.
+ If the method is not native, the nargs argument values and objectref are popped from
+ the operand stack. A new frame is created on the Java virtual machine stack for the
+ method being invoked. The objectref and the argument values are consecutively made
+ the values of local variables of the new frame, with objectref in local variable 0,
+ arg1 in local variable 1 (or, if arg1 is of type long or double, in local variables 1
+ and 2), and so on. Any argument value that is of a floating-point type undergoes
+ value set conversion (§3.8.3) prior to being stored in a local variable. The new
+ frame is then made current, and the Java virtual machine pc is set to the opcode
+ of the first instruction of the method to be invoked. Execution continues with the
+ first instruction of the method.
+ If the method is native and the platform-dependent code that implements it has not
+ yet been bound (§5.6) into the Java virtual machine, that is done. The nargs argument
+ values and objectref are popped from the operand stack and are passed as parameters
+ to the code that implements the method. Any argument value that is of a floating-point
+ type undergoes value set conversion (§3.8.3) prior to being passed as a parameter. The
+ parameters are passed and the code is invoked in an implementation-dependent manner.
+ When the platform-dependent code returns, the following take place:
+ If the native method is synchronized, the monitor associated with objectref is released
+ or exited as if by execution of a monitorexit instruction.
+ If the native method returns a value, the return value of the platform-dependent code
+ is converted in an implementation-dependent way to the return type of the native method
+ and pushed onto the operand stack.
+ Linking Exceptions
+ During resolution of the symbolic reference to the method, any of the exceptions
+ pertaining to method resolution documented in Section 5.4.3.3 can be thrown.
+ Otherwise, if the resolved method is a class (static) method, the invokevirtual instruction
+ throws an IncompatibleClassChangeError.
+
+ Runtime Exceptions
+ Otherwise, if objectref is null, the invokevirtual instruction throws a NullPointerException.
+ Otherwise, if no method matching the resolved name and descriptor is selected, invokevirtual
+ throws an AbstractMethodError.
+ Otherwise, if the selected method is abstract, invokevirtual throws an AbstractMethodError.
+ Otherwise, if the selected method is native and the code that implements the method cannot
+ be bound, invokevirtual throws an UnsatisfiedLinkError.
+
+ Notes
+ The nargs argument values and objectref are not one-to-one with the first nargs + 1 local
+ variables. Argument values of types long and double must be stored in two consecutive local
+ variables, thus more than nargs local variables may be required to pass nargs argument
+ values to the invoked method."
+
+ "Modified: / 04-06-2011 / 18:13:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ior
+ "
+ Boolean OR int
+ stack: val1 val2 -> result
+ args: nothing"
+
+ self pushInt: (self pop bitOr: self pop).
+
+"
+Description
+Both value1 and value2 must be of type int. They are popped from the operand stack.
+An int result is calculated by taking the bitwise inclusive OR of value1 and value2.
+The result is pushed onto the operand stack.
+"
+
+ "Created: / 14-03-2011 / 18:20:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+irem
+ "
+ Remainder int
+ stack: value1 value2 -> result
+ args: nothing"
+
+ | value1 value2 |
+
+ value2 := self pop.
+ value1 := self pop.
+ self pushInt: (value1 - ((value1 // value2) * value2)).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped from the operand stack.
+ The int result is value1 - (value1 / value2) * value2. The result is pushed onto the
+ operand stack.
+ The result of the irem instruction is such that (a/b)*b + (a%b) is equal to a. This identity
+ holds even in the special case in which the dividend is the negative int of largest possible
+ magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule
+ that the result of the remainder operation can be negative only if the dividend is negative
+ and can be positive only if the dividend is positive. Moreover, the magnitude of the result
+ is always less than the magnitude of the divisor.
+
+ Runtime Exception
+ If the value of the divisor for an int remainder operator is 0, irem throws an ArithmeticException."
+
+ "Modified: / 14-03-2011 / 17:32:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ireturn
+ "
+ Return int from method
+ stack: value -> nothing
+ args: nothing"
+
+ self leaveProcessorWith: (self pop).
+
+ "
+ Description
+ The current method must have return type boolean, byte, short,
+ char, or int. The value must be of type int. If the current method
+ is a synchronized method, the monitor acquired or reentered on
+ invocation of the method is released or exited (respectively) as
+ if by execution of a monitorexit instruction. If no exception is
+ thrown, value is popped from the operand stack of the current frame
+ (§3.6) and pushed onto the operand stack of the frame of the invoker.
+ Any other values on the operand stack of the current method are discarded.
+ The interpreter then returns control to the invoker of the method,
+ reinstating the frame of the invoker.
+
+ Runtime Exceptions
+ If the current method is a synchronized method and the current thread
+ is not the owner of the monitor acquired or reentered on invocation of
+ the method, ireturn throws an IllegalMonitorStateException. This can
+ happen, for example, if a synchronized method contains a monitorexit
+ instruction, but no monitorenter instruction, on the object on which
+ the method is synchronized.
+ Otherwise, if the virtual machine implementation enforces the rules
+ on structured use of locks described in Section 8.13 and if the first
+ of those rules is violated during invocation of the current method,
+ then ireturn throws an IllegalMonitorStateException."
+ "Created: / 06-03-2011 / 21:24:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 17:42:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ishl
+ "
+ Shift left int
+ stack: val1 val2 -> result
+ args: nothing"
+
+ self swap.
+ self pushInt: (self pop bitShift32: self pop).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped from the operand
+ stack. An int result is calculated by shifting value1 left by s bit positions, where
+ s is the value of the low 5 bits of value2. The result is pushed onto the operand stack.
+
+ Notes
+ This is equivalent (even if overflow occurs) to multiplication by 2 to the power s.
+ The shift distance actually used is always in the range 0 to 31, inclusive, as if
+ value2 were subjected to a bitwise logical AND with the mask value 0x1f."
+
+ "Created: / 14-03-2011 / 17:12:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-03-2011 / 19:01:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ishr
+ "
+ Shift right int
+ stack: val1 val2 -> result
+ args: nothing"
+
+ self swap.
+ self pushInt: (self pop rightShift: (self pop bitAnd: 2r11111)).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped from the operand
+ stack. An int result is calculated by shifting value1 right by s bit positions,
+ with sign extension, where s is the value of the low 5 bits of value2. The result
+ is pushed onto the operand stack.
+
+ Notes
+ The resulting value is , where s is value2 & 0x1f. For nonnegative value1, this
+ is equivalent to truncating int division by 2 to the power s. The shift distance
+ actually used is always in the range 0 to 31, inclusive, as if value2 were
+ subjected to a bitwise logical AND with the mask value 0x1f."
+
+ "Created: / 14-03-2011 / 17:19:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore
+ "superclass JavaByteCodeProcessor says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+!
+
+istore: idx
+ "store int value into variable #index
+ stack: value -> nothing
+ args: index"
+
+ context at: (idx + 1) put: (self pop).
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local variable
+ array of the current frame (§3.6). The value on the top of the operand stack
+ must be of type int. It is popped from the operand stack, and the value of
+ the local variable at index is set to value.
+
+ Notes
+ The istore opcode can be used in conjunction with the wide instruction to
+ access a local variable using a two-byte unsigned index."
+
+ "Modified: / 14-03-2011 / 20:03:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isub
+ "
+ int substract
+ stack: value1, value2 -> result
+ args: nothing"
+
+ self pushInt: (0 - self pop + self pop).
+
+ "
+ Both value1 and value2 must be of type int. The values are
+ popped from the operand stack. The int result is value1 - value2.
+ The result is pushed onto the operand stack.
+ For int subtraction, a - b produces the same result as a + (-b).
+ For int values, subtraction from zero is the same as negation.
+ The result is the 32 low-order bits of the true mathematical result
+ in a sufficiently wide two's-complement format, represented
+ as a value of type int. If overflow occurs, then the sign of
+ the result may not be the same as the sign of the mathematical
+ sum of the two values.
+ Despite the fact that overflow may occur, execution of an isub
+ instruction never throws a runtime exception."
+
+ "Created: / 06-03-2011 / 23:14:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iushr
+ "
+ Logical shift right int
+ stack: value1 value2 -> result
+ args: nothing"
+
+ self swap.
+ self pushInt: (self pop unsignedBitShift32: self pop).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. The values are popped from the
+ operand stack. An int result is calculated by shifting value1 right by s
+ bit positions, with zero extension, where s is the value of the low 5 bits
+ of value2. The result is pushed onto the operand stack.
+
+ Notes
+ If value1 is positive and s is value2 & 0x1f, the result is the same as
+ that of value1 >> s; if value1 is negative, the result is equal to the
+ value of the expression (value1 >> s) + (2 << ~s). The addition of the
+ (2 << ~s) term cancels out the propagated sign bit. The shift distance
+ actually used is always in the range 0 to 31, inclusive."
+
+ "Created: / 14-03-2011 / 18:58:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ixor
+ "
+ Boolean XOR int
+ stack: value1 value -> result
+ args: nothing"
+
+ self pushInt: (self pop bitXor: self pop).
+
+ "
+ Description
+ Both value1 and value2 must be of type int. They are popped from the operand
+ stack. An int result is calculated by taking the bitwise exclusive OR of
+ value1 and value2. The result is pushed onto the operand stack."
+
+ "Created: / 14-03-2011 / 18:07:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:35:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+jsr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+jsr_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+l2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+l2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+l2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+ladd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+laload
+ self halt
+!
+
+land
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lastore
+ self halt
+!
+
+lcmp
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lconst: arg
+ "
+ Push long constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self pushLong: arg.
+
+ "
+ Push the long constant <l> (0 or 1) onto the operand stack."
+
+ "Created: / 17-03-2011 / 15:31:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:03:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc1
+ "
+ Push item from runtime constant pool
+ stack: nothing -> value
+ args: index"
+
+ self pushRef: (constantPool at: self fetchIndex).
+
+ "
+ Description
+ The index is an unsigned byte that must be a valid index into the runtime constant
+ pool of the current class (§3.6). The runtime constant pool entry at index either
+ must be a runtime constant of type int or float, or must be a symbolic reference
+ to a string literal (§5.1).
+ If the runtime constant pool entry is a runtime constant of type int or float, the
+ numeric value of that runtime constant is pushed onto the operand stack as an int
+ or float, respectively.
+ Otherwise, the runtime constant pool entry must be a reference to an instance of
+ class String representing a string literal (§5.1). A reference to that instance,
+ value, is pushed onto the operand stack.
+
+ Notes
+ The ldc instruction can only be used to push a value of type float taken from the float value set (§3.3.2) because a constant of type float in the constant pool (§4.4.4) must be taken from the float value set."
+
+ "Modified: / 14-03-2011 / 16:04:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc2
+ "
+ push item from runtime constant pool (wide index)
+ stack: .. -> value
+ args: indexByte1 indexByte2"
+
+ self pushRef: (constantPool at: self fetchIndex2).
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit
+ index into the runtime constant pool of the current class (§3.6), where the
+ value of the index is calculated as (indexbyte1 << 8) | indexbyte2. The index
+ must be a valid index into the runtime constant pool of the current class.
+ The runtime constant pool entry at the index either must be a runtime constant
+ of type int or float, or must be a symbolic reference to a string literal (§5.1).
+ If the runtime constant pool entry is a runtime constant of type int or float,
+ the numeric value of that runtime constant is pushed onto the operand stack as
+ an int or float, respectively.
+ Otherwise, the runtime constant pool entry must be a reference to an instance
+ of class String representing a string literal (§5.1). A reference to that
+ instance, value, is pushed onto the operand stack.
+
+ Notes
+ The ldc_w instruction is identical to the ldc instruction except for its wider
+ runtime constant pool index.
+ The ldc_w instruction can only be used to push a value of type float taken from
+ the float value set (§3.3.2) because a constant of type float in the constant
+ pool (§4.4.4) must be taken from the float value set."
+
+ "Modified: / 28-03-2011 / 18:04:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc2w
+"
+Push long or double from runtime constant pool (wide index)
+stack: .. -> value
+args: indexByte1 indexByte2
+"
+self ldc2.
+"
+Description
+The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit index
+into the runtime constant pool of the current class (§3.6), where the value of the
+index is calculated as (indexbyte1 << 8) | indexbyte2. The index must be a valid
+index into the runtime constant pool of the current class. The runtime constant pool
+entry at the index must be a runtime constant of type long or double (§5.1). The
+numeric value of that runtime constant is pushed onto the operand stack as a long
+or double, respectively.
+
+Notes
+Only a wide-index version of the ldc2_w instruction exists; there is no ldc2 instruction
+that pushes a long or double with a single-byte index.
+The ldc2_w instruction can only be used to push a value of type double taken from the
+double value set (§3.3.2) because a constant of type double in the constant pool (§4.4.5)
+must be taken from the double value set.
+"
+
+ "Modified: / 27-03-2011 / 21:12:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lload: idx
+"
+Load long from local variable
+stack: nothing -> value
+args: index"
+
+ self pushLong: (context at: idx + 1).
+
+ "
+ Description
+ The index is an unsigned byte. Both index and index + 1 must be indices
+ into the local variable array of the current frame (§3.6). The local variable
+ at index must contain a long. The value of the local variable at index is
+ pushed onto the operand stack.
+
+ Notes
+ The lload opcode can be used in conjunction with the wide instruction to
+ access a local variable using a two-byte unsigned index."
+
+ "Modified: / 13-03-2011 / 17:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lookupswtch
+ "
+ Access jump table by key match and jump
+ stack: key -> ..
+ args: insane"
+
+ | key jmpDest default npairs result |
+
+ key := self pop asInteger.
+ self skipPadding.
+ default := self fetchBytes4.
+ npairs := self fetchBytes4.
+ npairs
+ timesRepeat:
+ [
+ key = self fetchBytes4
+ ifTrue: [ jmpDest := self fetchBytes4 ]
+ ifFalse: [ self fetchBytes4 ] ].
+ jmpDest ifNil: [ jmpDest := default. ].
+ self relativeJump: jmpDest.
+
+ "
+ Description
+ A lookupswitch is a variable-length instruction. Immediately after the lookupswitch
+ opcode, between zero and three null bytes (zeroed bytes, not the null object) are
+ inserted as padding. The number of null bytes is chosen so that the defaultbyte1 begins
+ at an address that is a multiple of four bytes from the start of the current method
+ (the opcode of its first instruction). Immediately after the padding follow a series
+ of signed 32-bit values: default, npairs, and then npairs pairs of signed 32-bit values.
+ The npairs must be greater than or equal to 0. Each of the npairs pairs consists of an
+ int match and a signed 32-bit offset. Each of these signed 32-bit values is constructed
+ from four unsigned bytes as (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4.
+ The table match-offset pairs of the lookupswitch instruction must be sorted in increasing
+ numerical order by match.
+ The key must be of type int and is popped from the operand stack. The key is compared
+ against the match values. If it is equal to one of them, then a target address is
+ calculated by adding the corresponding offset to the address of the opcode of this
+ lookupswitch instruction. If the key does not match any of the match values, the target
+ address is calculated by adding default to the address of the opcode of this lookupswitch
+ instruction. Execution then continues at the target address.
+ The target address that can be calculated from the offset of each match-offset pair, as
+ well as the one calculated from default, must be the address of an opcode of an instruction
+ within the method that contains this lookupswitch instruction.
+
+ Notes
+ The alignment required of the 4-byte operands of the lookupswitch instruction guarantees
+ 4-byte alignment of those operands if and only if the method that contains the lookupswitch
+ is positioned on a 4-byte boundary.
+ The match-offset pairs are sorted to support lookup routines that are quicker than linear
+ search."
+
+ "Modified: / 21-03-2011 / 18:38:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lor
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lrem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lreturn
+ "
+ Return long from method
+ stack: value -> empty
+ args: nothing"
+
+ self leaveProcessorWith: (self pop).
+
+ "
+ Description
+ The current method must have return type long. The value must be of type
+ long. If the current method is a synchronized method, the monitor acquired
+ or reentered on invocation of the method is released or exited (respectively)
+ as if by execution of a monitorexit instruction. If no exception is thrown,
+ value is popped from the operand stack of the current frame (§3.6) and pushed
+ onto the operand stack of the frame of the invoker. Any other values on the
+ operand stack of the current method are discarded.
+ The interpreter then returns control to the invoker of the method, reinstating
+ the frame of the invoker.
+
+ Runtime Exceptions
+ If the current method is a synchronized method and the current thread is not
+ the owner of the monitor acquired or reentered on invocation of the method,
+ lreturn throws an IllegalMonitorStateException. This can happen, for example,
+ if a synchronized method contains a monitorexit instruction, but no monitorenter
+ instruction, on the object on which the method is synchronized.
+ Otherwise, if the virtual machine implementation enforces the rules on structured
+ use of locks described in Section 8.13 and if the first of those rules is
+ violated during invocation of the current method, then lreturn throws an
+ IllegalMonitorStateException."
+ "Created: / 14-03-2011 / 13:40:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lshl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lshr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lstore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lstore: idx
+ "
+ Store long into local variable
+ stack: value -> nothing
+ args: index"
+
+ self istore: idx.
+
+ "
+ Description
+ The index is an unsigned byte. Both index and index + 1 must be indices
+ into the local variable array of the current frame (§3.6). The value on
+ the top of the operand stack must be of type long. It is popped from the
+ operand stack, and the local variables at index and index + 1 are set to
+ value.
+
+ Notes
+ The lstore opcode can be used in conjunction with the wide instruction to
+ access a local variable using a two-byte unsigned index."
+
+ "Modified: / 14-03-2011 / 17:55:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lushr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+lxor
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+monenter
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+monexit
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+multianewarray
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+new
+ "
+ Create new object
+ stack: nothing -> objectRef
+ args: indexByte1 indexByte2"
+
+ | classRef result |
+
+ classRef := constantPool at: self fetchIndex2.
+ self breakPoint:#mh_instructions.
+ result := (JavaVM classForName: classRef name) new.
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into
+ the runtime constant pool of the current class (§3.6), where the value of
+ the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool item
+ at the index must be a symbolic reference to a class, array, or interface
+ type. The named class, array, or interface type is resolved (§5.4.3.1) and
+ should result in a class type (it should not result in an array or interface
+ type). Memory for a new instance of that class is allocated from the
+ garbage-collected heap, and the instance variables of the new object are
+ initialized to their default initial values (§2.5.1). The objectref, a reference
+ to the instance, is pushed onto the operand stack.
+ On successful resolution of the class, it is initialized (§5.5) if it has not
+ already been initialized.
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the class, array, or interface
+ type, any of the exceptions documented in Section 5.4.3.1 can be thrown.
+ Otherwise, if the symbolic reference to the class, array, or interface type
+ resolves to an interface or is an abstract class, new throws an InstantiationError.
+
+ Runtime Exception
+ Otherwise, if execution of this new instruction causes initialization of the
+ referenced class, new may throw an Error as detailed in Section 2.17.5.
+
+ Note
+ The new instruction does not completely create a new instance; instance creation
+ is not completed until an instance initialization method has been invoked on
+ the uninitialized instance."
+
+ "Created: / 25-02-2011 / 00:17:39 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 24-02-2011 / 22:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-03-2011 / 17:18:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+newarray
+ "
+ Create new array
+ stack: count -> arrayRef
+ args: arrayType"
+
+ | type size |
+
+ type := self fetchByte.
+ size := self pop.
+ type = 4 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'boolean' sized: size ].
+ type = 5 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'char' sized: size ].
+ type = 6 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'float' sized: size ].
+ type = 7 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'double' sized: size ].
+ type = 8 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'byte' sized: size ].
+ type = 9 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'short' sized: size ].
+ type = 10 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'int' sized: size ].
+ type = 11 ifTrue: [ ^ self pushNewPrimitiveArrayOf: 'long' sized: size ].
+ self halt: 'Type not recognized - tell mh'.
+
+"
+Description
+The count must be of type int. It is popped off the operand stack. The count represents
+the number of elements in the array to be created.
+The atype is a code that indicates the type of array to create. It must take one of the
+following values:
+Array Type atype
+T_BOOLEAN 4
+T_CHAR 5
+T_FLOAT 6
+T_DOUBLE 7
+T_BYTE 8
+T_SHORT 9
+T_INT 10
+T_LONG 11
+
+
+A new array whose components are of type atype and of length count is allocated
+from the garbage-collected heap. A reference arrayref to this new array object is pushed
+into the operand stack. Each of the elements of the new array is initialized to the
+default initial value for the type of the array (§2.5.1).
+
+Runtime Exception
+If count is less than zero, newarray throws a NegativeArraySizeException.
+
+Notes
+In Sun's implementation of the Java virtual machine, arrays of type boolean (atype
+is T_BOOLEAN) are stored as arrays of 8-bit values and are manipulated using the baload
+and bastore instructions, instructions that also access arrays of type byte. Other
+implementations may implement packed boolean arrays; the baload and bastore instructions
+must still be used to access those arrays.
+"
+
+ "Created: / 14-03-2011 / 18:24:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 27-03-2011 / 21:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+nop
+"Do nothing"
+
+ "Created: / 14-03-2011 / 18:52:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop1
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+pop2
+ "
+ Pop the top one or two operand stack values
+ stack v1: value2 value1 -> nothing where each of value1 and value2 is a value of a category 1 computational type (§3.11.1).
+ stack v2: value -> nothing where value is a value of a category 2 computational type (§3.11.1).
+ args: nothing
+"
+
+ sp := sp - 2.
+"
+Description
+Pop the top one or two values from the operand stack.
+"
+
+ "Modified: / 13-03-2011 / 17:20:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+putfield
+ "Set field in object
+ stack: objectRef value -> nothing
+ args: indexbyte1 indexbyte2"
+
+ | newValue fieldOwner fieldref |
+
+ newValue := self pop.
+ fieldOwner := self pop.
+ fieldref := constantPool at: self fetchIndex2.
+ fieldref resolve.
+ fieldOwner instVarAt: fieldref offset put: newValue.
+
+ "Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index
+ into the runtime constant pool of the current class (§3.6), where the value
+ of the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool
+ item at that index must be a symbolic reference to a field (§5.1), which
+ gives the name and descriptor of the field as well as a symbolic reference
+ to the class in which the field is to be found. The class of objectref must
+ not be an array. If the field is protected (§4.6), and it is either a member
+ of the current class or a member of a superclass of the current class, then
+ the class of objectref must be either the current class or a subclass of
+ the current class.
+ The referenced field is resolved (§5.4.3.2). The type of a value stored
+ by a putfield instruction must be compatible with the descriptor of the
+ referenced field (§4.3.2). If the field descriptor type is boolean, byte,
+ char, short, or int, then the value must be an int. If the field descriptor
+ type is float, long, or double, then the value must be a float, long, or
+ double, respectively. If the field descriptor type is a reference type, then
+ the value must be of a type that is assignment compatible (§2.6.7) with the
+ field descriptor type. If the field is final, it should be declared in the
+ current class. Otherwise, an IllegalAccessError is thrown.
+ The value and objectref are popped from the operand stack. The objectref
+ must be of type reference. The value undergoes value set conversion (§3.8.3),
+ resulting in value', and the referenced field in objectref is set to value'.
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the field, any of the
+ exceptions pertaining to field resolution documented in Section 5.4.3.2 can be thrown.
+
+
+ Otherwise, if the resolved field is a static field, putfield throws
+ an IncompatibleClassChangeError.
+ Otherwise, if the field is final, it must be declared in the current
+ class. Otherwise, an IllegalAccessError is thrown.
+
+ Runtime Exception
+ Otherwise, if objectref is null, the putfield instruction throws a NullPointerException."
+
+ "Modified: / 04-06-2011 / 18:14:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+putstatic
+ "
+ Set static field in class
+ stack: value -> nothing
+ args: indexByte1 indexByte2"
+
+ | newValue fieldref |
+
+ newValue := self pop.
+ fieldref := constantPool at: self fetchIndex2.
+ fieldref resolveStatic.
+ fieldref owner instVarAt: fieldref offset put: newValue.
+
+ "
+ Description
+ The unsigned indexbyte1 and indexbyte2 are used to construct an index into
+ the runtime constant pool of the current class (§3.6), where the value of
+ the index is (indexbyte1 << 8) | indexbyte2. The runtime constant pool
+ item at that index must be a symbolic reference to a field (§5.1), which
+ gives the name and descriptor of the field as well as a symbolic reference
+ to the class or interface in which the field is to be found. The referenced
+ field is resolved (§5.4.3.2).
+ On successful resolution of the field the class or interface that declared
+ the resolved field is initialized (§5.5) if that class or interface has not
+ already been initialized.
+ The type of a value stored by a putstatic instruction must be compatible with
+ the descriptor of the referenced field (§4.3.2). If the field descriptor type
+ is boolean, byte, char, short, or int, then the value must be an int. If the
+ field descriptor type is float, long, or double, then the value must be a float,
+ long, or double, respectively. If the field descriptor type is a reference type,
+ then the value must be of a type that is assignment compatible (§2.6.7) with
+ the field descriptor type. If the field is final, it should be declared in
+ the current class. Otherwise, an IllegalAccessError is thrown.
+ The value is popped from the operand stack and undergoes value set conversion
+ (§3.8.3), resulting in value'. The class field is set to value'.
+
+ Linking Exceptions
+ During resolution of the symbolic reference to the class or interface field,
+ any of the exceptions pertaining to field resolution documented in Section
+ 5.4.3.2 can be thrown.
+ Otherwise, if the resolved field is not a static (class) field or an interface
+ field, putstatic throws an IncompatibleClassChangeError.
+ Otherwise, if the field is final, it must be declared in the current class.
+ Otherwise, an IllegalAccessError is thrown.
+
+ Runtime Exception
+ Otherwise, if execution of this putstatic instruction causes initialization
+ of the referenced class or interface, putstatic may throw an Error as detailed
+ in Section 2.17.5.
+
+ Notes
+ A putstatic instruction may be used only to set the value of an interface field
+ on the initialization of that field. Interface fields may be assigned to only
+ once, on execution of an interface variable initialization expression when the
+ interface is initialized (§2.17.4)."
+
+ "Created: / 24-02-2011 / 23:21:16 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 24-02-2011 / 22:14:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:14:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ret
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+ret_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+return
+ "Return void from method
+ stack: nothing -> nothing
+ args: nothing"
+
+ self leaveProcessorWith: nil.
+
+ "
+ Description
+ The current method must have return type void. If the current method is a synchronized
+ method, the monitor acquired or reentered on invocation of the method is released or
+ exited (respectively) as if by execution of a monitorexit instruction. If no exception
+ is thrown, any values on the operand stack of the current frame (§3.6) are discarded.
+ The interpreter then returns control to the invoker of the method, reinstating the
+ frame of the invoker.
+
+ Runtime Exceptions
+ If the current method is a synchronized method and the current thread is not the owner
+ of the monitor acquired or reentered on invocation of the method, return throws an
+ IllegalMonitorStateException. This can happen, for example, if a synchronized method
+
+ contains a monitorexit instruction, but no monitorenter instruction, on the object on
+ which the method is synchronized.
+ Otherwise, if the virtual machine implementation enforces the rules on structured use
+ of locks described in Section 8.13 and if the first of those rules is violated during
+ invocation of the current method, then return throws an IllegalMonitorStateException."
+ "Created: / 24-02-2011 / 11:38:13 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 24-02-2011 / 23:10:54 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 13-03-2011 / 17:22:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+saload
+ self halt
+!
+
+sastore
+ self halt
+!
+
+sipush
+ "pushes a short onto the stack
+ stack: nothing -> value
+ args: byte1 byte2"
+
+ self pushInt: (self fetchBytes2).
+
+ "
+ Description
+ The immediate unsigned byte1 and byte2 values are assembled
+ into an intermediate short where the value of the short is (byte1 << 8) | byte2.
+ The intermediate value is then sign-extended to an int value. That value is
+ pushed onto the operand stack."
+
+ "Modified: / 17-03-2011 / 17:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+swap
+"
+Swap the top two operand stack values
+stack: value2 value1 -> value1 value2
+args: nothing
+"
+ | v1 v2 |
+
+ v1 := self pop.
+ v2 := self pop.
+ self pushInt: v1.
+ self pushInt: v2.
+
+"
+Description
+Swap the top two values on the operand stack.
+The swap instruction must not be used unless value1 and value2 are both
+values of a category 1 computational type (§3.11.1).
+
+Notes
+The Java virtual machine does not provide an instruction implementing a
+swap on operands of category 2 computational types.
+"
+
+ "Modified: / 13-03-2011 / 17:24:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+tableswtch
+ "
+ Access jump table by index and jump
+ stack: index -> ..
+ args: insane :)"
+
+ | index jmpDest default low high result |
+
+ index := self pop asInteger.
+ self skipPadding.
+ default := self fetchBytes4.
+ low := self fetchBytes4.
+ high := self fetchBytes4.
+ low to: high
+ do:
+ [:idx |
+ idx = index
+ ifTrue: [ jmpDest := self fetchBytes4 ]
+ ifFalse: [ self fetchBytes4 ] ].
+ jmpDest ifNil: [ jmpDest := default. ].
+ self relativeJump: jmpDest.
+
+ "
+ Description
+ A tableswitch is a variable-length instruction. Immediately after the tableswitch opcode,
+ between 0 and 3 null bytes (zeroed bytes, not the null object) are inserted as padding.
+ The number of null bytes is chosen so that the following byte begins at an address that
+ is a multiple of 4 bytes from the start of the current method (the opcode of its first
+ instruction). Immediately after the padding follow bytes constituting three signed 32-bit
+ values: default, low, and high. Immediately following those bytes are bytes constituting a
+ series of high - low + 1 signed 32-bit offsets. The value low must be less than or equal
+ to high. The high - low + 1 signed 32-bit offsets are treated as a 0-based jump table.
+ Each of these signed 32-bit values is constructed as (byte1 << 24) | (byte2 << 16) |
+ (byte3 << 8) | byte4.
+ The index must be of type int and is popped from the operand stack. If index is less than
+ low or index is greater than high, then a target address is calculated by adding default
+ to the address of the opcode of this tableswitch instruction. Otherwise, the offset at
+ position index - low of the jump table is extracted. The target address is calculated by
+ adding that offset to the address of the opcode of this tableswitch instruction. Execution
+ then continues at the target address.
+ The target address that can be calculated from each jump table offset, as well as the ones
+ that can be calculated from default, must be the address of an opcode of an instruction
+ within the method that contains this tableswitch instruction.
+
+ Notes
+ The alignment required of the 4-byte operands of the tableswitch instruction guarantees 4-byte
+ alignment of those operands if and only if the method that contains the tableswitch starts
+ on a 4-byte boundary."
+
+ "Modified: / 21-03-2011 / 18:35:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+wide
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+! !
+
+!JavaByteCodeInterpreter methodsFor:'interpretation'!
+
+handleAbstractMethod
+self halt: 'Is it allowed to interpret abstract method? I dont think so :)'.
+
+ "Created: / 22-03-2011 / 14:50:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpret: aMethod receiver: aReceiver arguments: args
+ self
+ log: ('Invoking method ' , aMethod name , ' on ' , aReceiver printString
+ , ' with ' , args printString).
+
+ ^ self
+ process: aMethod
+ receiver: aReceiver
+ arguments: args.
+
+ "Created: / 17-03-2011 / 17:25:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 28-03-2011 / 18:03:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpretInner: aJavaMethod receiver: aReceiver arguments: anArgs
+ ^ aJavaMethod interpretWithReceiver: aReceiver arguments: anArgs.
+
+ "Created: / 31-03-2011 / 16:29:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeInterpreter class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeInterpreterTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,1373 @@
+"
+ 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' }"
+
+JavaByteCodeProcessorTests subclass:#JavaByteCodeInterpreterTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaByteCodeInterpreterTests 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.
+
+"
+! !
+
+!JavaByteCodeInterpreterTests class methodsFor:'resources'!
+
+resources
+
+ ^ Array with: JavaInitializedResource with: JavaTestsResource.
+
+ "Created: / 15-03-2011 / 17:29:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 14:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeInterpreterTests methodsFor:'tests'!
+
+testAnd
+ | result expResult |
+
+ expResult := 2r10010101.
+ result := self
+ invoke: #'and(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 255 149 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 iand
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 17:02:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:49:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testBitShiftLeft
+ | result expResult |
+
+ expResult := 2r101010000.
+ result := self
+ invoke: #'bitShiftLeft(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 21 4 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 ishl
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:56:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:49:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testBitShiftRight
+ | result expResult |
+
+ expResult := 2r11011.
+ result := self
+ invoke: #'bitShiftRight(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 439 4 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 ishr
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:57:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:49:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDec2
+ | result expResult |
+
+ expResult := 1.
+ result := self
+ invoke: #'dec2(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 3 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iinc 0 -1
+ 3 iinc 0 -1
+ 6 iload_0
+ 7 ireturn"
+
+ "Created: / 14-03-2011 / 16:58:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:49:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDiv
+ | result expResult |
+
+ expResult := 1.
+ result := self
+ invoke: #'div(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 101 10 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 irem
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:54:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:49:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testDivision
+ | result expResult |
+
+ expResult := 10.
+ result := self
+ invoke: #'division(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 101 10 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 iload_1
+ 2 idiv
+ 3 ireturn"
+
+ "Created: / 14-03-2011 / 16:57:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:48:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInc2
+ | result expResult |
+
+ expResult := 5.
+ result := self
+ invoke: #'inc2(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 3 ).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iinc 0 1
+ 3 iinc 0 1
+ 6 iload_0
+ 7 ireturn"
+
+ "Created: / 14-03-2011 / 16:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:48:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInheritedMethodCall
+ | result |
+
+ self shouldnt:
+ [ result := self
+ invoke: #'foo()Ljava/lang/String;'
+ class: self loadSimpleInheritingJavaClass
+ args: nil. ]
+ raise: Error.
+ self assertFalse: (result isNil).
+"0 ldc1 2 ['foo']
+2 areturn "
+
+ "Created: / 14-03-2011 / 16:21:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:47:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testJustLoadConstants
+ "/self shouldnt:
+
+
+ [ self
+ invoke: #'justUseConstants()V'
+ class: self loadSimpleMathJavaClass
+ args: #(). ] value.
+
+ "static method
+
+ 0 lconst_0
+ 1 lstore_0
+ 2 lconst_1
+ 3 lstore_2
+ 4 fconst_0
+ 5 fstore 4
+ 7 fconst_1
+ 8 fstore 5
+ 10 fconst_2
+ 11 fstore 6
+ 13 dconst_0
+ 14 dstore 7
+ 16 dconst_1
+ 17 dstore 9
+ 19 return"
+
+ "Created: / 14-03-2011 / 17:05:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:48:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMultipy
+ | result expResult |
+
+ expResult := 200.
+ result := self
+ invoke: #'multiply(II)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 20 with: 10).
+ self assertTrue: expResult = result.
+"static method
+
+0 iload_0
+1 iload_1
+2 imul
+3 ireturn "
+
+ "Created: / 06-03-2011 / 14:17:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:50:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testNegateInt
+ | result expResult |
+
+ expResult := -56.
+ result := self
+ invoke: #'negateInt(I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 55 ).
+ self assertTrue: expResult = result.
+"0 iload_0
+1 iconst_m1
+2 ixor
+3 ireturn "
+
+ "Created: / 14-03-2011 / 16:55:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:50:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testOr
+ | result expResult |
+
+ expResult := 119.
+ result := self
+ invoke: #'or(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 55 66 ).
+ self assertTrue: expResult = result.
+"0 iload_0
+1 iload_1
+2 ior
+3 ireturn "
+
+ "Created: / 14-03-2011 / 17:02:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:50:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testOverridenMethodCall
+ | result |
+
+ self shouldnt:
+ [ result := self
+ invoke: #'bar()Ljava/lang/String;'
+ class: self loadSimpleInheritingJavaClass
+ args: nil. ]
+ raise: Error.
+ self assertFalse: (result isNil).
+"0 ldc1 2 ['bar']
+2 areturn "
+
+ "Modified: / 16-03-2011 / 21:51:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testPower
+ | result expResult |
+
+ expResult := 1024.
+ result := self
+ invoke: #'power(II)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 2 with: 10).
+ self assertTrue: expResult = result.
+"0 iload_0
+1 iload_1
+2 iconst_1
+3 invokestatic 2 [JavaMethod(stx.libjava.tests.simpleClasses.SimpleMath::int powerAcc (int int int))]
+6 ireturn "
+
+ "Created: / 06-03-2011 / 14:18:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:51:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testReturnArrayOfLongs
+ | result |
+
+ self shouldnt:
+ [ result := self
+ invoke: #'giveMeArrayOfLongs()[J'
+ class: self loadSimpleMathJavaClass
+ args: #(). ]
+ raise: Error.
+"0 bipush 100
+2 newarray 11 [T_LONG]
+4 areturn "
+
+ "Created: / 14-03-2011 / 17:08:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:52:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDouble
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 1234.45.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 1234.45).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 13-03-2011 / 17:43:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:54:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDoubleMaxValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 1.79769313486232E+308.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 1.79769313486232E+308).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 14-03-2011 / 14:06:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:53:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDoubleMinValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 4.94065645841247E-324.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 4.94065645841247E-324).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 14-03-2011 / 14:06:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:54:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDoubleNan
+ | result crate |
+
+ crate := self loadCrateJavaClass new.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: Float nan).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (result isNaN).
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 14-03-2011 / 14:07:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:54:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDoubleWithInfinityArg
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := Float infinity.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: Float infinity).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 14-03-2011 / 13:52:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:54:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersDoubleWithNegativeInfinityArg
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := Float negativeInfinity.
+ self
+ invoke: #'setDoubleVar(D)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: Float negativeInfinity).
+ result := self
+ invoke: #'getDoubleVar()D'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setDoubleVar:
+ 0 aload_0
+ 1 dload_1
+ 2 putfield 3
+ 5 return
+
+ getDoubleVar:
+ 0 aload_0
+ 1 getfield 3
+ 4 dreturn"
+
+ "Created: / 14-03-2011 / 13:53:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:54:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersInt
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 1234.
+ self
+ invoke: #'setIntVar(I)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 1234).
+ result := self
+ invoke: #'getIntVar()I'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setIntVar:
+ 0 aload_0
+ 1 iload_1
+ 2 putfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 5 return
+
+ getIntVar:
+ 0 aload_0
+ 1 getfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 4 ireturn"
+
+ "Created: / 13-03-2011 / 17:42:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:55:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersIntMaxValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 2147483647.
+ self
+ invoke: #'setIntVar(I)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 2147483647).
+ result := self
+ invoke: #'getIntVar()I'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setIntVar:
+ 0 aload_0
+ 1 iload_1
+ 2 putfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 5 return
+
+ getIntVar:
+ 0 aload_0
+ 1 getfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 4 ireturn"
+
+ "Created: / 14-03-2011 / 14:02:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:55:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersIntMinValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := -2147483648.
+ self
+ invoke: #'setIntVar(I)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: -2147483648).
+ result := self
+ invoke: #'getIntVar()I'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setIntVar:
+ 0 aload_0
+ 1 iload_1
+ 2 putfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 5 return
+
+ getIntVar:
+ 0 aload_0
+ 1 getfield 2 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'intVar'I offs=1)]
+ 4 ireturn"
+
+ "Created: / 14-03-2011 / 14:01:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:55:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersLong
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.
+ self
+ invoke: #'setLongVar(J)V'
+ class: crate class
+ receiver: crate
+ args: (Array
+ with: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890).
+ result := self
+ invoke: #'getLongVar()J'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+
+ "setLongVar:
+ 0 aload_0
+ 1 lload_1
+ 2 putfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 5 return
+
+ getLongVar:
+ 0 aload_0
+ 1 getfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 4 lreturn"
+
+ "Created: / 14-03-2011 / 13:36:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:56:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersLongMaxValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 9223372036854775807.
+ self
+ invoke: #'setLongVar(J)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 9223372036854775807).
+ result := self
+ invoke: #'getLongVar()J'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setLongVar:
+ 0 aload_0
+ 1 lload_1
+ 2 putfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 5 return
+
+ getLongVar:
+ 0 aload_0
+ 1 getfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 4 lreturn"
+
+ "Created: / 14-03-2011 / 14:04:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:56:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersLongMinValue
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := -9223372036854775808.
+ self
+ invoke: #'setLongVar(J)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: -9223372036854775808).
+ result := self
+ invoke: #'getLongVar()J'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setLongVar:
+ 0 aload_0
+ 1 lload_1
+ 2 putfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 5 return
+
+ getLongVar:
+ 0 aload_0
+ 1 getfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 4 lreturn"
+
+ "Created: / 14-03-2011 / 14:04:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:56:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersLongWithIntArg
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 12.
+ self
+ invoke: #'setLongVar(J)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 12).
+ result := self
+ invoke: #'getLongVar()J'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+ "setLongVar:
+ 0 aload_0
+ 1 lload_1
+ 2 putfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 5 return
+
+ getLongVar:
+ 0 aload_0
+ 1 getfield 4 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'longVar'J offs=3)]
+ 4 lreturn"
+
+ "Created: / 14-03-2011 / 13:49:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:56:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetterAndGettersString
+ | result expResult crate |
+
+ crate := self loadCrateJavaClass new.
+ expResult := 'hello world'.
+ self
+ invoke: #'setStringVar(Ljava/lang/String;)V'
+ class: crate class
+ receiver: crate
+ args: (Array with: 'hello world').
+ result := self
+ invoke: #'getStringVar()Ljava/lang/String;'
+ class: crate class
+ receiver: crate
+ args: nil.
+ self assert: (expResult = result).
+"setString:
+0 aload_0
+1 aload_1
+2 putfield 5 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'stringVar'Ljava/lang/String; offs=4)]
+5 return
+
+getString:
+0 aload_0
+1 getfield 5 [JavaFieldRef (stx.libjava.tests.simpleClasses.Crate 'stringVar'Ljava/lang/String; offs=4)]
+4 areturn "
+
+ "Created: / 14-03-2011 / 13:45:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:57:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSimpleAdd
+ | result expResult |
+
+ expResult := 2002.
+ result := self
+ invoke: #'add2To2000Expect2002()I'
+ class: self loadSimpleMathJavaClass
+ args: nil.
+ self assertTrue: expResult = result.
+
+"static method
+
+0 iconst_2
+1 istore_0
+2 sipush 2000
+5 istore_1
+6 iload_0
+7 iload_1
+8 iadd
+9 istore_2
+10 iload_2
+11 ireturn"
+
+ "Created: / 06-03-2011 / 14:18:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:57:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSimpleAdd2
+ | result expResult |
+
+ expResult := 5.
+ result := self
+ invoke: #'addMinus5ToArg(I)I'
+ class: self loadSimpleMathJavaClass
+ args: (Array with: 10).
+ self assertTrue: expResult = result.
+
+ "static method
+
+ 0 iload_0
+ 1 bipush -5
+ 3 iadd
+ 4 ireturn"
+
+ "Created: / 06-03-2011 / 14:18:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:59:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testStackCreation
+ | result expResult |
+
+ expResult := 7.
+ result := self
+ invoke: #'isYourStackCreatedCorrectly()I'
+ class: self loadSimpleMathJavaClass
+ args: #().
+ self assertTrue: expResult = result.
+
+ "0 iconst_0
+ 1 istore_0
+ 2 iconst_1
+ 3 istore_1
+ 4 iconst_2
+ 5 istore_0
+ 6 iconst_3
+ 7 istore_1
+ 8 iconst_4
+ 9 istore_0
+ 10 iconst_5
+ 11 istore_0
+ 12 bipush 6
+ 14 istore_1
+ 15 bipush 7
+ 17 istore_0
+ 18 bipush 8
+ 20 istore_1
+ 21 bipush 9
+ 23 istore_1
+ 24 iload_0
+ 25 ireturn"
+
+ "Created: / 14-03-2011 / 17:03:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:59:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSumArray
+ | result expResult |
+
+ expResult := 15.
+ result := self
+ invoke: #'sumArray([I)I'
+ class: self loadSimpleMathJavaClass
+ args: #( #(1 2 3 4 5) ).
+ self assertTrue: expResult = result.
+
+ "
+ Decompiled source:
+ Static method
+ 0 iconst_0
+ 1 istore_1
+ 2 iconst_0
+ 3 istore_2
+ 4 iload_2
+ 5 aload_0
+ 6 arraylength
+ 7 if_icmpge 15 [22]
+ 10 iload_1
+ 11 aload_0
+ 12 iload_2
+ 13 iaload
+ 14 iadd
+ 15 istore_1
+ 16 iinc 2 1
+ 19 goto -15 [4]
+ 22 iload_1
+ 23 ireturn"
+
+ "Created: / 14-03-2011 / 17:06:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:58:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSumArrayOfDoubles
+ | result expResult |
+
+ expResult := 16.5.
+ result := self
+ invoke: #'sumArrayOfDoubles([D)D'
+ class: self loadSimpleMathJavaClass
+ args: #( #(1.1 2.2 3.3 4.4 5.5) ).
+ self assertTrue: expResult = result.
+"0 dconst_0
+1 dstore_1
+2 iconst_0
+3 istore_3
+4 iload_3
+5 aload_0
+6 arraylength
+7 if_icmpge 15 [22]
+10 dload_1
+11 aload_0
+12 iload_3
+13 daload
+14 dadd
+15 dstore_1
+16 iinc 3 1
+19 goto -15 [4]
+22 dload_1
+23 dreturn "
+
+ "Created: / 14-03-2011 / 17:07:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:59:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testUnsignedBitShiftLeft
+ | result expResult |
+
+ expResult := 1234 bitShift: 5.
+ result := self
+ invoke: #'unsignedBitShiftRight(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 1234 5 ).
+ self assertTrue: expResult = result.
+"0 iload_0
+1 iload_1
+2 iushr
+3 ireturn"
+
+ "Created: / 14-03-2011 / 17:01:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:59:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testXor
+ | result expResult |
+
+ expResult := 1234 bitXor: 5.
+ result := self
+ invoke: #'xor(II)I'
+ class: self loadSimpleMathJavaClass
+ args: #( 1234 5 ).
+ self assertTrue: expResult = result.
+"0 iload_0
+1 iload_1
+2 ixor
+3 ireturn "
+
+ "Modified: / 06-03-2011 / 15:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 14-03-2011 / 17:02:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 21:59:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeInterpreterTests methodsFor:'tests-helpers'!
+
+invoke: methodName class: aClass receiver: receiver args: args
+ | method result |
+
+ method := aClass lookupMethodFor: methodName.
+ result := JavaByteCodeInterpreter new
+ interpret: method
+ receiver: receiver
+ arguments: args.
+ ^ result.
+
+ "Created: / 10-03-2011 / 23:30:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:32:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeInterpreterTests methodsFor:'tests2'!
+
+testGetBoolean
+ | result expResult inst |
+
+ inst := self loadSimpleClassWithManyReferences new.
+ expResult := 1.
+ result := self
+ invoke: #'getBoolean()Z'
+ class: inst class
+ receiver: inst
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+
+ "
+ Deassembling getBoolean
+ 1: ALOAD_0 (42) ARGS: [] STACK: [.. -> FIELD 0: stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences]
+ 2: GETFIELD (180) ARGS: [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] STACK: [objectRef -> objectRef]
+ 5: BIPUSH (16) ARGS: [9] STACK: [.. -> value]
+ 7: AALOAD (50) ARGS: [] STACK: [arrayRef, index -> value]
+ 8: CHECKCAST (192) ARGS: [java.lang.Boolean] STACK: [objectRef -> objectRef]
+ 11: INVVIRT (182) ARGS: [JavaMethodRef (java.lang.Boolean 'booleanValue'()Z)] STACK: [objectRef, [arg1, arg2, ...] -> ..]
+ 14: IRETURN (172) ARGS: [] STACK: [value -> EMPTY]"
+
+ "Created: / 14-03-2011 / 21:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 17:45:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetByte
+ | result expResult |
+
+ expResult := 11.
+ result := self
+ invoke: #'getByte()B'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 bipush 7
+6 aaload
+7 checkcast 17 [java.lang.Byte]
+10 invokevirtual 31 [JavaMethodRef (java.lang.Byte 'byteValue'()B)]
+13 ireturn "
+
+ "Created: / 14-03-2011 / 21:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 22:04:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetChar
+ | result expResult |
+
+ expResult := 97.
+ result := self
+ invoke: #'getChar()C'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 iconst_3
+5 aaload
+6 checkcast 25 [java.lang.Character]
+9 invokevirtual 26 [JavaMethodRef (java.lang.Character 'charValue'()C)]
+12 ireturn "
+
+ "Created: / 14-03-2011 / 21:31:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 17:45:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetDateArray
+ | result expResult |
+
+ "again - you're comparing java array with st array - watch out"
+ "/ expResult := #( nil nil nil ).
+ result := self
+ invoke: #'getDateArray()[Ljava/util/Date;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+"/ self assertTrue: (result = expResult).
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 bipush 8
+6 aaload
+7 checkcast 32 [UnresolvedClass([Ljava.util.Date;)]
+10 checkcast 32 [UnresolvedClass([Ljava.util.Date;)]
+13 areturn "
+
+ "Created: / 14-03-2011 / 21:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 17:59:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetDouble
+ | result |
+
+ result := self
+ invoke: #'getDouble()Ljava/lang/Double;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_2
+ 5 aaload
+ 6 checkcast 24 [java.lang.Double]
+ 9 areturn"
+
+ "Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 17:10:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetInt
+ | result expResult |
+
+ expResult := 1.
+ result := self
+ invoke: #'getInt()I'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 iconst_1
+5 aaload
+6 checkcast 13 [java.lang.Integer]
+9 invokevirtual 23 [JavaMethodRef (java.lang.Integer 'intValue'()I)]
+12 ireturn"
+
+ "Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 22:05:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetIntArray
+ | result expResult |
+
+ "again - you're comparing java array with st array - watch out"
+ expResult := #( nil nil nil nil nil ).
+ result := self
+ invoke: #'getIntArray()[I'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self
+ invoke: #'setIntArray([I)V'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: result.
+
+ "/self assertTrue: (result = expResult).
+ "0 aload_0
+ 1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+ 4 iconst_5
+ 5 aaload
+ 6 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')]
+ 9 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')]
+ 12 areturn"
+
+ "Created: / 14-03-2011 / 21:33:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 18:53:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetLong
+ | result expResult |
+
+ expResult := 10.
+ result := self
+ invoke: #'getLong()J'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 iconst_4
+5 aaload
+6 checkcast 27 [java.lang.Long]
+9 invokevirtual 28 [JavaMethodRef (java.lang.Long 'longValue'()J)]
+ 12 lreturn"
+
+ "Created: / 14-03-2011 / 21:32:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 22:05:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetShort
+ | result expResult |
+
+ expResult := 1.
+ result := self
+ invoke: #'getShort()S'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+"0 aload_0
+1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)]
+4 bipush 6
+6 aaload
+7 checkcast 14 [java.lang.Short]
+10 invokevirtual 30 [JavaMethodRef (java.lang.Short 'shortValue'()S)]
+13 ireturn "
+
+ "Created: / 14-03-2011 / 21:33:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 22:06:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testGetString
+|result|
+ result := self
+ invoke: #'getString()Ljava/lang/String;'
+ class: self loadSimpleClassWithManyReferences
+ receiver: self loadSimpleClassWithManyReferences new
+ args: nil.
+ self assertFalse: (result isNil).
+
+ "Modified: / 28-03-2011 / 22:40:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInitSimpleClassWithManyReferences
+
+ | c |
+ self
+ invoke: #'<init>()V'
+ class: (c := self loadSimpleClassWithManyReferences)
+ receiver: c new
+ args: nil.
+
+ "Created: / 28-03-2011 / 22:39:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-04-2011 / 14:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testLookupSwitch
+ | result expResult |
+
+ expResult := -1.
+ result := self
+ invoke: #'switchInt(I)I'
+ class: self loadSwitchExamplesClass
+ receiver: self loadSwitchExamplesClass new
+ args: #(-1000).
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+
+ "Created: / 21-03-2011 / 13:51:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSetBoolean
+ | inst |
+
+ inst := self loadSimpleClassWithManyReferences new.
+ self
+ invoke: #'setBoolean(I)V'
+ class: inst class
+ receiver: inst
+ args: #( 5 ).
+ self
+ invoke: #'setBoolean(I)V'
+ class: inst class
+ receiver: inst
+ args: #( 4 ).
+
+"
+1: ILOAD_1 (27) ARGS: [] STACK: [.. -> FIELD 1: 'Arg 1']
+2: ICONST_2 (5) ARGS: [] STACK: [.. -> 2]
+3: IREM (112) ARGS: [] STACK: [value, value -> result]
+4: IFNE (154) ARGS: [JMP to: 20] STACK: [value -> ..]
+7: ALOAD_0 (42) ARGS: [] STACK: [.. -> FIELD 0: stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences]
+8: GETFIELD (180) ARGS: [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] STACK: [objectRef -> objectRef]
+11: BIPUSH (16) ARGS: [9] STACK: [.. -> value]
+13: GETSTATIC (178) ARGS: [JavaFieldRef (java.lang.Boolean 'TRUE'Ljava/lang/Boolean; offs=29)] STACK: [.. -> objectRef]
+16: AASTORE (83) ARGS: [] STACK: [arrayRef, index, value -> ..]
+17: GOTO (167) ARGS: [JMP to: 31] STACK: [.. -> ..]
+20: ALOAD_0 (42) ARGS: [] STACK: [.. -> FIELD 0: stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences]
+21: GETFIELD (180) ARGS: [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] STACK: [objectRef -> objectRef]
+24: BIPUSH (16) ARGS: [9] STACK: [.. -> value]
+26: ICONST_0 (3) ARGS: [] STACK: [.. -> 0]
+27: INVSTATIC (184) ARGS: [JavaMethodRef (java.lang.Boolean 'valueOf'(Z)Ljava/lang/Boolean;)] STACK: [[arg1, arg2, ...] -> ..]
+30: AASTORE (83) ARGS: [] STACK: [arrayRef, index, value -> ..]
+31: RETURN (177) ARGS: [] STACK: [.. -> EMPTY]"
+
+ "Created: / 21-03-2011 / 18:53:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 12:18:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testTableSwitch
+ | result expResult |
+
+ expResult := 1.
+ result := self
+ invoke: #'switchChar(C)I'
+ class: self loadSwitchExamplesClass
+ receiver: self loadSwitchExamplesClass new
+ args: #($b).
+ self assertFalse: (result isNil).
+ self assertTrue: (result = expResult).
+
+ "Created: / 21-03-2011 / 13:51:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeInterpreterTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeProcessor.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,2620 @@
+"
+ 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:#JavaByteCodeProcessor
+ instanceVariableNames:'byteCode pc method constantPool context receiver sp retVal
+ instrPointer op wide numArgs numVars leaveProcessor'
+ classVariableNames:'OpSwitchTable Verbose'
+ poolDictionaries:''
+ category:'Languages-Java-Bytecode'
+!
+
+!JavaByteCodeProcessor 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
+"
+ Base class for processing Java bytecode.
+ This class is based on NewCompiler::JavaByteCodeProcessor
+ written originally by Claus Gittinger
+
+ [author:]
+ Jan Vrany (jan.vrany@fit.cvut.cz)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavaByteCodeProcessor class methodsFor:'initialization'!
+
+initialize
+ OpSwitchTable := Array new: 256.
+ OpSwitchTable at: 1 + 0 put: #nop.
+ OpSwitchTable at: 1 + 1 put: #'aconst_null'.
+ OpSwitchTable at: 1 + 2 put: #'iconst_m1'.
+ OpSwitchTable at: 1 + 3 put: #'iconst_0'.
+ OpSwitchTable at: 1 + 4 put: #'iconst_1'.
+ OpSwitchTable at: 1 + 5 put: #'iconst_2'.
+ OpSwitchTable at: 1 + 6 put: #'iconst_3'.
+ OpSwitchTable at: 1 + 7 put: #'iconst_4'.
+ OpSwitchTable at: 1 + 8 put: #'iconst_5'.
+ OpSwitchTable at: 1 + 9 put: #'lconst_0'.
+ OpSwitchTable at: 1 + 10 put: #'lconst_1'.
+ OpSwitchTable at: 1 + 11 put: #'fconst_0'.
+ OpSwitchTable at: 1 + 12 put: #'fconst_1'.
+ OpSwitchTable at: 1 + 13 put: #'fconst_2'.
+ OpSwitchTable at: 1 + 14 put: #'dconst_0'.
+ OpSwitchTable at: 1 + 15 put: #'dconst_1'.
+ OpSwitchTable at: 1 + 16 put: #bipush.
+ OpSwitchTable at: 1 + 17 put: #sipush.
+ OpSwitchTable at: 1 + 18 put: #ldc1.
+ OpSwitchTable at: 1 + 19 put: #ldc2.
+ OpSwitchTable at: 1 + 20 put: #ldc2w.
+ OpSwitchTable at: 1 + 21 put: #iload.
+ OpSwitchTable at: 1 + 22 put: #lload.
+ OpSwitchTable at: 1 + 23 put: #fload.
+ OpSwitchTable at: 1 + 24 put: #dload.
+ OpSwitchTable at: 1 + 25 put: #aload.
+ OpSwitchTable at: 1 + 26 put: #'iload_0'.
+ OpSwitchTable at: 1 + 27 put: #'iload_1'.
+ OpSwitchTable at: 1 + 28 put: #'iload_2'.
+ OpSwitchTable at: 1 + 29 put: #'iload_3'.
+ OpSwitchTable at: 1 + 30 put: #'lload_0'.
+ OpSwitchTable at: 1 + 31 put: #'lload_1'.
+ OpSwitchTable at: 1 + 32 put: #'lload_2'.
+ OpSwitchTable at: 1 + 33 put: #'lload_3'.
+ OpSwitchTable at: 1 + 34 put: #'fload_0'.
+ OpSwitchTable at: 1 + 35 put: #'fload_1'.
+ OpSwitchTable at: 1 + 36 put: #'fload_2'.
+ OpSwitchTable at: 1 + 37 put: #'fload_3'.
+ OpSwitchTable at: 1 + 38 put: #'dload_0'.
+ OpSwitchTable at: 1 + 39 put: #'dload_1'.
+ OpSwitchTable at: 1 + 40 put: #'dload_2'.
+ OpSwitchTable at: 1 + 41 put: #'dload_3'.
+ OpSwitchTable at: 1 + 42 put: #'aload_0'.
+ OpSwitchTable at: 1 + 43 put: #'aload_1'.
+ OpSwitchTable at: 1 + 44 put: #'aload_2'.
+ OpSwitchTable at: 1 + 45 put: #'aload_3'.
+ OpSwitchTable at: 1 + 46 put: #iaload.
+ OpSwitchTable at: 1 + 47 put: #laload.
+ OpSwitchTable at: 1 + 48 put: #faload.
+ OpSwitchTable at: 1 + 49 put: #daload.
+ OpSwitchTable at: 1 + 50 put: #aaload.
+ OpSwitchTable at: 1 + 51 put: #baload.
+ OpSwitchTable at: 1 + 52 put: #caload.
+ OpSwitchTable at: 1 + 53 put: #saload.
+ OpSwitchTable at: 1 + 54 put: #istore.
+ OpSwitchTable at: 1 + 55 put: #lstore.
+ OpSwitchTable at: 1 + 56 put: #fstore.
+ OpSwitchTable at: 1 + 57 put: #dstore.
+ OpSwitchTable at: 1 + 58 put: #astore.
+ OpSwitchTable at: 1 + 59 put: #'istore_0'.
+ OpSwitchTable at: 1 + 60 put: #'istore_1'.
+ OpSwitchTable at: 1 + 61 put: #'istore_2'.
+ OpSwitchTable at: 1 + 62 put: #'istore_3'.
+ OpSwitchTable at: 1 + 63 put: #'lstore_0'.
+ OpSwitchTable at: 1 + 64 put: #'lstore_1'.
+ OpSwitchTable at: 1 + 65 put: #'lstore_2'.
+ OpSwitchTable at: 1 + 66 put: #'lstore_3'.
+ OpSwitchTable at: 1 + 67 put: #'fstore_0'.
+ OpSwitchTable at: 1 + 68 put: #'fstore_1'.
+ OpSwitchTable at: 1 + 69 put: #'fstore_2'.
+ OpSwitchTable at: 1 + 70 put: #'fstore_3'.
+ OpSwitchTable at: 1 + 71 put: #'dstore_0'.
+ OpSwitchTable at: 1 + 72 put: #'dstore_1'.
+ OpSwitchTable at: 1 + 73 put: #'dstore_2'.
+ OpSwitchTable at: 1 + 74 put: #'dstore_3'.
+ OpSwitchTable at: 1 + 75 put: #'astore_0'.
+ OpSwitchTable at: 1 + 76 put: #'astore_1'.
+ OpSwitchTable at: 1 + 77 put: #'astore_2'.
+ OpSwitchTable at: 1 + 78 put: #'astore_3'.
+ OpSwitchTable at: 1 + 79 put: #iastore.
+ OpSwitchTable at: 1 + 80 put: #lastore.
+ OpSwitchTable at: 1 + 81 put: #fastore.
+ OpSwitchTable at: 1 + 82 put: #dastore.
+ OpSwitchTable at: 1 + 83 put: #aastore.
+ OpSwitchTable at: 1 + 84 put: #bastore.
+ OpSwitchTable at: 1 + 85 put: #castore.
+ OpSwitchTable at: 1 + 86 put: #sastore.
+ OpSwitchTable at: 1 + 87 put: #pop1.
+ OpSwitchTable at: 1 + 88 put: #pop2.
+ OpSwitchTable at: 1 + 89 put: #dup.
+ OpSwitchTable at: 1 + 90 put: #'dup_x1'.
+ OpSwitchTable at: 1 + 91 put: #'dup_x2'.
+ OpSwitchTable at: 1 + 92 put: #dup2.
+ OpSwitchTable at: 1 + 93 put: #'dup2_x1'.
+ OpSwitchTable at: 1 + 94 put: #'dup2_x2'.
+ OpSwitchTable at: 1 + 95 put: #swap.
+ OpSwitchTable at: 1 + 96 put: #iadd.
+ OpSwitchTable at: 1 + 97 put: #ladd.
+ OpSwitchTable at: 1 + 98 put: #fadd.
+ OpSwitchTable at: 1 + 99 put: #dadd.
+ OpSwitchTable at: 1 + 100 put: #isub.
+ OpSwitchTable at: 1 + 101 put: #lsub.
+ OpSwitchTable at: 1 + 102 put: #fsub.
+ OpSwitchTable at: 1 + 103 put: #dsub.
+ OpSwitchTable at: 1 + 104 put: #imul.
+ OpSwitchTable at: 1 + 105 put: #lmul.
+ OpSwitchTable at: 1 + 106 put: #fmul.
+ OpSwitchTable at: 1 + 107 put: #dmul.
+ OpSwitchTable at: 1 + 108 put: #idiv.
+ OpSwitchTable at: 1 + 109 put: #ldiv.
+ OpSwitchTable at: 1 + 110 put: #fdiv.
+ OpSwitchTable at: 1 + 111 put: #ddiv.
+ OpSwitchTable at: 1 + 112 put: #irem.
+ OpSwitchTable at: 1 + 113 put: #lrem.
+ OpSwitchTable at: 1 + 114 put: #frem.
+ OpSwitchTable at: 1 + 115 put: #drem.
+ OpSwitchTable at: 1 + 116 put: #ineg.
+ OpSwitchTable at: 1 + 117 put: #lneg.
+ OpSwitchTable at: 1 + 118 put: #fneg.
+ OpSwitchTable at: 1 + 119 put: #dneg.
+ OpSwitchTable at: 1 + 120 put: #ishl.
+ OpSwitchTable at: 1 + 121 put: #lshl.
+ OpSwitchTable at: 1 + 122 put: #ishr.
+ OpSwitchTable at: 1 + 123 put: #lshr.
+ OpSwitchTable at: 1 + 124 put: #iushr.
+ OpSwitchTable at: 1 + 125 put: #lushr.
+ OpSwitchTable at: 1 + 126 put: #iand.
+ OpSwitchTable at: 1 + 127 put: #land.
+ OpSwitchTable at: 1 + 128 put: #ior.
+ OpSwitchTable at: 1 + 129 put: #lor.
+ OpSwitchTable at: 1 + 130 put: #ixor.
+ OpSwitchTable at: 1 + 131 put: #lxor.
+ OpSwitchTable at: 1 + 132 put: #iinc.
+ OpSwitchTable at: 1 + 133 put: #i2l.
+ OpSwitchTable at: 1 + 134 put: #i2f.
+ OpSwitchTable at: 1 + 135 put: #i2d.
+ OpSwitchTable at: 1 + 136 put: #l2i.
+ OpSwitchTable at: 1 + 137 put: #l2f.
+ OpSwitchTable at: 1 + 138 put: #l2d.
+ OpSwitchTable at: 1 + 139 put: #f2i.
+ OpSwitchTable at: 1 + 140 put: #f2l.
+ OpSwitchTable at: 1 + 141 put: #f2d.
+ OpSwitchTable at: 1 + 142 put: #d2i.
+ OpSwitchTable at: 1 + 143 put: #d2l.
+ OpSwitchTable at: 1 + 144 put: #d2f.
+ OpSwitchTable at: 1 + 145 put: #int2byte.
+ OpSwitchTable at: 1 + 146 put: #int2char.
+ OpSwitchTable at: 1 + 147 put: #int2short.
+ OpSwitchTable at: 1 + 148 put: #lcmp.
+ OpSwitchTable at: 1 + 149 put: #fcmpl.
+ OpSwitchTable at: 1 + 150 put: #fcmpg.
+ OpSwitchTable at: 1 + 151 put: #dcmpl.
+ OpSwitchTable at: 1 + 152 put: #dcmpg.
+ OpSwitchTable at: 1 + 153 put: #ifeq.
+ OpSwitchTable at: 1 + 154 put: #ifne.
+ OpSwitchTable at: 1 + 155 put: #iflt.
+ OpSwitchTable at: 1 + 156 put: #ifge.
+ OpSwitchTable at: 1 + 157 put: #ifgt.
+ OpSwitchTable at: 1 + 158 put: #ifle.
+ OpSwitchTable at: 1 + 159 put: #ificmpeq.
+ OpSwitchTable at: 1 + 160 put: #ificmpne.
+ OpSwitchTable at: 1 + 161 put: #ificmplt.
+ OpSwitchTable at: 1 + 162 put: #ificmpge.
+ OpSwitchTable at: 1 + 163 put: #ificmpgt.
+ OpSwitchTable at: 1 + 164 put: #ificmple.
+ OpSwitchTable at: 1 + 165 put: #ifacmpeq.
+ OpSwitchTable at: 1 + 166 put: #ifacmpne.
+ OpSwitchTable at: 1 + 167 put: #goto.
+ OpSwitchTable at: 1 + 168 put: #jsr.
+ OpSwitchTable at: 1 + 169 put: #ret.
+ OpSwitchTable at: 1 + 170 put: #tableswtch.
+ OpSwitchTable at: 1 + 171 put: #lookupswtch.
+ OpSwitchTable at: 1 + 172 put: #ireturn.
+ OpSwitchTable at: 1 + 173 put: #lreturn.
+ OpSwitchTable at: 1 + 174 put: #freturn.
+ OpSwitchTable at: 1 + 175 put: #dreturn.
+ OpSwitchTable at: 1 + 176 put: #areturn.
+ OpSwitchTable at: 1 + 177 put: #return.
+ OpSwitchTable at: 1 + 178 put: #getstatic.
+ OpSwitchTable at: 1 + 179 put: #putstatic.
+ OpSwitchTable at: 1 + 180 put: #getfield.
+ OpSwitchTable at: 1 + 181 put: #putfield.
+ OpSwitchTable at: 1 + 182 put: #invvirt.
+ OpSwitchTable at: 1 + 183 put: #invnonvirt.
+ OpSwitchTable at: 1 + 184 put: #invstatic.
+ OpSwitchTable at: 1 + 185 put: #invinterface.
+ OpSwitchTable at: 1 + 187 put: #new.
+ OpSwitchTable at: 1 + 188 put: #newarray.
+ OpSwitchTable at: 1 + 189 put: #anewarray.
+ OpSwitchTable at: 1 + 190 put: #arraylength.
+ OpSwitchTable at: 1 + 191 put: #athrow.
+ OpSwitchTable at: 1 + 192 put: #checkcast.
+ OpSwitchTable at: 1 + 193 put: #instanceof.
+ OpSwitchTable at: 1 + 194 put: #monenter.
+ OpSwitchTable at: 1 + 195 put: #monexit.
+ OpSwitchTable at: 1 + 196 put: #wide.
+ OpSwitchTable at: 1 + 197 put: #multianewarray.
+ OpSwitchTable at: 1 + 198 put: #ifnull.
+ OpSwitchTable at: 1 + 199 put: #ifnonnull.
+ OpSwitchTable at: 1 + 200 put: #'goto_w'.
+ OpSwitchTable at: 1 + 201 put: #'jsr_w'.
+ OpSwitchTable at: 1 + 202 put: #breakpoint.
+ OpSwitchTable at: 1 + 203 put: #'ret_w'.
+
+ Verbose := false.
+ "
+ self initialize"
+
+ "Created: / 17-03-2011 / 14:56:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 16:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 20:23:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor class methodsFor:'accessing'!
+
+verbose: bool
+Verbose := bool.
+
+ "Created: / 21-03-2011 / 18:32:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor class methodsFor:'private-logging'!
+
+log: aMessage
+Verbose ifTrue: [
+ ('JAVA [info]: ' , aMessage) infoPrintCR.].
+
+ "Created: / 17-03-2011 / 14:59:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor methodsFor:'initialization'!
+
+reset
+ pc := method startPC.
+ byteCode := method byteCode.
+ constantPool := method javaClass constantPool.
+
+ "Modified: / 17-03-2011 / 14:53:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor methodsFor:'instructions'!
+
+aaload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+aastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+aconst_null
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+aload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 15:07:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload: arg
+ "
+ Load reference from local variable 0
+ nothing -> objectRef"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Description
+ The <n> must be an index into the local variable array of the
+ current frame (§3.6). The local variable at <n> must contain a
+ reference. The objectref in the local variable at index is pushed
+ onto the operand stack.
+
+ Notes
+ An aload_<n> instruction cannot be used to load a value of type
+ returnAddress from a local variable onto the operand stack. This
+ asymmetry with the corresponding astore_<n> instruction is intentional.
+ Each of the aload_<n> instructions is the same as aload with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 15:26:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload_0
+ "
+ Load reference from local variable 0
+ nothing -> objectRef"
+
+ self aload: 0.
+
+ "
+ Description
+ The <n> must be an index into the local variable array of the
+ current frame (§3.6). The local variable at <n> must contain a
+ reference. The objectref in the local variable at index is pushed
+ onto the operand stack.
+
+ Notes
+ An aload_<n> instruction cannot be used to load a value of type
+ returnAddress from a local variable onto the operand stack. This
+ asymmetry with the corresponding astore_<n> instruction is intentional.
+ Each of the aload_<n> instructions is the same as aload with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 10-03-2011 / 21:42:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 16:56:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload_1
+ self aload: 1.
+
+ "Created: / 10-03-2011 / 21:42:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 16:56:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload_2
+ self aload: 2.
+
+ "Created: / 10-03-2011 / 21:42:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 16:56:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+aload_3
+ self aload: 3.
+
+ "Created: / 10-03-2011 / 21:43:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 16:56:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+anewarray
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:57:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+areturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+arraylength
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+astore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:37:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore:arg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+astore_0
+
+
+ ^self astore: 0.
+
+ "Created: / 17-03-2011 / 16:39:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore_1
+ ^ self astore: 1.
+
+ "Created: / 17-03-2011 / 16:39:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore_2
+ ^ self astore: 2.
+
+ "Created: / 17-03-2011 / 16:39:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+astore_3
+ ^ self astore: 3.
+
+ "Created: / 17-03-2011 / 16:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+athrow
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:57:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+baload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+bastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+bipush
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+breakpoint
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:59:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+caload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+castore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+checkcast
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:57:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+d2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dadd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+daload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dcmpg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:52:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dcmpl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:52:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dconst: arg
+ "Push the double constant <d> (0.0 or 1.0) onto the operand stack.
+ stack: nothing -> const
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Modified: / 17-03-2011 / 15:27:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dconst_0
+"
+Push the double constant <d> (0.0 or 1.0) onto the operand stack.
+stack: nothing -> const
+args: nothing
+"
+ self dconst: 0.
+
+ "Created: / 14-03-2011 / 18:02:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dconst_1
+ "
+ Push the double constant <d> (0.0 or 1.0) onto the operand stack.
+ stack: nothing -> const
+ args: nothing"
+
+ self dconst: 1.
+
+ "Created: / 14-03-2011 / 18:03:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ddiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 15:07:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload: arg
+ "
+ Load double from local variable
+ stack: nothing -> value
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the current frame (§3.6).
+ The local variable at <n> must contain a double. The value of the local variable at <n> is pushed
+ onto the operand stack.
+
+ Notes
+ Each of the dload_<n> instructions is the same as dload with an index of <n>, except that the
+ operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 15:26:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload_0
+ "
+ Load double from local variable
+ stack: nothing -> value
+ args: nothing"
+
+ self dload: 0.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the current frame (§3.6).
+ The local variable at <n> must contain a double. The value of the local variable at <n> is pushed
+ onto the operand stack.
+
+ Notes
+ Each of the dload_<n> instructions is the same as dload with an index of <n>, except that the
+ operand <n> is implicit."
+
+ "Created: / 13-03-2011 / 17:55:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload_1
+ self dload: 1.
+
+ "Created: / 13-03-2011 / 17:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload_2
+ self dload: 2.
+
+ "Created: / 13-03-2011 / 17:55:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dload_3
+ self dload: 3.
+
+ "Created: / 13-03-2011 / 17:55:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:47:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+drem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:47:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dreturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dstore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dstore: arg
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+"
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be of
+ type double. It is popped from the operand stack and undergoes value set
+ conversion (§3.8.3), resulting in value'. The local variables at <n> and
+ <n> + 1 are set to value'.
+
+ Notes
+ Each of the dstore_<n> instructions is the same as dstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 15:28:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore_0
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self dstore: 0.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be of
+ type double. It is popped from the operand stack and undergoes value set
+ conversion (§3.8.3), resulting in value'. The local variables at <n> and
+ <n> + 1 are set to value'.
+
+ Notes
+ Each of the dstore_<n> instructions is the same as dstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 19:04:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore_1
+"
+Store double into local variable
+stack: value -> nothing
+args: nothing
+"
+
+self dstore: 1.
+"
+Description
+Both <n> and <n> + 1 must be indices into the local variable array of the
+current frame (§3.6). The value on the top of the operand stack must be of
+type double. It is popped from the operand stack and undergoes value set
+conversion (§3.8.3), resulting in value'. The local variables at <n> and
+<n> + 1 are set to value'.
+
+Notes
+Each of the dstore_<n> instructions is the same as dstore with an index
+of <n>, except that the operand <n> is implicit.
+"
+
+ "Created: / 14-03-2011 / 19:04:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore_2
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self dstore: 2.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be of
+ type double. It is popped from the operand stack and undergoes value set
+ conversion (§3.8.3), resulting in value'. The local variables at <n> and
+ <n> + 1 are set to value'.
+
+ Notes
+ Each of the dstore_<n> instructions is the same as dstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 19:04:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dstore_3
+ "
+ Store double into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self dstore: 3.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be of
+ type double. It is popped from the operand stack and undergoes value set
+ conversion (§3.8.3), resulting in value'. The local variables at <n> and
+ <n> + 1 are set to value'.
+
+ Notes
+ Each of the dstore_<n> instructions is the same as dstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 19:04:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:45:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:44:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+dup2
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dup2_x1
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dup2_x2
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dup_x1
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+dup_x2
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+f2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+f2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+f2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fadd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+faload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+fastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+fcmpg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:52:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fcmpl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:51:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fconst: arg
+ "
+ Push float constant
+ stack: nothing -> const
+ arg: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility.
+ "
+ Description
+ Push the float constant <f> (0.0, 1.0, or 2.0) onto the operand stack."
+
+ "Modified: / 17-03-2011 / 15:28:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fconst_0
+ "
+ Push float constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self fconst: 0.
+
+ "
+ Description
+ Push the float constant <f> (0.0, 1.0, or 2.0) onto the operand stack."
+
+ "Created: / 14-03-2011 / 17:56:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fconst_1
+ "
+ Push float constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self fconst: 1.
+
+ "
+ Description
+ Push the float constant <f> (0.0, 1.0, or 2.0) onto the operand stack."
+
+ "Created: / 14-03-2011 / 17:57:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fconst_2
+ "
+ Push float constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self fconst: 2.
+
+ "
+ Description
+ Push the float constant <f> (0.0, 1.0, or 2.0) onto the operand stack."
+
+ "Created: / 14-03-2011 / 17:57:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fdiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 15:07:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload:arg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+fload_0
+ ^ self fload: 0.
+
+ "Created: / 17-03-2011 / 16:34:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload_1
+ ^ self fload: 1.
+
+ "Created: / 17-03-2011 / 16:35:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload_2
+ ^ self fload: 2.
+
+ "Created: / 17-03-2011 / 16:35:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fload_3
+ ^ self fload: 3.
+
+ "Created: / 17-03-2011 / 16:35:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:45:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:47:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+frem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+freturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:55:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+fstore: arg
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Modified: / 17-03-2011 / 15:29:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore_0
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+
+ self fstore: 0.
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 17:59:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore_1
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+
+ self fstore: 1.
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 17:59:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore_2
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+
+ self fstore: 2.
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 18:00:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fstore_3
+ "
+ Store float into local variable
+ stack: value -> nothing
+ args: index"
+
+ self fstore: 3.
+
+ "
+ Description
+ The index is an unsigned byte that must be an index into the local
+ variable array of the current frame (§3.6). The value on the top of
+ the operand stack must be of type float. It is popped from the operand
+ stack and undergoes value set conversion (§3.8.3), resulting in value'.
+ The value of the local variable at index is set to value'.
+
+ Notes
+ The fstore opcode can be used in conjunction with the wide instruction
+ to access a local variable using a two-byte unsigned index."
+
+ "Created: / 14-03-2011 / 18:00:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:45:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getfield
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+getstatic
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:55:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+goto
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+goto_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:49:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i2l
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:49:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+i_dup
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iadd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iaload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iand
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iconst: arg
+ "
+ Push int constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self subclassResponsibility.
+
+ "
+ Description
+ Push the int constant <i> (-1, 0, 1, 2, 3, 4 or 5) onto the operand stack.
+
+ Notes
+ Each of this family of instructions is equivalent to bipush <i> for the
+ respective value of <i>, except that the operand <i> is implicit."
+
+ "Created: / 17-03-2011 / 15:29:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 20-03-2011 / 20:41:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_0
+ "
+ Push int constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self iconst: 0.
+
+ "
+ Description
+ Push the int constant <i> (-1, 0, 1, 2, 3, 4 or 5) onto the operand stack.
+
+ Notes
+ Each of this family of instructions is equivalent to bipush <i> for the
+ respective value of <i>, except that the operand <i> is implicit."
+
+ "Modified: / 17-03-2011 / 15:30:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_1
+ self iconst:1.
+
+ "Modified: / 17-03-2011 / 15:30:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_2
+ self iconst: 2.
+
+ "Modified: / 17-03-2011 / 15:30:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_3
+ self iconst: 3.
+
+ "Modified: / 17-03-2011 / 15:30:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_4
+ self iconst: 4.
+
+ "Modified: / 17-03-2011 / 15:30:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_5
+ self iconst: 5.
+
+ "Modified: / 17-03-2011 / 15:30:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iconst_m1
+ self iconst: -1.
+
+ "Modified: / 17-03-2011 / 15:30:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+idiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifacmpeq
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:53:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifacmpne
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:53:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifeq
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifge
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifgt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmpeq
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmpge
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmpgt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmple
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmplt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ificmpne
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifle
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iflt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifne
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ifnonnull
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ifnull
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iinc
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 15:06:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload: arg
+ "
+ loads an int value from local variable 0
+ stack: nothing -> value
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Description
+ The <n> must be an index into the local variable array of the current frame (§3.6).
+ The local variable at <n> must contain an int. The value of the local variable
+ at <n> is pushed onto the operand stack.
+
+ Notes
+ Each of the iload_<n> instructions is the same as iload with an index of <n>,
+ except that the operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 15:30:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload_0
+ "
+ loads an int value from local variable 0
+ stack: nothing -> value
+ args: nothing"
+
+ self iload: 0.
+
+ "
+ Description
+ The <n> must be an index into the local variable array of the current frame (§3.6).
+ The local variable at <n> must contain an int. The value of the local variable
+ at <n> is pushed onto the operand stack.
+
+ Notes
+ Each of the iload_<n> instructions is the same as iload with an index of <n>,
+ except that the operand <n> is implicit."
+
+ "Created: / 06-03-2011 / 21:22:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 20:58:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload_1
+ "check iload_0"
+ self iload: 1.
+
+ "Created: / 06-03-2011 / 21:22:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-03-2011 / 16:36:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload_2
+ "check iload_0"
+ self iload:2.
+
+ "Created: / 06-03-2011 / 21:24:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+iload_3
+ "check iload_0"
+
+ self iload: 3.
+
+ "Created: / 14-03-2011 / 19:05:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+imul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ineg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:47:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+instanceof
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:57:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2byte
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:51:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2char
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:51:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+int2short
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invinterface
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:56:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invnonvirt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:56:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invstatic
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+invvirt
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:56:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ior
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+irem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ireturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ishl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ishr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+istore
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:36:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore: arg
+ "store int value into variable 0
+ stack: value -> nothing
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Description
+ The <n> must be an index into the local variable array of the current frame (§3.6).
+ The value on the top of the operand stack must be of type int. It is popped from
+ the operand stack, and the value of the local variable at <n> is set to value.
+
+ Notes
+ Each of the istore_<n> instructions is the same as istore with an index of <n>,
+ except that the operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 15:31:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore_0
+ "store int value into variable 0
+ stack: value -> nothing
+ args: nothing"
+
+ self istore: 0.
+
+ "
+ Description
+ The <n> must be an index into the local variable array of the current frame (§3.6).
+ The value on the top of the operand stack must be of type int. It is popped from
+ the operand stack, and the value of the local variable at <n> is set to value.
+
+ Notes
+ Each of the istore_<n> instructions is the same as istore with an index of <n>,
+ except that the operand <n> is implicit."
+
+ "Created: / 06-03-2011 / 21:01:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 15:31:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore_1
+ "check istore_0"
+ self istore: 1.
+
+ "Created: / 06-03-2011 / 21:18:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore_2
+ "check istore_0"
+ self istore: 2.
+
+ "Created: / 06-03-2011 / 21:23:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+istore_3
+ "check istore_0"
+
+ self istore: 3.
+
+ "Created: / 14-03-2011 / 19:05:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+iushr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ixor
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+jsr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:54:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+jsr_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2d
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2f
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+l2i
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:50:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ladd
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:44:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+laload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+land
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:48:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+lcmp
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:51:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lconst: arg
+ "
+ Push long constant
+ stack: nothing -> const
+ arg: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+ "
+ Push the long constant <l> (0 or 1) onto the operand stack."
+
+ "Modified: / 17-03-2011 / 16:30:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lconst_0
+ "
+ Push long constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self lconst: 0.
+
+ "
+ Push the long constant <l> (0 or 1) onto the operand stack."
+
+ "Created: / 14-03-2011 / 17:53:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 16:28:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lconst_1
+ "
+ Push long constant
+ stack: nothing -> const
+ arg: nothing"
+
+ self lconst: 1.
+
+ "
+ Push the long constant <l> (0 or 1) onto the operand stack."
+
+ "Created: / 14-03-2011 / 17:53:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 16:29:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ldc1
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ldc2
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ldc2w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ldiv
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 15:06:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload: arg
+ "
+ Load long from local variable
+ stack: nothing -> value
+ args: nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The local variable at <n> must contain a long. The
+ value of the local variable at <n> is pushed onto the operand stack.
+
+ Notes
+ Each of the lload_<n> instructions is the same as lload with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Modified: / 17-03-2011 / 16:33:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload_0
+"
+Load long from local variable
+stack: nothing -> value
+args: nothing
+"
+ self lload: 0.
+
+"
+Description
+Both <n> and <n> + 1 must be indices into the local variable array of the
+current frame (§3.6). The local variable at <n> must contain a long. The
+value of the local variable at <n> is pushed onto the operand stack.
+
+Notes
+Each of the lload_<n> instructions is the same as lload with an index
+of <n>, except that the operand <n> is implicit.
+"
+
+ "Created: / 14-03-2011 / 13:38:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload_1
+self lload: 1.
+
+ "Created: / 14-03-2011 / 13:37:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload_2
+ self lload: 2.
+
+ "Created: / 14-03-2011 / 13:38:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lload_3
+ self lload: 3.
+
+ "Created: / 14-03-2011 / 13:38:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lmul
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lneg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:47:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lookupswtch
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:55:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lor
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:49:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lrem
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:46:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lreturn
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+lshl
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:48:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lshr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:48:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:37:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore:arg
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+lstore_0
+ "store long into local variable 0
+ stack: value -> nothing
+ args: nothing"
+
+ self lstore: 0.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be
+ of type long. It is popped from the operand stack, and the local variables
+ at <n> and <n> + 1 are set to value.
+
+ Notes
+ Each of the lstore_<n> instructions is the same as lstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 17:54:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore_1
+ "store long into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self lstore: 1.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be
+ of type long. It is popped from the operand stack, and the local variables
+ at <n> and <n> + 1 are set to value.
+
+ Notes
+ Each of the lstore_<n> instructions is the same as lstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 17:55:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore_2
+ "store long into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self lstore: 2.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be
+ of type long. It is popped from the operand stack, and the local variables
+ at <n> and <n> + 1 are set to value.
+
+ Notes
+ Each of the lstore_<n> instructions is the same as lstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 17:55:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lstore_3
+ "store long into local variable
+ stack: value -> nothing
+ args: nothing"
+
+ self lstore: 3.
+
+ "
+ Description
+ Both <n> and <n> + 1 must be indices into the local variable array of the
+ current frame (§3.6). The value on the top of the operand stack must be
+ of type long. It is popped from the operand stack, and the local variables
+ at <n> and <n> + 1 are set to value.
+
+ Notes
+ Each of the lstore_<n> instructions is the same as lstore with an index
+ of <n>, except that the operand <n> is implicit."
+
+ "Created: / 14-03-2011 / 17:56:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lsub
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:45:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lushr
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:48:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lxor
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:49:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+monenter
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+monexit
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+multianewarray
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+new
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+newarray
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+nop
+"Do nothing"
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Modified: / 17-03-2011 / 16:27:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop1
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:43:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop2
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+putfield
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+putstatic
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+ret
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:54:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ret_w
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:59:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+return
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+saload
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+sastore
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+sipush
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+swap
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+tableswtch
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:54:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+wide
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+
+ "Created: / 17-03-2011 / 16:58:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor methodsFor:'private-helpers'!
+
+fetchByte
+ "fetch sign extended byte value stored in bytecode"
+ pc := pc + 1.
+ ^ (byteCode at: (pc - 1)) signExtendedByteValue.
+
+ "Created: / 06-03-2011 / 22:26:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:00:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fetchBytes2
+ "fetch sign extended 2 byte value stored in bytecode"
+ pc := pc + 2.
+ ^ (((byteCode at: (pc - 2)) bitShift: 8) + (byteCode at: (pc - 1)))
+ signExtendedShortValue.
+
+ "Created: / 06-03-2011 / 21:12:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:00:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fetchBytes4
+ "fetch sign extended 4 byte value stored in bytecode"
+
+ pc := pc + 4.
+ ^ (((((byteCode at: (pc - 4)) bitShift: 24)
+ bitOr: ((byteCode at: (pc - 3)) bitShift: 16))
+ bitOr: ((byteCode at: (pc - 2)) bitShift: 8))
+ bitOr: (byteCode at: (pc - 1))) asSigned32.
+
+ "Created: / 21-03-2011 / 12:59:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 15:10:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fetchIndex
+ "fetch index value from bytecode"
+ pc := pc + 1.
+ ^ (byteCode at: (pc - 1)).
+
+ "Created: / 24-02-2011 / 22:37:18 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-03-2011 / 17:01:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+fetchIndex2
+ "fetch index 2 byte value from bytecode"
+ pc := pc + 2.
+ ^ ((byteCode at: (pc - 2)) bitShift: 8) bitOr: (byteCode at: (pc - 1)).
+
+ "Modified: / 24-02-2011 / 21:33:53 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-03-2011 / 17:01:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pop
+ "return and remove top of the stack"
+
+ sp := sp - 1.
+ ^ context at: sp + 1.
+
+ "Modified: / 17-03-2011 / 17:39:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+popDouble
+ "so far I didn't find a reason to handle doubles and long on stack differently"
+ ^ self pop.
+
+ "Modified: / 17-03-2011 / 17:02:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+popLong
+"so far I didn't find a reason to handle doubles and long on stack differently"
+ ^ self pop.
+
+ "Modified: / 17-03-2011 / 17:02:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushConstant: something
+ "push constant value on the stack - is there really not any better push method?"
+ sp := sp + 1.
+ context at: sp put: something
+
+ "Modified: / 17-03-2011 / 17:05:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushDouble: something
+ "push double value on the stack"
+
+ ^ self pushInt: something.
+
+ "Modified: / 17-03-2011 / 17:06:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushFloat: something
+ "push float value on the stack"
+ self pushInt: something.
+
+ "Created: / 13-03-2011 / 16:39:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:06:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushInt: something
+ "push integer value on the stack"
+ sp := sp + 1.
+ context at: sp put: something
+
+ "Created: / 13-03-2011 / 17:28:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 17-03-2011 / 17:06:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushLong: something
+ "push long value on the stack"
+
+ ^ self pushInt: something.
+
+ "sp := sp + 2.
+ context at: sp - 1 put: #'dummy long complement'.
+ context at: sp put: something asLargeInteger."
+
+ "Modified: / 17-03-2011 / 17:07:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushNewArrayOf: type sized: size
+ "push new array of type with <size> slots"
+
+ self pushRef: ((JavaArray javaArrayClassFor: type) new: size).
+
+ "Created: / 14-03-2011 / 18:36:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 27-03-2011 / 21:06:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushNewPrimitiveArrayOf: typeName sized: size
+ "push new array of <typeName> (e.g. 'long', only primitive types) with <size> slots"
+
+ self
+ pushRef: ((JavaArray
+ javaArrayClassFor: (JavaDescriptor baseTypesByTypeName at: typeName))
+ new: size).
+
+ "Created: / 27-03-2011 / 21:06:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+pushRef: something
+ "push java ref on the stack"
+ sp := sp + 1.
+ context at: sp put: something
+
+ "Created: / 13-03-2011 / 16:35:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-03-2011 / 16:49:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+relativeJump: pos
+ "move pc relatively by the position <pos>."
+
+ pc := instrPointer + pos.
+
+ "Created: / 21-03-2011 / 18:19:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+skipPadding
+ "in tableswitch and lookupswitch instructions, there's a padding after instruction to ensure
+ 32bit values following begin at address that is multiple of 4 bytes from the start of the current
+ method bytecode"
+
+ | jmpSize |
+
+ jmpSize := ((4 - (pc \\ 4)) + 1) \\ 4.
+ pc := pc + jmpSize.
+ ^ jmpSize.
+
+ "Created: / 21-03-2011 / 13:13:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 15:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+tos
+ ^ context at:sp.
+! !
+
+!JavaByteCodeProcessor methodsFor:'private-logging'!
+
+log: aMessage
+self class log: aMessage.
+
+ "Created: / 17-03-2011 / 14:59:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor methodsFor:'processing loop'!
+
+enterProcessingLoop
+ Context cannotReturnSignal handle:
+ [:ex |
+ "/ this is required for blocks of this method, which do a homeReturn.
+ "/ since my context is not really on the stack (and therefore not returnable),
+ "/ catch the error and return manually.
+ ^ ex parameter ]
+ do:
+ [ [ leaveProcessor ] whileFalse:
+ [ instrPointer := pc.
+ op := byteCode at: pc.
+ pc := pc + 1.
+ self switch: op. ]. ].
+
+ "Created: / 31-03-2011 / 16:38:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+handleAbstractMethod
+ self subclassResponsibility.
+
+ "Created: / 22-03-2011 / 14:49:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+initializeContextArgsFrom: argArray
+ 1 to: numArgs do: [:idx | context at: idx put: (argArray at: idx). ]
+
+ "Created: / 21-03-2011 / 15:17:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+initializeContextVars
+ 1 to: numVars do: [:idx | context at: (numArgs + idx) put: nil. ]
+!
+
+leaveProcessorWith: aReturnObject
+ retVal := aReturnObject.
+ leaveProcessor := true
+
+ "Modified: / 17-03-2011 / 17:39:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+process: aMethod receiver: aReceiver arguments: args
+ | argArray |
+
+ aMethod isAbstract
+ ifTrue:
+ [ ('Processing abstract method ' , aMethod displayString) infoPrintCR.
+ ^ self handleAbstractMethod. ].
+ args size ~~ aMethod javaNumArgs
+ ifTrue: [ self error: 'bad number of arguments' ].
+ aMethod isStatic
+ ifTrue: [ argArray := args ]
+ ifFalse:
+ [ argArray := OrderedCollection with: aReceiver.
+ args ifNotNil: [ argArray addAll: args. ]. ].
+ numArgs := argArray size.
+ numVars := aMethod numVars.
+ method := aMethod.
+ context := JavaContext new: (numArgs + numVars + aMethod stackSize).
+ context setNumArgs: numArgs numVars: numVars.
+ receiver := aReceiver.
+ byteCode := aMethod byteCode.
+ constantPool := aMethod constantPool.
+ pc := 1.
+ wide := false.
+ self initializeContextArgsFrom: argArray.
+ self initializeContextVars.
+ sp := numArgs + numVars.
+ leaveProcessor := false.
+ self enterProcessingLoop.
+ ^ retVal
+
+ "Modified: / 24-02-2011 / 11:09:07 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 17-03-2011 / 17:25:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 31-03-2011 / 16:38:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+switch: op
+
+ self log: 'invoking ' , (OpSwitchTable at: op + 1) printString , '(' , op printString , ')'.
+ self perform: (OpSwitchTable at: op + 1)
+
+ "Modified: / 17-03-2011 / 15:01:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-03-2011 / 20:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeProcessor class methodsFor:'documentation'!
+
+version
+ ^ '$Id$'
+!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaByteCodeProcessor initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeProcessorTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,160 @@
+"
+ 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:#JavaByteCodeProcessorTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaByteCodeProcessorTests 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.
+
+"
+! !
+
+!JavaByteCodeProcessorTests class methodsFor:'testing'!
+
+isAbstract
+
+ ^self == JavaByteCodeProcessorTests
+
+ "Created: / 08-08-2011 / 17:36:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeProcessorTests methodsFor:'tests-helpers'!
+
+invoke: methodName class: aClass args: args
+ ^ self invoke:methodName class: aClass receiver:aClass args: args
+
+ "Created: / 10-03-2011 / 23:32:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invoke:arg1 class:arg2 receiver:arg3 args:arg4
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+loadCrateJavaClass
+ ^ Java classForName: 'stx.libjava.tests.simpleClasses.Crate'.
+
+ "Created: / 10-03-2011 / 21:34:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+loadSimpleClassWithManyReferences
+ ^ Java
+ classForName: 'stx.libjava.tests.mocks.SimpleClassWithManyReferences'.
+
+ "Created: / 14-03-2011 / 21:26:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:15:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadSimpleInheritingJavaClass
+ ^ Java classForName: 'stx.libjava.tests.mocks.SimpleInheritingClass'.
+
+ "Created: / 10-03-2011 / 21:34:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadSimpleMathJavaClass
+ ^ Java classForName: 'stx.libjava.tests.mocks.SimpleMath'.
+
+ "Created: / 10-03-2011 / 21:28:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadSwitchExamplesClass
+ ^ Java classForName: 'stx.libjava.tests.mocks.SwitchExamples'.
+
+ "Created: / 21-03-2011 / 13:51:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:15:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaByteCodeProcessorTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaByteCodeSteppableInterpreter.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,249 @@
+"
+ 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' }"
+
+JavaByteCodeInterpreter subclass:#JavaByteCodeSteppableInterpreter
+ instanceVariableNames:'interpretInnerHook'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Bytecode'
+!
+
+!JavaByteCodeSteppableInterpreter 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.
+
+"
+! !
+
+!JavaByteCodeSteppableInterpreter methodsFor:'accessing'!
+
+byteCode
+^ byteCode.
+
+ "Created: / 01-04-2011 / 16:18:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+constantPool
+^constantPool.
+
+ "Created: / 01-04-2011 / 16:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+context
+ ^ context.
+
+ "Created: / 01-04-2011 / 16:20:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+currentOp
+ ^ op.
+
+ "Created: / 01-04-2011 / 16:18:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+instructionPointer
+^ instrPointer.
+
+ "Created: / 01-04-2011 / 16:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+method
+ ^ method.
+
+ "Created: / 01-04-2011 / 16:20:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+numArgs
+ ^ numArgs.
+
+ "Created: / 01-04-2011 / 16:19:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+numVars
+^numVars.
+
+ "Created: / 01-04-2011 / 16:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+programCounter
+^pc.
+
+ "Created: / 01-04-2011 / 16:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+receiver
+^ receiver.
+
+ "Created: / 01-04-2011 / 16:19:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+stackPointer
+^ sp.
+
+ "Created: / 01-04-2011 / 16:18:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+wide
+ ^ wide.
+
+ "Created: / 01-04-2011 / 16:19:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeSteppableInterpreter methodsFor:'interpretation'!
+
+enterProcessingLoop
+"nothing done here (yet?), call interpretNext"
+
+ "Created: / 31-03-2011 / 16:40:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-04-2011 / 16:13:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+hasFinished
+ ^ leaveProcessor.
+
+ "Created: / 31-03-2011 / 22:53:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpret: aMethod receiver: aReceiver arguments: args
+ self
+ log: ('Invoking method ' , aMethod name , ' on ' , aReceiver printString
+ , ' with ' , args printString).
+ super
+ interpret: aMethod
+ receiver: aReceiver
+ arguments: args.
+ ^ self.
+
+ "Created: / 17-03-2011 / 17:25:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-04-2011 / 16:10:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpretInner: aJavaMethod receiver: aReceiver arguments: arguments
+
+ interpretInnerHook ifNil:
+ [ ^ super
+ interpretInner: aJavaMethod
+ receiver: aReceiver
+ arguments: arguments ]
+ ifNotNil:
+ [ ^ interpretInnerHook
+ with: aJavaMethod
+ with: aReceiver
+ with: arguments ].
+
+ "Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-04-2011 / 16:15:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpretInnerHook: threeArgBlock
+ "args: method receiver arguments"
+
+ interpretInnerHook := threeArgBlock.
+
+ "Created: / 31-03-2011 / 22:50:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-04-2011 / 14:49:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+interpretNext
+ leaveProcessor ifTrue: [ ^ self interpretationFinished ].
+ Context cannotReturnSignal handle: [:ex | ^ ex parameter ]
+ do:
+ [ instrPointer := pc.
+ op := byteCode at: pc.
+ pc := pc + 1.
+ self switch: op. ].
+
+ "Created: / 31-03-2011 / 16:41:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+returnValue
+ ^ retVal.
+
+ "Created: / 31-03-2011 / 22:53:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaByteCodeSteppableInterpreter class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaCharTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaCharTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaCharTypeNode 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.
+
+"
+! !
+
+!JavaCharTypeNode methodsFor:'accessing'!
+
+selector
+ ^ 'c'
+
+ "Created: / 17-12-2010 / 16:38:08 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaCharTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaClass.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaClass.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,12 +12,38 @@
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' }"
JavaBehavior subclass:#JavaClass
instanceVariableNames:'classLoader fullName sourceFile binaryFilePath fields initValues
- staticFields'
+ staticFields annotations protectionDomain signatureJ'
classVariableNames:'ArgumentConversionErrorSignal OrderOfClassInits'
poolDictionaries:''
category:'Languages-Java-Classes'
@@ -23,8 +53,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -32,6 +66,33 @@
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.
+
"
!
@@ -79,8 +140,9 @@
cls := meta new.
cls setSuperclass:JavaObject.
cls instSize:0.
- cls setName:('JAVA::' , aString).
+ cls setName:('JAVA::' , aString).
cls flags:0.
+
cls setAccessFlags:0.
"/ cls setClassVariableString:''.
cls setInstanceVariableString:''.
@@ -132,8 +194,9 @@
^ cls
- "Created: / 15.4.1996 / 15:52:55 / cg"
- "Modified: / 3.1.1998 / 22:32:25 / cg"
+ "Created: / 15-04-1996 / 15:52:55 / cg"
+ "Modified: / 03-01-1998 / 22:32:25 / cg"
+ "Modified: / 26-11-2010 / 19:00:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
name:aString
@@ -142,6 +205,15 @@
"Created: 15.4.1996 / 15:52:55 / cg"
! !
+!JavaClass class methodsFor:'class initialization'!
+
+initialize
+
+ ArgumentConversionErrorSignal := Signal new notifierString:'argument conversion error'.
+
+ "Created: / 20-10-2010 / 11:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaClass class methodsFor:'method lookup'!
canConvertArgsToJava:argArray asSpecifiedIn:argSigSpecArray
@@ -196,17 +268,17 @@
"given a smalltalk argument, convert to a java object as appropriate."
^ self
- convertToJava:arg
- type:type
- ifFail:[:msg :default |
- ArgumentConversionErrorSignal
- raiseWith:arg
- errorString:msg.
- default
- ]
-
- "Modified: / 5.11.1998 / 18:43:33 / cg"
- "Created: / 6.11.1998 / 00:45:13 / cg"
+ convertToJava:arg
+ type:type
+ ifFail:[:msg :default |
+ ArgumentConversionErrorSignal
+ raiseWith:arg
+ errorString:msg.
+ default
+ ]
+
+ "Created: / 06-11-1998 / 00:45:13 / cg"
+ "Modified: / 20-10-2010 / 11:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
convertToJava:arg type:type ifFail:failBlock
@@ -216,157 +288,172 @@
|expectedCls f failValue|
type == #boolean ifTrue:[
- arg == true ifTrue:[
- ^ 1
- ].
- arg == false ifTrue:[
- ^ 0
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0
+ arg == true ifTrue:[
+ ^ 1
+ ].
+ arg == false ifTrue:[
+ ^ 0
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0
].
type == #int ifTrue:[
- arg isInteger ifTrue:[
- (arg between:-16r8000000 and:16r7FFFFFFF) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('integer range; cannot convert argument to ' , type) value:0.
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0
+ arg isInteger ifTrue:[
+ (arg between: (16r8000000 * -1) and:16r7FFFFFFF) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('integer range; cannot convert argument to ' , type) value:0.
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0
].
type == #long ifTrue:[
- arg isInteger ifTrue:[
- (arg between:-16r800000000000000 and:16r7FFFFFFFFFFFFFFF) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('integer range; cannot convert argument to ' , type) value:0
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0
+ arg isInteger ifTrue:[
+ (arg between:"(-1 * 16r800000000000000) -->"-576460752303423488 and:16r7FFFFFFFFFFFFFFF) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('integer range; cannot convert argument to ' , type) value:0
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0
].
(type == #float) ifTrue:[
- arg isLimitedPrecisionReal ifTrue:[
- ^ arg asShortFloat
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
+ arg isLimitedPrecisionReal ifTrue:[
+ ^ arg asShortFloat
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
].
(type = 'java.lang.Float') ifTrue:[
- arg isLimitedPrecisionReal ifTrue:[
- f := (Java at:'java.lang.Float') new.
- f perform:#'<init>(F)V' with:(arg asShortFloat).
+ arg isLimitedPrecisionReal ifTrue:[
+ f := (Java at:'java.lang.Float') new.
+ f perform:#'<init>(F)V' with:(arg asShortFloat).
self halt.
- ^ f.
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
+ ^ f.
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
].
(type = 'java.lang.Double') ifTrue:[
- arg isLimitedPrecisionReal ifTrue:[
- f := (Java at:'java.lang.Double') new.
- f perform:#'<init>(D)V' with:(arg asFloat).
+ arg isLimitedPrecisionReal ifTrue:[
+ f := (Java at:'java.lang.Double') new.
+ f perform:#'<init>(D)V' with:(arg asFloat).
self halt.
- ^ f.
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
+ ^ f.
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
].
(type == #double) ifTrue:[
- arg isLimitedPrecisionReal ifTrue:[
- ^ arg asFloat
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
+ arg isLimitedPrecisionReal ifTrue:[
+ ^ arg asFloat
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0.0.
].
(type == #char) ifTrue:[
- arg isCharacter ifTrue:[
- ^ arg asciiValue
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:0
+ arg isCharacter ifTrue:[
+ ^ arg asciiValue
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:0
].
(type = 'char[]') ifTrue:[
- arg isString ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ arg isString ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
(type = 'int[]') ifTrue:[
- (arg isArray or:[arg isMemberOf:SignedIntegerArray]) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ (arg isArray or:[arg isMemberOf:SignedIntegerArray]) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
(type = 'long[]') ifTrue:[
- (arg isArray or:[arg isMemberOf:SignedIntegerArray]) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ (arg isArray or:[arg isMemberOf:SignedIntegerArray]) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
(type = 'float[]') ifTrue:[
- (arg isArray or:[arg isMemberOf:FloatArray]) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ (arg isArray or:[arg isMemberOf:FloatArray]) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
(type = 'double[]') ifTrue:[
- (arg isArray or:[arg isMemberOf:DoubleArray]) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ (arg isArray or:[arg isMemberOf:DoubleArray]) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
(type endsWith:'[]') ifTrue:[
- (arg isArray or:[arg isNil]) ifTrue:[
- ^ arg
- ].
- ^ failBlock value:('cannot convert argument to ' , type) value:''
+ (arg isArray or:[arg isNil]) ifTrue:[
+ ^ arg
+ ].
+ ^ failBlock value:('cannot convert argument to ' , type) value:''
].
+ expectedCls := Java classForName:type.
+ (arg isKindOf:expectedCls) ifTrue:[
+ "/ matches class and subclasses
+ ^ arg
+ ].
+
+
(type = 'java.lang.Object') ifTrue:[
- "/ matches any
- ^ arg
+ "/ matches any
+ ^ arg
].
(type = 'java.lang.String') ifTrue:[
- arg isString ifTrue:[
- ^ Java as_String:arg
- ].
- failValue := ''
- ].
- expectedCls := Java classForName:type.
- (arg isKindOf:expectedCls) ifTrue:[
- "/ matches class and subclasses
- ^ arg
+ arg isString ifTrue:[
+ ^ Java as_String:arg
+ ].
+ failValue := ''
].
arg isNil ifTrue:[
- "/ matches any
- ^ arg
+ "/ matches any
+ ^ arg
].
self halt.
^ failBlock value:('cannot convert argument to ' , type) value:failValue
- "Created: / 6.11.1998 / 00:46:19 / cg"
- "Modified: / 6.11.2001 / 13:28:29 / cg"
+ "Created: / 06-11-1998 / 00:46:19 / cg"
+ "Modified: / 06-11-2001 / 13:28:29 / cg"
+ "Modified: / 17-01-2011 / 10:08:04 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 17-03-2011 / 14:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
convertToSmalltalk:jObj type:type
"given a java return value, convert to a smalltalk object as appropriate.
Currently, only a few types are converted."
+ "JV@2011-02-04"
+ "Hack for primitive types"
+ (JavaDescriptor baseTypesByTypeName keys includes: type) ifTrue:[^jObj].
+ "jObj is registered for the specified type?"
+
+ "
+ (JavaObjectDictionary new reflectionOf: jObj class name) = (Java classForName: type) ifTrue: [
+ ^ jObj
+ ].
+ "
+
type == #boolean ifTrue:[
- jObj == 0 ifTrue:[
- ^ false
- ].
- ^ true
+ jObj == 0 ifTrue:[
+ ^ false
+ ].
+ ^ true
].
type == #void ifTrue:[
- ^ nil
+ ^ nil
].
(type = 'java.lang.String') ifTrue:[
- ^ Java as_ST_String:jObj
+ ^ Java as_ST_String:jObj
].
"/ (type = 'java.lang.Float') ifTrue:[
@@ -377,15 +464,17 @@
"/ ].
(type == #char) ifTrue:[
- jObj isInteger ifTrue:[
- ^ Character value:jObj
- ].
+ jObj isInteger ifTrue:[
+ ^ Character value:jObj
+ ].
].
^ jObj
- "Created: / 6.11.1998 / 00:49:53 / cg"
- "Modified: / 11.11.1998 / 02:08:11 / cg"
+ "Created: / 06-11-1998 / 00:49:53 / cg"
+ "Modified: / 11-11-1998 / 02:08:11 / cg"
+ "Modified: / 17-01-2011 / 10:42:56 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 08-04-2011 / 17:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
lookupMethod:selector numArgs:nargs in:aClass static:staticMethod
@@ -501,6 +590,19 @@
!JavaClass class methodsFor:'special'!
+deinitClasses
+
+ Smalltalk allClassesDo:
+ [:cls|cls isJavaClass ifTrue:[cls deinit]].
+ self flushClassesInitOrder.
+
+ "
+ JavaClass deinitClasses
+ "
+
+ "Created: / 25-10-2010 / 16:47:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
flushClassesInitOrder
OrderOfClassInits := nil
@@ -534,6 +636,30 @@
!JavaClass methodsFor:'accessing'!
+allInterfaces
+
+ | ifaces cls |
+
+ ifaces := Set new.
+ cls := self.
+ [ cls isJavaClass ] whileTrue:
+ [cls interfaces do:[:iface| ifaces add: iface; addAll: iface allInterfaces].
+ cls := cls superclass].
+ ^ifaces.
+
+ "Created: / 05-02-2011 / 23:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+annotations
+ ^ annotations ifNil:[JavaClassAnnotationContainer empty].
+
+ "Modified: / 03-03-2011 / 22:52:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+annotations:something
+ annotations := something.
+!
+
binaryFile
^ binaryFilePath
!
@@ -603,6 +729,14 @@
^ constantPool
!
+ensureHasAnnotations
+ annotations ifNil: [ annotations := JavaAnnotationContainer for: self ].
+ ^ annotations
+
+ "Created: / 25-02-2011 / 16:02:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 17:13:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
fields
^ fields
!
@@ -612,20 +746,28 @@
!
interfaces
- interfaces notNil ifTrue:[
- interfaces := interfaces collect:[:clsRef |
- clsRef isUnresolved ifTrue:[
- clsRef preResolve
- ] ifFalse:[
- clsRef
- ]
- ].
- ].
- ^ interfaces
+ interfaces notNil
+ ifTrue:
+ [ interfaces := interfaces collect:
+ [:clsRef | clsRef javaClass ] ].
+
+ ^ interfaces ? #()
+
+ "Modified: / 31-05-2011 / 09:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
javaClass
+
^ self
+
+ "Modified: / 22-05-2011 / 13:32:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaComponentClass
+ ^self.
+
+ "Created: / 20-12-2010 / 22:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-05-2011 / 23:26:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
javaName
@@ -662,6 +804,26 @@
"
!
+javaPackageAsDirname
+ "the javaPackage - as directory in class path"
+
+ |components|
+
+ components := fullName asCollectionOfSubstringsSeparatedBy:$/.
+ components size > 1 ifTrue:[
+ ^ (components copyWithoutLast:1) asStringWith: Filename separator
+ ].
+ ^ fullName
+
+ "
+ Java allClasses first fullName
+ Java allClasses first javaPackage
+ Java allClasses first package
+ "
+
+ "Created: / 30-11-2010 / 12:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
lastName
^ fullName copyFrom:(fullName lastIndexOf:$/)+1
@@ -717,6 +879,38 @@
"
!
+protectionDomain
+ ^ protectionDomain
+!
+
+protectionDomain:something
+ protectionDomain := something.
+!
+
+runtimeVisibleAnnotationsAsBytesOrNil
+ annotations ifNil:[ ^ nil ].
+ annotations runtimeVisible ifNil:[ ^ nil ].
+ ^ annotations runtimeVisible bytes
+
+ "Created: / 25-02-2011 / 16:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setSignature: aSymbol
+
+ signatureJ := aSymbol
+
+ "Created: / 13-08-2011 / 00:30:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+signatureJ
+
+ "stupid naming, but superclass defines signature too"
+
+ ^signatureJ
+
+ "Created: / 13-08-2011 / 00:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
source
^ Java classSourceOf:self
@@ -737,6 +931,20 @@
^ staticFields
!
+superinterface
+
+ | ifaces |
+
+ self assert: self isInterface message: 'Type must be an interface'.
+ (ifaces := self interfaces) size == 0 ifTrue:[^nil].
+ ifaces size = 1 ifTrue:[^ifaces first].
+
+ self error: 'Should not happen!!'.
+ ^nil
+
+ "Created: / 04-02-2011 / 12:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
typeOfField:aFieldName
fields do:[:aField |
@@ -761,6 +969,14 @@
"Created: 12.8.1997 / 02:46:51 / cg"
! !
+!JavaClass methodsFor:'autoboxing'!
+
+javaBox:anObject
+ ^ anObject
+
+ "Created: / 14-08-2011 / 22:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaClass methodsFor:'browser interface'!
isVisualStartable
@@ -820,40 +1036,6 @@
^ super browserClass.
"Modified: / 14.10.1998 / 15:28:38 / cg"
-!
-
-compilerClass
- "return the compiler to use for this class -
- this can be redefined in special classes, to compile classes with
- Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
-
- ^ JavaCompiler ? Compiler
-!
-
-evaluatorClass
- "return the compiler to use for expression evaluation for this class -
- this can be redefined in special classes, to evaluate expressions with
- Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
-
- ^ JavaParser ? Parser.
-
-!
-
-parserClass
- "return the parser to use for parsing this class -
- this can be redefined in special classes, to parse classes with
- Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
-
- ^ JavaParser ? Parser.
-
-!
-
-syntaxHighlighterClass
- "return the class to use for syntaxHighlighting (prettyPrinting) this class -
- this can be redefined in special classes, to highlight classes with
- Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
-
- ^ JavaSyntaxHighlighter "/ ? SyntaxHighlighter
! !
!JavaClass methodsFor:'compiling'!
@@ -1028,14 +1210,14 @@
classInit
"call the classes JAVA clinit function"
- |m|
+ |m|
(accessFlags bitAnd:A_INITIALIZED) ~~ 0 ifTrue:[^ self].
accessFlags := accessFlags bitOr:A_INITIALIZED.
superclass ~~ JavaObject ifTrue:[
- superclass classInit
+ superclass classInit
].
"/ "/ also, all referenced classes must be ...
"/ constantPool classReferencesDo:[:aClass |
@@ -1044,25 +1226,27 @@
m := self compiledMethodAt:#'<clinit>()V'.
m notNil ifTrue:[
-"/ 'calling clinit() of ' print. self fullName printNL.
- [
- OrderOfClassInits notNil ifTrue:[
- OrderOfClassInits add:self.
- ].
-
- m
- valueWithReceiver:self
- arguments:#()
- selector:#'<clinit>()V'
- search:self class
- sender:nil
- ] valueOnUnwindDo:[
- accessFlags := accessFlags bitXor:A_INITIALIZED.
- ]
+ "/'calling <clinit>() of ' print. self fullName printNL.
+ [
+ OrderOfClassInits notNil ifTrue:[
+ OrderOfClassInits add:self.
+ ].
+
+ m
+ valueWithReceiver:self
+ arguments:#()
+ selector:#'<clinit>()V'
+ search:self class
+ sender:nil
+ ] valueOnUnwindDo:[
+ accessFlags := accessFlags bitXor:A_INITIALIZED.
+ ].
+ "/'calling <clinit>() done ' print. self fullName printNL.
] ifFalse:[
"/ self fullName print. ' has no clinit()' printNL.
].
+
"
JavaVM instructionTrace:true.
JavaVM callTrace:true.
@@ -1074,7 +1258,9 @@
(Java classNamed:'java.util.Properties') classInit
"
- "Modified: / 12.11.1998 / 15:41:11 / cg"
+ "Modified: / 12-11-1998 / 15:41:11 / cg"
+ "Modified: / 11-12-2010 / 15:23:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-08-2011 / 19:37:33 / jv"
!
initializeStaticFields
@@ -1149,31 +1335,28 @@
"create a new cleared JAVA instance.
Its instVars are cleared to the corresponding typed values;
however, <init> is not invoked for it."
-
- |newJavaObject sz "{ Class: SmallInteger }" |
-
- (accessFlags bitAnd:A_ABSTRACT_OR_INTERFACE) ~~ 0 ifTrue:[
- JavaVM throwInstantiationExceptionFor:self.
- ^ nil
- ].
-
+
+ | newJavaObject
+ sz "{ Class: SmallInteger }" |
+
+ (accessFlags bitAnd: A_ABSTRACT_OR_INTERFACE) ~~ 0
+ ifTrue:
+ [ JavaVM throwInstantiationExceptionFor: self.
+ ^ nil ].
newJavaObject := super basicNew.
- initValues notNil ifTrue:[
- sz := self instSize.
- 1 to:sz do:[:i |
- newJavaObject instVarAt:i put:(initValues at:i)
- ].
- ].
-
+ initValues notNil
+ ifTrue:
+ [ sz := self instSize.
+ 1 to: sz do: [:i | newJavaObject instVarAt: i put: (initValues at: i) ]. ].
^ newJavaObject
"
(Java classNamed:'java.lang.String') basicNew inspect
(Java classNamed:'java.lang.String') newCleared inspect
- (Java classNamed:'java.lang.String') new inspect
- "
-
- "Modified: / 13.11.1998 / 14:10:45 / cg"
+ (Java classNamed:'java.lang.String') new inspect"
+
+ "Modified: / 13-11-1998 / 14:10:45 / cg"
+ "Modified: / 10-03-2011 / 22:38:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
newWith_String:argString
@@ -1317,19 +1500,25 @@
!
lookupMethodFor:selector
- |method cls sel|
+ |method cls sel queue |
sel := selector asSymbolIfInterned.
sel notNil ifTrue:[
- cls := self.
- [cls notNil] whileTrue:[
- method := cls compiledMethodAt:sel.
- method notNil ifTrue:[ ^ method ].
- cls := cls superclass.
- ].
+ queue := OrderedCollection with: self.
+ [ queue isEmpty ] whileFalse:[
+ cls := queue removeFirst.
+ method := cls compiledMethodAt:sel.
+ method notNil ifTrue:[ ^ method ].
+ queue addAll: cls interfaces.
+ cls isInterface ifFalse:[
+ cls superclass ~~ JavaObject ifTrue:[queue add: cls superclass]
+ ]
+ ].
].
-
+ "/cls ifNotNil:[^super lookupMethodFor: selector].
^ nil
+
+ "Modified: / 10-08-2011 / 22:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
performStatic:selector
@@ -1381,6 +1570,17 @@
"Created: / 10.12.1998 / 21:50:29 / cg"
! !
+!JavaClass methodsFor:'misc ui support'!
+
+iconInBrowserSymbol
+ <resource: #programImage>
+
+
+ ^#javaClassBrowserIcon
+
+ "Created: / 20-12-2010 / 19:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaClass methodsFor:'printOut'!
printNameInHierarchy
@@ -1461,36 +1661,36 @@
binaryFilePath := aPathName
!
-setConstantPool:anArray
- constantPool := anArray.
-
- "Created: 15.4.1996 / 16:42:52 / cg"
-!
-
setFields:f
|vals|
JavaClass setInstanceVariableStringFromFields:f in:self.
instSize := superclass instSize + f size.
-
fields := f.
+
+ f withIndexDo:[:field :index|
+ field setClass: self.
+ field setIndex: superclass instSize + index.
+ ].
+
vals := self allInstVarNames
- collect:[:nm |
- self initValueFor:nm
- ].
+ collect:[:nm |
+ self initValueFor:nm
+ ].
vals isEmpty ifTrue:[
- initValues := nil
+ initValues := nil
] ifFalse:[
- (vals detect:[:el | el notNil] ifNone:nil) isNil ifTrue:[
- initValues := nil
- ] ifFalse:[
- initValues := vals asArray
- ]
+ (vals detect:[:el | el notNil] ifNone:nil) isNil ifTrue:[
+ initValues := nil
+ ] ifFalse:[
+ initValues := vals asArray
+ ]
]
- "Created: / 15.4.1996 / 16:42:52 / cg"
- "Modified: / 6.11.1998 / 01:53:01 / cg"
+ "Created: / 15-04-1996 / 16:42:52 / cg"
+ "Modified: / 06-11-1998 / 01:53:01 / cg"
+ "Modified: / 27-07-2011 / 09:26:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setFullName:aString
@@ -1526,7 +1726,7 @@
staticFields := f.
-
+ "Modified: / 17-08-2011 / 09:26:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
setSuperclass:aClass
@@ -1554,6 +1754,15 @@
"Modified: 22.8.1997 / 15:06:45 / cg"
! !
+!JavaClass methodsFor:'private-changes management'!
+
+writingChangeWithTimeStamp:doStampIt do:aBlock
+
+ "No changes for Java classes now"
+
+ "Created: / 14-12-2010 / 18:07:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaClass methodsFor:'queries'!
canBeSubclassed
@@ -1566,6 +1775,18 @@
"Created: / 5.11.1998 / 23:04:50 / cg"
!
+containsMethodsAnnotatedWith:aJavaTypeName
+ | methods |
+
+ methods := self selectMethodsAnnotatedWith:aJavaTypeName.
+ methods size > 0 ifTrue:[ ^ true ].
+ (self name ~= #'java/lang/Object')
+ ifTrue:[ ^ superclass containsMethodsAnnotatedWith:aJavaTypeName. ].
+ ^ false.
+
+ "Created: / 02-03-2011 / 23:01:14 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
hasInterface:aJavaInterface
"return true, if I respond to all methods as
required by the argument, an aJavaInterface"
@@ -1593,25 +1814,113 @@
!
+isAnonymous
+
+ | i |
+ i := name lastIndexOf: $$.
+ i ~~ 0 ifTrue:[
+ i + 1 to: name size do:[:i|
+ (name at:i) isDigit ifFalse:[^false].
+ ].
+ ^true
+ ].
+ ^false
+
+ "
+ (Java at:'java.io.Console') isAnonymous
+ (Java at:'java.io.Console$1') isAnonymous
+ (Java at:'java.io.Console$1$1') isAnonymous
+ (Java at:'sun.misc.Launcher$ExtClassLoader') isAnonymous
+
+ "
+
+ "Created: / 18-03-1997 / 17:48:01 / cg"
+ "Created: / 07-08-2011 / 15:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaArrayClass
+
+ ^false
+
+ "Created: / 05-02-2011 / 22:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
isJavaClass
^ self ~~ JavaClass
"Created: 18.3.1997 / 17:48:01 / cg"
!
+isJavaClassType
+
+ ^self isInterface not
+
+ "
+ (Java classForName:'java.lang.Class') isJavaClassType
+ "
+
+ "Created: / 11-02-2011 / 08:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaInterfaceType
+
+ ^self isInterface
+
+ "
+ (Java classForName:'java.lang.Class') isJavaInterfaceType
+ "
+
+ "Created: / 11-02-2011 / 08:09:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
isJavaMethodRef
^ false
"Created: / 9.11.1999 / 15:42:10 / cg"
!
+isJavaPrimitiveType
+
+ ^false
+
+ "
+ (Java classForName:'java.lang.Class') isJavaPrimitiveType
+ ByteArray isJavaPrimitiveType
+ "
+
+ "Created: / 21-12-2010 / 23:03:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaReferenceType
+
+ ^true
+
+ "
+ (Java classForName:'java.lang.Class') isJavaReferenceType
+ "
+
+ "Created: / 20-12-2010 / 21:54:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isJavaType
+
+ ^true
+
+ "
+ (Java classForName:'java.lang.Class') isJavaType
+ "
+
+ "Created: / 20-12-2010 / 21:53:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
isUnresolved
"return true, if the receiver is unresolved;
javaClasses are never; JavaUnresolvedClasses are always"
^ false
- "Modified: / 7.5.1998 / 12:23:14 / cg"
+ "Modified: / 07-05-1998 / 12:23:14 / cg"
+ "Created: / 06-03-2011 / 22:57:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
nameInBrowser
@@ -1641,6 +1950,16 @@
"Modified: / 19.10.1998 / 20:07:24 / cg"
!
+selectMethodsAnnotatedWith:aJavaTypeName
+ ^ self methodDictionary values select:
+ [:method |
+ (method annotations
+ ifNotNil:[ method annotations runtimeVisible at:aJavaTypeName ifAbsent:nil ])
+ isNil not ]
+
+ "Created: / 02-03-2011 / 23:06:42 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
supportsMethodCategories
^ self isJavaClass not
@@ -1649,25 +1968,104 @@
!
typeName
- ^ 'L' , self fullName
+ ^ 'L' , self fullName , ';'.
"
- (Java at:'java.util.Stack') typeName
- "
-
- "Modified: / 10.2.1998 / 17:13:26 / cg"
+ (Java at:'java.util.Stack') typeName"
+
+ "Modified: / 10-02-1998 / 17:13:26 / cg"
+ "Modified: / 02-03-2011 / 22:48:40 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaClass methodsFor:'queries-protocol'!
+
+equalsOrIsSubclassOf: aJavaClass
+ self = aJavaClass ifTrue: [^true].
+ ^ self isSubclassOf:aJavaClass.
+
+ "Created: / 30-05-2011 / 23:07:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+includesBehavior: aClass
+
+ ^(aClass isJavaClass not or:[aClass isInterface not])
+ ifTrue:[super includesBehavior: aClass]
+ ifFalse:[self == aClass or:[self allInterfaces includes: aClass]].
+
+ "Created: / 05-02-2011 / 23:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2011 / 09:12:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isSubclassOf: aJavaClass
+|tmpClass|
+
+tmpClass := self superclass.
+[tmpClass isJavaClass] whileTrue: [tmpClass = aJavaClass ifTrue:[^true]. tmpClass := tmpClass superclass].
+^false.
+
+ "Created: / 13-04-2011 / 23:18:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClass methodsFor:'reflection'!
+
+lookupFieldByNameAndType: aJavaNameAndType
+
+ | field cls |
+
+ cls := self.
+ [ cls ~= JavaObject ] whileTrue: [
+ field := cls fields detect:
+ [:each |
+ each name = aJavaNameAndType name
+ "and: [ each signatureWithoutTypeVariables = aJavaNameAndType descriptor ]"]
+ ifNone:[nil].
+ field ifNotNil:[^field].
+ cls := cls superclass.
+ ].
+ self breakPoint: #jv.
+ ^nil
+
+ "Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:06:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-08-2011 / 00:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupMethodByNameAndType: aJavaNameAndType
+ ^ self lookupMethodFor: aJavaNameAndType selector.
+
+ "Created: / 11-04-2011 / 21:28:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lookupStaticFieldByNameAndType: aJavaNameAndType
+
+ | field cls |
+
+ cls := self.
+ [ cls ~= JavaObject ] whileTrue: [
+ field := cls staticFields detect:
+ [:each |
+ each name = aJavaNameAndType name
+ "and: [ each signature = aJavaNameAndType descriptor ]"]
+ ifNone:[nil].
+ field ifNotNil:[^field].
+ cls := cls superclass.
+ ].
+ self breakPoint: #jv.
+ ^nil
+
+ "Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:06:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-08-2011 / 00:46:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupStaticMethodByNameAndType: aJavaNameAndType
+ ^ self lookupMethodFor: aJavaNameAndType selector.
+
+ "Created: / 28-04-2011 / 22:50:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClass methodsFor:'special'!
-arrayClass
-"/ self halt.
- ^ Array
-
- "Created: / 10.11.1998 / 02:07:32 / cg"
- "Modified: / 8.1.1999 / 14:11:34 / cg"
-!
-
asClassPointerRef
"/ self halt.
^ self
@@ -1676,12 +2074,30 @@
"Modified: / 8.1.1999 / 14:11:26 / cg"
!
+deinit
+
+ accessFlags := accessFlags bitClear: A_INITIALIZED.
+
+ "Created: / 25-10-2010 / 12:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
deref
^ self
"Created: / 10.11.1998 / 02:08:06 / cg"
!
+javaArrayClass
+ "/ self halt.
+ "/ ^ Array
+
+ ^ JavaVM javaArrayClassFor:self
+
+ "Created: / 10-11-1998 / 02:07:32 / cg"
+ "Modified: / 08-01-1999 / 14:11:34 / cg"
+ "Modified: / 19-12-2010 / 16:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
updateClassRefsFrom:oldClass to:newClass
self == oldClass ifTrue:[
self makeObsolete.
@@ -1706,8 +2122,130 @@
"Modified: / 4.2.1998 / 22:08:19 / cg"
! !
+!JavaClass methodsFor:'support - refactorings'!
+
+directlyDefinesMethod: aSelector
+
+ ^self methodDictionary includes: aSelector.
+
+ "Created: / 16-03-2011 / 14:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+metaclass
+
+ ^self class
+
+ "Created: / 16-03-2011 / 14:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaClass methodsFor:'support - sUnit'!
+
+asTestCase
+ self isTestletLike
+ ifTrue: [^ TestletTestCaseProxy for: self ].
+ ^ JUnitTestCaseProxy for: self.
+
+ "Created: / 04-03-2011 / 08:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-04-2011 / 17:52:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-05-2011 / 18:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+asTestlet
+ ^ TestletTestCaseProxy for: self
+
+ "Created: / 29-04-2011 / 16:53:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+buildSuite
+ self isTestletLike ifTrue: [ ^(TestletTestCaseProxy for: self) buildSuite ].
+^ (JUnitTestCaseProxy for: self) buildSuite
+
+ "Created: / 29-05-2011 / 22:45:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isTestCaseLike
+ | junit_framework_TestCase org_junit_Test |
+
+ "try JUnit 4.x"
+ [ org_junit_Test := JavaVM classForName: 'org.junit.Test' ] on: Error
+ do:
+ [ "nothing"
+ ].
+ (org_junit_Test notNil
+ and: [ self containsMethodsAnnotatedWith: org_junit_Test typeName ])
+ ifTrue: [ ^ true ].
+ "Try jUnit 3.x"
+
+ [ junit_framework_TestCase := JavaVM
+ classForName: 'junit.framework.TestCase' ] on: Error
+ do:
+ [ "nothing"
+ ].
+ junit_framework_TestCase ifNotNil:
+ [ self == org_junit_Test ifTrue: [ ^ false ].
+ (self includesBehavior: junit_framework_TestCase) ifTrue: [ ^ true ] ].
+ ^ self isTestletLike.
+
+ "
+ JAVA::java::lang::Object isTestCaseLike
+ JAVA::stx::libjava::tests::junit::JUnit3Tests isTestCaseLike"
+
+ "Created: / 28-02-2011 / 21:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 06-03-2011 / 14:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-05-2011 / 22:48:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isTestSelector: selector
+
+ "Hack, you're right, blame on me"
+
+ | junit_framework_TestCase m |
+
+ ((selector == #'test(Lgnu/testlet/TestHarness;)V')
+ and:[self ~~ (Java at:'gnu.testlet.Testlet')])
+ ifTrue:[^true].
+
+
+ junit_framework_TestCase := Java at:'junit.framework.TestCase'.
+ (junit_framework_TestCase notNil and:
+ [self includesBehavior:junit_framework_TestCase])
+ ifTrue:[^selector startsWith: 'test'].
+
+ m := self lookupSelector: selector.
+ "Sorry fo that, but I need this method to be fast"
+ ^m annotations runtimeVisible includesKey: 'Lorg/junit/Test;'.
+
+ "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 04-03-2011 / 07:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isTestletLike
+ | testlet |
+
+
+ [ testlet := JavaVM classForName: 'gnu.testlet.Testlet' ] on: Error
+ do:
+ [ "nothing"
+ ].
+ testlet ifNil:[^ false].
+ self == testlet ifTrue: [ ^ false ].
+ (self includesBehavior: testlet) ifTrue: [ ^ true ].
+ ^ false.
+
+ "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 06-03-2011 / 14:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 29-04-2011 / 17:02:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
!JavaClass class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaClass.st,v 1.127 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaClass.st,v 1.127 2011/08/18 18:42:48 vrany Exp $'
! !
+
+JavaClass initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassAnnotationContainer.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,102 @@
+"
+ 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' }"
+
+JavaAnnotationContainer subclass:#JavaClassAnnotationContainer
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+!JavaClassAnnotationContainer 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.
+
+"
+! !
+
+!JavaClassAnnotationContainer class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassContentRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,223 @@
+"
+ 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' }"
+
+JavaRef2 subclass:#JavaClassContentRef2
+ instanceVariableNames:'classRefIndex nameAndTypeIndex classCache nameAndTypeCache'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaClassContentRef2 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.
+
+"
+! !
+
+!JavaClassContentRef2 class methodsFor:'instance creation'!
+
+in: aJavaConstantPool withNameAndTypeAt: nameAndTypeCPIndex andClassAt: classRefCPIndex
+ ^ self basicNew
+ initializeIn: aJavaConstantPool
+ withNameAndTypeAt: nameAndTypeCPIndex
+ andClassAt: classRefCPIndex.
+
+ "Created: / 12-05-2011 / 18:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassContentRef2 methodsFor:'accessing'!
+
+classRef
+ ^ constantPool at: classRefIndex.
+
+ "Modified: / 12-05-2011 / 18:38:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+descriptor
+ ^ self nameAndType descriptor.
+
+ "Created: / 08-04-2011 / 15:08:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+name
+ ^ self nameAndType name.
+
+ "Created: / 08-04-2011 / 13:54:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+nameAndType
+ ^ constantPool at: nameAndTypeIndex.
+
+ "Created: / 11-04-2011 / 19:57:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+selector
+ ^ self nameAndType selector.
+
+ "Created: / 11-04-2011 / 20:38:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:39:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+signature
+ ^ self nameAndType signature.
+
+ "Created: / 20-05-2011 / 17:10:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassContentRef2 methodsFor:'comparing'!
+
+= anotherJavaRef
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+!
+
+hash
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+! !
+
+!JavaClassContentRef2 methodsFor:'initialization'!
+
+initializeIn: aJavaConstantPool withNameAndTypeAt: nameAndTypeCPIndex andClassAt: classRefCPIndex
+ constantPool := aJavaConstantPool.
+ classRefIndex := classRefCPIndex.
+ nameAndTypeIndex := nameAndTypeCPIndex.
+ super initialize.
+
+ "Created: / 12-05-2011 / 18:37:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassContentRef2 methodsFor:'printing'!
+
+displayString
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ self classRef displayString , '.' , self name
+
+ "Created: / 14-08-2011 / 21:18:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+printString
+ ^ 'JavaClassContentRef: class=[' , self classRef printString , '] name=['
+ , self nameAndType printString , ']'.
+
+ "Created: / 10-05-2011 / 14:15:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:40:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassContentRef2 methodsFor:'resolving'!
+
+invalidate
+ self classRef invalidate.
+ classCache := nil.
+ nameAndTypeCache := nil.
+ super invalidate.
+
+ "Created: / 13-04-2011 / 12:21:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 18-05-2011 / 12:41:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invalidateForClass: internalJavaClassName
+ "Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
+ Return true, if reference was invalidated."
+
+ (self classRef invalidateForClass: internalJavaClassName)
+ ifTrue:
+ [ self invalidate.
+ ^ true ].
+ ^ false.
+
+ "Modified: / 12-05-2011 / 18:40:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassContentRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassOrInterfaceTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaClassOrInterfaceTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaClassOrInterfaceTypeNode 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.
+
+"
+! !
+
+!JavaClassOrInterfaceTypeNode methodsFor:'accessing'!
+
+selector
+ ^ 'L'
+
+ "Created: / 17-12-2010 / 16:38:17 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaClassOrInterfaceTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaClassReader.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaClassReader.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,14 +12,41 @@
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:#JavaClassReader
instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots
- constSlot'
- classVariableNames:'Verbose Silent AbsolutelySilent LazyClassLoading
- InvalidClassFormatSignal ClassLoaderQuerySignal'
+ constSlot classBeingLoaded'
+ classVariableNames:'Verbose AnnotationsVerbose Silent AbsolutelySilent
+ LazyClassLoading InvalidClassFormatSignal ClassLoaderQuerySignal
+ JavaArchiveCache'
poolDictionaries:''
category:'Languages-Java-Support'
!
@@ -24,8 +55,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,30 +68,60 @@
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.
+
"
-
-
! !
!JavaClassReader class methodsFor:'initialization'!
initialize
- InvalidClassFormatSignal := Signal new mayProceed:true.
- InvalidClassFormatSignal notifierString:'class load failure'.
- InvalidClassFormatSignal nameClass:self message:#invalidClassFormatSignal.
-
- Verbose := false.
+ InvalidClassFormatSignal := Signal new mayProceed: true.
+ InvalidClassFormatSignal notifierString: 'class load failure'.
+ InvalidClassFormatSignal nameClass: self message: #invalidClassFormatSignal.
+ Verbose := false.
Silent := true.
AbsolutelySilent := false.
-
- LazyClassLoading := false. "/ true.
- ClassLoaderQuerySignal := QuerySignal new
+
+ "/LazyClassLoading := false.
+
+ LazyClassLoading := true.
+ ClassLoaderQuerySignal := QuerySignal new.
+ JavaArchiveCache := CacheDictionary new: 32.
+ AnnotationsVerbose := false.
"
- JavaClassReader initialize
- "
-
- "Modified: / 27.1.1998 / 17:54:23 / cg"
+ JavaClassReader initialize"
+
+ "Modified: / 27-01-1998 / 17:54:23 / cg"
+ "Modified: / 17-12-2010 / 17:37:45 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 10-05-2011 / 23:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-07-2011 / 17:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaClassReader class methodsFor:'Signal constants'!
@@ -75,18 +140,38 @@
!JavaClassReader class methodsFor:'constants'!
-fileMajorVersion
- ^ 45
-
- "Modified: / 7.5.1998 / 13:14:27 / cg"
- "Created: / 7.5.1998 / 13:16:35 / cg"
+fileMajorVersions
+ ^#(
+ 46 "Java 1.2"
+ 47 "???"
+ 48 "???"
+ 49 "Java 5"
+ 50 "Java 6"
+ ).
+
+ "
+ JSR 202:
+ The Java virtual machine implementation of Sun's JDK release 1.0.2 supports
+ class file format versions 45.0 through 45.3 inclusive. Sun's JDK releases
+ 1.1.X can support class file formats of versions in the range 45.0 through
+ 45.65535 inclusive. For k > 1 implementations of version 1.k of the Java 2
+ platform can support class file formats of versions in the range 45.0 through
+ 44+k.0 inclusive.
+"
+
+ "Created: / 19-10-2010 / 21:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-06-2011 / 21:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-06-2011 / 22:50:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 18-08-2011 / 19:32:37 / jv"
!
-fileMinorVersion
- ^ 3
-
- "Modified: / 7.5.1998 / 13:14:27 / cg"
- "Created: / 7.5.1998 / 13:16:40 / cg"
+fileMinorVersions
+ ^ #(
+ 3 "Java 1.2"
+ 0 "Java 6"
+ )
+
+ "Created: / 19-10-2010 / 21:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
magic_LSB
@@ -104,6 +189,17 @@
!JavaClassReader class methodsFor:'debugging'!
+annotationsVerbose:aBoolean
+ AnnotationsVerbose := aBoolean
+
+ "
+ Java flushClasses.
+ JavaClassReader verbose:true
+ JavaClassReader verbose:false"
+
+ "Created: / 25-02-2011 / 12:25:23 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
verbose:aBoolean
Verbose := aBoolean
@@ -144,112 +240,178 @@
"Modified: / 20.10.1998 / 17:24:54 / cg"
!
-loadClassLazy:aClassName ignoring:classesBeingLoaded
+loadClassLazy: internalJavaClassName
+ ^ self loadClassLazy: internalJavaClassName ignoring: Set new.
+
+ "Created: / 08-04-2011 / 18:00:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 11-04-2011 / 19:31:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+loadClassLazy: className classpath: classpath ignoring: classesBeingLoaded
"private helper:
reads a class, installs and returns it.
The class is searched along the ClassPath.
This is a partial load (to load other classes):
- - The classes stringConstants are not fixed to be JavaStrings
+ - The classes stringConstants are not fixed to be JavaStrings
(i.e they are still ST-Strings).
- The class is NOT initialized."
-
- |rslt clsName cls loadedClass|
-
- (aClassName endsWith:';') ifTrue:[
- ('oops - loading of ' , aClassName , ' attempted') printNL.
- self halt:'should not happen'.
- ^ nil
- ].
- (aClassName endsWith:'[]') ifTrue:[
- ('oops - loading of ' , aClassName , ' attempted') printNL.
- self halt:'should not happen'.
- ^ nil
- ].
-
- clsName := aClassName.
- (clsName includes:$.) ifTrue:[
- clsName := clsName asString copyReplaceAll:$. with:$/
- ].
-
- (classesBeingLoaded notNil and:[classesBeingLoaded includes:clsName]) ifTrue:[
- ('oops - recursive load of ' , clsName , ' attempted') printNL.
- self halt:'should not happen'.
- ^ JavaUnresolvedClassConstant fullName:clsName
- ].
-
- (cls := Java at:clsName) notNil ifTrue:[
- ('oops - ' , clsName , ' is already loaded') printNL.
- self halt:clsName , ' is already loaded - should not happen'.
- ^ cls
- ].
-
- classesBeingLoaded isNil ifTrue:[
- loadedClass := Set with:clsName
- ] ifFalse:[
- loadedClass := Set withAll:classesBeingLoaded.
- loadedClass add:clsName.
+
+ | rslt clsName cls loadedClass |
+
+ clsName := className utf8Encoded.
+ (clsName endsWith: ';')
+ ifTrue:
+ [ (clsName startsWith: '[L')
+ ifTrue: [ clsName := clsName copyFrom: 3 to: clsName size - 1. ]
+ ifFalse:
+ [ ('oops - loading of ' , clsName , ' attempted') printNL.
+ self halt: 'should not happen'.
+ ^ nil. ] ].
+ (clsName endsWith: '[]')
+ ifTrue:
+ [ ('oops - loading of ' , clsName , ' attempted') printNL.
+ self halt: 'should not happen'.
+ ^ nil ].
+ (clsName includes: $.)
+ ifTrue: [ clsName := clsName asString copyReplaceAll: $. with: $/ ].
+ (classesBeingLoaded notNil and: [ classesBeingLoaded includes: clsName ])
+ ifTrue:
+ [ ('oops - recursive load of ' , clsName , ' attempted') printNL.
+ self halt: 'should not happen'.
+ ^ JavaUnresolvedClassConstant fullName: clsName ].
+ (cls := Java at: clsName) notNil
+ ifTrue:
+ [ ('oops - ' , clsName , ' is already loaded') printNL.
+
+ "/self halt:clsName , ' is already loaded - should not happen'.
+
+ ^ cls ].
+ classesBeingLoaded isNil
+ ifTrue: [ loadedClass := Set with: clsName ]
+ ifFalse:
+ [ loadedClass := Set withAll: classesBeingLoaded.
+ loadedClass add: clsName. ].
+ classpath do:
+ [:path |
+ | nm p zar entry zipFile read |
+
+ Verbose == true
+ ifTrue: [ Transcript showCR: 'trying ' , path asFilename pathName , ' ...'. ].
+ p := path.
+ p asFilename isDirectory
+ ifTrue:
+ [ (p endsWith: Filename separator)
+ ifFalse: [ p := p , (Filename separator asString) ].
+ (Array
+ with: clsName
+ with: clsName asLowercase
+ with: clsName asUppercase) do:
+ [:tryName |
+ nm := p , tryName , '.class'.
+ Verbose == true ifTrue: [ Transcript showCR: 'trying ' , nm , ' ...'. ].
+ nm asFilename exists
+ ifTrue:
+ [ (Java isExcludedFromClassPath: nm)
+ ifFalse:
+ [ rslt := self loadFileLazy: nm ignoring: loadedClass.
+ rslt notNil ifTrue: [ ^ rslt ]. ] ]. ] ]
+ ifFalse:
+ [ Verbose == true
+ ifTrue:
+ [ Transcript
+ showCR: 'trying ' , (p asFilename withSuffix: 'jar') pathName , ' ...'.
+ Transcript
+ showCR: 'and ' , (p asFilename withSuffix: 'zip') pathName , ' ...'. ].
+ ((zipFile := p asFilename withSuffix: 'jar') exists
+ or: [ (zipFile := p asFilename withSuffix: 'zip') exists ])
+ ifTrue:
+ [
+ zar := JavaArchiveCache at: zipFile
+ ifAbsentPut: [ ZipArchive oldFileNamed: zipFile ].
+ read :=
+ [ nm := clsName , '.class'.
+ entry := zar extract: nm.
+ entry notNil
+ ifTrue:
+ [ (Java isExcludedFromClassPath: nm)
+ ifFalse:
+ [ rslt := self loadStreamLazy: (entry readStream) ignoring: loadedClass.
+ rslt notNil ifTrue: [ ^ rslt ]. ] ] ].
+ JavaClassReader invalidClassFormatSignal handle:
+ [ "Kludge, sometimes zar gets corrupted"
+
+ zar := JavaArchiveCache at: zipFile put: (ZipArchive oldFileNamed: zipFile).
+ read value ]
+ do: [ read value ]. ] ] ].
+ ^nil.
+
+ "Modified: / 14-08-1997 / 11:38:42 / stefan"
+ "Modified: / 17-09-1998 / 20:51:25 / cg"
+ "Modified: / 21-03-2011 / 12:42:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 08:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadClassLazy: aClassName ignoring: classesBeingLoaded
+
+ | class loader |
+ class := self loadClassLazy: aClassName classpath: Java release classPath ignoring: classesBeingLoaded.
+ class notNil ifTrue:[^class].
+ class := self loadClassLazy: aClassName classpath: Java classPath ignoring: classesBeingLoaded.
+ class isNil ifTrue:[^nil].
+ loader := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl.
+ loader ifNil:[
+ loader := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'.
].
-
- Java classPath do:[:path |
- |nm p zar entry zipFile|
-
- Verbose == true ifTrue:[
- Transcript showCR:'trying ' , path asFilename pathName, ' ...'.
- ].
-
- p := path.
- p asFilename isDirectory ifTrue:[
- (p endsWith:Filename separator) ifFalse:[
- p := p , (Filename separator asString)
- ].
- (Array
- with:clsName
- with:clsName asLowercase
- with:clsName asUppercase)
- do:[:tryName |
- nm := p , tryName , '.class'.
- Verbose == true ifTrue:[
- Transcript showCR:'trying ' , nm, ' ...'.
- ].
- nm asFilename exists ifTrue:[
- (Java isExcludedFromClassPath:nm) ifFalse:[
- rslt := self loadFileLazy:nm ignoring:loadedClass.
- rslt notNil ifTrue:[^ rslt].
- ]
- ].
- ]
- ] ifFalse:[
- Verbose == true ifTrue:[
- Transcript showCR:'trying ' , (p asFilename withSuffix:'jar') pathName, ' ...'.
- Transcript showCR:'and ' , (p asFilename withSuffix:'zip') pathName, ' ...'.
- ].
- ((zipFile := p asFilename withSuffix:'jar') exists
- or:[(zipFile := p asFilename withSuffix:'zip') exists]) ifTrue:[
- zar := ZipArchive oldFileNamed:zipFile.
- (Array
- with:clsName
- with:clsName asLowercase
- with:clsName asUppercase)
- do:[:tryName |
- nm := tryName , '.class'.
- entry := zar extract:nm.
- entry notNil ifTrue:[
- (Java isExcludedFromClassPath:nm) ifFalse:[
- rslt := self loadStreamLazy:(entry readStream) ignoring:loadedClass.
- rslt notNil ifTrue:[^ rslt].
- ]
- ]
- ]
- ]
- ]
- ].
-
- ('JAVA [info]: no file found for: ' , clsName) infoPrintCR.
- ^ nil
-
- "Modified: / 14.8.1997 / 11:38:42 / stefan"
- "Modified: / 17.9.1998 / 20:51:25 / cg"
+ class classLoader: loader.
+ ^ class
+
+ "Modified: / 14-08-1997 / 11:38:42 / stefan"
+ "Modified: / 17-09-1998 / 20:51:25 / cg"
+ "Modified: / 21-03-2011 / 12:42:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-08-2011 / 09:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadClassesIn: directory
+ "load all classes (.class files, strictly speaking) found in given directory.
+ The argument is string containing the name of the directory.
+
+ Returns a set of loaded classes."
+
+ ^self loadClassesIn: directory matching: '*'
+
+ "Modified: / 11-06-2011 / 13:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadClassesIn: directory matching: pattern
+ "load all classes (.class files, strictly speaking) found in given directory.
+ The arguments are a string containing the name of the directory
+ and a class name pattern. Only classes matching the pattern are loaded.
+ class names are matched using String>>matches:.
+
+ Returns a set of loaded classes."
+
+ | dir dirString className loadedClasses |
+
+ dir := directory asFilename asAbsoluteFilename.
+ loadedClasses := Set new.
+ Java addToClassPath: dir pathName.
+ dir recursiveDirectoryContentsAsFilenamesDo:
+ [:filename |
+ (filename isRegularFile and: [ filename suffix = #class ])
+ ifTrue:
+ [ dirString := dir pathName.
+ className := filename withoutSuffix pathName.
+ className := className subString: dirString size + 2 to: className size.
+ className := className copyReplaceAll: (Filename separator) with: $..
+ (className matches: pattern) ifTrue:
+ [loadedClasses add: (self loadClass: className)]]].
+
+ ^ loadedClasses.
+
+ "Modified: / 29-04-2011 / 17:43:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 11-06-2011 / 13:34:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-06-2011 / 16:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
loadFile:aFilename
@@ -363,18 +525,27 @@
"Created: / 30.3.1998 / 17:59:02 / cg"
!
-loadSystemClass:aClassName
+loadSystemClass: aClassName
"reads a class, installs and returns it.
The classes string constants are resolved & <clinit> is called,
if it implements it.
This only loads local classes (i.e. any Java classReader is not used)"
-
- |rslt|
-
- rslt := self loadClassLazy:aClassName ignoring:(Set new).
- rslt notNil ifTrue:[self postLoadActions].
-
- ^ rslt
+
+ | class classLoaderClass |
+
+ class := JavaClassReader loadClassLazy: aClassName ignoring: (Set new).
+ class isNil ifTrue: [ ^nil].
+ self assert: class constantPool owner == class.
+ JavaClassReader postLoadActions.
+"/ "Set the classloader iff the VM is booted"
+"/ "Rubbish, do not do that"
+"/ JavaVM booted ifTrue:[
+"/ classLoaderClass := Java at:'java.lang.ClassLoader'.
+"/ classLoaderClass notNil ifTrue:[
+"/ class classLoader: (classLoaderClass instVarNamed:#scl).
+"/ ].
+"/ ].
+ ^ class
"
JavaClassReader loadSystemClass:'awt/Component'
@@ -383,11 +554,54 @@
JavaClassReader loadSystemClass:'java/lang/Object'
JavaClassReader loadSystemClass:'java/lang/AbstractMethodError'
- JavaClassReader loadSystemClass:'java/lang/Thread'
+ JavaClassReader loadSystemClass:'java/lang/Thread'"
+
+ "Created: / 20-10-1998 / 17:24:40 / cg"
+ "Modified: / 13-05-2011 / 17:50:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadSystemClass: aClassName classpath: classpath
+ "reads a class, installs and returns it.
+ The classes string constants are resolved & <clinit> is called,
+ if it implements it.
+ This only loads local classes (i.e. any Java classReader is not used)"
+
+ | class loader |
+
+ class := JavaClassReader loadClassLazy: aClassName classpath: classpath ignoring: (Set new).
+ class isNil ifTrue: [ ^nil].
+ classpath = Java release classPath ifFalse:[
+ loader := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl.
+ loader ifNil:[
+ loader := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'.
+ ].
+ class classLoader: loader.
+ ].
+ self assert: class constantPool owner == class.
+ JavaClassReader postLoadActions.
+"/ "Set the classloader iff the VM is booted"
+"/ "Rubbish, do not do that"
+"/ JavaVM booted ifTrue:[
+"/ classLoaderClass := Java at:'java.lang.ClassLoader'.
+"/ classLoaderClass notNil ifTrue:[
+"/ class classLoader: (classLoaderClass instVarNamed:#scl).
+"/ ].
+"/ ].
+ ^ class
+
"
-
- "Modified: / 3.1.1998 / 22:36:13 / cg"
- "Created: / 20.10.1998 / 17:24:40 / cg"
+ JavaClassReader loadSystemClass:'awt/Component'
+ JavaClassReader loadSystemClass:'awt/Button'
+ JavaClassReader loadSystemClass:'browser/AddButton'
+
+ JavaClassReader loadSystemClass:'java/lang/Object'
+ JavaClassReader loadSystemClass:'java/lang/AbstractMethodError'
+ JavaClassReader loadSystemClass:'java/lang/Thread'"
+
+ "Created: / 20-10-1998 / 17:24:40 / cg"
+ "Modified: / 13-05-2011 / 17:50:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 09:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
postLoadActions
@@ -480,7 +694,7 @@
|inStream javaClass|
- Silent ifFalse:[
+ "Silent"false ifFalse:[
'reading ' print. aFilename print. ' ...' printCR.
].
@@ -502,10 +716,12 @@
' ... loaded ' print. javaClass displayString printNL.
].
+
^ javaClass
- "Created: / 15.4.1996 / 14:58:53 / cg"
- "Modified: / 9.5.1998 / 01:44:24 / cg"
+ "Created: / 15-04-1996 / 14:58:53 / cg"
+ "Modified: / 09-05-1998 / 01:44:24 / cg"
+ "Modified: / 09-08-2011 / 15:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readStream:aStream
@@ -519,21 +735,22 @@
"Modified: 14.8.1997 / 19:51:50 / cg"
!
-readStream:aStream ignoring:classesBeingLoaded
+readStream: aStream ignoring: classesBeingLoaded
"reads a class from aStream and returns it.
The JavaClass is not installed as global"
-
- |javaClass|
-
- javaClass := self new readStream:aStream ignoring:classesBeingLoaded.
-
- AbsolutelySilent ifFalse:[
- ' ... loaded ' print. javaClass displayString printNL.
- ].
-
+
+ | javaClass |
+
+ javaClass := JavaClassReader new readStream: aStream ignoring: classesBeingLoaded.
+ AbsolutelySilent
+ ifFalse:
+ [ ' ... loaded ' print.
+ javaClass displayString printNL. ].
^ javaClass
- "Modified: / 30.3.1998 / 18:14:40 / cg"
+ "Modified: / 30-03-1998 / 18:14:40 / cg"
+ "Modified: / 09-05-2011 / 23:15:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-07-2011 / 17:21:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readStream:aStream loader:aClassLoader
@@ -551,28 +768,29 @@
"Modified: 15.8.1997 / 01:00:35 / cg"
!
-readStream:aStream loader:aClassLoader loadUnresolved:loadUnresolved
+readStream: aStream loader: aClassLoader loadUnresolved: loadUnresolved
"reads a class from aStream and returns it.
The JavaClass is installed as global.
If new classes are required to be loaded, aClassLoader is
asked to do it. If aClassLoader is nil, a new standard loader
is created."
-
- |javaClass|
-
- ClassLoaderQuerySignal answer:aClassLoader
- do:[
- javaClass := self readStream:aStream ignoring:(Set new).
- javaClass notNil ifTrue:[
- self postLoadActions:loadUnresolved.
- Java at:(javaClass fullName asSymbol) put:javaClass.
- JavaUnresolvedConstant resolveFor:javaClass.
- ].
- ].
+
+ | javaClass |
+
+ ClassLoaderQuerySignal answer: aClassLoader
+ do:
+ [ javaClass := self readStream: aStream ignoring: (Set new).
+ javaClass notNil
+ ifTrue:
+ [ JavaClassReader postLoadActions: loadUnresolved.
+ Java at: (javaClass fullName asSymbol) put: javaClass.
+ JavaUnresolvedConstant resolveFor: javaClass. ]. ].
^ javaClass
- "Created: / 15.8.1997 / 00:59:24 / cg"
- "Modified: / 23.1.1998 / 17:14:09 / cg"
+ "Created: / 15-08-1997 / 00:59:24 / cg"
+ "Modified: / 23-01-1998 / 17:14:09 / cg"
+ "Modified: / 09-05-2011 / 23:15:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-07-2011 / 17:21:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
resolveClass:aJavaClass
@@ -636,183 +854,193 @@
"Modified: / 20.10.1998 / 17:59:09 / cg"
! !
+!JavaClassReader class methodsFor:'mode setting'!
+
+useOldClassReader
+ self error: 'Old class reader should not be used anymore!!'.
+UsedJavaClassReaderClass := JavaClassReader.
+
+ "Created: / 09-05-2011 / 23:11:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassReader methodsFor:'accessing'!
+
+constants
+^ constants.
+
+ "Created: / 10-05-2011 / 13:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+constants: aJavaConstantPool
+ constants := aJavaConstantPool.
+
+ "Created: / 10-05-2011 / 13:48:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+stream
+^ inStream.
+
+ "Created: / 09-05-2011 / 23:22:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+stream:aReadStream
+ inStream := aReadStream.
+
+ "Created: / 09-05-2011 / 23:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
!JavaClassReader methodsFor:'file reading'!
-readClassFileIgnoring:classesbeingLoaded
+readClassFileIgnoring: classesbeingLoaded
"reads a class from inStream and returns it.
The JavaClass is not installed as global and its constants
(especially strings) may not be fully resolved."
-
- |magic
- access_flags this_class this_class_index super_class super_class_index
- realSuperClass this_class_ref existingSuperClass
- fields interfaces staticFields nStatic
- jSuperClass loader superClassName thisClassName existing_class
- thisMetaClass|
+
+ | magic access_flags this_class_index super_class super_class_index this_class_ref existingSuperClass fields interfaces staticFields nStatic superClassName thisClassName existing_class thisMetaClass |
"/
"/ read magic, determine byte order
"/
msb := true.
- magic := inStream nextUnsignedLongMSB:true.
- magic = (self class magic_MSB) ifFalse:[
- magic = (self class magic_LSB) ifFalse:[
- InvalidClassFormatSignal raiseErrorString:'not a java class file'.
- ^ nil
- ].
- msb := false.
- Verbose ifTrue:[Transcript showCR:'file is lsb'].
- ] ifTrue:[
- Verbose ifTrue:[Transcript showCR:'file is msb'].
- ].
-
+ magic := inStream nextUnsignedLongMSB: true.
+ magic = (self class magic_MSB)
+ ifFalse:
+ [ magic = (self class magic_LSB)
+ ifFalse:
+ [ InvalidClassFormatSignal raiseErrorString: 'not a java class file'.
+ ^ nil ].
+ msb := false.
+ Verbose ifTrue: [ Transcript showCR: 'file is lsb' ]. ]
+ ifTrue: [ Verbose ifTrue: [ Transcript showCR: 'file is msb' ]. ].
+
"/
"/ get version
"/
- minorVsn := inStream nextUnsignedShortMSB:msb.
- majorVsn := inStream nextUnsignedShortMSB:msb.
-
- (majorVsn ~~ (self class fileMajorVersion)
- or:[minorVsn ~~ (self class fileMinorVersion)]) ifTrue:[
- Transcript show:'warning this file has version '; show:majorVsn; show:'.'; showCR:minorVsn.
- ].
-
- Verbose ifTrue:[
- Transcript show:'version = ';
- show:(majorVsn printString);
- show:'.';
- showCR:(minorVsn printString).
- ].
-
+
+ minorVsn := inStream nextUnsignedShortMSB: msb.
+ majorVsn := inStream nextUnsignedShortMSB: msb.
+ ((self class fileMajorVersions includes: majorVsn) not
+ or: [ (self class fileMinorVersions includes: minorVsn) not ])
+ ifTrue:
+ [ Transcript
+ show: 'warning this file has version ';
+ show: majorVsn;
+ show: '.';
+ showCR: minorVsn. ].
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'version = ';
+ show: (majorVsn printString);
+ show: '.';
+ showCR: (minorVsn printString). ].
+
"/
"/ get constant pool
"/
+
self readConstantPool.
-
+
"/
"/ access flags
"/
- access_flags := inStream nextUnsignedShortMSB:msb.
- this_class_index := inStream nextUnsignedShortMSB:msb.
- super_class_index := inStream nextUnsignedShortMSB:msb.
-
- super_class_index == 0 ifTrue:[
- super_class := nil
- ] ifFalse:[
- super_class := constants at:super_class_index.
- superClassName := super_class fullName.
-
- "/ special for ST-classes
- (superClassName startsWith:'smalltalk.') ifTrue:[
- "/ a Smalltalk class
- superClassName := superClassName copyFrom:11.
- existingSuperClass := Smalltalk at:superClassName asSymbol.
- existingSuperClass notNil ifTrue:[
- super_class := existingSuperClass
- ] ifFalse:[
- "/ self halt - must load superclass ...
- ]
- ] ifFalse:[
- "/ a JAVA class
- existingSuperClass := Java classNamed:superClassName.
- existingSuperClass notNil ifTrue:[
- super_class := existingSuperClass
- ] ifFalse:[
- (super_class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- Silent ifFalse:[
- 'load superClass: ' print. superClassName printCR.
- ].
- loader := ClassLoaderQuerySignal query.
- loader isNil ifTrue:[
- existingSuperClass := self class
- loadClassLazy:superClassName
- ignoring:classesbeingLoaded.
- ] ifFalse:[
- jSuperClass := loader
- perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
- with:(Java as_String:superClassName).
- existingSuperClass := JavaVM classForJavaClassObject:jSuperClass.
- ].
- existingSuperClass isNil ifTrue:[
- ('JAVA: cannot find superclass: ' , superClassName) infoPrintCR.
- "/ self halt:('cannot find superclass: ' , superClassName).
- ^ nil.
- ].
- super_class := existingSuperClass
- ] ifFalse:[
- self halt:'oops - superclass ?'
- ]
- ].
- ].
- ].
-
+
+ access_flags := inStream nextUnsignedShortMSB: msb.
+ this_class_index := inStream nextUnsignedShortMSB: msb.
+ super_class_index := inStream nextUnsignedShortMSB: msb.
+ super_class_index == 0
+ ifTrue: [ super_class := nil ]
+ ifFalse:
+ [ super_class := constants at: super_class_index.
+ superClassName := super_class fullName.
+
+ "/ special for ST-classes
+
+ (superClassName startsWith: 'smalltalk.')
+ ifTrue:
+ [ "/ a Smalltalk class
+ superClassName := superClassName copyFrom: 11.
+ existingSuperClass := Smalltalk at: superClassName asSymbol.
+ existingSuperClass notNil
+ ifTrue: [ super_class := existingSuperClass ]
+ ifFalse:
+ [ "/ self halt - must load superclass ...
+ ] ]
+ ifFalse:
+ [ "/ a JAVA class
+ super_class := Java classNamed: superClassName.
+ super_class ifNil:
+ [ super_class := self loadSuperclassIdentifiedBy: (constants at: super_class_index)
+ ignoring: classesbeingLoaded ].
+ super_class ifNil: [ self halt: 'Cannot find super class?!!' ]. ]. ].
+
"/
"/ get interfaces
"/
+
interfaces := self readInterfaces.
-
+
"/
"/ get fields
"/
+
fields := self readFieldInfofields.
-
+
"/
"/ create the fields as instVars
"/ static fields are created as class-InstVars
"/
- staticFields := fields select:[:f | f isStatic].
+
+ staticFields := fields select: [:f | f isStatic ].
nStatic := staticFields size.
-
- this_class_ref := constants at:this_class_index.
+ this_class_ref := constants at: this_class_index.
thisClassName := this_class_ref fullName.
-
+
"/ care for smalltalk classes ...
- (thisClassName startsWith:'smalltalk.') ifTrue:[
- thisClassName := thisClassName copyFrom:11.
-
- existing_class := Smalltalk at:thisClassName asSymbol.
- existing_class notNil ifTrue:[
- self halt:('overloading existing class: ', thisClassName).
- thisClassName := (thisClassName , '_new') asSymbol.
- ].
- thisMetaClass := Metaclass new.
- thisMetaClass setSuperclass:super_class class.
- thisMetaClass instSize:(super_class class instSize + nStatic).
-
- this_class := thisMetaClass new.
- this_class setSuperclass:super_class.
- this_class setName:thisClassName asSymbol.
- ] ifFalse:[
- "/ a java class
-
- this_class := JavaClass fullName:thisClassName numStatic:nStatic.
-
- nStatic ~~ 0 ifTrue:[
- fields := fields select:[:f | f isStatic not].
-
- JavaClass setInstanceVariableStringFromFields:staticFields in:this_class class.
- this_class setStaticFields:staticFields.
- this_class initializeStaticFields.
- ].
-
- this_class setAccessFlags:access_flags.
- this_class setSuperclass:super_class.
- this_class setConstantPool:constants.
-
- this_class setFields:fields.
- this_class setInterfaces:interfaces.
-
- constants owner:this_class.
- ].
-
+
+ (thisClassName startsWith: 'smalltalk.')
+ ifTrue:
+ [ thisClassName := thisClassName copyFrom: 11.
+ existing_class := Smalltalk at: thisClassName asSymbol.
+ existing_class notNil
+ ifTrue:
+ [ self halt: ('overloading existing class: ' , thisClassName).
+ thisClassName := (thisClassName , '_new') asSymbol. ].
+ thisMetaClass := Metaclass new.
+ thisMetaClass setSuperclass: super_class class.
+ thisMetaClass instSize: (super_class class instSize + nStatic).
+ classBeingLoaded := thisMetaClass new.
+ classBeingLoaded setSuperclass: super_class.
+ classBeingLoaded setName: thisClassName asSymbol. ]
+ ifFalse:
+ [ "/ a java class
+ classBeingLoaded := JavaClass fullName: thisClassName numStatic: nStatic.
+
+ fields := fields select: [:f | f isStatic not ].
+
+ JavaClass setInstanceVariableStringFromFields: staticFields
+ in: classBeingLoaded class.
+
+ classBeingLoaded setStaticFields: staticFields.
+ classBeingLoaded initializeStaticFields.
+ classBeingLoaded setAccessFlags: access_flags.
+ classBeingLoaded setSuperclass: super_class.
+ classBeingLoaded setConstantPool: constants.
+ classBeingLoaded setFields: fields.
+ classBeingLoaded setInterfaces: interfaces.
+ ].
+
"/
"/ get methods
"/
- self readMethodsFor:this_class.
-
- self readAttributesFor:this_class.
-
- ^ this_class
+
+ self readMethodsFor: classBeingLoaded.
+ self readAttributesFor: classBeingLoaded.
+"/ classBeingLoaded constantPool
+"/ do: [:each | self updateOwnerInCPItem: each ].
+ classBeingLoaded fields do: [:each | self updateOwnerInField: each ].
+ classBeingLoaded staticFields do: [:each | self updateOwnerInField: each ].
+ ^ classBeingLoaded.
"
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
@@ -821,11 +1049,14 @@
JavaClassReader verbose:true.
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class'
- JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'
- "
-
- "Created: / 15.4.1996 / 15:02:47 / cg"
- "Modified: / 12.11.1998 / 21:14:45 / cg"
+ JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'"
+
+ "Created: / 15-04-1996 / 15:02:47 / cg"
+ "Modified: / 12-11-1998 / 21:14:45 / cg"
+ "Modified: / 15-10-2010 / 17:37:38 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 28-01-2011 / 15:09:48 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 18-05-2011 / 15:30:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-05-2011 / 14:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readStream:aStream ignoring:classesBeingLoaded
@@ -847,148 +1078,257 @@
!JavaClassReader methodsFor:'file reading - attributes'!
-readAnnotationDefaultAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: AnnotationDefault') infoPrintCR.
- self skipAttribute:'AnnotationDefault'.
+readAnnotationDefaultAttributeFor:something
+ "/ ('JAVA [info]: unhandled attribute: AnnotationDefault') infoPrintCR.
+
+ |len startPos endPos annotationDefault|
+
+ self assert:something isJavaMethod
+ description:'AnnotationDefault may only occure for methods!!'.
+ len := inStream nextUnsignedLongMSB:msb.
+ startPos := inStream position.
+ annotationDefault := (something ensureHasAnnotations)
+ default:(JavaAnnotationDefault new
+ value:(self readAnnotationValueFor:something));
+ default.
+ endPos := inStream position.
+ inStream position:startPos.
+ annotationDefault bytes:(inStream next:len).
+ self assert:inStream position = endPos
+ description:'self readAnnotationValueFor: something is reading what it shouldn'.
+
+ "Modified: / 28-02-2011 / 17:08:28 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-03-2011 / 23:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readAnnotationFor:something
+ | typeIndex type result attrsCount |
+
+ typeIndex := inStream nextUnsignedShortMSB:msb.
+ type := constants at:typeIndex.
+ attrsCount := inStream nextUnsignedShortMSB:msb.
+ result := JavaAnnotation for:something.
+ result name:type.
+ attrsCount timesRepeat:
+ [ | nameIndex name valueIndex attr |
+
+ nameIndex := inStream nextUnsignedShortMSB:msb.
+ name := constants at:nameIndex.
+ attr := self readAnnotationValueFor:something.
+ attr name:name.
+ result values at:attr name put:attr.
+ AnnotationsVerbose
+ ifTrue:[ ('JAVA [INFO]: Reading annotation attribute: ' , name) infoPrintCR. ]. ].
+ ^ result.
+
+ "Created: / 17-12-2010 / 16:21:28 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 25-02-2011 / 12:25:36 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 27-07-2011 / 09:37:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-readAttribute:attributeName for:something
+readAnnotationValueFor:something
+ | tag result |
+
+ tag := (inStream nextByte) asCharacter.
+ tag = $e
+ ifTrue:
+ [ result := JavaAnnotationEnumValue for:something.
+ result nameIndex:(inStream nextUnsignedShortMSB:msb).
+ result valueIndex:(inStream nextUnsignedShortMSB:msb).
+ AnnotationsVerbose
+ ifTrue:
+ [ ('JAVA [INFO]: Reading annotation enum value: ' , result name printString, ' -> '
+ , result value printString) infoPrintCR ].
+ ^ result ].
+ tag = $c
+ ifTrue:
+ [ result := JavaAnnotationClassValue for:something.
+ result classIndex:(inStream nextUnsignedShortMSB:msb).
+ AnnotationsVerbose
+ ifTrue:
+ [ ('JAVA [INFO]: Reading annotation class value: ' , result name printString, ' -> '
+ , result value printString) infoPrintCR ].
+ ^ result ].
+ tag = $@
+ ifTrue:
+ [ result := JavaAnnotationNestedAnnotationValue for:something.
+ result classIndex:(inStream nextUnsignedShortMSB:msb).
+ AnnotationsVerbose
+ ifTrue:
+ [ ('JAVA [INFO]: Reading annotation nested annotation value: ' , result name printString
+ , ' -> ' , result value printString)
+ infoPrintCR ].
+ ^ result ].
+ tag = $[
+ ifTrue:
+ [ result := JavaAnnotationArrayValue for:something.
+ result count:(inStream nextUnsignedShortMSB:msb).
+ AnnotationsVerbose
+ ifTrue:[ ('JAVA [INFO]: Reading annotation array value') infoPrintCR ].
+ 1 to:result count
+ do:[:index | result values at:index put:(self readAnnotationValueFor:something) ].
+ AnnotationsVerbose
+ ifTrue:
+ [ ('JAVA [INFO]: Finished reading annotation array value: '
+ , result value printString) infoPrintCR ].
+ ^ result ].
+ result := JavaAnnotationPrimitiveValue for:something.
+ result valueIndex:(inStream nextUnsignedShortMSB:msb).
+ AnnotationsVerbose
+ ifTrue:
+ [ ('JAVA [INFO]: Finished reading annotation primitive value: '
+ , result name printString , ' -> ' , result value printString) infoPrintCR ].
+ ^ result.
+
+ "Created: / 17-12-2010 / 16:44:14 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 28-02-2011 / 16:12:09 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+readAttribute:attributeName for:something
"/ implemented JAVA attributes
- (attributeName = 'ConstantValue') ifTrue:[
- self readConstantValueAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'Code') ifTrue:[
- self readCodeAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'Exceptions') ifTrue:[
- self readExceptionsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'InnerClasses') ifTrue:[
- self readInnerClassesAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'EnclosingMethod') ifTrue:[
- self readEnclosingMethodAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'LineNumberTable') ifTrue:[
- self readLineNumberTableAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'LocalVariableTable') ifTrue:[
- self readLocalVariableTableAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'LocalVariableTypeTable') ifTrue:[
- self readLocalVariableTypeTableAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'SourceFile') ifTrue:[
- self readSourceFileAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'SourceDebugExtension') ifTrue:[
- self readSourceDebugExtensionAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'Synthetic') ifTrue:[
- self readSyntheticAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'Signature') ifTrue:[
- self readSignatureAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'Deprecated') ifTrue:[
- self readDeprecatedAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'RuntimeVisibleAnnotations') ifTrue:[
- self readRuntimeVisibleAnnotationsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'RuntimeInvisibleAnnotations') ifTrue:[
- self readRuntimeInvisibleAnnotationsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'RuntimeVisibleParameterAnnotations') ifTrue:[
- self readRuntimeVisibleParameterAnnotationsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'RuntimeInvisibleParameterAnnotations') ifTrue:[
- self readRuntimeInvisibleParameterAnnotationsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'AnnotationDefault') ifTrue:[
- self readAnnotationDefaultAttributeFor:something.
- ^ self.
- ].
-
+
+ (attributeName = 'ConstantValue')
+ ifTrue:
+ [ self readConstantValueAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'Code')
+ ifTrue:
+ [ self readCodeAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'Exceptions')
+ ifTrue:
+ [ self readExceptionsAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'InnerClasses')
+ ifTrue:
+ [ self readInnerClassesAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'EnclosingMethod')
+ ifTrue:
+ [ self readEnclosingMethodAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'LineNumberTable')
+ ifTrue:
+ [ self readLineNumberTableAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'LocalVariableTable')
+ ifTrue:
+ [ self readLocalVariableTableAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'LocalVariableTypeTable')
+ ifTrue:
+ [ self readLocalVariableTypeTableAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'SourceFile')
+ ifTrue:
+ [ self readSourceFileAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'SourceDebugExtension')
+ ifTrue:
+ [ self readSourceDebugExtensionAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'Synthetic')
+ ifTrue:
+ [ self readSyntheticAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'Signature')
+ ifTrue:
+ [ self readSignatureAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'Deprecated')
+ ifTrue:
+ [ self readDeprecatedAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'RuntimeVisibleAnnotations')
+ ifTrue:
+ [ self readRuntimeAnnotationsAttributeFor:something visible:true.
+ ^ self. ].
+ (attributeName = 'RuntimeInvisibleAnnotations')
+ ifTrue:
+ [ self readRuntimeAnnotationsAttributeFor:something visible:false.
+ ^ self. ].
+ (attributeName = 'RuntimeVisibleParameterAnnotations')
+ ifTrue:
+ [ self readRuntimeParameterAnnotationsAttributeFor:something visible:true.
+ ^ self. ].
+ (attributeName = 'RuntimeInvisibleParameterAnnotations')
+ ifTrue:
+ [ self readRuntimeParameterAnnotationsAttributeFor:something visible:false.
+ ^ self. ].
+ (attributeName = 'AnnotationDefault')
+ ifTrue:
+ [ self readAnnotationDefaultAttributeFor:something.
+ ^ self. ].
+
"/ ignored JAVA attributes
- (attributeName = 'FastJavac1.0') ifTrue:[
-"/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
- self skipAttribute:attributeName.
- ^ self.
- ].
- (attributeName = 'AbsoluteSourcePath') ifTrue:[
- ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
- self skipAttribute:attributeName.
- ^ self.
- ].
-
- (attributeName startsWith:((Character value:13) asString , 'WARNING:')) ifTrue:[
-"/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
- self skipAttribute:attributeName.
- ^ self.
- ].
-
-
+
+ (attributeName = 'FastJavac1.0')
+ ifTrue:
+ [ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
+ self skipAttribute:attributeName.
+ ^ self. ].
+ (attributeName = 'AbsoluteSourcePath')
+ ifTrue:
+ [ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
+ self skipAttribute:attributeName.
+ ^ self. ].
+ (attributeName startsWith:((Character value:13) asString , 'WARNING:'))
+ ifTrue:
+ [ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
+ self skipAttribute:attributeName.
+ ^ self. ].
+ (attributeName = 'StackMapTable')
+ ifTrue:
+ [ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
+ self readStackMapTableAttributeFor:something.
+ ^ self. ].
+
"/ implemented ST attributes
- (attributeName = 'STLiterals') ifTrue:[
- self readSTLiteralsAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'ClassRevision') ifTrue:[
- self readSTClassRevisionAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'ClassPackage') ifTrue:[
- self readSTClassPackageAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'ClassCategory') ifTrue:[
- self readSTClassCategoryAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'ClassVarNames') ifTrue:[
- self readSTClassVarNamesAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'ClassInstVarNames') ifTrue:[
- self readSTClassInstVarNamesAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'InstVarNames') ifTrue:[
- self readSTInstVarNamesAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'STCode') ifTrue:[
- self readSTCodeAttributeFor:something.
- ^ self.
- ].
- (attributeName = 'MethodCategory') ifTrue:[
- self readSTMethodCategoryAttributeFor:something.
- ^ self.
- ].
-
+
+ (attributeName = 'STLiterals')
+ ifTrue:
+ [ self readSTLiteralsAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'ClassRevision')
+ ifTrue:
+ [ self readSTClassRevisionAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'ClassPackage')
+ ifTrue:
+ [ self readSTClassPackageAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'ClassCategory')
+ ifTrue:
+ [ self readSTClassCategoryAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'ClassVarNames')
+ ifTrue:
+ [ self readSTClassVarNamesAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'ClassInstVarNames')
+ ifTrue:
+ [ self readSTClassInstVarNamesAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'InstVarNames')
+ ifTrue:
+ [ self readSTInstVarNamesAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'STCode')
+ ifTrue:
+ [ self readSTCodeAttributeFor:something.
+ ^ self. ].
+ (attributeName = 'MethodCategory')
+ ifTrue:
+ [ self readSTMethodCategoryAttributeFor:something.
+ ^ self. ].
+
"/ unknown attributes
+
('JAVA [warning]: unrecognized attribute: ' , attributeName) infoPrintCR.
self skipAttribute:attributeName.
- "Modified: / 3.12.1998 / 13:13:42 / cg"
+ "Modified: / 03-12-1998 / 13:13:42 / cg"
+ "Modified: / 25-02-2011 / 18:09:21 / Marcel Hlopko <hlopik@gmail.com>"
!
readAttributeFor:something
@@ -999,7 +1339,7 @@
attribute_name_index := inStream nextUnsignedShortMSB:msb.
attribute_name_index == 0 ifTrue:[
self halt.
-"/ self skipAttribute:'unnamed'.
+ "/self skipAttribute:'unnamed'.
^ self.
].
@@ -1022,8 +1362,9 @@
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
"
- "Created: / 15.4.1996 / 15:40:17 / cg"
- "Modified: / 9.4.1998 / 18:13:34 / cg"
+ "Created: / 15-04-1996 / 15:40:17 / cg"
+ "Modified: / 09-04-1998 / 18:13:34 / cg"
+ "Modified: / 19-10-2010 / 21:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readAttributesFor:something
@@ -1039,6 +1380,14 @@
"Created: 15.4.1996 / 15:40:17 / cg"
!
+readDeprecatedAttributeFor:aJavaMethodWithHandler
+
+ self skipAttribute:'Deprecated'.
+ ^self
+
+ "Created: / 18-10-2010 / 22:26:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
readEnclosingMethodAttributeFor:something
"/ ('JAVA [info]: unhandled attribute: EnclosingMethod') infoPrintCR.
self skipAttribute:'EnclosingMethod'.
@@ -1054,29 +1403,84 @@
self skipAttribute:'LocalVariableTypeTable'.
!
-readRuntimeInvisibleAnnotationsAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: RuntimeInvisibleAnnotationsAttributeFor') infoPrintCR.
- self skipAttribute:'RuntimeInvisibleAnnotationsAttributeFor'.
-!
-
-readRuntimeInvisibleParameterAnnotationsAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: RuntimeInvisibleParameterAnnotations') infoPrintCR.
- self skipAttribute:'RuntimeInvisibleParameterAnnotations'.
+readRuntimeAnnotationsAttributeFor: something visible: visible
+ | length annotationsCount annotations rawAnnotations startPos endPos |
+
+ self assert: inStream isPositionable
+ message: '.class file stream must be positionable'.
+ length := inStream nextUnsignedLongMSB: msb.
+ startPos := inStream position.
+ annotationsCount := inStream nextUnsignedShortMSB: msb.
+ annotationsCount = 0 ifTrue: [ ^ nil ].
+ annotations := visible ifTrue: [something ensureHasAnnotations ensureRuntimeVisible] ifFalse: [something ensureHasAnnotations ensureRuntimeInvisible].
+ annotationsCount timesRepeat:
+ [ | currentAnnotation |
+
+ currentAnnotation := self readAnnotationFor: something.
+ annotations at: currentAnnotation name put: currentAnnotation. ].
+ "Cut raw annotations as required by getRawAnnotations()"
+ endPos := inStream position.
+ inStream position: startPos.
+ rawAnnotations := inStream next: length.
+ inStream position ~= endPos
+ ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ].
+ annotations rawAnnotations: rawAnnotations.
+
+ "Modified: / 07-01-2011 / 22:00:07 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 25-02-2011 / 18:45:58 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-03-2011 / 23:01:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 16:57:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-readRuntimeVisibleAnnotationsAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: RuntimeVisibleAnnotations') infoPrintCR.
- self skipAttribute:'RuntimeVisibleAnnotations'.
-!
-
-readRuntimeVisibleParameterAnnotationsAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: RuntimeVisibleParameterAnnotations') infoPrintCR.
- self skipAttribute:'RuntimeVisibleParameterAnnotations'.
+readRuntimeParameterAnnotationsAttributeFor: javaMethod visible: visible
+ | length paramsCount annotationsCount rawAnnotations startPos endPos |
+
+ self assert: inStream isPositionable
+ message: '.class file stream must be positionable'.
+ length := inStream nextUnsignedLongMSB: msb.
+ startPos := inStream position.
+ paramsCount := inStream nextByte.
+ paramsCount = 0 ifTrue: [ ^ nil ].
+ 1 to: paramsCount
+ do:
+ [:paramIndex |
+ annotationsCount := inStream nextUnsignedShortMSB: msb.
+ annotationsCount > 0
+ ifTrue:
+ [ | annotations |
+ annotations := visible
+ ifTrue:
+ [ javaMethod ensureHasAnnotations ensureVisibleParameterAnnotationsAt: paramIndex ]
+ ifFalse:
+ [javaMethod ensureHasAnnotations ensureInvisibleParameterAnnotationsAt: paramIndex ].
+ annotationsCount timesRepeat:
+ [ | annotation |
+
+ annotation := self readAnnotationFor: javaMethod.
+ annotations at: (annotation name) put: annotation. ] ]].
+ endPos := inStream position.
+ rawAnnotations := inStream position: startPos.
+ rawAnnotations := inStream next: length.
+ inStream position ~= endPos
+ ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ].
+ javaMethod annotations rawAnnotations: rawAnnotations.
+
+ "Modified: / 28-02-2011 / 17:05:47 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 16-03-2011 / 17:26:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readSignatureAttributeFor:something
-"/ ('JAVA [info]: unhandled attribute: Signature') infoPrintCR.
- self skipAttribute:'Signature'.
+
+ |attribute_length signature_index signature|
+
+ attribute_length := inStream nextUnsignedLongMSB:msb.
+
+ signature_index := inStream nextUnsignedShortMSB:msb.
+ signature := constants at:signature_index.
+
+ something setSignature: signature.
+
+ "Modified: / 13-08-2011 / 00:28:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readSourceDebugExtensionAttributeFor:something
@@ -1111,6 +1515,13 @@
"Modified: / 12.5.1998 / 22:01:07 / cg"
!
+readStackMapTableAttributeFor:something
+"/ ('JAVA [info]: unhandled attribute: StackMapTable') infoPrintCR.
+ self skipAttribute:'StackMapTable'.
+
+ "Created: / 09-02-2011 / 01:19:20 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
readSyntheticAttributeFor:something
"/ ('JAVA [info]: unhandled attribute: Synthetic') infoPrintCR.
self skipAttribute:'Synthetic'.
@@ -1312,102 +1723,87 @@
!
readConstantPool
- |constantPoolCount const i|
+ | constantPoolSize const |
"/
"/ get constant pool
"/
- constantPoolCount := inStream nextUnsignedShortMSB:msb.
- Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCR:constantPoolCount].
-
- constants := JavaConstantPool "Array" new:constantPoolCount-1.
-
+ constantPoolSize := inStream nextUnsignedShortMSB: msb.
+ self info: 'constantPoolSize = ' , constantPoolSize printString.
+ constants := JavaConstantPool new: constantPoolSize - 1.
constSlot := 1.
- [constSlot < constantPoolCount] whileTrue:[
- Verbose ifTrue:[Transcript show:'const: '; showCR:constSlot].
- const := self readConstant.
- constants at:constSlot put:const.
-
- "/ long & double consts take 2 slots
- "/ (only first is used)
- constNeeds2Slots ifTrue:[
- constSlot := constSlot + 2.
- ] ifFalse:[
- constSlot := constSlot + 1.
- ]
- ].
-
+ [ constSlot < constantPoolSize ] whileTrue: [
+ self info: 'const slot: ' , constSlot printString.
+ const := self readConstant.
+ constants at: constSlot put: const.
+
+ "/ long & double consts take 2 slots
+ "/ (only first is used)
+
+ constNeeds2Slots
+ ifTrue: [ constSlot := constSlot + 2. ]
+ ifFalse: [ constSlot := constSlot + 1. ]].
constSlot := -1.
-
- "/ preresolve what can be (especially, strings are resolved here)
-
- 1 to:constantPoolCount-1 do:[:i |
- |const value|
-
- const := constants at:i.
- const notNil ifTrue:[ "/ kludge for 2-slot constants (which only take 1 slot in ST/X)
- (const isKindOf:JavaUnresolvedConstant) ifTrue:[
- value := const preResolve.
- value ~~ const ifTrue:[
- constants at:i put:value.
- ]
- ]
- ]
- ].
+
+ 1 to: constantPoolSize - 1
+ do:
+ [:i |
+ | const value |
+
+ const := constants at: i.
+ const ifNotNil:
+ [ "/ kludge for 2-slot constants (which only take 1 slot in ST/X)
+ (const isKindOf: JavaUnresolvedConstant)
+ ifTrue:
+ [ value := const preResolve.
+ value ~~ const ifTrue: [ constants at: i put: value. ] ] ] ].
"
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
- "
-
- "Created: / 15.4.1996 / 15:14:11 / cg"
- "Modified: / 7.5.1998 / 11:44:06 / cg"
+ JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'"
+
+ "Modified: / 07-05-1998 / 11:44:06 / cg"
+ "Created: / 13-05-2011 / 16:52:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Asciz
- |len string|
-
- len := inStream nextUnsignedShortMSB:msb.
- string := String new:len.
- inStream nextBytes:len into:string startingAt:1.
-
- Verbose ifTrue:[Transcript show:'asciz; string= '; showCR:string].
-
+ | len string |
+
+
+ len := inStream nextUnsignedShortMSB: msb.
+ string := String new: len.
+ inStream
+ nextBytes: len
+ into: string
+ startingAt: 1.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'asciz; string= ';
+ showCR: string ].
^ string
"
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
- "
-
- "Created: 15.4.1996 / 15:15:35 / cg"
- "Modified: 15.4.1996 / 16:33:45 / cg"
+ JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'"
+
+ "Created: / 15-04-1996 / 15:15:35 / cg"
+ "Modified: / 15-04-1996 / 16:33:45 / cg"
+ "Modified: / 13-05-2011 / 17:31:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Class
- |name_index name|
-
- name_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'class; index= '; showCR:name_index].
-
- name := constants at:name_index.
- name notNil ifTrue:[
- Verbose ifTrue:[Transcript showCR:'name in constant_class already resolved'].
- "/ self halt
- ].
-
- ^ JavaUnresolvedClassConstant
- pool:constants
- poolIndex:constSlot
- nameIndex:name_index
-
- "
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: / 15.4.1996 / 15:21:13 / cg"
- "Modified: / 8.5.1998 / 21:53:16 / cg"
+ | nameIndex |
+
+ nameIndex := inStream nextUnsignedShortMSB: msb.
+ ((constants at: nameIndex) isNil)
+ ifTrue:
+ [ self info: ('reading class; index=' , nameIndex printString , ' name='
+ , (constants at: nameIndex) printString) ]
+ ifFalse: [ self info: ('reading class; index= ' , nameIndex printString) ].
+ ^ JavaClassRef2 in: constants withNameAt: nameIndex.
+
+ "Modified: / 18-05-2011 / 18:21:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Double
@@ -1462,27 +1858,22 @@
"Modified: / 8.5.1998 / 22:06:07 / cg"
!
-readConstant_Fieldref
- |class_index name_and_type_index|
-
- class_index := inStream nextUnsignedShortMSB:msb.
- name_and_type_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'fieldref; classindex= '; showCR:class_index].
- Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCR:name_and_type_index].
-
- ^ JavaUnresolvedFieldrefConstant
- pool:constants
- poolIndex:constSlot
- classIndex:class_index
- nameandTypeIndex:name_and_type_index
-
- "
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: 15.4.1996 / 15:22:18 / cg"
- "Modified: 15.4.1996 / 16:07:01 / cg"
+readConstant_Fieldref
+ "incrementally changing resolving logic, fields will come later"
+
+ | classIndex nameAndTypeIndex |
+
+ classIndex := inStream nextUnsignedShortMSB: msb.
+ nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
+ self
+ info: 'reading fieldref; classindex=' , classIndex printString
+ , ' nameAndTypeIndex=' , nameAndTypeIndex printString.
+ ^ JavaFieldRef2
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
+
+ "Modified: / 15-05-2011 / 14:20:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Float
@@ -1550,26 +1941,19 @@
!
readConstant_InterfaceMethodref
- |class_index name_and_type_index|
-
- class_index := inStream nextUnsignedShortMSB:msb.
- name_and_type_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'methodref; classindex= '; showCR:class_index].
- Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
-
- ^ JavaUnresolvedInterfaceMethodrefConstant
- pool:constants
- poolIndex:constSlot
- classIndex:class_index
- nameandTypeIndex:name_and_type_index
-
- "
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: 15.4.1996 / 15:22:37 / cg"
- "Modified: 15.4.1996 / 16:07:19 / cg"
+ | classIndex nameAndTypeIndex |
+
+ classIndex := inStream nextUnsignedShortMSB: msb.
+ nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
+ self
+ info: 'reading interface methodref; classindex=' , classIndex printString
+ , ' nameAndTypeIndex=' , nameAndTypeIndex printString.
+ ^ JavaInterfaceMethodRef2
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
+
+ "Modified: / 12-05-2011 / 18:57:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Long
@@ -1597,110 +1981,111 @@
!
readConstant_Methodref
- |class_index name_and_type_index|
-
- class_index := inStream nextUnsignedShortMSB:msb.
- name_and_type_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'methodref; classindex= '; showCR:class_index].
- Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
-
- ^ JavaUnresolvedMethodrefConstant
- pool:constants
- poolIndex:constSlot
- classIndex:class_index
- nameandTypeIndex:name_and_type_index
-
- "
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: 15.4.1996 / 15:22:37 / cg"
- "Modified: 15.4.1996 / 16:07:19 / cg"
+ | classIndex nameAndTypeIndex |
+
+ classIndex := inStream nextUnsignedShortMSB: msb.
+ nameAndTypeIndex := inStream nextUnsignedShortMSB: msb.
+ self
+ info: 'reading methodref; classindex=' , classIndex printString , ' nameAndTypeIndex='
+ , nameAndTypeIndex printString.
+ ^ JavaMethodRef2
+ in: constants
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classIndex.
+
+ "Modified: / 15-05-2011 / 14:20:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_NameAndType
- |name_index signature_index|
-
- name_index := inStream nextUnsignedShortMSB:msb.
- signature_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'methodref; nameindex= '; showCR:name_index].
- Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCR:signature_index].
-
- ^ JavaUnresolvedNameandTypeConstant
- pool:constants
- poolIndex:constSlot
- nameIndex:name_index
- signatureIndex:signature_index
-
- "
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: 15.4.1996 / 15:23:43 / cg"
- "Modified: 15.4.1996 / 16:17:16 / cg"
+ | nameIndex descriptorIndex |
+
+ nameIndex := inStream nextUnsignedShortMSB: msb.
+ descriptorIndex := inStream nextUnsignedShortMSB: msb.
+ self
+ info: 'reading nameAndType; nameindex=' , nameIndex printString
+ , ' descriptorIndex= ' , descriptorIndex printString.
+ ^JavaNameAndType2
+ in: constants
+ withNameAt: nameIndex
+ andDescriptorAt: descriptorIndex.
+
+ "Modified: / 10-05-2011 / 17:09:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_String
- |tag string_index chars jString|
-
- string_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
-
+ | string_index chars jString |
+
+ string_index := inStream nextUnsignedShortMSB: msb.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'string; index= ';
+ showCR: string_index ].
+
"/ resolve here if possible
- string_index < constSlot ifTrue:[
- Java java_lang_String notNil ifTrue:[
- chars := (constants at:string_index).
- chars isString ifFalse:[
- self halt:'should not happen'
- ].
- jString := Java as_String:chars.
- ^ jString.
- ]
- ].
-
+
+ string_index < constSlot
+ ifTrue:
+ [ Java java_lang_String notNil
+ ifTrue:
+ [ chars := (constants at: string_index).
+ chars isString ifFalse: [ self halt: 'should not happen' ].
+ jString := JavaVM javaStringObjectForString:chars interned:true.
+ ^ jString. ] ].
^ JavaUnresolvedStringConstant
- pool:constants
- poolIndex:constSlot
- stringIndex:string_index
+ pool: constants
+ poolIndex: constSlot
+ stringIndex: string_index
"
Verbose := true.
- JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'
- "
-
- "Created: / 15.4.1996 / 15:20:33 / cg"
- "Modified: / 7.5.1998 / 11:42:45 / cg"
+ JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'"
+
+ "Created: / 15-04-1996 / 15:20:33 / cg"
+ "Modified: / 07-05-1998 / 11:42:45 / cg"
+ "Modified: / 13-05-2011 / 17:31:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 10-08-2011 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readConstant_Unicode
- |len string ascii|
-
- len := inStream nextUnsignedShortMSB:msb.
- string := TwoByteString new:len.
- 1 to:len do:[:idx |
- ascii := inStream nextUnsignedShortMSB:msb.
- string at:idx put:(Character value:ascii).
- ].
-
- Verbose ifTrue:[Transcript show:'asciz; unicodeString= '; showCR:string].
-
+ | len string ascii |
+
+ len := inStream nextUnsignedShortMSB: msb.
+ string := TwoByteString new: len.
+ 1 to: len
+ do:
+ [:idx |
+ ascii := inStream nextUnsignedShortMSB: msb.
+ string at: idx put: (Character value: ascii). ].
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'asciz; unicodeString= ';
+ showCR: string ].
^ string
+
+ "Modified: / 13-05-2011 / 17:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_Utf8
- |len bytes string|
-
- len := inStream nextUnsignedShortMSB:msb.
- bytes := ByteArray new:len.
- inStream nextBytes:len into:bytes startingAt:1.
- string := CharacterArray fromUTF8Bytes:bytes.
-
- Verbose ifTrue:[Transcript show:'asciz; string= '; showCR:string].
-
+ | len bytes string |
+
+ len := inStream nextUnsignedShortMSB: msb.
+ bytes := ByteArray new: len.
+ inStream
+ nextBytes: len
+ into: bytes
+ startingAt: 1.
+ string := CharacterArray fromJavaUTF8Bytes: bytes.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'asciz; string= ';
+ showCR: string ].
^ string
+
+ "Modified: / 19-10-2010 / 12:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-05-2011 / 17:31:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassReader methodsFor:'file reading - constants-ST'!
@@ -1772,49 +2157,56 @@
!
readConstant_ST_String
- |tag string_index chars|
-
- string_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
-
+ | tag string_index chars |
+
+
+ string_index := inStream nextUnsignedShortMSB: msb.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'string; index= ';
+ showCR: string_index ].
+
"/ resolve here if possible
- string_index < constSlot ifTrue:[
- chars := (constants at:string_index).
- ^ chars
- ].
-
+
+ string_index < constSlot
+ ifTrue:
+ [ chars := (constants at: string_index).
+ ^ chars ].
^ JavaUnresolvedSTStringConstant
- pool:constants
- poolIndex:constSlot
- stringIndex:string_index
-
- "Modified: / 7.5.1998 / 11:48:28 / cg"
- "Created: / 7.5.1998 / 11:49:55 / cg"
+ pool: constants
+ poolIndex: constSlot
+ stringIndex: string_index
+
+ "Created: / 07-05-1998 / 11:49:55 / cg"
+ "Modified: / 13-05-2011 / 17:32:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
readConstant_ST_Symbol
- |tag string_index chars|
-
- string_index := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:'symbol; index= '; showCR:string_index].
-
+ | tag string_index chars |
+
+
+ string_index := inStream nextUnsignedShortMSB: msb.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: 'symbol; index= ';
+ showCR: string_index ].
+
"/ resolve here if possible
- string_index < constSlot ifTrue:[
- chars := (constants at:string_index).
- chars isString ifFalse:[
- self halt:'should not happen'
- ].
- ^ chars asSymbol
- ].
-
+
+ string_index < constSlot
+ ifTrue:
+ [ chars := (constants at: string_index).
+ chars isString ifFalse: [ self halt: 'should not happen' ].
+ ^ chars asSymbol ].
^ JavaUnresolvedSTSymbolConstant
- pool:constants
- poolIndex:constSlot
- stringIndex:string_index
-
- "Modified: / 7.5.1998 / 11:48:28 / cg"
+ pool: constants
+ poolIndex: constSlot
+ stringIndex: string_index
+
+ "Modified: / 07-05-1998 / 11:48:28 / cg"
+ "Modified: / 13-05-2011 / 17:32:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaClassReader methodsFor:'file reading - fields'!
@@ -1842,35 +2234,37 @@
!
readFieldInfofield
- |access_flags name_index signature_index attributes_count field|
-
- access_flags := inStream nextUnsignedShortMSB:msb.
- name_index := inStream nextUnsignedShortMSB:msb.
- signature_index := inStream nextUnsignedShortMSB:msb.
-
+ | access_flags name_index descriptor_index attributes_count field |
+
+ access_flags := inStream nextUnsignedShortMSB: msb.
+ name_index := inStream nextUnsignedShortMSB: msb.
+ descriptor_index := inStream nextUnsignedShortMSB: msb.
field := JavaField new.
- field setAccessFlags:access_flags.
- field setName:(constants at:name_index) asSymbol.
- field setSignature:(constants at:signature_index) asSymbol.
-
- attributes_count := inStream nextUnsignedShortMSB:msb.
-
- Verbose ifTrue:[Transcript show:' field name: '; show:(constants at:name_index);
- show:' access: '; show:access_flags;
- show:' attrib_cnt: '; showCR:attributes_count].
-
- 1 to:attributes_count do:[:i |
- self readAttributeFor:field.
- ].
-
- ^ field
+ field setAccessFlags: access_flags.
+ field setName: (constants at: name_index) asSymbol.
+ field setDescriptor: (constants at: descriptor_index) asSymbol.
+ field setConstantPool: constants.
+ attributes_count := inStream nextUnsignedShortMSB: msb.
+ Verbose
+ ifTrue:
+ [ Transcript
+ show: ' field name: ';
+ show: (constants at: name_index);
+ show: ' access: ';
+ show: access_flags;
+ show: ' attrib_cnt: ';
+ showCR: attributes_count ].
+ 1 to: attributes_count do: [:i | self readAttributeFor: field. ].
+ ^ field.
"
- JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
- "
-
- "Created: / 15.4.1996 / 15:38:43 / cg"
- "Modified: / 15.10.1998 / 10:38:01 / cg"
+ JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'"
+
+ "Created: / 15-04-1996 / 15:38:43 / cg"
+ "Modified: / 15-10-1998 / 10:38:01 / cg"
+ "Modified: / 17-12-2010 / 18:44:30 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 18-05-2011 / 14:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-08-2011 / 19:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readFieldInfofields
@@ -1938,7 +2332,7 @@
Verbose ifTrue:[Transcript show:'code_attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)].
- minorVsn > 2 ifTrue:[
+ ((minorVsn > 2) or:[majorVsn > 45]) ifTrue:[
"/ should be:
max_stack := inStream nextUnsignedShortMSB:msb.
max_locals := inStream nextUnsignedShortMSB:msb.
@@ -2008,8 +2402,9 @@
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
"
- "Created: / 15.4.1996 / 15:40:17 / cg"
- "Modified: / 16.5.1998 / 01:39:42 / cg"
+ "Created: / 15-04-1996 / 15:40:17 / cg"
+ "Modified: / 16-05-1998 / 01:39:42 / cg"
+ "Modified: / 17-12-2010 / 00:24:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readExceptionsAttributeFor:aJavaMethod
@@ -2112,7 +2507,7 @@
!
readMethodFor:aClass
- |m access_flags name_index name signature_index signature
+ |m access_flags name_index name descriptor_index descriptor
tooManyArgs|
"/
@@ -2120,14 +2515,14 @@
"/
access_flags := inStream nextUnsignedShortMSB:msb.
name_index := inStream nextUnsignedShortMSB:msb.
- signature_index := inStream nextUnsignedShortMSB:msb.
+ descriptor_index := inStream nextUnsignedShortMSB:msb.
name := constants at:name_index.
- signature := constants at:signature_index.
+ descriptor := constants at:descriptor_index.
Verbose ifTrue:[
Transcript show:'method name:'; showCR:name.
- Transcript show:'signature:'; showCR:signature.
+ Transcript show:'descriptor:'; showCR:descriptor.
].
aClass isJavaClass ifTrue:[
@@ -2143,7 +2538,7 @@
tooManyArgs := true.
ex proceed.
] do:[
- m setName:name signature:signature.
+ m setName:name descriptor:descriptor.
].
m setJavaClass:aClass.
@@ -2155,7 +2550,7 @@
].
(m exceptionHandlerTable isNil) ifTrue:[
m isNative ifFalse:[
- m exceptionTable isNil ifTrue:[
+ m getExceptionTable isNil ifTrue:[
m := JavaMethod fromMethod:m
] ifFalse:[
m := JavaMethodWithException fromMethod:m
@@ -2164,7 +2559,7 @@
] ifFalse:[
m setAccessFlags:(m accessFlags bitOr:JavaMethod A_HASHANDLER)
].
- aClass addMethod:m name:name signature:signature.
+ aClass addMethod:m name:name signature:descriptor.
] ifFalse:[
m := Method new.
self readAttributesFor:m.
@@ -2179,8 +2574,9 @@
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
"
- "Created: / 15.4.1996 / 16:48:49 / cg"
- "Modified: / 25.9.1999 / 23:16:25 / cg"
+ "Created: / 15-04-1996 / 16:48:49 / cg"
+ "Modified: / 25-09-1999 / 23:16:25 / cg"
+ "Modified: / 14-08-2011 / 19:42:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
readMethodsFor:aJavaClass
@@ -2285,14 +2681,65 @@
"Created: / 16.5.1998 / 01:04:19 / cg"
! !
+!JavaClassReader methodsFor:'helpers'!
+
+loadSuperclassIdentifiedBy: something ignoring: classesBeingLoaded
+ "overriding method, here we expect something to be new JavaClassRef2"
+
+ self assert: something isJavaRef
+ message: 'class identifier is not a java reference'.
+
+ self assert: something isJavaClassRef
+ message: 'class identifier is not a java class reference'.
+
+ (classesBeingLoaded includes: something fullName) ifTrue:
+ [self error: 'class we want to load is being loaded and that means something went wrong. tell mh'].
+
+ "Do NOT use >>something resolve<< here, since something
+ has no owner set and therefore access check will cause DNU.
+ Ask JV for details."
+
+ ^Java classForName: something javaClassName.
+
+ "Created: / 18-05-2011 / 14:55:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-05-2011 / 13:58:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateOwnerInCPItem: each
+ ((each isJavaRef and: [ each isNewJavaRef ])
+ or: [ each isJavaNameAndType and: [ each isNewJavaNameAndType ] ])
+ ifTrue: [ each owner: classBeingLoaded ].
+
+ "Created: / 12-05-2011 / 17:40:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+updateOwnerInField: each
+
+ each setClass: classBeingLoaded.
+
+ "Created: / 18-05-2011 / 13:57:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassReader methodsFor:'logging'!
+
+info: message
+ Verbose ifTrue: [ Transcript showCR: message printString ].
+
+ "Created: / 18-05-2011 / 15:06:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
!JavaClassReader class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: /cvs/stx/stx/libjava/JavaClassReader.st,v 1.93 2011/08/18 18:42:48 vrany Exp $'
!
version_CVS
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.92 2009/10/09 14:21:53 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id: JavaClassReader.st,v 1.93 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaClassReader initialize!
+JavaClassReader initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassReader2Tests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,315 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaClassReader2Tests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaClassReader2Tests 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.
+
+"
+! !
+
+!JavaClassReader2Tests methodsFor:'tests'!
+
+_testJavaInitializationWithNewReader
+
+ "Disabled by default, since it flushes
+ Java causing hudson test runner to fail
+ (proxy testcases are already loaded)"
+
+
+ self assert: false.
+ JavaClassReader useNewClassReader.
+ Java flushAllJavaResources.
+ Java initialize.
+ JavaVM initializeVM.
+ JavaClassReader useOldClassReader.
+
+ "Modified: / 12-05-2011 / 18:21:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 01-06-2011 / 21:48:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_testJavaInitializationWithOldReader
+
+ "Disabled by default, since it flushes
+ Java causing hudson test runner to fail
+ (proxy testcases are already loaded)"
+
+ JavaClassReader useOldClassReader.
+ Java flushAllJavaResources.
+ Java initialize.
+ JavaVM initializeVM.
+ JavaClassReader useOldClassReader.
+
+ "Created: / 01-06-2011 / 21:47:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingClass
+ | reader constantPool result |
+
+ reader := JavaClassReader new.
+ constantPool := JavaConstantPool new: 1.
+ constantPool at: 1 put: 'Ljava/lang/Object;'.
+ reader constants: constantPool.
+ reader stream: (ReadStream on: #( 1 0 )).
+ result := reader readConstant_Class.
+ self assertTrue: (result notNil).
+ self assertTrue: (result isJavaRef).
+ self assertTrue: (result isNewJavaRef).
+ self assertTrue: (result name = 'Ljava/lang/Object;').
+
+ "Created: / 10-05-2011 / 13:52:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingField
+ | reader constantPool result |
+
+ reader := JavaClassReader new.
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3
+ put: (self
+ getNameAndTypeIn: constantPool
+ withNameAt: 4
+ andTypeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
+ reader constants: constantPool.
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
+ result := reader readConstant_Fieldref.
+ self assertTrue: (result notNil).
+ self assertTrue: (result isJavaRef).
+ self assertTrue: (result isNewJavaRef).
+ self assertTrue: (result classRef isJavaRef).
+ self assertTrue: (result nameAndType isNewJavaNameAndType).
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
+
+ "Created: / 10-05-2011 / 14:12:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 18:00:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingInterfaceMethod
+ | reader constantPool result |
+
+ reader := JavaClassReader new.
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3
+ put: (self
+ getNameAndTypeIn: constantPool
+ withNameAt: 4
+ andTypeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
+ reader constants: constantPool.
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
+ result := reader readConstant_InterfaceMethodref.
+ self assertTrue: (result notNil).
+ self assertTrue: (result isJavaRef).
+ self assertTrue: (result isNewJavaRef).
+ self assertTrue: (result classRef isNewJavaRef).
+ self assertTrue: (result classRef isNewJavaRef).
+ self assertTrue: (result nameAndType isNewJavaNameAndType).
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
+ self assertTrue: (result owner = self javaLangObject).
+
+ "Created: / 10-05-2011 / 14:12:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 18:00:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingMethod
+ | reader constantPool result |
+
+ reader := JavaClassReader new.
+ constantPool := JavaConstantPool new: 5.
+ constantPool at: 1 put: 'class'.
+ constantPool at: 2 put: (self getClassRefIn: constantPool withNameAt: 1).
+ constantPool at: 3
+ put: (self
+ getNameAndTypeIn: constantPool
+ withNameAt: 4
+ andTypeAt: 5).
+ constantPool at: 4 put: 'name'.
+ constantPool at: 5 put: 'type'.
+ constantPool owner: self javaLangObject.
+ reader constants: constantPool.
+ reader stream: (ReadStream on: #( 2 0 3 0 )).
+ result := reader readConstant_Methodref.
+ self assertTrue: (result notNil).
+ self assertTrue: (result isJavaRef).
+ self assertTrue: (result isNewJavaRef).
+ self assertTrue: (result classRef isNewJavaRef).
+ self assertTrue: (result classRef isNewJavaRef).
+ self assertTrue: (result nameAndType isNewJavaNameAndType).
+ self assertTrue: (result nameAndType name = 'name').
+ self assertTrue: (result nameAndType descriptor = 'type').
+ self assertTrue: (result owner = self javaLangObject).
+
+ "Created: / 10-05-2011 / 14:10:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 18:00:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingNameAndType
+ | reader constantPool result |
+
+ reader := JavaClassReader new.
+ constantPool := JavaConstantPool new: 2.
+ constantPool at: 1 put: 'foo'.
+ constantPool at: 2 put: 'bar'.
+ reader constants: constantPool.
+ reader stream: (ReadStream on: #( 1 0 2 0 )).
+ result := reader readConstant_NameAndType.
+ self assertTrue: (result notNil).
+ self assertTrue: (result isJavaNameAndType).
+ self assertTrue: (result isNewJavaNameAndType).
+ self assertTrue: (result name = 'foo').
+ self assertTrue: (result descriptor = 'bar').
+
+ "Created: / 10-05-2011 / 13:56:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testReadingStream
+
+ |result|
+ result := JavaClassReader readStream: self getCrateClassReadStream.
+ self assertTrue: (result notNil).
+
+ "Created: / 10-05-2011 / 12:16:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-08-2011 / 17:25:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testWholeConstantPoolContainsFullyInitializedItems
+ | result |
+
+ result := JavaClassReader readStream: self getCrateClassReadStream.
+ result constantPool do:
+ [:each |
+ each isJavaRef
+ ifTrue: [ self assertTrue: each isNewJavaRef. self assertTrue: each owner notNil. self assertTrue: each constantPool notNil.]
+ ifFalse:
+ [ each isJavaNameAndType
+ ifTrue: [ self assertTrue: each isNewJavaNameAndType. self assertTrue: each owner notNil. self assertTrue: each constantPool notNil.] ] ].
+
+ "Created: / 10-05-2011 / 17:01:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testWholeConstantPoolContainsOnlyNewRefs
+ | result |
+
+ result := JavaClassReader readStream: self getCrateClassReadStream.
+ result constantPool do:
+ [:each |
+ each isJavaRef
+ ifTrue: [ self assertTrue: each isNewJavaRef ]
+ ifFalse:
+ [ each isJavaNameAndType
+ ifTrue: [ self assertTrue: each isNewJavaNameAndType ] ] ].
+
+ "Created: / 10-05-2011 / 12:18:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 10-05-2011 / 16:59:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassReader2Tests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassReaderTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,138 @@
+"
+ 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:#JavaClassReaderTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaClassReaderTests 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.
+
+"
+! !
+
+!JavaClassReaderTests class methodsFor:'resources'!
+
+resources
+ ^ Array with: JavaInitializedResource with: JavaTestsResource with: JavaLibrariesResource.
+
+ "Created: / 15-03-2011 / 15:48:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 14:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:06:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassReaderTests methodsFor:'setUp'!
+
+setUp
+ "we need to flush caches"
+
+ Java addToClassPath: '/usr/share/java/junit4.jar'.
+
+ "Created: / 15-03-2011 / 15:54:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 15-03-2011 / 16:59:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 16-03-2011 / 14:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaClassReaderTests methodsFor:'testing'!
+
+testLoadClassesInGivenRootDir
+ JavaClassReader
+ loadClassesIn: ((UserPreferences current javaTestsDirectory) asFilename
+ / 'libjava' / 'bin').
+ self
+ assertTrue: (Java classNamed: 'stx.libjava.tests.RegexTests') isNil not.
+
+ "Created: / 16-03-2011 / 21:31:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 18:07:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassReaderTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,292 @@
+"
+ 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' }"
+
+JavaRef2 subclass:#JavaClassRef2
+ instanceVariableNames:'nameIndex'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaClassRef2 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.
+
+"
+! !
+
+!JavaClassRef2 class methodsFor:'instance creation'!
+
+in: aJavaConstantPool withNameAt: nameIndex
+
+
+ ^ self basicNew initializeIn: aJavaConstantPool withNameAt: nameIndex.
+
+ "Created: / 10-05-2011 / 14:56:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'accessing'!
+
+classLoader
+ self owner ifNil: [ ^ nil ] ifNotNil: [ ^ self owner classLoader ].
+
+ "Created: / 11-04-2011 / 21:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-05-2011 / 18:32:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaClass
+
+ valueCache ifNil:[self resolve].
+ ^valueCache
+
+ "Created: / 22-05-2011 / 14:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassName
+ "return java class name as written in java programs e.g. java.util.String
+ in case of array, return class name without square brackets"
+
+ | tmp |
+
+ tmp := self name copy.
+ [ tmp startsWith: '[' ] whileTrue: [ tmp := tmp copyFrom: 2 ].
+ tmp := tmp replaceAll: $/ with: $..
+ (tmp startsWith: 'L') ifTrue: [ tmp := tmp copyFrom: 2 to: tmp size ].
+ (tmp endsWith: ';') ifTrue: [ tmp := tmp copyFrom: 1 to: tmp size - 1 ].
+ ^ tmp.
+
+ "Created: / 08-04-2011 / 18:30:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 15:30:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+name
+ ^constantPool at: nameIndex.
+
+ "Created: / 08-04-2011 / 13:48:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-05-2011 / 09:59:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'array support'!
+
+arrayDimensions
+ ^ self name occurrencesOf: $[.
+
+ "Created: / 08-04-2011 / 18:42:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-05-2011 / 10:00:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isJavaArrayClassRef
+ ^ self name startsWith: '['.
+
+ "Created: / 08-04-2011 / 18:40:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-05-2011 / 10:00:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'comparing'!
+
+= anotherJavaClassRef
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ anotherJavaClassRef isJavaClassRef ifFalse: [ ^ false ].
+ ^ self name = anotherJavaClassRef name.
+
+ "Modified: / 08-04-2011 / 13:48:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+hash
+ ^ self name hash.
+
+ "Modified: / 13-05-2011 / 10:00:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'initialization'!
+
+initializeIn: aJavaConstantPool withNameAt: nameCPIndex
+ nameIndex := nameCPIndex.
+ constantPool := aJavaConstantPool.
+ super initialize.
+
+ "Modified: / 10-05-2011 / 14:57:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'printing'!
+
+displayString
+
+ ^self name
+
+ "Created: / 14-08-2011 / 21:18:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fullName
+ ^ self name.
+
+ "Created: / 10-05-2011 / 14:19:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+printString
+ ^ 'JavaClassRef for: ' , self name printString.
+
+ "Created: / 10-05-2011 / 14:16:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-05-2011 / 10:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ "Resolving static inner classes is not different from resolving any other class, it's only done in different circumstances"
+
+ ^ self findResolvedValue.
+
+ "Created: / 28-04-2011 / 21:57:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+findResolvedValue
+ "Resolve reference and set valueCache."
+
+ valueCache := JavaResolver uniqueInstance
+ resolveClassIndentifiedByRef: self.
+
+ "Modified: / 08-04-2011 / 17:39:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+findResolvedValue: doInit
+ "Resolve reference and set valueCache."
+
+ valueCache := JavaResolver uniqueInstance
+ resolveClassIndentifiedByRef: self init: doInit.
+
+ "Modified: / 08-04-2011 / 17:39:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 22:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'queries'!
+
+isJavaClassRef
+^true.
+
+ "Created: / 11-04-2011 / 19:10:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRef2 methodsFor:'resolving'!
+
+invalidateForClass: internalJavaClassName
+ "Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
+ Return true, if reference was invalidated."
+
+ self name = internalJavaClassName
+ ifTrue:
+ [
+ self invalidate.
+ ^ true ].
+ ^ false.
+
+ "Modified: / 23-05-2011 / 15:21:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolve
+
+ ^self resolve: true
+
+ "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 22:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+resolve: doInit
+ "
+ Resolves a class. If doInit is true, then the class is initialuzed,
+ otherwise not.
+ "
+
+ self isResolved ifFalse: [ self findResolvedValue: doInit ].
+ ^ valueCache.
+
+ "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 22:18:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaClassRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaClassRefTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,362 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaClassRefTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaClassRefTests 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.
+
+"
+! !
+
+!JavaClassRefTests methodsFor:'arrays'!
+
+testCorrectArrayCreation
+|classRef result expectedResult |
+
+ classRef := self getClassRefNamed: '[Ljava/lang/Object;'.
+ result := classRef resolve.
+ expectedResult := JavaVM javaArrayClassFor: (Java classForName: 'java.lang.Object').
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 23-05-2011 / 21:15:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testCorrectMultiArrayCreation
+ | classRef result expectedResult |
+
+ classRef := self getClassRefNamed: '[[[[[Ljava/lang/Object;'.
+ result := classRef resolve.
+ expectedResult := JavaVM
+ javaArrayClassFor: (Java classForName: 'java.lang.Object').
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 23-05-2011 / 21:15:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRefTests methodsFor:'permission tests'!
+
+testAccessingNonPublicFromInside
+ | javaClassRef initString throwedException |
+
+ self enableMockedExceptionThrowing.
+
+ [ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
+ javaClassRef resolve. ] on: Error
+ do: [:e | throwedException := e ].
+ self assertTrue: (throwedException isNil).
+ self disableMockedExceptionThrowing.
+
+ "Created: / 13-04-2011 / 13:42:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingNonPublicFromOutside
+ | javaClassRef initString throwedException |
+
+ self enableMockedExceptionThrowing.
+
+ [ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ javaClassRef resolve. ] on: Error
+ do: [:e | throwedException := e ].
+ self assertTrue: (throwedException notNil
+ and: [ throwedException messageText = 'IllegalAccessError' ]).
+ self disableMockedExceptionThrowing.
+
+ "Created: / 13-04-2011 / 13:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublic
+ | javaClassRef initString |
+
+ self enableMockedExceptionThrowing.
+ self shouldnt:
+ [ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ javaClassRef resolve. ]
+ raise: Error.
+ self disableMockedExceptionThrowing.
+
+ "Created: / 13-04-2011 / 13:36:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testNonPublicClassPresent
+ | javaClassRef initString |
+
+ self enableMockedExceptionThrowing.
+ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java
+ classForName: 'stx.libjava.tests.mocks.SubclassOfNonPublicClass').
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef valueCache notNil).
+ self disableMockedExceptionThrowing.
+
+ "Created: / 13-04-2011 / 13:38:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testPublicClassPresent
+ | javaClassRef initString |
+
+ self enableMockedExceptionThrowing.
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef valueCache notNil).
+ self disableMockedExceptionThrowing.
+
+ "Created: / 13-04-2011 / 13:39:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRefTests methodsFor:'primitives'!
+
+testAllPrimitiveArrayClasses
+ | classRef descriptor |
+
+ #( $B $C $D $F $I $J $S $Z ) do:
+ [:each |
+ descriptor := '[' , each.
+ classRef := self getClassRefNamed: descriptor.
+ self assertTrue: ((JavaDescriptor readFromString: descriptor) javaClass
+ = classRef resolve) ].
+
+ "Created: / 23-05-2011 / 20:49:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAllPrimitiveClasses
+ | classRef |
+
+ #( $B $C $D $F $I $J $S $Z )
+ do:
+ [:each |
+
+ classRef := self getClassRefNamed: each asString.
+ self assertTrue: ((JavaDescriptor baseTypes at: each) = classRef resolve) ].
+
+ "Created: / 23-05-2011 / 20:48:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAllPrimitiveMultiArrayClasses
+ | classRef descriptor |
+
+ #( $B $C $D $F $I $J $S $Z )
+ do:
+ [:each |
+ descriptor := '[[[[' , each.
+ classRef := self getClassRefNamed: descriptor.
+ self assertTrue: ((JavaDescriptor readFromString: descriptor) javaClass
+ = classRef resolve) ].
+
+ "Created: / 23-05-2011 / 20:50:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRefTests methodsFor:'resolving static tests'!
+
+testCorrectStaticResolving
+ | javaClassRef initString result expectedResult |
+
+ initString := 'Lstx/libjava/tests/mocks/ClassWithInnerClasses$InnerStatic;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses').
+ expectedResult := Java
+ classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses$InnerStatic'.
+ result := javaClassRef resolveStatic.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 28-04-2011 / 21:51:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRefTests methodsFor:'resolving tests'!
+
+testCorrectInstanceCreation
+ | javaClassRef initString |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ self assertFalse: (javaClassRef isResolved).
+ self assertTrue: (javaClassRef valueCache isNil).
+ self assertTrue: (javaClassRef name = initString).
+
+ "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testCorrectResolving
+ | javaClassRef initString result expectedResult |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ expectedResult := Java classForName: 'java.lang.String'.
+ result := javaClassRef resolve.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidation
+ | javaClassRef initString |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ self assertTrue: (javaClassRef isResolved not).
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef isResolved).
+ javaClassRef invalidate.
+ self assertTrue: (javaClassRef isResolved not).
+
+ "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassNegative
+ | javaClassRef initString |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ self assertTrue: (javaClassRef isResolved not).
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef isResolved).
+ javaClassRef invalidateForClass: 'Ljava/lang/Object;'.
+ self assertTrue: (javaClassRef isResolved).
+
+ "Created: / 08-04-2011 / 16:21:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassPositive
+ | javaClassRef initString |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ self assertTrue: (javaClassRef isResolved not).
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef isResolved).
+ javaClassRef invalidateForClass: initString.
+ self assertTrue: (javaClassRef isResolved not).
+
+ "Created: / 08-04-2011 / 16:21:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:57:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testResolving
+ | javaClassRef initString |
+
+ initString := 'Ljava/lang/String;'.
+ javaClassRef := self getClassRefNamed: initString.
+ javaClassRef owner: (Java classForName: 'java.lang.Object').
+ self assertTrue: (javaClassRef isResolved not).
+ javaClassRef resolve.
+ self assertTrue: (javaClassRef isResolved).
+
+ "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:57:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaClassRefTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaConstantPool.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaConstantPool.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,15 +12,38 @@
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' }"
Array variableSubclass:#JavaConstantPool
instanceVariableNames:'owner'
- classVariableNames:''
+ classVariableNames:'ConstantPools'
poolDictionaries:''
category:'Languages-Java-Reader-Support'
!
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,60 +65,95 @@
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.
+
"
+! !
+
+!JavaConstantPool class methodsFor:'initialization'!
+
+initialize
+ ConstantPools := OrderedCollection new: 1000.
+ "Modified: / 08-04-2011 / 17:28:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-04-2011 / 09:25:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+!JavaConstantPool class methodsFor:'instance creation'!
+
+new: size
+ "return an initialized instance"
+
+ ^ ConstantPools add: ((super new: size)
+ initialize;
+ yourself).
+
+ "Created: / 08-04-2011 / 16:56:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-04-2011 / 09:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-04-2011 / 18:46:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaConstantPool class methodsFor:'accessing'!
+
+allConstantPools
+ "linked list of all constant pools in system"
+ ^ ConstantPools.
+
+ "Created: / 08-04-2011 / 16:53:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-04-2011 / 09:24:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+allConstantPools: anOorderedCollection
+ "linked list of all constant pools in system"
+
+ ConstantPools := anOorderedCollection.
+
+ "Created: / 08-04-2011 / 17:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-04-2011 / 09:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-04-2011 / 18:47:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaConstantPool class methodsFor:'special'!
-compressPools
- "unify all constants"
-
- |strings nameandTypes jStrings|
-
- strings := Set new.
- nameandTypes := Set new.
-
- self allInstancesDo:[:aPool |
- aPool keysAndValuesDo:[:idx :aConst |
- |existing nt|
+invalidateForClass: internalJavaClassName
+ "Only alias, everybody calls invalidateForClass so why not me :)"
+
+ ^self invalidateReferencesToClass: internalJavaClassName.
- aConst isString ifTrue:[
- existing := strings elementAt:aConst ifAbsent:nil.
- existing isNil ifTrue:[
- strings add:aConst
- ] ifFalse:[
- aPool at:idx put:existing
- ]
- ] ifFalse:[
- (aConst isMemberOf:JavaFieldref) ifTrue:[
- nt := aConst nameandType.
- existing := nameandTypes elementAt:nt ifAbsent:nil.
- existing isNil ifTrue:[
- nameandTypes add:nt
- ] ifFalse:[
- aConst nameandType:existing
- ]
- ] ifFalse:[
- (aConst isMemberOf:JavaNameandType) ifTrue:[
- existing := nameandTypes elementAt:aConst ifAbsent:nil.
- existing isNil ifTrue:[
- nameandTypes add:aConst
- ] ifFalse:[
- aPool at:idx put:existing
- ]
- ]
- ]
- ]
- ].
- ]
+ "Created: / 08-04-2011 / 16:52:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
- "
- self compressPools
- "
+invalidateReferencesToClass: internalJavaClassName
+ "Go over all constant pools and call invalidateForClass on all
+ references. (usable when given class was unloaded etc)"
+ ConstantPools do: [:each | each invalidateForClass: internalJavaClassName].
- "Modified: 19.8.1997 / 14:04:25 / cg"
+ "Created: / 08-04-2011 / 16:09:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaConstantPool methodsFor:'accessing'!
@@ -108,6 +174,60 @@
"Created: 28.6.1996 / 21:12:22 / cg"
! !
+!JavaConstantPool methodsFor:'adding'!
+
+at: classRefIndex putClassRefWithNameAt: classNameIndex
+ self at: classRefIndex
+ put: (JavaClassRef2 in: self withNameAt: classNameIndex).
+
+ "Created: / 13-05-2011 / 09:48:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+at: fieldRefIndex putFieldRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex
+ self at: fieldRefIndex
+ put: (JavaFieldRef2
+ in: self
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classRefIndex).
+
+ "Created: / 13-05-2011 / 09:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+at: interfaceMethodRefIndex putInterfaceMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex
+ self at: interfaceMethodRefIndex
+ put: (JavaInterfaceMethodRef2
+ in: self
+ withNameAndTypeAt: nameAndTypeIndex
+ andClassAt: classRefIndex).
+
+ "Created: / 13-05-2011 / 09:08:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+at: methodRefIndex putMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex
+ self at: methodRefIndex
+ put: (JavaMethodRef2 in: self withNameAndTypeAt: nameAndTypeIndex andClassAt:classRefIndex).
+
+ "Created: / 13-05-2011 / 09:07:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+at: nameAndTypeIndex putNameAndTypeWithNameAt: nameIndex andDescriptorAt: descriptorIndex
+ self at: nameAndTypeIndex
+ put: (JavaNameAndType2 in: self withNameAt: nameIndex andDescriptorAt: descriptorIndex).
+
+ "Created: / 13-05-2011 / 09:05:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaConstantPool methodsFor:'initialization'!
+
+initialize
+ "Invoked when a new instance is created."
+
+ "/ please change as required (and remove this comment)
+ "/ owner := nil.
+
+ "/ super initialize. -- commented since inherited method does nothing
+! !
+
!JavaConstantPool methodsFor:'printing & storing'!
displayString
@@ -123,38 +243,35 @@
!JavaConstantPool methodsFor:'queries'!
refersToMethod:aJavaMethod
+
+ self error: 'JV@2011-07-26: Update to new resolving scheme!!'.
+
self do:[:constItem |
(constItem == aJavaMethod) ifTrue:[^ true].
- (constItem isMemberOf:JavaMethodref) ifTrue:[
- self halt.
- ].
- (constItem isMemberOf:JavaUnresolvedMethodrefConstant) ifTrue:[
- self halt.
+
+ ].
+ ^ false
+
+ "Created: / 29-07-1997 / 17:39:19 / cg"
+ "Modified: / 26-07-2011 / 18:00:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+refersToMethodNamed:aJavaMethodName
+
+ self error: 'JV@2011-07-26: Update to new resolving scheme!!'.
+
+ self do:[:constItem |
+ (constItem isKindOf:JavaMethod) ifTrue:[
+ constItem name = aJavaMethodName ifTrue:[^ true].
+ ] ifFalse:[
+
]
].
^ false
- "Modified: 29.7.1997 / 17:36:49 / cg"
- "Created: 29.7.1997 / 17:39:19 / cg"
-!
-
-refersToMethodNamed:aJavaMethodName
- self do:[:constItem |
- (constItem isKindOf:JavaMethod) ifTrue:[
- constItem name = aJavaMethodName ifTrue:[^ true].
- ] ifFalse:[
- (constItem isMemberOf:JavaMethodref) ifTrue:[
- constItem name = aJavaMethodName ifTrue:[^ true].
- ].
- (constItem isMemberOf:JavaUnresolvedMethodrefConstant) ifTrue:[
- self halt.
- ]
- ]
- ].
- ^ false
-
- "Created: / 29.7.1997 / 17:39:24 / cg"
- "Modified: / 16.10.1998 / 01:22:02 / cg"
+ "Created: / 29-07-1997 / 17:39:24 / cg"
+ "Modified: / 16-10-1998 / 01:22:02 / cg"
+ "Modified: / 26-07-2011 / 17:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaConstantPool methodsFor:'special'!
@@ -170,6 +287,25 @@
"Created: / 4.1.1998 / 00:40:11 / cg"
!
+invalidateAll
+ "go over all entries and call invalidate on all references"
+
+ self do:
+ [:entry |
+ entry isJavaRef
+ ifTrue: [ entry invalidate] ].
+
+ "Created: / 13-05-2011 / 09:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invalidateForClass: internalJavaClassName
+"go over all entries and call invalidateForClass on all references"
+
+self do: [:entry | entry isJavaRef ifTrue:[entry invalidateForClass: internalJavaClassName]].
+
+ "Created: / 08-04-2011 / 16:11:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
updateClassRefsFrom:oldClass to:newClass
owner == oldClass ifTrue:[
self halt.
@@ -223,5 +359,11 @@
!JavaConstantPool class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaConstantPool.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaConstantPool.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
! !
+
+JavaConstantPool initialize!
\ No newline at end of file
--- a/JavaContext.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaContext.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
Context variableSubclass:#JavaContext
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,54 @@
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.
+
+"
+! !
+
+!JavaContext methodsFor:'* As yet uncategorized *'!
+
+markForException
+ "set the exception handler flag in the receiver.
+ The JVM needs this to enter an exception handler instead of restarting
+ from the beginning (when the context is restarted).
+ - a highly internal mechanism and not for public use."
+"
+%{ /* NOCONTEXT */
+#ifdef __JAVA_EX_PEND
+ /* actually no longer - only a non-nil exPC is now used as marker */
+ __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND));
+#endif
+%}
"
-
+ "Modified: / 13-12-1995 / 19:05:22 / cg"
+ "Modified: / 25-10-2010 / 17:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaContext methodsFor:'ST context mimicri'!
@@ -279,6 +355,15 @@
"Created: / 13.1.1998 / 16:48:16 / cg"
! !
+!JavaContext methodsFor:'accessing'!
+
+programmingLanguage
+
+ ^JavaLanguage instance
+
+ "Created: / 17-03-2011 / 10:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaContext methodsFor:'exception handler support'!
exceptionArg:aJavaException
@@ -292,22 +377,6 @@
exPC := newPc.
"Created: / 7.1.1998 / 21:36:56 / cg"
-!
-
-markForException
- "set the exception handler flag in the receiver.
- The JVM needs this to enter an exception handler instead of restarting
- from the beginning (when the context is restarted).
- - a highly internal mechanism and not for public use."
-
-%{ /* NOCONTEXT */
-#ifdef __JAVA_EX_PEND
- /* actually no longer - only a non-nil exPC is now used as marker */
- __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND));
-#endif
-%}
-
- "Modified: 13.12.1995 / 19:05:22 / cg"
! !
!JavaContext methodsFor:'printing & storing'!
@@ -400,5 +469,9 @@
!JavaContext class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaContext.st,v 1.36 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaContext.st,v 1.36 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaDecompiler.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaDecompiler.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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:#JavaDecompiler
@@ -26,8 +54,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -35,8 +67,34 @@
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.
+
"
-
!
examples
@@ -617,84 +675,80 @@
"Modified: / 5.12.1998 / 15:58:37 / cg"
!
-methodDefinitionOf:m inPackage:pckgName on:s
- |aMethod type nm specComponents accessAttributeStyle codeStyle methodNameStyle|
+methodDefinitionOf: m inPackage: pckgName on: s
+ | aMethod nm specComponents accessAttributeStyle codeStyle methodNameStyle |
aMethod := m.
- m isWrapped ifTrue:[
+ m isWrapped ifTrue: [
aMethod := m originalMethod
].
-
- accessAttributeStyle := Java prettyPrintStyle at:#accessAttribute.
- codeStyle := Java prettyPrintStyle at:#code.
- methodNameStyle := Java prettyPrintStyle at:#methodName.
-
- s nextPutAll:' '.
- s emphasis:accessAttributeStyle.
- aMethod isPublic ifTrue:[
- s nextPutAll:'public '.
- ] ifFalse:[
- aMethod isProtected ifTrue:[
- s nextPutAll:'protected '.
- ] ifFalse:[
- s nextPutAll:'private '.
- ]
+ accessAttributeStyle := Java prettyPrintStyle at: #accessAttribute.
+ codeStyle := Java prettyPrintStyle at: #code.
+ methodNameStyle := Java prettyPrintStyle at: #methodName.
+ s nextPutAll: ' '.
+ s emphasis: accessAttributeStyle.
+ aMethod isPublic ifTrue: [
+ s nextPutAll: 'public '.
+ ] ifFalse: [
+ aMethod isProtected ifTrue: [
+ s nextPutAll: 'protected '.
+ ] ifFalse: [ s nextPutAll: 'private '. ]
].
- aMethod isFinal ifTrue:[
- s nextPutAll:'final '.
+ aMethod isFinal ifTrue: [
+ s nextPutAll: 'final '.
].
- aMethod isStatic ifTrue:[
- s nextPutAll:'static '.
+ aMethod isStatic ifTrue: [
+ s nextPutAll: 'static '.
].
- aMethod isNative ifTrue:[
- s nextPutAll:'native '.
+ aMethod isNative ifTrue: [
+ s nextPutAll: 'native '.
].
- aMethod isSynchronized ifTrue:[
- s nextPutAll:'synchronized '.
+ aMethod isSynchronized ifTrue: [
+ s nextPutAll: 'synchronized '.
].
- s emphasis:codeStyle.
-
- (nm := aMethod name) = '<init>' ifTrue:[
+ s emphasis: codeStyle.
+ (nm := aMethod name) = '<init>' ifTrue: [
nm := aMethod javaClass lastName.
].
- specComponents := JavaMethod
- specComponentsWithArgsFromSignature:(aMethod signature)
- withName:nm
- in:(aMethod javaClass package).
-
- s nextPutAll:(specComponents at:1).
+ specComponents := JavaMethod
+ specComponentsWithArgsFromSignature: (aMethod instVarNamed:#descriptor)
+ withName: nm
+ in: (aMethod javaClass package).
+ s nextPutAll: (specComponents at: 1).
s space.
- s emphasis:methodNameStyle.
- s nextPutAll:(specComponents at:2).
- s emphasis:codeStyle.
- s nextPutAll:' ('.
- s nextPutAll:(specComponents at:3).
- s nextPutAll:')'.
-
- aMethod exceptionTable size > 0 ifTrue:[
- s nextPutAll:' throws '.
+ s emphasis: methodNameStyle.
+ s nextPutAll: (specComponents at: 2).
+ s emphasis: codeStyle.
+ s nextPutAll: ' ('.
+ s nextPutAll: (specComponents at: 3).
+ s nextPutAll: ')'.
+ aMethod exceptionTable size > 0 ifTrue: [
+ s nextPutAll: ' throws '.
+ aMethod exceptionTable
+ keysAndValuesDo: [
+ :index :aClassRef |
+ | nm |
- aMethod exceptionTable keysAndValuesDo:[:index :aClassRef |
- |nm|
-
- nm := aClassRef fullName.
- (nm startsWith:pckgName) ifTrue:[
- nm := nm copyFrom:pckgName size + 2
- ] ifFalse:[
- (nm startsWith:'java/lang') ifTrue:[
- nm := nm copyFrom:'java/lang' size + 2.
+ nm := aClassRef name.
+ (nm startsWith: pckgName) ifTrue: [
+ nm := nm copyFrom: pckgName size + 2
+ ] ifFalse: [
+ (nm startsWith: 'java/lang') ifTrue: [
+ nm := nm copyFrom: 'java/lang' size + 2.
+ ].
].
- ].
- index ~~ 1 ifTrue:[
- s nextPutAll:', '
- ].
- s nextPutAll:(nm copyReplaceAll:$/ with:$.)
- ]
+ index ~~ 1 ifTrue: [ s nextPutAll: ', ' ].
+ s nextPutAll: (nm copyReplaceAll: $/ with: $.)
+ ]
].
- s nextPutAll:';'; cr.
+ s
+ nextPutAll: ';';
+ cr.
- "Created: / 1.8.1997 / 12:24:11 / cg"
- "Modified: / 14.11.1998 / 00:03:09 / cg"
+ "Created: / 01-08-1997 / 12:24:11 / cg"
+ "Modified: / 14-11-1998 / 00:03:09 / cg"
+ "Modified: / 04-06-2011 / 17:18:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 15-08-2011 / 08:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaDecompiler class methodsFor:'decompiling'!
@@ -1244,7 +1298,11 @@
!JavaDecompiler class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaDecompiler.st,v 1.50 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaDecompiler.st,v 1.50 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaDecompiler initialize!
+JavaDecompiler initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaDescriptor.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,336 @@
+"
+ 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:#JavaDescriptor
+ instanceVariableNames:''
+ classVariableNames:'BaseTypes BaseTypesByTypeName ArrayTypes'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaDescriptor 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.
+
+"
+! !
+
+!JavaDescriptor class methodsFor:'instance creation'!
+
+fromString: aString
+
+ ^self readFromString: aString
+
+ "Created: / 25-11-2010 / 18:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readFrom: aStream
+
+ ^ self
+ readFrom:aStream
+ onError:[ self conversionErrorSignal
+ raiseErrorString:'invalid java descriptor']
+
+ "Created: / 25-11-2010 / 18:04:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readFrom:stream onError:exceptionBlock
+
+ (stream peek == $( or:[stream peek == $<])
+ ifTrue: [^self readMethodDescriptorFrom: stream onError: exceptionBlock]
+ ifFalse:[^self readFieldDescriptorFrom: stream onError: exceptionBlock].
+
+ "
+ JavaDescriptor fromString:'Ljava/lang/Object;'
+ JavaDescriptor fromString:'[I'
+ JavaDescriptor fromString:'[[I'
+ JavaDescriptor fromString:'(ILjava/lang/Object;)V'
+ JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;'
+ JavaDescriptor fromString:'<T:Ljava/lang/Object;>(Ljava/util/Collection<TT;>;I)Ljava/util/Collection<TT;>;'
+
+ "
+
+ "Created: / 25-11-2010 / 17:50:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-08-2011 / 01:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaDescriptor class methodsFor:'accessing'!
+
+baseTypes
+
+ ^BaseTypes
+
+ "Created: / 22-05-2011 / 17:45:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+baseTypesByTypeName
+
+ ^BaseTypesByTypeName
+
+ "Created: / 03-02-2011 / 21:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaDescriptor class methodsFor:'class initialization'!
+
+initialize
+
+ "
+ Tools::NewSystemBrowser basicNew spawnClassBrowserFor: BaseTypes values label:'Java primitive types' in:#newBrowser
+ "
+
+ "/WARNING: If you change something here, you MUST also
+ "/ change JavaField class>>#initialize !!!!!!
+ BaseTypes := IdentityDictionary new
+ at: $B put: Byte;
+ at: $C put: Character;
+ at: $D put: Float;
+ at: $F put: ShortFloat;
+ at: $I put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
+ at: $J put: LargeInteger;
+ at: $S put: Short;
+ at: $Z put: Boolean;
+ at: $V put: UndefinedObject;
+ yourself.
+
+ BaseTypesByTypeName := Dictionary new
+ at: 'byte' put: Byte;
+ at: 'char' put: Character;
+ at: 'double' put: Float;
+ at: 'float' put: ShortFloat;
+ at: 'int' put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
+ at: 'long' put: LargeInteger;
+ at: 'short' put: Short;
+ at: 'boolean' put: Boolean;
+ at: 'void' put: UndefinedObject;
+ yourself.
+
+ "
+ Tools::NewSystemBrowser basicNew spawnClassBrowserFor: ArrayTypes values label:'Java primitive array types' in:#newBrowser
+ "
+
+ "/WARNING: If you change something here, you MUST also
+ "/ change JavaField class>>#initialize !!!!!!
+
+ ArrayTypes := IdentityDictionary new
+ at: $B put: ByteArray;
+ at: $C put: Unicode16String;
+ at: $D put: DoubleArray;
+ at: $F put: FloatArray;
+ at: $I put: SignedIntegerArray;
+ at: $J put: SignedLongIntegerArray;
+ at: $S put: WordArray;
+ at: $Z put: BooleanArray;
+ yourself
+
+ "Created: / 25-11-2010 / 17:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-08-2011 / 00:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaDescriptor class methodsFor:'reading-private'!
+
+readArrayTypeFrom: stream onError: exceptionBlock
+
+ | p c |
+ stream next. "eat $["
+ p := stream peek.
+ (#(
+ $B "byte"
+ $C "char"
+ $D "double"
+ $F "float"
+ $I "int"
+ $J "long"
+ $S "short"
+ $Z "boolean"
+ ) includes: p) ifTrue:[^JavaFieldDescriptor javaClass: (ArrayTypes at: stream next)].
+
+ "OK, not a primitive array..."
+ c := self readFrom: stream onError: exceptionBlock.
+ ^JavaFieldDescriptor javaClass: (JavaVM javaArrayClassFor: c javaClass)
+
+ "Created: / 25-11-2010 / 18:12:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-02-2011 / 23:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readBaseTypeFrom: stream onError: exceptionBlock
+
+ ^JavaFieldDescriptor javaClass: (BaseTypes at: (stream next) ifAbsent: exceptionBlock)
+
+ "Created: / 25-11-2010 / 18:11:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readFieldDescriptorFrom: stream onError: exceptionBlock
+
+ | p |
+ p := stream peek.
+
+ p == $L ifTrue:[^self readObjectTypeFrom: stream onError: exceptionBlock].
+ p == $[ ifTrue:[^self readArrayTypeFrom: stream onError: exceptionBlock].
+ (#(
+ $B "byte"
+ $C "char"
+ $D "double"
+ $F "float"
+ $I "int"
+ $J "long"
+ $S "short"
+ $Z "boolean"
+ $V "void"
+ ) includes: p) ifTrue:[^self readBaseTypeFrom: stream onError: exceptionBlock].
+
+ exceptionBlock value
+
+ "Created: / 25-11-2010 / 17:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-12-2010 / 22:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readMethodDescriptorFrom: stream onError: exceptionBlock
+
+ | parameterDescriptors returnDescriptor |
+
+ stream peek == $< ifTrue:[
+ self readTypeVariableFrom: stream onError: exceptionBlock
+ ].
+ stream next. "eat $("
+ parameterDescriptors := OrderedCollection new.
+ [ stream peek ~= $) ] whileTrue:[
+ parameterDescriptors add:( self readFieldDescriptorFrom: stream onError: exceptionBlock).
+ ].
+ stream next. "eat $)"
+ stream peek == $V ifFalse:[
+ returnDescriptor := self readFieldDescriptorFrom: stream onError: exceptionBlock.
+ ] ifTrue:[
+ stream next. "eat $V"
+ ].
+ ^JavaMethodDescriptor parameters: parameterDescriptors return: returnDescriptor
+
+ "
+ JavaDescriptor fromString:'(ILjava/lang/Object;)V'
+ JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;'
+ "
+
+ "Created: / 25-11-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-08-2011 / 01:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readObjectTypeFrom: stream onError: exceptionBlock
+
+ | clsName out |
+
+ stream next. "/eat $L.
+ out := String new writeStream.
+ [ stream peek ~~ $; and:[stream peek ~~ $< ]] whileTrue:[out nextPut: stream next].
+ clsName := out contents.
+ stream peek == $< ifTrue:[
+ self readTypeVariableFrom: stream onError: exceptionBlock
+ ].
+
+ "Just a check"
+ stream next ~= $; ifTrue:[exceptionBlock value].
+ ^JavaFieldDescriptor javaClassName: clsName.
+
+ "Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readTypeVariableFrom: stream onError: exceptionBlock
+
+ | nangles |
+
+ stream next. "/eat $<.
+ nangles := 1.
+ [ nangles ~~ 0 ] whileTrue:[
+ stream peek == $< ifTrue:[nangles := nangles + 1].
+ stream peek == $> ifTrue:[nangles := nangles - 1].
+ stream next.
+ ]
+
+ "Created: / 13-08-2011 / 01:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaDescriptor class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaDescriptor initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaDoubleTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaDoubleTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaDoubleTypeNode 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.
+
+"
+! !
+
+!JavaDoubleTypeNode methodsFor:'accessing'!
+
+selector
+ ^ $d
+
+ "Created: / 17-12-2010 / 18:29:07 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaDoubleTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaEmbeddedFrameView.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaEmbeddedFrameView.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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' }"
JavaView subclass:#JavaEmbeddedFrameView
@@ -27,8 +55,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -36,8 +68,34 @@
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
@@ -653,5 +711,9 @@
!JavaEmbeddedFrameView class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaEmbeddedFrameView.st,v 1.26 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaEmbeddedFrameView.st,v 1.26 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaError.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,102 @@
+"
+ 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' }"
+
+Error subclass:#JavaError
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaError 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.
+
+"
+! !
+
+!JavaError class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaEvaluator.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,124 @@
+"
+ 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:#JavaEvaluator
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaEvaluator 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.
+
+"
+! !
+
+!JavaEvaluator methodsFor:'compiler interface'!
+
+evaluate:source in: context receiver: receiver notifying: requestor logged: logged ifFail: fail
+
+ | binding shell result |
+ binding := (Java classForName:'groovy.lang.Binding') new.
+ shell := (Java classForName:'groovy.lang.GroovyShell') newCleared.
+ shell perform: #'<init>(Lgroovy/lang/Binding;)V' with: binding.
+ result := shell perform: #'evaluate(Ljava/lang/String;)Ljava/lang/Object;'
+ with: (Java as_String: source).
+ ^result.
+
+ "Created: / 17-08-2011 / 08:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+moreSharedPools: pools
+
+ "Ignored for Java"
+
+ "Created: / 16-08-2011 / 10:15:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaEvaluator class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaExceptionTableEntry.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaExceptionTableEntry.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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:#JavaExceptionTableEntry
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaExceptionTableEntry class methodsFor:'instance creation'!
@@ -90,6 +146,18 @@
handlerPC printString , ')'
"Modified: 15.8.1997 / 03:33:51 / cg"
+!
+
+printOn: aStream
+ super printOn: aStream.
+ aStream nextPut:$(.
+ catchType printOn: aStream.
+ aStream nextPutAll:' in ' , startPC printString , '..' ,
+ endPC printString , '->' ,
+ handlerPC printString , ')'
+
+ "Modified: / 15-08-1997 / 03:33:51 / cg"
+ "Created: / 25-02-2011 / 09:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaExceptionTableEntry methodsFor:'private accessing'!
@@ -99,14 +167,25 @@
return the handler-PC; otherwise, return nil."
|cls|
+ "JV+MH@2011-02-25: You may wonder why there is endPC - 1:
+ The Java VM Spec, 3rd edition, sec 4.7.3, page 78:
- (pc between:startPC and:endPC) ifTrue:[
+ The fact that end_pc is exclusive is a historical mistake in the design of the
+ Java virtual machine: if the Java virtual machine code for a method is exactly
+ 65535 bytes long and ends with an instruction that is 1 byte long, then that
+ instruction cannot be protected by an exception handler. A compiler writer can
+ work around this bug by limiting the maximum size of the generated Java
+ virtual machine code for any method, instance initialization method, or static
+ initializer (the size of any code array) to 65534 bytes.
+
+ "
+
+ (pc between:startPC and:endPC - 1) ifTrue:[
(catchType == 0) ifTrue:[^ handlerPC].
(catchType isNil) ifTrue:[^ handlerPC].
cls := aMethod javaClass.
- catchType isUnresolved ifTrue:[
- catchType := catchType preResolve.
- ].
+ catchType := catchType javaClass.
+
(catchType isKindOf:JavaClass) ifFalse:[
self halt.
^ nil
@@ -118,7 +197,8 @@
].
^ nil
- "Modified: / 7.1.1998 / 15:30:14 / cg"
+ "Modified: / 07-01-1998 / 15:30:14 / cg"
+ "Modified: / 31-05-2011 / 09:53:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
@@ -133,5 +213,9 @@
!JavaExceptionTableEntry class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaExceptionTableEntry.st,v 1.16 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaExceptionTableEntry.st,v 1.16 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaExceptionThrowerMock.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,145 @@
+"
+ 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:#JavaExceptionThrowerMock
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaExceptionThrowerMock 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.
+
+"
+! !
+
+!JavaExceptionThrowerMock methodsFor:'exceptions'!
+
+throwAbstractMethodError
+ self error: 'AbstractMethodError'.
+
+ "Created: / 11-04-2011 / 20:19:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:09:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwIllegalAccessError
+ self error: 'IllegalAccessError'.
+
+ "Created: / 11-04-2011 / 19:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:09:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwIllegalAccessException
+ self error: 'IllegalAccessException'.
+
+ "Created: / 13-04-2011 / 23:02:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwIncompatibleClassChangeError
+ self error: 'IncompatibleClassChangeError'.
+
+ "Created: / 11-04-2011 / 20:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:09:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwNoSuchFieldException
+ self error: 'NoSuchFieldException'.
+
+ "Created: / 11-04-2011 / 21:35:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:10:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwNoSuchMethodError
+ self error: 'NoSuchMethodError'.
+
+ "Created: / 11-04-2011 / 20:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:10:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaExceptionThrowerMock class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaField.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaField.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,13 +12,40 @@
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' }"
-JavaRef subclass:#JavaField
- instanceVariableNames:'accessFlags name signature constantValue'
+Object subclass:#JavaField
+ instanceVariableNames:'accessFlags class name descriptor signature index constantValue
+ annotations constantPool'
classVariableNames:'A_FINAL A_PRIVATE A_PROTECTED A_PUBLIC A_STATIC A_TRANSIENT
- A_VOLATILE A_SMALLTALK A_SYBTHETIC A_ENUM'
+ A_VOLATILE A_SMALLTALK A_SYBTHETIC A_ENUM FieldTypeClasses'
poolDictionaries:''
category:'Languages-Java-Reader-Support'
!
@@ -23,8 +54,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -32,9 +67,34 @@
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.
+
+"
! !
!JavaField class methodsFor:'class initialization'!
@@ -50,11 +110,43 @@
A_SYBTHETIC := 16r1000.
A_ENUM := 16r4000.
+ FieldTypeClasses := IdentityDictionary new
+ "Base types"
+ "/WARNING: If you change something here, you MUST also
+ "/ change JavaDescriptor class>>#initialize !!!!!!
+
+ at: #B put: Byte;
+ at: #C put: Character;
+ at: #D put: Float;
+ at: #F put: ShortFloat;
+ at: #I put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
+ at: #J put: LargeInteger;
+ at: #S put: Short;
+ at: #Z put: Boolean;
+
+ "Array types"
+ "/WARNING: If you change something here, you MUST also
+ "/ change JavaDescriptor class>>#initialize !!!!!!
+ at: #'[B' put: ByteArray;
+ at: #'[C' put: Unicode16String;
+ at: #'[D' put: DoubleArray;
+ at: #'[F' put: FloatArray;
+ at: #'[I' put: SignedIntegerArray; "Kludge: instances of java int are in fact SmallIntegers"
+ at: #'[J' put: SignedLongIntegerArray;
+ at: #'[S' put: WordArray;
+ at: #'[Z' put: BooleanArray;
+
+ yourself
+
+
+
+
"
self initialize
"
- "Modified: / 13.5.1998 / 14:44:43 / cg"
+ "Modified: / 13-05-1998 / 14:44:43 / cg"
+ "Modified: / 10-08-2011 / 00:48:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaField class methodsFor:'constants'!
@@ -103,6 +195,26 @@
!JavaField methodsFor:'accessing'!
+accessFlags
+ ^ accessFlags
+!
+
+annotations
+ ^ annotations
+!
+
+annotations:something
+ annotations := something.
+!
+
+constantPool
+
+ ^ constantPool
+
+ "Created: / 17-12-2010 / 18:40:23 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 27-07-2011 / 09:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
constantValue
^ constantValue
!
@@ -111,6 +223,35 @@
constantValue := aValue
!
+ensureHasAnnotations
+ annotations ifNil: [ annotations := JavaAnnotationContainer for:self ].
+ ^ annotations
+
+ "Created: / 25-02-2011 / 16:04:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+index
+
+ index ifNil:[
+ self isStatic ifTrue:[
+ index := class class instVarOffsetOf: name
+ ] ifFalse:[
+ index := class instVarOffsetOf: name
+ ].
+ ].
+ ^ index
+
+ "Modified: / 17-08-2011 / 09:26:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClass
+
+ ^ class
+
+ "Created: / 27-07-2011 / 09:17:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
name
^ name
!
@@ -121,15 +262,7 @@
"Created: / 15.10.1998 / 10:37:06 / cg"
! !
-!JavaField methodsFor:'printing & storing'!
-
-displayString
- ^ self class name , '(name: ' , name displayString , ')'
-
-
-! !
-
-!JavaField methodsFor:'private accessing'!
+!JavaField methodsFor:'initialization'!
setAccessFlags:flags
accessFlags := flags.
@@ -137,12 +270,41 @@
"Created: 16.4.1996 / 13:04:25 / cg"
!
+setClass: aClass
+
+ class := aClass
+
+ "Created: / 27-07-2011 / 09:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setConstantPool:aJavaContantPool
+
+ constantPool := aJavaContantPool.
+
+ "Created: / 17-12-2010 / 18:41:59 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 27-07-2011 / 09:30:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
setConstantValue:something
constantValue := something.
"Created: 16.4.1996 / 13:04:58 / cg"
!
+setDescriptor:aString
+
+ descriptor := aString.
+
+ "Created: / 16-04-1996 / 13:04:43 / cg"
+ "Created: / 14-08-2011 / 19:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setIndex:anInteger
+ index := anInteger.
+
+ "Created: / 22-11-2010 / 17:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
setName:aString
name := aString.
@@ -155,12 +317,28 @@
"Created: 16.4.1996 / 13:04:43 / cg"
! !
+!JavaField methodsFor:'printing & storing'!
+
+printOn: aStream
+
+ super printOn: aStream.
+ aStream
+ nextPutAll:'(name: ';
+ nextPutAll: name;
+ nextPut:$,; space;
+ nextPutAll:'descriptor: ';
+ nextPutAll: signature;
+ nextPut:$)
+
+ "Created: / 22-05-2011 / 16:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaField methodsFor:'queries'!
initialValue
- ^ JavaClass initialValueFromSignature:signature
+ ^ JavaClass initialValueFromSignature: descriptor
-
+ "Modified: / 14-08-2011 / 19:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isFinal
@@ -206,19 +384,32 @@
!
type
- ^ JavaMethod typeFromSignature:signature in:nil
+ ^ JavaMethod typeFromSignature:descriptor in:nil
+
+ "Modified: / 08-01-1998 / 19:13:22 / cg"
+ "Modified: / 14-08-2011 / 19:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- "Modified: / 8.1.1998 / 19:13:22 / cg"
+typeClass
+
+ ^(JavaDescriptor fromString: descriptor) javaClass.
+
+ "Created: / 23-11-2010 / 17:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-08-2011 / 19:59:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaField class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: /cvs/stx/stx/libjava/JavaField.st,v 1.18 2011/08/18 18:42:48 vrany Exp $'
!
version_CVS
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.17 2009/10/09 14:04:34 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id: JavaField.st,v 1.18 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaField initialize!
+JavaField initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFieldAnnotationContainer.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,102 @@
+"
+ 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' }"
+
+JavaAnnotationContainer subclass:#JavaFieldAnnotationContainer
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+!JavaFieldAnnotationContainer 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.
+
+"
+! !
+
+!JavaFieldAnnotationContainer class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFieldDescriptor.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,151 @@
+"
+ 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' }"
+
+JavaDescriptor subclass:#JavaFieldDescriptor
+ instanceVariableNames:'javaClassName javaClass'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaFieldDescriptor 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.
+
+"
+! !
+
+!JavaFieldDescriptor class methodsFor:'instance creation'!
+
+javaClass: cls
+
+ ^self new javaClass: cls
+
+ "Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassName: clsName
+
+ ^self new javaClassName: clsName
+
+ "Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaFieldDescriptor methodsFor:'accessing'!
+
+javaClass
+
+ javaClass ifNil:[javaClass := Java classForName: self javaClassName].
+ ^javaClass
+
+ "Modified: / 13-08-2011 / 01:24:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassName
+ ^ javaClassName upTo: $<
+
+ "Modified: / 13-08-2011 / 01:24:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassObject
+
+ ^JavaVM javaClassObjectForClass: self javaClass
+
+ "Created: / 25-11-2010 / 18:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaFieldDescriptor methodsFor:'initialization'!
+
+javaClass:something
+ javaClass := something.
+!
+
+javaClassName:something
+ javaClassName := something.
+! !
+
+!JavaFieldDescriptor class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFieldRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,205 @@
+"
+ 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' }"
+
+JavaClassContentRef2 subclass:#JavaFieldRef2
+ instanceVariableNames:'offset type'
+ classVariableNames:'T_LONG T_DOUBLE'
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaFieldRef2 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.
+
+"
+! !
+
+!JavaFieldRef2 class methodsFor:'initialization'!
+
+initialize
+ T_LONG := 1.
+ T_DOUBLE := 2.
+
+ "Created: / 15-05-2011 / 22:31:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRef2 methodsFor:'accessing'!
+
+isJavaFieldRef
+^true.
+
+ "Created: / 11-04-2011 / 21:47:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+offset
+ ^ offset.
+
+ "Created: / 15-05-2011 / 22:26:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+type
+ type == T_LONG ifTrue: [ ^ #long. ].
+ type == T_DOUBLE ifTrue: [ ^ #double ].
+ ^ type.
+
+ "Created: / 15-05-2011 / 22:29:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRef2 methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ valueCache := JavaResolver uniqueInstance
+ resolveStaticFieldIndentifiedByRef: self.
+ "/Use javaClass of the field, not the class ref!!
+ classCache := valueCache javaClass.
+ classCache ifNil: [ self breakPoint: #mh ].
+ self resolveStaticOffset.
+ nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
+ self resolveType.
+ nameAndTypeCache ifNil: [ self breakPoint: #mh ].
+
+ "Created: / 28-04-2011 / 22:05:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 18-05-2011 / 12:44:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 24-05-2011 / 14:05:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+findResolvedValue
+ valueCache := JavaResolver uniqueInstance
+ resolveFieldIndentifiedByRef: self.
+ classCache := (constantPool at: classRefIndex) resolve.
+ classCache ifNil: [ self breakPoint: #mh ].
+ self resolveOffset.
+ nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
+ self resolveType.
+ nameAndTypeCache ifNil: [ self breakPoint: #mh ].
+
+ "Modified: / 18-05-2011 / 12:44:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveOffset
+ "fieldRef must be resolved before calling me"
+
+ | currentClass |
+
+ currentClass := classCache.
+
+ [ offset := currentClass instVarOffsetOf: self name.
+ offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ].
+
+ "Modified: / 20-05-2011 / 20:36:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveStaticOffset
+ "fieldRef must be resolved before calling me"
+
+ | currentClass |
+
+ currentClass := classCache.
+
+ [ offset := currentClass class instVarOffsetOf: self name.
+ offset isNil and: [ currentClass superclass ~= JavaObject ]. ] whileTrue: [ currentClass := currentClass superclass. ].
+
+ "Modified: / 20-05-2011 / 20:36:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveType
+ type := JavaMethod typeFromSignature:((constantPool at: nameAndTypeIndex) descriptor) in:nil.
+ type == #long ifTrue:[
+ type := T_LONG.
+ ] ifFalse:[
+ type == #double ifTrue:[
+ type := T_DOUBLE
+ ]
+ ].
+
+ "Created: / 15-05-2011 / 22:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaFieldRef2 initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFieldRefTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,495 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaFieldRefTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaFieldRefTests 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.
+
+"
+! !
+
+!JavaFieldRefTests methodsFor:'permission tests'!
+
+testAccessingPPFromOutside
+ | javaFieldRef initString |
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [
+ javaFieldRef := self
+ getFieldRefNamed: 'packagePrivateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 14-04-2011 / 15:05:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:40:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPPFromPackage
+ | javaFieldRef initString |
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+
+
+self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'packagePrivateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 14-04-2011 / 15:08:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:41:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPPFromSubclass
+ | javaFieldRef initString |
+
+
+
+
+initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'packagePrivateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error.
+
+ "Created: / 14-04-2011 / 15:08:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:42:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromOutside
+ | javaFieldRef initString |
+
+
+
+
+initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'privateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:42:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromOutsideInNonPublic
+ | javaFieldRef initString |
+
+
+
+
+initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self
+ should:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'privateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:43:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromSubclass
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'privateField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:45:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromOutside
+ | javaFieldRef initString |
+
+
+initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'protectedField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:46:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromOutsideInNonPublic
+ | javaFieldRef initString |
+
+
+
+initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self
+ should:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'protectedField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+
+ javaFieldRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:46:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromPackage
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'protectedField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 14-04-2011 / 15:09:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:48:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromSubclass
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'protectedField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:49:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromOutside
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:51:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromOutsideInNonPublic
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:52:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromSubclass
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ shouldnt:
+ [ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ javaFieldRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaFieldRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:52:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRefTests methodsFor:'resolving static tests'!
+
+testResolvingStatic
+ | javaFieldRef initString result expectedResult |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'publicStaticField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ result := javaFieldRef resolveStatic.
+ expectedResult := (Java
+ classForName: 'stx.libjava.tests.mocks.PublicClass') staticFields
+ at: 3.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 28-04-2011 / 22:00:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:32:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRefTests methodsFor:'resolving tests'!
+
+testCorrectInstanceCreation
+ | initString javaFieldRef |
+
+ initString := 'Ljava/lang/String;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'value'
+ typed: '[C'
+ inClass: initString.
+ self assertTrue: (javaFieldRef isResolved not).
+ self assertTrue: (javaFieldRef valueCache isNil).
+ self assertTrue: (javaFieldRef name = 'value').
+ self assertTrue: (javaFieldRef descriptor = '[C').
+ self assertTrue: (javaFieldRef classRef name = initString).
+
+ "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:28:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testCorrectResolving
+ | initString javaFieldRef expectedResult result |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ self assertTrue: (javaFieldRef isResolved not).
+ javaFieldRef resolve.
+ self assertTrue: (javaFieldRef isResolved).
+ result := javaFieldRef resolve.
+ expectedResult := (Java
+ classForName: 'stx.libjava.tests.mocks.PublicClass') fields
+ at: 3.
+ self assertTrue: (result = expectedResult).
+ self assertTrue: (javaFieldRef offset = 3).
+ self assertTrue: (javaFieldRef type = 'java.lang.String').
+
+ "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:29:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidation
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ self assertTrue: (javaFieldRef isResolved not).
+ javaFieldRef resolve.
+ self assertTrue: (javaFieldRef isResolved).
+ self assertTrue: (javaFieldRef classRef isResolved).
+ javaFieldRef invalidate.
+ self assertTrue: (javaFieldRef isResolved not).
+ self assertTrue: (javaFieldRef classRef isResolved not).
+
+ "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:30:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassNegative
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ self assertTrue: (javaFieldRef isResolved not).
+ javaFieldRef resolve.
+ self assertTrue: (javaFieldRef isResolved).
+ javaFieldRef invalidateForClass: 'Ljava/lang/Object;'.
+ self assertTrue: (javaFieldRef isResolved).
+
+ "Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:31:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassPositive
+ | javaFieldRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self
+ getFieldRefNamed: 'publicField'
+ typed: 'Ljava/lang/String;'
+ inClass: initString.
+ self assertTrue: (javaFieldRef isResolved not).
+ javaFieldRef resolve.
+ self assertTrue: (javaFieldRef isResolved).
+ javaFieldRef invalidateForClass: 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self assertTrue: (javaFieldRef isResolved not).
+
+ "Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:31:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testResolving
+ | javaFieldRef initString |
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ javaFieldRef := self getFieldRefNamed: 'publicField' typed:'Ljava/lang/String;' inClass:initString.
+
+ self assertTrue: (javaFieldRef isResolved not).
+ javaFieldRef resolve.
+ self assertTrue: (javaFieldRef isResolved).
+
+ "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 15:53:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaFieldRefTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFloatTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaFloatTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaFloatTypeNode 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.
+
+"
+! !
+
+!JavaFloatTypeNode methodsFor:'accessing'!
+
+selector
+ ^ $f
+
+ "Created: / 17-12-2010 / 18:13:00 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaFloatTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaFormalParameterNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,118 @@
+"
+ 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' }"
+
+JavaNode subclass:#JavaFormalParameterNode
+ instanceVariableNames:'type variableDeclaratorId'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaFormalParameterNode 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.
+
+"
+! !
+
+!JavaFormalParameterNode methodsFor:'accessing'!
+
+selector
+ ^ type selector, variableDeclaratorId first value
+
+ "Created: / 17-12-2010 / 16:50:07 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+type:something
+ type := something.
+!
+
+variableDeclaratorId:something
+ variableDeclaratorId := something.
+! !
+
+!JavaFormalParameterNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaInflater.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,102 @@
+"
+ 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:#JavaInflater
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaInflater 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.
+
+"
+! !
+
+!JavaInflater class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaInitializedResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,128 @@
+"
+ 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' }"
+
+JavaAntProjectResource subclass:#JavaInitializedResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaInitializedResource 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.
+
+"
+! !
+
+!JavaInitializedResource class methodsFor:'accessing - ant project'!
+
+antProjectDir
+
+ ^ (Smalltalk packageDirectoryForPackageId: 'stx:libjava') / 'java' / 'libjava-support'
+
+ "Created: / 18-07-2011 / 15:08:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaInitializedResource methodsFor:'running'!
+
+setUp
+
+ | java_lang_System |
+
+ (java_lang_System := Java at: 'java.lang.System') ifNil:[
+ Java initialize.
+ JavaVM initializeVM.
+ ] ifNotNil:[
+ java_lang_System classInit.
+ ].
+ super setUp.
+
+ "Created: / 16-03-2011 / 14:42:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaInitializedResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaIntTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaIntTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaIntTypeNode 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.
+
+"
+! !
+
+!JavaIntTypeNode methodsFor:'accessing'!
+
+selector
+ ^ 'i'
+
+ "Created: / 17-12-2010 / 16:38:25 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaIntTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaInterfaceMethodRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,134 @@
+"
+ 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' }"
+
+JavaMethodRef2 subclass:#JavaInterfaceMethodRef2
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaInterfaceMethodRef2 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.
+
+"
+! !
+
+!JavaInterfaceMethodRef2 methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ self halt: 'tell mh if you have valid use case for calling me'.
+
+ "Created: / 28-04-2011 / 22:53:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 18-05-2011 / 12:44:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+findResolvedValue
+ "Resolve reference and set valueCache."
+
+ valueCache := JavaResolver uniqueInstance
+ resolveInterfaceMethodIdentifiedByRef: self.
+classCache := (constantPool at: classRefIndex) resolve.
+ classCache ifNil: [ self breakPoint: #mh ].
+ nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
+ nameAndTypeCache ifNil: [ self breakPoint: #mh ].
+
+ "Modified: / 18-05-2011 / 12:44:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaInterfaceMethodRef2 methodsFor:'queries'!
+
+isJavaInterfaceMethodRef
+ "we will see if this is expected behavior"
+
+ ^ true.
+
+ "Created: / 14-04-2011 / 15:33:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaInterfaceMethodRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaInterfaceMethodRefTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,240 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaInterfaceMethodRefTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaInterfaceMethodRefTests 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.
+
+"
+! !
+
+!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'!
+
+testCorrectInstanceCreation
+ | initString javaMethodRef |
+
+ initString := 'Ljava/lang/Runnable;'.
+ javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ self assertTrue: (javaMethodRef valueCache isNil).
+ self assertTrue: (javaMethodRef name = 'run').
+ self assertTrue: (javaMethodRef descriptor = '()V').
+ self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;').
+
+ "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:19:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testCorrectResolving
+ | initString javaMethodRef expectedResult result |
+
+ initString := 'Ljava/lang/Runnable;'.
+ javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ result := javaMethodRef resolve.
+ expectedResult := (Java classForName: 'java.lang.Runnable')
+ methodDictionary at: #'run()V'.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidation
+ | javaMethodRef initString|
+
+ initString :='Ljava/lang/Runnable;'.
+
+ javaMethodRef := javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ self assertTrue: (javaMethodRef classRef isResolved).
+ javaMethodRef invalidate.
+ self assertTrue: (javaMethodRef isResolved not).
+ self assertTrue: (javaMethodRef classRef isResolved not).
+
+ "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassNegative
+ | javaMethodRef initString|
+
+ initString :='Ljava/lang/Runnable;'.
+
+ javaMethodRef := javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ self assertTrue: (javaMethodRef classRef isResolved).
+ javaMethodRef invalidateForClass: 'Ljava/lang/Object;'.
+ self assertTrue: (javaMethodRef isResolved).
+ self assertTrue: (javaMethodRef classRef isResolved).
+
+ "Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassPositive
+ | javaMethodRef initString|
+
+ initString :='Ljava/lang/Runnable;'.
+
+ javaMethodRef := javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ self assertTrue: (javaMethodRef classRef isResolved).
+ javaMethodRef invalidateForClass: 'Ljava/lang/Runnable;'.
+ self assertTrue: (javaMethodRef isResolved not).
+ self assertTrue: (javaMethodRef classRef isResolved not).
+
+ "Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testResolving
+ | javaMethodRef initString|
+
+ initString :='Ljava/lang/Runnable;'.
+
+ javaMethodRef := javaMethodRef := self
+ getInterfaceMethodRefNamed: 'run'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef classRef isResolved).
+ self assertTrue: (javaMethodRef isResolved).
+
+ "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaInterfaceMethodRefTests methodsFor:'permission tests'!
+
+testAccessingPublicFromSubclass
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getInterfaceMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ].
+
+ "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaInterfaceMethodRefTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaInvalidRefError.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,120 @@
+"
+ 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' }"
+
+JavaError subclass:#JavaInvalidRefError
+ instanceVariableNames:'javaClass index'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaInvalidRefError 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.
+
+"
+! !
+
+!JavaInvalidRefError methodsFor:'accessing'!
+
+index
+ ^ index
+!
+
+index:anInteger
+ index := anInteger.
+!
+
+javaClass
+ ^ javaClass
+!
+
+javaClass:aJavaClass
+ javaClass := aJavaClass.
+! !
+
+!JavaInvalidRefError class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaJUnitTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,197 @@
+"
+ 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:#JavaJUnitTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaJUnitTests 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
+"
+ A test case that tests whether JUnit 3.x works under
+ stx:libjava.
+
+ [author:]
+ Jan Vrany <jan.vrany@fit.cvut.cz>
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavaJUnitTests class methodsFor:'resource'!
+
+resources
+
+ ^ Array
+ with: JavaInitializedResource
+ with: JavaLibrariesResource
+ with: JavaTestsResource
+
+ "Created: / 28-02-2011 / 15:28:52 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 08-04-2011 / 17:03:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaJUnitTests methodsFor:'running'!
+
+setUp
+
+ super setUp.
+ Java addToClassPath: '/usr/share/java/junit4.jar'.
+
+ "Created: / 16-03-2011 / 15:28:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaJUnitTests methodsFor:'tests - jUnit 3.x'!
+
+test_junit3x_01
+
+ | runner junit3testcase result |
+ "/ Java effectiveClassPath
+
+ runner := Java classForName: 'org.junit.runner.JUnitCore'.
+ self assert: runner notNil.
+ junit3testcase := Java classForName: 'stx.libjava.tests.JUnit3Tests'.
+ self assert: junit3testcase notNil.
+
+ "signature: Result runClass(java.lang.Class[] classes)"
+ result := runner
+ perform:#'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
+ with: (Array with: (JavaVM javaClassObjectForClass: junit3testcase)).
+
+ "
+ result getFailures
+ "
+ self assert: result getRunCount = 4.
+ self assert: result getFailureCount = 2.
+ self assert: result wasSuccessful == 0"false"
+
+ "Created: / 06-02-2011 / 12:14:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-04-2011 / 23:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaJUnitTests methodsFor:'tests - jUnit 4.x'!
+
+test_junit4x_01
+ | runner junit4testcase result |
+
+ "/ Java effectiveClassPath
+
+ runner := Java classForName:'org.junit.runner.JUnitCore'.
+ self assert:runner notNil.
+ junit4testcase := Java classForName:'stx.libjava.tests.JUnit4Tests'.
+ self assert:junit4testcase notNil.
+ "signature: Result runClass(java.lang.Class[] classes)"
+ result := runner
+ perform:#'runClasses([Ljava/lang/Class;)Lorg/junit/runner/Result;'
+ with:(Array with:(JavaVM javaClassObjectForClass:junit4testcase)).
+ "
+ result getFailures
+ "
+ self assert:result getRunCount = 3.
+ self assert:result getFailureCount = 1.
+ self assert:result wasSuccessful == 0
+
+ "Created: / 06-02-2011 / 12:14:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-02-2011 / 17:27:16 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 07-04-2011 / 23:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaJUnitTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaJavadocNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,120 @@
+"
+ 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:#JavaJavadocNode
+ instanceVariableNames:'lineNumber value'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaJavadocNode 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.
+
+"
+! !
+
+!JavaJavadocNode methodsFor:'accessing'!
+
+lineNumber
+ ^ lineNumber
+!
+
+lineNumber:something
+ lineNumber := something.
+!
+
+value
+ ^ value
+!
+
+value:something
+ value := something.
+! !
+
+!JavaJavadocNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLanguage.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,188 @@
+"
+ 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' }"
+
+ProgrammingLanguage subclass:#JavaLanguage
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaLanguage 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.
+
+"
+! !
+
+!JavaLanguage methodsFor:'accessing'!
+
+lookup
+
+ ^Lookup builtin
+
+ "Created: / 17-03-2011 / 14:23:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+name
+ "Answers a human-readable name of myself:
+ 'Smalltalk' for SmalltalkLanguage,
+ 'Ruby' for RubyLanguage
+ ..."
+
+ ^ 'Java'
+
+ "Modified: / 26-10-2010 / 23:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sourceFileSuffix
+ "Answers a default suffix for source files, i.e. 'st' for Smalltalk,
+ 'js' for JavaScript or 'rb' for Ruby', etc."
+
+ ^ 'java'
+
+ "Modified: / 26-10-2010 / 23:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLanguage methodsFor:'accessing - classes'!
+
+compilerClass
+ "Answer a class suitable for compiling a source code in 'my' language"
+
+ ^ nil "No Java compiler yet"
+
+ "Modified: / 26-10-2010 / 23:41:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+evaluatorClass
+
+ ^JavaEvaluator
+
+ "Created: / 16-08-2011 / 10:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupClass
+
+ ^JavaLookup
+
+ "Created: / 17-03-2011 / 14:08:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parserClass
+ "Answer a class suitable for parsing a source code in 'my' language"
+
+ ^ nil "No Java parser yet"
+
+ "Modified: / 26-10-2010 / 23:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sourceFileReaderClass
+ "Answers a class that can be used for reading & compiling source files"
+
+ ^ nil "No Java compiler yet"
+
+ "Modified: / 26-10-2010 / 23:41:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sourceFileWriterClass
+ "Answers a class is used for source file writing (i.e. file-out)"
+
+ ^ JavaSourceFileWriter
+
+ "Modified: / 27-10-2010 / 18:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLanguage methodsFor:'queries'!
+
+supportsExtensionMethods
+
+ ^false
+
+ "Created: / 19-03-2011 / 10:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLanguage class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLibraries.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,191 @@
+"
+ 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:#JavaLibraries
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaLibraries 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.
+
+"
+! !
+
+!JavaLibraries class methodsFor:'accessing'!
+
+directory
+
+ ^Java cacheDirectory / 'libs'
+
+ "
+ JavaLibraries directory
+ "
+
+ "Created: / 08-04-2011 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+url
+
+ ^(Smalltalk at:#stx_libjava) svnRepositoryUrlBase , '/libs'
+
+ "Created: / 08-04-2011 / 16:32:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLibraries class methodsFor:'private'!
+
+checkoutDirectory
+
+ OperatingSystem getNetworkAddresses size < 2
+ ifTrue:
+ [self error: 'No network connection!!'. ^self].
+
+ (OperatingSystem
+ executeCommand:('svn co %1 %2' bindWith: self url with: self directory asString))
+ ifFalse:
+ [self error: 'Cannot checkout libraries!!'. ^self].
+
+ "Created: / 08-04-2011 / 16:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateDirectory
+
+ OperatingSystem getNetworkAddresses size < 2
+ ifTrue:
+ [^self].
+
+ (OperatingSystem
+ executeCommand:('svn update %1 %2' bindWith: self url with: self directory asString))
+ ifFalse:
+ [self error: 'Cannot update libraries!!'. ^self].
+
+ "Created: / 08-04-2011 / 16:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLibraries class methodsFor:'utilities'!
+
+addToClassPath: jarname
+
+ | dir jar |
+
+ (dir := self directory) exists
+ ifFalse:[self update].
+
+ (jar := dir / jarname) exists
+ ifTrue: [Java addToClassPath: jar pathName]
+ ifFalse:[self error:'Library ' , jarname , ' not found in ', dir pathName].
+
+ "
+ JavaLibraries addToClassPath:'junit4.jar'.
+ Java classPath
+ "
+
+ "Created: / 08-04-2011 / 16:49:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+flush
+
+ self directory recursiveRemove
+
+ "Created: / 08-04-2011 / 16:27:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+update
+
+ | dir |
+ dir := self directory.
+ dir exists
+ ifTrue: [self updateDirectory]
+ ifFalse:[self checkoutDirectory]
+
+ "Created: / 08-04-2011 / 16:29:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaLibraries class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLibrariesResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,117 @@
+"
+ 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:#JavaLibrariesResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaLibrariesResource 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.
+
+"
+! !
+
+!JavaLibrariesResource methodsFor:'running'!
+
+setUp
+ JavaLibraries
+ update;
+ addToClassPath: 'junit4.jar';
+ addToClassPath: 'log4j-1.2.jar';
+ addToClassPath: 'asm3-all.jar';
+ addToClassPath: 'hamcrest-core.jar';
+ yourself.
+
+ "Created: / 08-04-2011 / 17:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 20:36:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaLibrariesResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaLocalVariableTable.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaLocalVariableTable.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
Array variableSubclass:#JavaLocalVariableTable
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaLocalVariableTable methodsFor:'queries'!
@@ -73,5 +129,9 @@
!JavaLocalVariableTable class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaLocalVariableTable.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaLocalVariableTable.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaLocalVariableTableEntry.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaLocalVariableTableEntry.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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:#JavaLocalVariableTableEntry
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaLocalVariableTableEntry methodsFor:'accessing'!
@@ -75,6 +131,13 @@
, ']'
"Created: / 8.1.1998 / 18:32:30 / cg"
+!
+
+printOn: aStream
+
+ aStream nextPutAll: self displayString
+
+ "Created: / 23-11-2010 / 19:45:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaLocalVariableTableEntry methodsFor:'private accessing'!
@@ -92,5 +155,9 @@
!JavaLocalVariableTableEntry class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaLocalVariableTableEntry.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaLocalVariableTableEntry.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLongTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaLongTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaLongTypeNode 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.
+
+"
+! !
+
+!JavaLongTypeNode methodsFor:'accessing'!
+
+selector
+ ^ 'l'
+
+ "Created: / 17-12-2010 / 16:38:31 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaLongTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLookup.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,180 @@
+"
+ 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' }"
+
+Lookup subclass:#JavaLookup
+ instanceVariableNames:''
+ classVariableNames:'Instance'
+ poolDictionaries:''
+ category:'Languages-Java-Lookup'
+!
+
+!JavaLookup 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.
+
+"
+! !
+
+!JavaLookup class methodsFor:'instance creation'!
+
+instance
+ Instance ifNil: [
+ Instance := self basicNew.
+ ].
+ ^ Instance.
+
+ "Modified: / 25-02-2011 / 14:45:03 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+new
+ ^ self instance.
+
+ "Created: / 25-02-2011 / 14:44:43 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!JavaLookup methodsFor:'lookup'!
+
+javaLookupMethodForSelector:selector for:receiver withArguments:argArrayOrNil
+ "as a courtesy to the smalltalker, try to map methods"
+
+ |args numArgs javaMethod sel m cls|
+
+ args := argArrayOrNil.
+ numArgs := args size.
+ sel := selector.
+ cls := receiver class.
+
+ javaMethod := JavaClass lookupMethod:sel numArgs:numArgs in: cls static:false.
+
+ javaMethod notNil ifTrue:[
+ args notNil ifTrue:[
+ args := JavaClass
+ convertArgsToJava:args
+ asSpecifiedIn:(javaMethod argSignature)
+ numArgs:numArgs.
+ ].
+ javaMethod isWrapped ifTrue:[
+ m := javaMethod originalMethod
+ ] ifFalse:[
+ m := javaMethod
+ ].
+ ].
+ ^ m.
+"/ retVal := javaMethod
+"/ valueWithReceiver:self
+"/ arguments:args
+"/ selector:m selector
+"/ search:m javaClass
+"/ sender:nil.
+"/
+"/ ^ JavaClass convertToSmalltalk:retVal type:(m returnType).
+
+ "Created: / 25-02-2011 / 19:49:22 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+
+ "As a courtesy to a Smalltalker, try to map smalltalk selectors to a
+ java ones."
+
+ (selector includes: $() ifTrue:[
+ "Probably a Java selector, so no fancy mapping here"
+ ^super lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+ ].
+
+ "Created: / 21-02-2011 / 13:38:55 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 11-04-2011 / 20:19:50 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 16-08-2011 / 09:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalltalkLookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+ ^ Lookup builtin lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext.
+
+ "Created: / 25-02-2011 / 19:46:54 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!JavaLookup class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaLookupTestsResource.st Fri Aug 19 08:58:19 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!
\ No newline at end of file
--- a/JavaMethod.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaMethod.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,12 +12,38 @@
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' }"
CompiledCode variableSubclass:#JavaMethod
- instanceVariableNames:'accessFlags selector javaClass signature lineNumberTable
- localVariableTable'
+ instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject
+ lineNumberTable localVariableTable sourceLineNumber annotations'
classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
@@ -27,8 +57,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -36,8 +70,34 @@
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.
+
"
-
! !
!JavaMethod class methodsFor:'initialization'!
@@ -86,6 +146,7 @@
SignatureTypeCodes at:$Z put:#boolean.
SignatureTypeCodes at:$L put:#object.
SignatureTypeCodes at:$[ put:#array.
+ SignatureTypeCodes at:$T put:#typevar.
ForceByteCodeDisplay := false.
@@ -96,7 +157,15 @@
ForceByteCodeDisplay := false.
"
- "Modified: / 16.10.1998 / 01:29:48 / cg"
+ "Modified: / 16-10-1998 / 01:29:48 / cg"
+ "Modified: / 13-08-2011 / 01:02:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reinitialize
+
+ self flags:(self flags bitOr:Behavior flagJavaMethod).
+
+ "Created: / 14-12-2010 / 20:58:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaMethod class methodsFor:'instance creation'!
@@ -180,6 +249,33 @@
"
"Created: / 4.2.1998 / 00:22:54 / cg"
+!
+
+makeJavaMethod
+
+ self flags:((self flags
+ bitOr:Behavior flagJavaMethod)
+ bitClear:Behavior flagMetaMethod)
+
+ "
+ JavaMethod makeJavaMethod
+ JavaMethod makeMetaMethod
+ "
+
+ "Created: / 23-02-2011 / 12:56:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+makeMetaMethod
+
+ self flags:((self flags
+ bitOr:Behavior flagMetaMethod)
+ bitClear:Behavior flagJavaMethod)
+ "
+ JavaMethod makeJavaMethod
+ JavaMethod makeMetaMethod
+ "
+
+ "Created: / 23-02-2011 / 12:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaMethod class methodsFor:'signature parsing'!
@@ -220,33 +316,31 @@
"Modified: / 8.1.1998 / 19:10:20 / cg"
!
-argSignatureFromArgTypeArray:arr
- |sig|
+argSignatureFromArgTypeArray:arr
+ | sig |
sig := ''.
- arr do:[:el |
- |jCLass|
-
- jCLass := el.
- jCLass isJavaClass ifFalse:[
- jCLass := JavaVM classForJavaClassObject:el
- ].
- jCLass isJavaClass ifTrue:[
- sig := sig , jCLass typeName.
- sig := sig, ';'
- ] ifFalse:[
- self halt.
- ]
- ].
+ arr do:
+ [:el |
+ | jCLass |
+
+ jCLass := el.
+ jCLass isJavaClass
+ ifFalse:[ jCLass := JavaVM reflection classForJavaClassObject:el ].
+ jCLass isJavaClass
+ ifTrue:
+ [ sig := sig , jCLass typeName.
+ ]
+ ifFalse:[ self halt. ] ].
^ sig
"
self argSignatureFromArgTypeArray:
- (Array
- with:(JavaVM javaClassObjectForClass:(Java at:'com.sun.java.swing.JComponent')))
- "
-
- "Modified: / 13.2.1998 / 14:57:58 / cg"
+ (Array
+ with:(JavaVM javaClassObjectForClass:(Java at:'com.sun.java.swing.JComponent')))"
+
+ "Modified: / 13-02-1998 / 14:57:58 / cg"
+ "Modified: / 02-03-2011 / 22:49:24 / Marcel Hlopko <hlopik@gmail.com>"
!
argSpecFromSignature:aSignature withName:name
@@ -334,44 +428,63 @@
fieldTypeFromStream:s in:aPackage
"parse a fieldTypeSpec - see java doc"
- |typeChar typeSym elType size className nm|
+ |typeChar typeSym elType size className nm out nangles |
typeChar := s next.
typeSym := SignatureTypeCodes at:typeChar ifAbsent:#unknown.
typeSym == #unknown ifTrue:[
- ^ typeSym
+ ^ typeSym
].
- typeSym == #object ifTrue:[
- className := s upTo:$;.
- "/ strip off default
-
- nm := className.
- aPackage notNil ifTrue:[
- (nm startsWith:aPackage) ifTrue:[
- nm := nm copyFrom:(aPackage size + 2).
- ].
- ].
+ (typeSym == #object or: [typeSym == #typevar]) ifTrue:[
+ "Take care about type variables"
+ out := String new writeStream.
+ [ s peek ~~ $; and:[ s peek ~~ $< ] ] whileTrue:[
+ out nextPut: s next.
+ ].
+ className := out contents.
+ "Eat possible type variables"
+ (s peek == $<) ifTrue:[
+ nangles := 1. s next.
+ [ nangles ~~ 0 ] whileTrue:[
+ s peek == $< ifTrue:[nangles := nangles + 1].
+ s peek == $> ifTrue:[nangles := nangles - 1].
+ s next.
+ ]
+ ].
+ s peek ~~ $; ifTrue:[self error: 'Signature corrupted?'].
+ s next. "/eat ;
+
+
+ typeSym == #typevar ifTrue:[^className].
+ "/ strip off default
+ nm := className.
+ aPackage notNil ifTrue:[
+ (nm startsWith:aPackage) ifTrue:[
+ nm := nm copyFrom:(aPackage size + 2).
+ ].
+ ].
- nm := nm copyReplaceAll:$/ with:$..
- ^ nm
+ nm := nm copyReplaceAll:$/ with:$..
+ ^ nm
].
typeSym == #array ifTrue:[
- s peek isDigit ifTrue:[
- size := Integer readFrom:s.
- elType := self fieldTypeFromStream:s in:aPackage.
- ^ elType , '[' , size printString , ']'
- ].
- elType := self fieldTypeFromStream:s in:aPackage.
- ^ elType , '[]'
+ s peek isDigit ifTrue:[
+ size := Integer readFrom:s.
+ elType := self fieldTypeFromStream:s in:aPackage.
+ ^ elType , '[' , size printString , ']'
+ ].
+ elType := self fieldTypeFromStream:s in:aPackage.
+ ^ elType , '[]'
].
^ typeSym
- "Created: / 18.3.1997 / 11:07:56 / cg"
- "Modified: / 18.7.1998 / 22:57:06 / cg"
+ "Created: / 18-03-1997 / 11:07:56 / cg"
+ "Modified: / 18-07-1998 / 22:57:06 / cg"
+ "Modified: / 13-08-2011 / 01:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
numArgsFromSignature:aSignature
@@ -380,7 +493,8 @@
|s|
s := aSignature readStream.
- s next ~~ $( ifTrue:[self halt].
+ (aSignature includes: $() ifFalse:[self error:'Invalid signature'].
+ [s next ~~ $(] whileTrue.
^ self numArgsFromStream:s.
@@ -388,7 +502,10 @@
JavaMethod numArgsFromSignature:'(LObject;)V'
JavaMethod numArgsFromSignature:'(BB)S'
JavaMethod numArgsFromSignature:'()V'
+ JavaMethod numArgsFromSignature:'(Ljava/util/ArrayList<*>;)V'
"
+
+ "Modified (comment): / 13-08-2011 / 00:59:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
numArgsFromStream:s
@@ -708,6 +825,13 @@
"Modified: / 8.1.1998 / 19:09:31 / cg"
! !
+!JavaMethod methodsFor:'* As yet uncategorized *'!
+
+sends:symbol1 or:symbol2
+
+ ^false
+! !
+
!JavaMethod methodsFor:'accessing'!
accessFlags
@@ -718,8 +842,27 @@
"Created: / 9.4.1998 / 17:49:44 / cg"
!
+annotations
+ ^ annotations ifNil:[JavaMethodAnnotationContainer empty].
+
+ "Modified: / 03-03-2011 / 23:51:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+annotations:something
+ annotations := something.
+!
+
argSignature
- ^ self class argSigArrayFromSignature:signature
+ ^ self class argSigArrayFromSignature:descriptor
+!
+
+asByteCodeMethod
+
+ "JavaMethods are always bytecode methods"
+
+ ^self
+
+ "Created: / 18-07-2011 / 20:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
comment
@@ -760,6 +903,23 @@
"Modified: 30.7.1997 / 16:27:55 / cg"
!
+descriptor
+
+ ^ JavaDescriptor fromString: descriptor
+
+ "Created: / 16-04-1996 / 11:34:29 / cg"
+ "Modified: / 14-08-2011 / 19:32:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ensureHasAnnotations
+ annotations
+ ifNil:[ annotations := JavaMethodAnnotationContainer for:self ].
+ ^ annotations
+
+ "Created: / 25-02-2011 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-02-2011 / 16:33:00 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
exceptionHandlerTable
^ nil
@@ -772,6 +932,22 @@
"Created: / 16.10.1998 / 01:51:04 / cg"
!
+firstInstructionLineNumber
+ ForceByteCodeDisplay == true ifTrue:[ ^ 1].
+ lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2].
+ ^ 0.
+
+ "Created: / 17-12-2010 / 17:02:46 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 08-01-2011 / 16:30:16 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+getExceptionTable
+
+ ^ nil
+
+ "Created: / 04-02-2011 / 23:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
getSourcePosition
^ 1
!
@@ -798,6 +974,18 @@
"Created: 16.4.1996 / 14:55:44 / cg"
!
+javaExceptionTable
+ ^ nil
+
+ "Created: / 04-06-2011 / 18:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+javaNumArgs
+^ self argSignature size.
+
+ "Created: / 14-03-2011 / 15:50:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
lineNumber
lineNumberTable isNil ifTrue:[^ nil].
^ lineNumberTable at:2
@@ -807,10 +995,11 @@
!
lineNumberTable
+"/ lineNumberTable ifNil:[ lineNumberTable := Dictionary new.].
^ lineNumberTable
- "Created: 16.4.1996 / 12:34:04 / cg"
- "Modified: 16.4.1996 / 12:49:06 / cg"
+ "Created: / 16-04-1996 / 12:34:04 / cg"
+ "Modified: / 13-12-2010 / 11:06:40 / Jan Kurs <kurs.jan@post.cz>"
!
literalsDetect:aBlock ifNone:exceptionBlock
@@ -847,11 +1036,25 @@
"
!
+mclass
+ ^ self javaClass
+!
+
+mclass: anObject
+
+ javaClass := anObject
+
+ "Created: / 18-10-2010 / 19:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
methodArgAndVarNames
- ^ ((1 to:self numArgs) collect:[:i | 'arg' , i printString])
+ ^ "((1 to:self numArgs) collect:[:i | 'arg' , i printString])"
+ self methodArgNames
,
- ((1 to:self numVars) collect:[:i | 'local' , i printString])
-
+ "((1 to:self numVars) collect:[:i | 'local' , i printString])"
+ self methodVarNames
+
+ "Modified: / 23-11-2010 / 19:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
methodArgNames
@@ -859,34 +1062,72 @@
nA := self numArgs.
localVariableTable notNil ifTrue:[
- ^ (1 to:nA) collect:
- [:argIndex |
- |slot name|
- "/ search for an entry with that index (slot),
- "/ which has is valid at PC 0
-
- self isStatic ifTrue:[
- slot := argIndex
- ] ifFalse:[
- slot := argIndex + 1
- ].
- name := localVariableTable nameForSlot:slot atPC:0.
- name isNil ifTrue:[
- 'arg' , argIndex printString
- ] ifFalse:[
- name
- ].
- ]
+ ^ (1 to:nA) collect:
+ [:argIndex |
+ |slot name|
+ "/ search for an entry with that index (slot),
+ "/ which has is valid at PC 0
+
+ self isStatic ifTrue:[
+ slot := argIndex - 1
+ ] ifFalse:[
+ slot := argIndex "/+ 1
+ ].
+ name := localVariableTable nameForSlot:slot atPC:0.
+ name isNil ifTrue:[
+ 'arg' , argIndex printString
+ ] ifFalse:[
+ name
+ ].
+ ]
].
^ (1 to:nA) collect:[:i | 'arg' , i printString]
+
+ "Modified: / 23-11-2010 / 19:47:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodVarNames
+ |nV|
+
+ nV := self numVars.
+ localVariableTable notNil ifTrue:[
+ ^ (self numArgs + 1 to: self numArgs + nV) collect:
+ [:argIndex |
+ |slot name|
+ "/ search for an entry with that index (slot),
+ "/ which has is valid at PC 0
+
+ self isStatic ifTrue:[
+ slot := argIndex - 1
+ ] ifFalse:[
+ slot := argIndex"/ + 1
+ ].
+ name := localVariableTable nameForSlot:slot atPC:0.
+ name isNil ifTrue:[
+ 'local' , argIndex printString
+ ] ifFalse:[
+ name
+ ].
+ ]
+ ].
+ ^ (1 to:nV) collect:[:i | 'local' , i printString]
+
+ "Created: / 23-11-2010 / 19:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
name
- ^ (selector copyWithoutLast:signature size) asSymbol
+ ^ (selector copyWithoutLast:descriptor size) asSymbol
"Created: 16.4.1996 / 11:34:22 / cg"
!
+nameSpaceName
+
+ ^''
+
+ "Created: / 18-10-2010 / 19:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
numLocals
^super numVars.
"/ numLocals isNil ifTrue:[^ 0].
@@ -911,15 +1152,22 @@
"Created: 30.7.1997 / 15:56:18 / cg"
!
+previousVersionCode
+
+ ^nil
+
+ "Created: / 18-10-2010 / 20:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
retValSignature
- ^ self class retValSpecFromSignature:signature in:nil
+ ^ self class retValSpecFromSignature:descriptor in:nil
"Modified: / 8.1.1998 / 19:06:40 / cg"
!
returnType
"/ ^ returnType
- ^ self class typeFromSignature:signature in:nil.
+ ^ self class typeFromSignature:descriptor in:nil.
"Modified: / 16.10.1998 / 00:17:43 / cg"
!
@@ -983,7 +1231,8 @@
returnsVoid
^ self returnType == #void
- "Modified: / 16.10.1998 / 00:18:53 / cg"
+ "Modified: / 16-10-1998 / 00:18:53 / cg"
+ "Modified: / 22-03-2011 / 12:27:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
selector
@@ -997,148 +1246,29 @@
"Modified: / 16.10.1998 / 13:41:06 / cg"
!
-setAccessFlags:flags
- accessFlags := flags.
-
- "Created: 16.4.1996 / 11:34:14 / cg"
-!
-
-setCode:codeBytes maxStack:max_stack maxLocals:max_locals u1:unknown1 u2:unknown2
-"/ javaByteCode := codeBytes.
- byteCode := codeBytes.
- "/ numStack := max_stack.
- "/ numLocals := max_locals.
- super numberOfVars:max_locals.
- super stackSize:max_stack.
-
-"/ self displayString printNL.
-"/ ' nStack: ' print. numStack print.
-"/ ' nLocal: ' print. numLocals print.
-"/ ' u1: ' print. unknown1 print.
-"/ ' u2: ' print. unknown2 printNL.
-
- "Modified: 1.8.1997 / 00:08:32 / cg"
-!
-
-setJavaClass:aJavaClass
- javaClass := aJavaClass
-
- "Modified: 16.4.1996 / 12:36:27 / cg"
- "Created: 16.4.1996 / 15:28:15 / cg"
-!
-
-setLineNumberTable:anArrayOfPCtoLineAssociations
- "since this uses up lots of memory, compress it"
-
- |allBytes allWords idx|
-
- allBytes := allWords := true.
-
- anArrayOfPCtoLineAssociations do:[:assoc |
- assoc key > 255 ifTrue:[
- allBytes := false.
- assoc key > 16rFFFF ifTrue:[
- allWords := false.
- ].
- ].
- assoc value > 255 ifTrue:[
- allBytes := false.
- assoc value > 16rFFFF ifTrue:[
- allWords := false
- ].
- ].
- ].
- allBytes ifTrue:[
- lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2).
- ] ifFalse:[
- allWords ifTrue:[
- lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2).
- ] ifFalse:[
- lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2).
- ]
- ].
-
- idx := 1.
- anArrayOfPCtoLineAssociations do:[:assoc |
- lineNumberTable at:idx put:assoc key.
- lineNumberTable at:idx+1 put:assoc value.
- idx := idx + 2.
- ].
-
- "Created: 16.4.1996 / 12:34:04 / cg"
- "Modified: 16.4.1996 / 12:49:06 / cg"
-!
-
-setLocalVariableTable:anArray
- localVariableTable := anArray.
-!
-
-setName:nameString signature:signatureString
- selector := (nameString , signatureString) asSymbol.
- self setSignature:signatureString
-!
-
-setSignature:aString
- |numArgs tooManyArgs returnType|
-
- signature := aString asSymbol.
-
- numArgs := self class numArgsFromSignature:aString.
- (tooManyArgs := (numArgs > self class maxNumberOfArguments)) ifTrue:[
- numArgs := 0.
- ].
- self numberOfArgs:numArgs.
- returnType := self class typeFromSignature:aString in:nil.
-
- "/ for the convenience of the VM, also mirror the return type in
- "/ the flags ...
-
- returnType == #void ifTrue:[
- accessFlags := accessFlags bitOr:R_VOID
- ] ifFalse:[
- returnType == #long ifTrue:[
- accessFlags := accessFlags bitOr:R_LONG
- ] ifFalse:[
- returnType == #double ifTrue:[
- accessFlags := accessFlags bitOr:R_DOUBLE
- ]
- ]
- ].
- tooManyArgs ifTrue:[
- ^ ArgumentSignal
- raiseRequestWith:self
- errorString:'too many args in method'
- ].
-
- "Created: / 16.4.1996 / 11:34:29 / cg"
- "Modified: / 16.10.1998 / 00:17:12 / cg"
-!
-
signature
- ^ signature
-
- "Created: 16.4.1996 / 11:34:29 / cg"
+
+ ^ signature ? descriptor
+
+ "Modified (format): / 14-08-2011 / 19:37:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
source
- |classSource|
-
-"/ self isNative ifTrue:[
-"/ ^ 'native method'
-"/ ].
-
+ | classSource |
+ "/ self isNative ifTrue:[
+ "/ ^ 'native method'
+ "/ ].
ForceByteCodeDisplay == true ifTrue:[
- ^ self decompiledBytecode
+ ^ self decompiledBytecode
].
-
lineNumberTable notNil ifTrue:[
- classSource := javaClass source.
- classSource notNil ifTrue:[^ classSource].
+ classSource := javaClass source.
+ classSource notNil ifTrue:[ ^ classSource].
].
-
^ self decompiledSource
- "Modified: / 4.1.1998 / 13:48:35 / cg"
+ "Modified: / 04-01-1998 / 13:48:35 / cg"
+ "Modified: / 13-12-2010 / 11:06:51 / Jan Kurs <kurs.jan@post.cz>"
!
sourceFilename
@@ -1146,18 +1276,45 @@
!
sourceLineNumber
- ForceByteCodeDisplay == true ifTrue:[
- ^ 1
+ "
+ sourceLineNumber ifNil: [
+ sourceLineNumber := (JavaSourceCodeCache new)
+ findLineForMethod: self
+ inClass:javaClass.
+ ].
+ "
+ sourceLineNumber := 0.
+
+ sourceLineNumber == 0 ifTrue:
+ [
+ "There is something wrong with parsing"
+"/ self halt.
+ self breakPoint: #libjava.
+ sourceLineNumber := self firstInstructionLineNumber -2.
].
- lineNumberTable notNil ifTrue:[
- ^ lineNumberTable at:2
- ].
-
- ^ 1
-
- "Created: 30.7.1997 / 15:40:45 / cg"
- "Modified: 30.7.1997 / 15:46:12 / cg"
+ ^ sourceLineNumber.
+
+ "Created: / 30-07-1997 / 15:40:45 / cg"
+ "Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 08-01-2011 / 16:20:40 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 05-02-2011 / 22:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+wrapper
+
+ ^nil
+
+ "Created: / 18-10-2010 / 19:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaMethod methodsFor:'compiler interface'!
+
+programmingLanguage
+
+ ^JavaLanguage instance
+
+ "Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaMethod methodsFor:'debugging'!
@@ -1271,18 +1428,17 @@
^ self
].
+ "
JavaDeparser isNil ifTrue:[
aStream nextPutAll:'// Sorry - no decompiler'.
^ self
].
+ "
"/ self isNative ifFalse:[
"/ self isAbstract ifFalse:[
- aStream nextPutAll:'// '; cr.
- aStream nextPutAll:'// decompiled source'; cr.
- aStream nextPutAll:'// '; cr.
- aStream cr.
+ aStream nextPutAll:'// source not available...'; cr.
SignalSet anySignal handle:[:ex |
ex signal == Object haltSignal ifTrue:[ex reject].
ex signal == MessageTracer breakpointSignal ifTrue:[ex reject].
@@ -1311,20 +1467,24 @@
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender sender sender printString.
aStream cr.
- JavaDecompiler isNil ifTrue:[
+ "
+ JavaByteCodeDisassembler isNil ifTrue:[
aStream nextPutAll:'// Sorry - no decompiler'
] ifFalse:[
- JavaDecompiler decompile:self to:aStream.
+ JavaByteCodeDisassembler diassemble:self to:aStream.
].
+ "
ex return
] do:[
- aStream nextPutAll:(JavaDeparser decompile:self).
+ "aStream nextPutAll:(JavaDeparser decompile:self)."
+ JavaByteCodeDisassembler diassemble:self to:aStream.
].
"/ ].
"/ ].
- "Created: / 30.7.1997 / 16:28:09 / cg"
- "Modified: / 21.12.1999 / 14:31:54 / cg"
+ "Created: / 30-07-1997 / 16:28:09 / cg"
+ "Modified: / 21-12-1999 / 14:31:54 / cg"
+ "Modified: / 22-03-2011 / 21:34:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
decompiler
@@ -1350,17 +1510,71 @@
!JavaMethod methodsFor:'error handling'!
+errorInvalidClassRefAt: index
+
+ "Sent by the VM when an invalid entry in contant pool
+ is encountered - for instance when the VM expects
+ a classref but the entry is not a classref"
+
+ "
+ javaClass constantPool at: index.
+ "
+
+ JavaInvalidRefError new
+ javaClass: javaClass;
+ index: index;
+ raiseRequest
+
+ "Created: / 18-07-2011 / 23:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+errorInvalidFieldRefAt: index
+
+ "Sent by the VM when an invalid entry in contant pool
+ is encountered - for instance when the VM expects
+ a classref but the entry is not a classref"
+
+ "
+ javaClass constantPool at: index.
+ "
+
+ JavaInvalidRefError new
+ javaClass: javaClass;
+ index: index;
+ raiseRequest
+
+ "Created: / 18-07-2011 / 23:33:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+errorInvalidMethodRefAt: index
+
+ "Sent by the VM when an invalid entry in contant pool
+ is encountered - for instance when the VM expects
+ a classref but the entry is not a classref"
+
+ "
+ javaClass constantPool at: index.
+ "
+
+ JavaInvalidRefError new
+ javaClass: javaClass;
+ index: index;
+ raiseRequest
+
+ "Created: / 18-07-2011 / 19:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
invalidByteCode
self isAbstract ifTrue:[
- ^ AbstractMethodInvokationSignal raise.
+ ^ AbstractMethodInvokationSignal raise.
].
- ((self class numArgsFromSignature:signature) > self class maxNumberOfArguments) ifTrue:[
- ^ self error:'method cannot be executed - too many args'
+ ((self class numArgsFromSignature:descriptor) > self class maxNumberOfArguments) ifTrue:[
+ ^ self error:'method cannot be executed - too many args'
].
^ super invalidByteCode
- "Created: / 27.1.1998 / 21:48:01 / cg"
- "Modified: / 27.1.1998 / 21:50:19 / cg"
+ "Created: / 27-01-1998 / 21:48:01 / cg"
+ "Modified: / 14-08-2011 / 19:29:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
invalidMethodRef
@@ -1375,16 +1589,211 @@
JavaVM throwClassNotFoundException
! !
+!JavaMethod methodsFor:'initialization'!
+
+setAccessFlags:flags
+ accessFlags := flags.
+
+ "Created: 16.4.1996 / 11:34:14 / cg"
+!
+
+setCode:codeBytes maxStack:max_stack maxLocals:max_locals u1:unknown1 u2:unknown2
+"/ javaByteCode := codeBytes.
+ byteCode := codeBytes.
+ "/ numStack := max_stack.
+ "/ numLocals := max_locals.
+ super numberOfVars:max_locals.
+ super stackSize:max_stack.
+
+"/ self displayString printNL.
+"/ ' nStack: ' print. numStack print.
+"/ ' nLocal: ' print. numLocals print.
+"/ ' u1: ' print. unknown1 print.
+"/ ' u2: ' print. unknown2 printNL.
+
+ "Modified: 1.8.1997 / 00:08:32 / cg"
+!
+
+setDescriptor:aString
+
+ descriptor := aString asSymbol.
+
+ "Created: / 16-04-1996 / 11:34:29 / cg"
+ "Modified: / 16-10-1998 / 00:17:12 / cg"
+ "Modified: / 13-08-2011 / 01:21:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 14-08-2011 / 19:41:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setJavaClass:aJavaClass
+ javaClass := aJavaClass
+
+ "Modified: 16.4.1996 / 12:36:27 / cg"
+ "Created: 16.4.1996 / 15:28:15 / cg"
+!
+
+setLineNumberTable:anArrayOfPCtoLineAssociations
+ "since this uses up lots of memory, compress it"
+
+ |allBytes allWords idx|
+
+ allBytes := allWords := true.
+
+ anArrayOfPCtoLineAssociations do:[:assoc |
+ assoc key > 255 ifTrue:[
+ allBytes := false.
+ assoc key > 16rFFFF ifTrue:[
+ allWords := false.
+ ].
+ ].
+ assoc value > 255 ifTrue:[
+ allBytes := false.
+ assoc value > 16rFFFF ifTrue:[
+ allWords := false
+ ].
+ ].
+ ].
+ allBytes ifTrue:[
+ lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2).
+ ] ifFalse:[
+ allWords ifTrue:[
+ lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2).
+ ] ifFalse:[
+ lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2).
+ ]
+ ].
+
+ idx := 1.
+ anArrayOfPCtoLineAssociations do:[:assoc |
+ lineNumberTable at:idx put:assoc key.
+ lineNumberTable at:idx+1 put:assoc value.
+ idx := idx + 2.
+ ].
+
+ "Created: 16.4.1996 / 12:34:04 / cg"
+ "Modified: 16.4.1996 / 12:49:06 / cg"
+!
+
+setLocalVariableTable:anArray
+ localVariableTable := anArray.
+!
+
+setName:nameString descriptor:aString
+
+
+ |numArgs tooManyArgs returnType|
+
+ selector := (nameString , aString) asSymbol.
+ self setDescriptor:aString.
+
+ numArgs := self class numArgsFromSignature:aString.
+ (tooManyArgs := (numArgs > self class maxNumberOfArguments)) ifTrue:[
+ numArgs := 0.
+ ].
+ self numberOfArgs:numArgs.
+ returnType := self class typeFromSignature:aString in:nil.
+
+ "/ for the convenience of the VM, also mirror the return type in
+ "/ the flags ...
+
+ returnType == #void ifTrue:[
+ accessFlags := accessFlags bitOr:R_VOID
+ ] ifFalse:[
+ returnType == #long ifTrue:[
+ accessFlags := accessFlags bitOr:R_LONG
+ ] ifFalse:[
+ returnType == #double ifTrue:[
+ accessFlags := accessFlags bitOr:R_DOUBLE
+ ]
+ ]
+ ].
+ tooManyArgs ifTrue:[
+ ^ ArgumentError
+ raiseRequestWith:self
+ errorString:'too many args in method'
+ ].
+
+ "Created: / 14-08-2011 / 19:41:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setSignature:aString
+
+ signature := aString asSymbol.
+
+ "Created: / 16-04-1996 / 11:34:29 / cg"
+ "Modified: / 16-10-1998 / 00:17:12 / cg"
+ "Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaMethod methodsFor:'inspecting'!
+
+inspectorExtraAttributes
+ "extra (pseudo instvar) entries to be shown in an inspector."
+
+ ^ Dictionary new
+ declareAllNewFrom:(super inspectorExtraAttributes ? #());
+ "/add:'-code' -> [ String streamContents:[:s | JavaDecompiler decompile: self to: s] ];
+ add:'-code' -> [ String streamContents:[:s | JavaByteCodeDisassembler diassemble: self to: s] ];
+ "/add:'-source' -> [ self source ];
+ yourself
+
+ "Modified: / 22-03-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaMethod methodsFor:'interpretation'!
+
+interpretWithReceiver: receiver
+
+ ^self
+ interpretWithReceiver: receiver
+ arguments: #()
+
+ "Created: / 24-02-2011 / 22:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+interpretWithReceiver: receiver arg: a1
+
+ ^self
+ interpretWithReceiver: receiver
+ arguments: (Array with: a1)
+
+ "Created: / 24-02-2011 / 22:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+interpretWithReceiver: receiver arg: a1 arg: a2
+
+ ^self
+ interpretWithReceiver: receiver
+ arguments: (Array with: a1 with: a2)
+
+ "Created: / 24-02-2011 / 22:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+interpretWithReceiver: receiver arg: a1 arg: a2 arg: a3
+
+ ^self
+ interpretWithReceiver: receiver
+ arguments: (Array with: a1 with: a2 with: a3)
+
+ "Created: / 24-02-2011 / 22:06:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+interpretWithReceiver: receiver arguments:args
+
+ ^ JavaByteCodeInterpreter
+ interpret:self
+ receiver:receiver
+ arguments:args
+
+ "Modified: / 24-02-2011 / 23:00:42 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 24-02-2011 / 22:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaMethod methodsFor:'methodref interchangability'!
homeMethod
^ self
!
-mclass
- ^ self javaClass
-!
-
method
^ self
!
@@ -1405,11 +1814,14 @@
accessFlags := aJavaMethod accessFlags.
selector := aJavaMethod selector.
javaClass := aJavaMethod javaClass.
- signature := aJavaMethod signature.
+ descriptor := aJavaMethod instVarNamed:#descriptor.
+ signature := aJavaMethod instVarNamed:#signature.
lineNumberTable := aJavaMethod lineNumberTable.
localVariableTable := aJavaMethod localVariableTable.
-
- "Modified: / 16.10.1998 / 01:27:19 / cg"
+ annotations := aJavaMethod annotations.
+
+ "Modified: / 16-10-1998 / 01:27:19 / cg"
+ "Modified: / 14-08-2011 / 19:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
updateClassRefsFrom:oldClass to:newClass
@@ -1441,9 +1853,9 @@
"/ ].
self name = #'<init>' ifTrue:[
- ^ self class specTextFromSignature:signature in:javaClass package withName:(javaClass lastName).
+ ^ self class specTextFromSignature:descriptor in:javaClass package withName:(javaClass lastName).
].
- ^ self class specTextFromSignature:signature in:javaClass package withName:(self name)
+ ^ self class specTextFromSignature:descriptor in:javaClass package withName:(self name)
!
shortDisplayString
@@ -1453,7 +1865,7 @@
signatureName
"return a string to be used when browsing"
- ^ self class specFromSignature:signature withName:(self name) in:nil
+ ^ self class specFromSignature:descriptor withName:(self name) in:nil
"Modified: / 8.1.1998 / 19:15:33 / cg"
!
@@ -1461,7 +1873,7 @@
signatureNameFor:name withArgsIn:aPackage
"return a string to be used when decompiling"
- ^ self class specWithArgsFromSignature:signature withName:name in:aPackage
+ ^ self class specWithArgsFromSignature:descriptor withName:name in:aPackage
"Created: 25.3.1997 / 18:49:45 / cg"
!
@@ -1469,7 +1881,7 @@
signatureNameIn:aPackage
"return a string to be used when browsing"
- ^ self class specFromSignature:signature withName:(self name) in:aPackage
+ ^ self class specFromSignature:descriptor withName:(self name) in:aPackage
"Created: 18.3.1997 / 11:11:01 / cg"
!
@@ -1477,7 +1889,7 @@
signatureNameText
"return a text to be used when browsing"
- ^ self class specTextFromSignature:signature withName:(self name)
+ ^ self class specTextFromSignature:descriptor withName:(self name)
"Created: 30.7.1997 / 14:40:29 / cg"
!
@@ -1485,7 +1897,7 @@
signatureNameTextFor:name withArgsIn:aPackage
"return a text to be used when decompiling"
- ^ self class specTextWithArgsFromSignature:signature withName:name in:aPackage
+ ^ self class specTextWithArgsFromSignature:descriptor withName:name in:aPackage
"Created: 25.3.1997 / 18:49:45 / cg"
"Modified: 1.8.1997 / 10:44:28 / cg"
@@ -1500,7 +1912,7 @@
myName = '<init>' ifTrue:[
myName := javaClass name
].
- ^ self class specFromSignature:signature withName:myName argNames:argNames in:nil
+ ^ self class specFromSignature:descriptor withName:myName argNames:argNames in:nil
"Created: / 8.1.1998 / 21:04:03 / cg"
"Modified: / 8.1.1998 / 21:22:38 / cg"
@@ -1515,7 +1927,7 @@
myName = '<init>' ifTrue:[
myName := javaClass name
].
- ^ self class specFromSignature:signature withName:myName argNames:argNames in:package
+ ^ self class specFromSignature:descriptor withName:myName argNames:argNames in:package
"Modified: / 8.1.1998 / 21:05:52 / cg"
"Created: / 8.1.1998 / 21:23:03 / cg"
@@ -1524,15 +1936,38 @@
signatureNameWithArgsIn:aPackage
"return a string to be used when browsing"
- ^ self class specWithArgsFromSignature:signature withName:(self name) in:aPackage
-
- "Created: 20.3.1997 / 12:44:17 / cg"
+ ^ self class specWithArgsFromSignature:descriptor withName:(self name) in:aPackage
+
+ "Created: / 20-03-1997 / 12:44:17 / cg"
+ "Modified: / 14-08-2011 / 19:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+signatureNameWithModifiers
+ "return a string to be used when deassembling"
+
+ | result |
+
+ result := self signatureName.
+ self isFinal ifTrue: [ result := 'final ' , result ].
+ self isStatic ifTrue: [ result := 'static ' , result ].
+ self isSynchronized ifTrue: [ result := 'synchronized ' , result ].
+ self isPrivate
+ ifTrue: [ result := 'private ' , result ]
+ ifFalse:
+ [ self isProtected
+ ifTrue: [ result := 'protected ' , result ]
+ ifFalse: [ self isPublic ifTrue: [ result := 'public ' , result ] ] ].
+ self isAbstract ifTrue: [ result := 'abstract ' , result ].
+ ^ result.
+
+ "Modified: / 08-01-1998 / 19:15:33 / cg"
+ "Created: / 22-03-2011 / 16:25:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
signatureNameWithoutReturnType
"return a string to be used when browsing"
- ^ self class argSpecFromSignature:signature withName:(self name)
+ ^ self class argSpecFromSignature:descriptor withName:(self name)
! !
@@ -1559,6 +1994,13 @@
"Modified: / 25.9.1999 / 23:07:01 / cg"
!
+hasPrimitiveCode
+
+ ^false
+
+ "Created: / 18-07-2011 / 20:45:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
hasResource
^ false
!
@@ -1633,6 +2075,15 @@
^ false
!
+isUnresolved
+ "return true, if the receiver is unresolved;"
+
+
+ ^ false
+
+ "Created: / 06-03-2011 / 22:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
isWrapped
^ self isBreakpointed
@@ -1869,6 +2320,13 @@
"Modified: / 9.11.1999 / 17:06:03 / cg"
!
+shouldBeSkippedInDebuggersWalkBack
+
+ ^false
+
+ "Created: / 30-11-2010 / 15:35:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
who
"return the class and selector of where I am defined in."
@@ -1909,14 +2367,26 @@
"Created: / 8.1.1998 / 19:17:58 / cg"
! !
+!JavaMethod methodsFor:'testing'!
+
+isSynthetic
+ ^false
+
+ "Created: / 18-10-2010 / 19:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaMethod class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: /cvs/stx/stx/libjava/JavaMethod.st,v 1.107 2011/08/18 18:42:48 vrany Exp $'
!
version_CVS
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.106 2009/10/09 14:04:17 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id: JavaMethod.st,v 1.107 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaMethod initialize!
+JavaMethod initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodAnnotationContainer.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,173 @@
+"
+ 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' }"
+
+JavaAnnotationContainer subclass:#JavaMethodAnnotationContainer
+ instanceVariableNames:'annotationDefault rawAnnotations visibleParameterAnnotations
+ invisibleParameterAnnotations'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Annotations'
+!
+
+!JavaMethodAnnotationContainer 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.
+
+"
+! !
+
+!JavaMethodAnnotationContainer methodsFor:'accessing'!
+
+default
+ ^ annotationDefault
+
+ "Created: / 03-03-2011 / 23:02:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+default:something
+ annotationDefault := something.
+!
+
+ensureInvisibleParameterAnnotationsAt: paramIndex
+ ((invisibleParameterAnnotations at: paramIndex)
+ size = 0)
+ ifTrue:
+ [ invisibleParameterAnnotations at: paramIndex
+ put: JavaAnnotationDictionary new ].
+ ^ invisibleParameterAnnotations at: paramIndex.
+
+ "Created: / 16-03-2011 / 17:21:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+ensureVisibleParameterAnnotationsAt: paramIndex
+ ((visibleParameterAnnotations at: paramIndex)
+ size = 0)
+ ifTrue:
+ [ visibleParameterAnnotations at: paramIndex
+ put: JavaAnnotationDictionary new ].
+ ^ visibleParameterAnnotations at: paramIndex.
+
+ "Created: / 16-03-2011 / 17:21:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+rawAnnotations
+ ^ rawAnnotations
+!
+
+rawAnnotations:something
+ rawAnnotations := something.
+! !
+
+!JavaMethodAnnotationContainer methodsFor:'initialization'!
+
+initialize
+ super initialize.
+
+ visibleParameterAnnotations := #().
+ invisibleParameterAnnotations := #().
+ annotationDefault := JavaAnnotationDefault empty.
+
+ "Modified: / 28-02-2011 / 16:34:54 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 16-03-2011 / 17:28:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 18-03-2011 / 23:50:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeFor: javaMethod
+ super initializeFor: javaMethod.
+ parent := javaMethod.
+
+ visibleParameterAnnotations := Array new: javaMethod javaNumArgs.
+ invisibleParameterAnnotations := Array new: javaMethod javaNumArgs.
+ 1 to: javaMethod javaNumArgs do: [:idx | visibleParameterAnnotations at: idx put: JavaAnnotationDictionary empty.invisibleParameterAnnotations at: idx put: JavaAnnotationDictionary empty. ].
+ annotationDefault := JavaAnnotationDefault empty.
+
+ "Modified: / 28-02-2011 / 16:34:54 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-03-2011 / 22:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2011 / 17:28:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodAnnotationContainer class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodDeclarationNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,172 @@
+"
+ 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' }"
+
+PPJavaNode subclass:#JavaMethodDeclarationNode
+ instanceVariableNames:'javadoc modifiers methodName retval arguments'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaMethodDeclarationNode 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
+"
+ This is AST node for PPJavaParser
+
+ [author:]
+ kursjan (kursjan@tibor)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavaMethodDeclarationNode methodsFor:'accessing'!
+
+arguments
+ ^ arguments
+!
+
+arguments: anObject
+ arguments := anObject
+!
+
+javadoc
+ ^ javadoc
+!
+
+javadoc: anObject
+ javadoc := anObject
+!
+
+methodName
+ ^ methodName
+!
+
+methodName: anObject
+ methodName := anObject
+!
+
+modifiers
+ ^ modifiers
+!
+
+modifiers: anObject
+ modifiers := anObject
+!
+
+name: anObject
+ methodName := anObject
+!
+
+retval
+ ^ retval
+!
+
+retval: anObject
+ retval := anObject
+! !
+
+!JavaMethodDeclarationNode methodsFor:'testing'!
+
+isPPMethodNode
+ ^ true.
+
+ "Created: / 30-12-2010 / 11:07:55 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaMethodDeclarationNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodDeclaratorNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,132 @@
+"
+ 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' }"
+
+JavaNode subclass:#JavaMethodDeclaratorNode
+ instanceVariableNames:'identifier formalParameterList'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaMethodDeclaratorNode 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.
+
+"
+! !
+
+!JavaMethodDeclaratorNode methodsFor:'accessing'!
+
+formalParameterList
+ ^ formalParameterList
+!
+
+formalParameterList:something
+ formalParameterList := something.
+!
+
+identifier
+ ^ identifier
+!
+
+identifier:something
+ identifier := something.
+!
+
+parameterSelector
+
+ ^String streamContents:
+ [:s|
+ self formalParameterList
+ do:[:p|s nextPutAll: (p selector)]
+ separatedBy:[s nextPutAll:'; ']
+ ]
+
+ "Created: / 17-12-2010 / 16:15:36 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaMethodDeclaratorNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodDescriptor.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,169 @@
+"
+ 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' }"
+
+JavaDescriptor subclass:#JavaMethodDescriptor
+ instanceVariableNames:'parameters return'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaMethodDescriptor 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.
+
+"
+! !
+
+!JavaMethodDescriptor class methodsFor:'instance creation'!
+
+parameters: parameterDescriptors return: returnDescriptor
+
+ ^self new
+ parameters: parameterDescriptors;
+ return: returnDescriptor;
+ yourself
+
+ "Created: / 25-11-2010 / 18:45:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaMethodDescriptor methodsFor:'accessing'!
+
+parameterClassObjects
+ ^ (Java classForName:'java.lang.Class') javaArrayClass
+ withAll:(parameters collect:[:p | p javaClassObject ])
+ "Created: / 25-11-2010 / 19:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" "Modified: / 19-12-2010 / 17:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parameterClasses
+
+ ^parameters collect:[:p|p javaClass]
+
+ "Created: / 25-11-2010 / 19:53:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parameters
+ ^ parameters
+!
+
+return
+ ^ return
+!
+
+returnClass
+
+ ^return notNil ifTrue:[
+ return javaClass
+ ] ifFalse:[
+ nil
+ ]
+
+ "Created: / 25-11-2010 / 19:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+returnClassObject
+ ^ return
+ ifNil:[JavaVM javaClassObjectForClass: UndefinedObject]
+ ifNotNil:[JavaVM javaClassObjectForClass: self returnClass].
+
+ "Created: / 25-11-2010 / 19:54:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-02-2011 / 16:16:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaMethodDescriptor methodsFor:'initialization'!
+
+parameters:aCollection
+ parameters := aCollection asArray.
+
+ "Modified: / 26-11-2010 / 10:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+return:something
+ return := something.
+! !
+
+!JavaMethodDescriptor class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,186 @@
+"
+ 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' }"
+
+JavaNode subclass:#JavaMethodNode
+ instanceVariableNames:'modifiers type declarator startPosition javadoc'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaMethodNode 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.
+
+"
+! !
+
+!JavaMethodNode methodsFor:'accessing'!
+
+declarator
+ ^ declarator
+!
+
+declarator:something
+ declarator := something.
+!
+
+javadoc
+ ^ javadoc
+!
+
+javadoc:something
+ javadoc := something.
+!
+
+modifiers
+ ^ modifiers
+!
+
+modifiers:something
+ modifiers := something.
+!
+
+selector
+ | name |
+"/ self halt: 'does not work properly ;('.
+ name := self declarator identifier.
+ name := name, '('.
+ name := name, (self declarator parameterSelector).
+ name := name, ')', (self type selector).
+
+ ^name.
+
+ "Created: / 13-12-2010 / 14:35:06 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-12-2010 / 17:47:10 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+startPosition
+ startPosition ifNil: [ startPosition := self determineStartPosition. ].
+ ^ startPosition
+
+ "Modified: / 13-12-2010 / 10:35:47 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+type
+ ^ type
+!
+
+type:something
+ type := something.
+! !
+
+!JavaMethodNode methodsFor:'printing & storing'!
+
+printOn:aStream
+ aStream nextPutAll: self selector.
+
+ "Created: / 17-12-2010 / 17:38:20 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaMethodNode methodsFor:'private'!
+
+determineStartPosition
+ self javadoc ifNotNil: [ ^ self javadoc lineNumber].
+ (self modifiers size > 0) ifTrue:[
+ ^ self modifiers first lineNumber
+ ].
+ ^ self type lineNumber.
+
+ "Created: / 13-12-2010 / 10:34:01 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-12-2010 / 18:19:30 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaMethodNode methodsFor:'queries'!
+
+isMethodDeclaration
+ ^ true.
+
+ "Created: / 13-12-2010 / 14:34:14 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaMethodNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,145 @@
+"
+ 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' }"
+
+JavaClassContentRef2 subclass:#JavaMethodRef2
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaMethodRef2 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.
+
+"
+! !
+
+!JavaMethodRef2 methodsFor:'printing & storing'!
+
+printOn:aStream
+ "append a printed representation if the receiver to the argument, aStream"
+
+ super printOn:aStream.
+! !
+
+!JavaMethodRef2 methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ valueCache := JavaResolver uniqueInstance
+ resolveStaticMethodIndentifiedByRef: self.
+ classCache := (constantPool at: classRefIndex) resolve.
+ classCache ifNil: [ self breakPoint: #mh ].
+ nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
+ nameAndTypeCache ifNil: [self breakPoint: #mh].
+
+ "Created: / 28-04-2011 / 22:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 18-05-2011 / 12:44:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+findResolvedValue
+ "Resolve reference and set valueCache."
+
+ valueCache := JavaResolver uniqueInstance
+ resolveMethodIndentifiedByRef: self.
+ classCache := (constantPool at: classRefIndex) resolve.
+ classCache ifNil: [ self breakPoint: #mh ].
+ nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
+ nameAndTypeCache ifNil: [self breakPoint: #mh].
+
+ "Modified: / 18-05-2011 / 12:44:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodRef2 methodsFor:'queries'!
+
+isJavaMethodRef
+^ true.
+
+ "Created: / 11-04-2011 / 19:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaMethodRefTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,475 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaMethodRefTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaMethodRefTests 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.
+
+"
+! !
+
+!JavaMethodRefTests methodsFor:'permission tests'!
+
+testAccessingPPFromOutside
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'packagePrivateMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPPFromSubclass
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'packagePrivateMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error
+ .
+
+ "Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromOutside
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'privateMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromOutsideInNonPublic
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'privateMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPrivateFromSubclass
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'privateMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromOutside
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'protectedMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromOutsideInNonPublic
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self
+ should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'protectedMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+
+ javaMethodRef resolve. ]
+ raise: Error
+ suchThat: [:e | e messageText = 'IllegalAccessError' ].
+
+ "Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromPackage
+ | javaMethodRef initString |
+
+initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
+ javaMethodRef resolve. ]
+ raise: Error.
+
+ "Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingProtectedFromSubclass
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'protectedMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error.
+
+ "Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromOutside
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error.
+
+ "Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromOutsideInNonPublic
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
+ self shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error.
+
+ "Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicFromSubclass
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+ self shouldnt:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
+ javaMethodRef resolve. ]
+ raise: Error.
+
+ "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testAccessingPublicInterfaceFromOutside
+ | javaMethodRef initString |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicInterface;'.
+ self should:
+ [ javaMethodRef := self
+ getMethodRefNamed: 'publicMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+ javaMethodRef
+ owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass').
+ javaMethodRef resolve. ]
+ raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError'].
+
+ "Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodRefTests methodsFor:'resolving static tests'!
+
+testCorrectStaticResolving
+ | initString javaMethodRef expectedResult result |
+
+ initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
+
+ javaMethodRef := self
+ getMethodRefNamed: 'publicStaticMethod'
+ typed: '()Ljava/lang/String;'
+ inClass: initString.
+
+ result := javaMethodRef resolveStatic.
+ expectedResult := (Java
+ classForName: 'stx.libjava.tests.mocks.PublicClass') methodDictionary
+ at: #'publicStaticMethod()Ljava/lang/String;'.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 28-04-2011 / 22:46:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodRefTests methodsFor:'resolving tests'!
+
+testCorrectInstanceCreation
+ | initString javaMethodRef |
+
+ initString := 'Ljava/lang/String;'.
+ javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString.
+
+ self assertTrue: (javaMethodRef isResolved not).
+ self assertTrue: (javaMethodRef valueCache isNil).
+ self assertTrue: (javaMethodRef name = '<init>').
+ self assertTrue: (javaMethodRef descriptor = '()V').
+ self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;').
+
+ "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testCorrectResolving
+ | initString javaMethodRef expectedResult result |
+
+ initString := 'Ljava/lang/String;'.
+ javaMethodRef := self
+ getMethodRefNamed: '<init>'
+ typed: '()V'
+ inClass: initString.
+
+ result := javaMethodRef resolve.
+ expectedResult := (Java classForName: 'java.lang.String') methodDictionary
+ at: #'<init>()V'.
+ self assertTrue: (result = expectedResult).
+
+ "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:06:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidation
+ | javaMethodRef initString|
+
+ initString := 'Ljava/lang/String;'.
+ javaMethodRef := self
+ getMethodRefNamed: '<init>'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ self assertTrue: (javaMethodRef classRef isResolved).
+ javaMethodRef invalidate.
+ self assertTrue: (javaMethodRef isResolved not).
+ self assertTrue: (javaMethodRef classRef isResolved not).
+
+ "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:06:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassNegative
+ | javaMethodRef initString|
+
+ initString := 'Ljava/lang/String;'.
+
+ javaMethodRef := self
+ getMethodRefNamed: '<init>'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ javaMethodRef invalidateForClass: 'Ljava/lang/Object;'.
+ self assertTrue: (javaMethodRef isResolved).
+
+ "Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:07:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidationForClassPositive
+ | javaMethodRef initString|
+
+ initString := 'Ljava/lang/String;'.
+ javaMethodRef := self
+ getMethodRefNamed: '<init>'
+ typed: '()V'
+ inClass: initString.
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef isResolved).
+ javaMethodRef invalidateForClass: 'Ljava/lang/String;'.
+ self assertTrue: (javaMethodRef isResolved not).
+
+ "Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testResolving
+ | initString javaMethodRef |
+
+ initString := 'Ljava/lang/String;'.
+ javaMethodRef := self
+ getMethodRefNamed: '<init>'
+ typed: '()V'
+ inClass: initString.
+
+ self assertTrue: (javaMethodRef isResolved not).
+ javaMethodRef resolve.
+ self assertTrue: (javaMethodRef classRef isResolved).
+ self assertTrue: (javaMethodRef isResolved).
+
+ "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 17:05:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaMethodRefTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaMethodWithException.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaMethodWithException.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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' }"
JavaMethod variableSubclass:#JavaMethodWithException
@@ -24,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,8 +65,34 @@
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.
+
"
-
! !
!JavaMethodWithException class methodsFor:'initialization'!
@@ -46,22 +104,47 @@
!JavaMethodWithException methodsFor:'accessing'!
exceptionTable
+ "return exception table - collection of classRefs"
+ ^ exceptionTable.
+
+ "Created: / 05-11-1998 / 19:58:38 / cg"
+ "Modified: / 04-02-2011 / 22:07:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:20:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getExceptionTable
+ "return exception table - collection of classRefs"
^ exceptionTable
- "Modified: / 16.4.1996 / 12:49:06 / cg"
- "Created: / 5.11.1998 / 19:58:38 / cg"
+ "Created: / 04-02-2011 / 23:07:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:20:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-setExceptionTable:anArray
+javaExceptionTable
+ "return exception table - collection of resolved java classes"
+ exceptionTable ifNil: [ ^ nil ].
+ ^ exceptionTable collect: [:classRef | classRef resolve ].
+
+ "Modified: / 04-02-2011 / 22:07:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 04-06-2011 / 17:16:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+setExceptionTable: anArray
+ "set exception table - expected arg: collection of classRefs"
exceptionTable := anArray.
- "Created: / 5.11.1998 / 19:58:43 / cg"
+ "Created: / 05-11-1998 / 19:58:43 / cg"
+ "Modified: / 04-06-2011 / 17:21:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaMethodWithException class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaMethodWithException.st,v 1.7 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaMethodWithException.st,v 1.7 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaMethodWithException initialize!
+JavaMethodWithException initialize!
\ No newline at end of file
--- a/JavaMethodWithHandler.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaMethodWithHandler.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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' }"
JavaMethodWithException variableSubclass:#JavaMethodWithHandler
@@ -24,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,8 +65,34 @@
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.
+
"
-
! !
!JavaMethodWithHandler class methodsFor:'initialization'!
@@ -61,7 +119,11 @@
!JavaMethodWithHandler class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaMethodWithHandler.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaMethodWithHandler.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaMethodWithHandler initialize!
+JavaMethodWithHandler initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaNameAndType2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,285 @@
+"
+ 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$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaNativeMemory.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,213 @@
+"
+ 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:#JavaNativeMemory
+ instanceVariableNames:'addresses chunks'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaNativeMemory 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.
+
+"
+! !
+
+!JavaNativeMemory class methodsFor:'instance creation'!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!JavaNativeMemory methodsFor:'accessing'!
+
+byteAt:address
+ |i chunk offset|
+
+ addresses size == 0 ifTrue:[
+ self errorAccessingUnallocatedMemory:address
+ ].
+ i := 1.
+ [
+ i <= (addresses size - 1) and:[ (addresses at:i + 1) <= address ]
+ ] whileTrue:[ i := i + 1 ].
+ offset := address - (addresses at:i).
+ chunk := chunks at:i.
+ (offset > chunk size) ifTrue:[
+ self errorAccessingUnallocatedMemory:address
+ ].
+ ^chunk at: offset + 1
+
+ "Created: / 09-12-2010 / 17:32:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+longAt:address put:value
+ |i chunk offset|
+
+ addresses size == 0 ifTrue:[
+ self errorAccessingUnallocatedMemory:address
+ ].
+ i := 1.
+ [
+ i <= (addresses size - 1) and:[ (addresses at:i + 1) <= address ]
+ ] whileTrue:[ i := i + 1 ].
+ offset := address - (addresses at:i).
+ chunk := chunks at:i.
+ (offset > chunk size) ifTrue:[
+ self errorAccessingUnallocatedMemory:address
+ ].
+ chunk longLongAt: offset + 1 put: value
+
+ "Created: / 09-12-2010 / 17:32:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaNativeMemory methodsFor:'allocation/deallocation'!
+
+free: address
+
+ "Frees the memory"
+
+ | index |
+ address = 0 ifTrue:[^self].
+
+ index := addresses
+ indexOf: address
+ ifAbsent:[self error:'Never allocated'].
+
+ (chunks at: index)
+ ifNil:[self error: 'Freed twice'].
+
+ chunks at: index put: nil.
+
+ "Created: / 07-12-2010 / 23:33:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+malloc: size
+
+ "Allocate new chunk of memory, size bytes long"
+
+ | address |
+ self assert: addresses size == chunks size.
+ addresses size > 0
+ ifTrue: [address := addresses last + chunks last size ]
+ ifFalse:[address := 0].
+ address := address + (Random nextIntegerBetween: 128 and: 256).
+
+ addresses add: address.
+ chunks add: (ByteArray new: size).
+
+ ^address
+
+ "Created: / 07-12-2010 / 23:25:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaNativeMemory methodsFor:'error reporting'!
+
+errorAccessingUnallocatedMemory:arg
+ self shouldImplement
+
+ "Created: / 07-12-2010 / 23:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaNativeMemory methodsFor:'initialization'!
+
+initialize
+ "Invoked when a new instance is created."
+
+ addresses := OrderedCollection new.
+ chunks := OrderedCollection new.
+
+ "/ super initialize. -- commented since inherited method does nothing
+
+ "Modified: / 07-12-2010 / 23:09:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaNativeMemory class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaNativeMethod.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaNativeMethod.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,17 +1,131 @@
+"
+ 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' }"
JavaMethodWithHandler variableSubclass:#JavaNativeMethod
instanceVariableNames:'nativeImplementation'
- classVariableNames:''
+ classVariableNames:'CacheNativeImplementation'
poolDictionaries:''
category:'Languages-Java-Classes'
!
+!JavaNativeMethod 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.
+
+"
+! !
!JavaNativeMethod class methodsFor:'initialization'!
+cacheNativeImplementation
+
+ "For details, see #cacheNativeImplementation:"
+
+ ^CacheNativeImplementation
+
+ "Created: / 30-04-2011 / 23:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cacheNativeImplementation: aBoolean
+
+ "If set, native implementations are cached, resulting
+ in better performance when calling native methods.
+ Hower, no change in native method implemenetaion will
+ not be visible then, unless #flushAllCachedNativeMethods
+ is explictely called"
+
+ CacheNativeImplementation := aBoolean
+
+ "Created: / 30-04-2011 / 23:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
initialize
self flags:(self flags bitOr:Behavior flagJavaMethod).
+
+ "By default, do not cache native impls while developing"
+ CacheNativeImplementation := Smalltalk isStandAloneApp.
+
+ "Modified: / 30-04-2011 / 23:35:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaNativeMethod class methodsFor:'cleanup'!
@@ -45,16 +159,136 @@
nativeImplementation := something.
"Created: / 25.9.1999 / 23:08:00 / cg"
+!
+
+sourceLineNumber
+ ForceByteCodeDisplay == true ifTrue:[ ^ 1].
+ lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2].
+ ^1
+
+
+ "
+ ^ (JavaSourceCodeCache new)
+ findLineForMethod:(self selector)
+ inClass:javaClass.
+ "
+
+ "Modified: / 13-12-2010 / 13:55:55 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 17-12-2010 / 10:34:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaNativeMethod methodsFor:'private'!
+
+compileNativeImplementation: sel dispatchingTo: oldSel
+
+ | src arg converted |
+ src := (JavaVM class compiledMethodAt: oldSel) source.
+ src := src asStringCollection.
+ (src first includesString: 'aJavaContext') ifTrue:[
+ arg := 'aJavaContext'
+ ] ifFalse:[
+ (src first includesString: 'nativeContext') ifTrue:[
+ arg := 'nativeContext'
+ ]
+ ].
+ arg ifNotNil:[
+ src removeFirst asString.
+ converted := true.
+ ] ifNil:[
+ arg := 'nativeContext'.
+ src := ' self breakPoint: #jv info: ''Convert it to new-style natives''.
+
+ ^ self ', oldSel, ' nativeContext'.
+ converted := false.
+ ].
+
+ (JavaVM class
+ compile:
+ (self nativeMethodTemplate bindWith:sel with: arg with: src asString)
+ classified:
+ 'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$. ))
+ package: JavaVM package.
+
+ converted ifTrue:[
+ (JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (converted)'
+ ] ifFalse:[
+ (JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (FAILED to convert)'
+ ]
+
+ "Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-05-2011 / 13:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+compileNativeImplementationStub: sel
+
+ (JavaVM class
+ compile:
+ (self nativeMethodTemplate bindWith:sel with: 'nativeContext' with:('^ UnimplementedNativeMethodSignal raise'))
+ classified:
+ 'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.))
+ package: JavaVM package
+
+ "Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+nativeMethodTemplate
+
+ ^'%1 %2
+
+ <javanative: ''', javaClass name , ''' name: ''', (selector copyWithoutLast:signature size), '''>
+
+ %3'
+
+ "Created: / 01-05-2011 / 00:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+searchNativeImplementation
+
+ "Returns a SELECTOR of native method implementation.
+ For now, two naming schemes are used. The onld one uses
+ just a class name and selector as a name for native method impl.
+ The new one uses fully qualified class name.
+ "
+
+ | nm newStyleSel oldStyleSel |
+ nm := selector upTo: $(.
+ newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':') asSymbol.
+ (JavaVM class canUnderstand: newStyleSel) ifTrue:
+ ["Good, a JavaVM understands new style native selectors"
+ ^newStyleSel].
+
+ oldStyleSel := ('_' , (javaClass lastName copyReplaceAll:$$ with:$_) , '_' , nm , ':') asSymbol.
+ (JavaVM class canUnderstand: oldStyleSel) ifTrue:
+ [
+ "Convert method on the fly only if Im Jan Vrany
+ (to avoid confusion of other developers :-)"
+ OperatingSystem getLoginName = 'jv' ifTrue:[
+ "OK, old style method has not yet been converted to a newstyle one.
+ Converts old-style method to a new-style one"
+ self compileNativeImplementation: newStyleSel dispatchingTo: oldStyleSel.
+ ^newStyleSel
+ ] ifFalse:[
+ ^oldStyleSel
+ ]].
+ self compileNativeImplementationStub: newStyleSel.
+ ^newStyleSel
+
+ "Created: / 30-04-2011 / 23:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-08-2011 / 01:08:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaNativeMethod methodsFor:'vm support'!
nativeMethodInvokation
- |nm sel mthd sender|
+
+ "Called by the VM when a native method is
+ to be executed"
+
+ | sel mthd sender|
(mthd := nativeImplementation) isNil ifTrue:[
- nm := selector copyWithoutLast:signature size.
- sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.
+ sel := self searchNativeImplementation.
mthd := (JavaVM class compiledMethodAt:sel).
(mthd isNil or:[mthd isLazyMethod]) ifTrue:[
@@ -68,7 +302,9 @@
perform:sel
with:sender.
].
- nativeImplementation := mthd.
+ CacheNativeImplementation ifTrue:[
+ nativeImplementation := mthd.
+ ]
].
^ mthd
@@ -82,13 +318,18 @@
JavaNativeMethod flushAllCachedNativeMethods
"
- "Modified: / 27.1.2000 / 13:34:53 / cg"
+ "Modified: / 27-01-2000 / 13:34:53 / cg"
+ "Modified: / 30-04-2011 / 23:52:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaNativeMethod class methodsFor:'documentation'!
version
- ^ '$Id$'
+ ^ '$Id: JavaNativeMethod.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaNativeMethod.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaNativeMethod initialize!
+JavaNativeMethod initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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:#JavaNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaNode 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.
+
+"
+! !
+
+!JavaNode methodsFor:'queries'!
+
+isMethodDeclaration
+ ^ false.
+
+ "Created: / 13-12-2010 / 14:34:14 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaObject.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaObject.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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:#JavaObject
@@ -24,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,8 +65,34 @@
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.
+
"
-
! !
!JavaObject class methodsFor:'misc'!
@@ -167,24 +225,24 @@
myClass == Java java_lang_String ifTrue:[
^ '''' , (Java as_ST_String:self) , ''''
].
-
myClass == (Java at:'java.lang.Class') ifTrue:[
- ^ super displayString , '(' , (JavaVM classForJavaClassObject:self) displayString , ')'
- ].
-
- myClass == (Java at:'java.lang.reflect.Method') ifTrue:[
- ^ super displayString , '(' , (JavaVM methodForJavaMethodObject:self) displayString , ')'
+ ^ super displayString , '('
+ , (JavaVM reflection classForJavaClassObject:self) displayString , ')'
].
-
- Object errorSignal handle:[:ex |
- javaString := ''.
- ] do:[
- javaString := Java as_ST_String:(self perform:#'toString()Ljava/lang/String;').
+ myClass == (Java at:'java.lang.reflect.Method') ifTrue:[
+ ^ super displayString , '('
+ , (JavaVM methodForJavaMethodObject:self) displayString , ')'
].
-
+ Object errorSignal
+ handle:[:ex | javaString := ''.]
+ do:[
+ javaString := Java
+ as_ST_String:(self perform:#'toString()Ljava/lang/String;').
+ ].
^ super displayString , ' (' , javaString , ')'.
- "Modified: / 4.11.1998 / 18:35:00 / cg"
+ "Modified: / 04-11-1998 / 18:35:00 / cg"
+ "Modified: / 28-01-2011 / 15:10:05 / Marcel Hlopko <hlopik@gmail.com>"
!
javaDisplayString
@@ -198,6 +256,34 @@
"Created: / 7.4.1997 / 17:38:13 / cg"
"Modified: / 4.11.1998 / 21:07:19 / cg"
+!
+
+printString
+ |myClass javaString|
+
+ myClass := self class.
+ myClass == Java java_lang_String ifTrue:[
+ ^ '''' , (Java as_ST_String:self) , ''''
+ ].
+ myClass == (Java at:'java.lang.Class') ifTrue:[
+ ^ super printString , '('
+ , (JavaVM reflection classForJavaClassObject:self) displayString , ')'
+ ].
+ myClass == (Java at:'java.lang.reflect.Method') ifTrue:[
+ ^ super printString , '('
+ , (JavaVM methodForJavaMethodObject:self) displayString , ')'
+ ].
+ Object errorSignal
+ handle:[:ex | javaString := ''.]
+ do:[
+ javaString := Java
+ as_ST_String:(self perform:#'toString()Ljava/lang/String;').
+ ].
+ ^ super printString , ' (' , javaString , ')'.
+
+ "Modified: / 04-11-1998 / 18:35:00 / cg"
+ "Created: / 20-12-2010 / 23:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:10:17 / Marcel Hlopko <hlopik@gmail.com>"
! !
!JavaObject methodsFor:'queries'!
@@ -280,5 +366,9 @@
!JavaObject class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaObject.st,v 1.54 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaObject.st,v 1.54 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaObjectDictionary.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,159 @@
+"
+ 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:#JavaObjectDictionary
+ instanceVariableNames:'dictionary'
+ classVariableNames:'Instance'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaObjectDictionary 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.
+
+"
+! !
+
+!JavaObjectDictionary class methodsFor:'instance creation'!
+
+instance
+ Instance ifNil: [
+ Instance := self basicNew initialize.
+ ].
+ ^ Instance.
+
+ "Created: / 09-01-2011 / 20:48:16 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+new
+ "Currently singleton but in future Query may be more suitable"
+ ^ self instance.
+
+ "Created: / 09-01-2011 / 20:48:16 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaObjectDictionary methodsFor:'accessing'!
+
+hasReflection: stClassName
+ "return true if stClassName has reflection in Java World"
+ ^ (dictionary at: stClassName ifAbsent: [ nil ]) notNil
+
+ "Created: / 17-01-2011 / 19:20:58 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+reflectionOf: stClassName
+ ^ dictionary at: stClassName ifAbsent: [ NoReflectionObject new ]
+
+ "Created: / 09-01-2011 / 21:03:24 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-01-2011 / 10:39:43 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!JavaObjectDictionary methodsFor:'adding & removing'!
+
+flush
+ dictionary removeAll.
+
+ "Created: / 09-01-2011 / 21:44:04 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+registerJavaObject: aJavaClass toStObject: aStObject
+ dictionary at: aStObject name asSymbol put: aJavaClass.
+
+ "Created: / 09-01-2011 / 21:40:00 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaObjectDictionary methodsFor:'initialization'!
+
+initialize
+ "Use StCounter instead of Counter"
+ dictionary := IdentityDictionary new.
+
+ "Modified: / 09-01-2011 / 21:36:58 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaObjectDictionary class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaPackage.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,117 @@
+"
+ 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.
+"
+
+NameSpace subclass:#JavaPackage
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Classes'
+!
+
+!JavaPackage 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.
+
+"
+! !
+
+!JavaPackage class methodsFor:'queries'!
+
+isNameSpace
+ "return true, if the receiver is a nameSpace.
+ Unconditionally true here for subclasses - my subclasses are namespaces"
+
+ ^ self ~~ JavaPackage .
+!
+
+isRealNameSpace
+ "return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class).
+ Unconditionally true here for subclasses - my subclasses are namespaces"
+
+ ^ self ~~ JavaPackage .
+! !
+
+!JavaPackage class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaParseResult.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,129 @@
+"
+ 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:#JavaParseResult
+ instanceVariableNames:'collection'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Parser'
+!
+
+!JavaParseResult 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.
+
+"
+! !
+
+!JavaParseResult class methodsFor:'instance creation'!
+
+from: aCollection
+ ^ self new
+ collection: aCollection.
+
+ "Created: / 08-01-2011 / 16:06:01 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParseResult methodsFor:'accessing'!
+
+collection
+ ^ collection
+!
+
+collection:something
+ collection := something.
+! !
+
+!JavaParseResult methodsFor:'instance creation'!
+
+methods
+ ^ self collection at: 6.
+
+ "Created: / 08-01-2011 / 16:06:25 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParseResult class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaParser.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,824 @@
+"
+ 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' }"
+
+PPCompositeParser subclass:#JavaParser
+ instanceVariableNames:'classDecl'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Parser'
+!
+
+PPParser subclass:#BlockParser
+ instanceVariableNames:'openBlockChar closeBlockChar innerBlockCount'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+PPParser subclass:#CommentParser
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+PPParser subclass:#MultilineCommentParser
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+PPJavaNode subclass:#PPBlockNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser::MultilineCommentParser
+!
+
+PPParser subclass:#LineNumberParser
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+ReadStream subclass:#LineNumberStream
+ instanceVariableNames:'eolPositions lastPosition previousWasCR'
+ classVariableNames:'CR LF'
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+JavaParser::MultilineCommentParser subclass:#JavaDocParser
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+PPParser subclass:#StatementParser
+ instanceVariableNames:'brackets'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaParser
+!
+
+!JavaParser 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.
+
+"
+! !
+
+!JavaParser class methodsFor:'parsing'!
+
+methodsIn: sourceCode
+ ^ (self parse: sourceCode) methods.
+
+ "Created: / 08-01-2011 / 15:42:24 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+parse: code
+ ^ JavaParseResult from: (super parse: code).
+
+ "Created: / 08-01-2011 / 16:05:01 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:07:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParser methodsFor:'accessing'!
+
+lineNumber
+ ^ LineNumberParser new.
+
+ "Created: / 29-12-2010 / 22:14:02 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:05:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+start
+ ^ self javaFile end.
+! !
+
+!JavaParser methodsFor:'grammar'!
+
+annotation
+ ^ $@ asParser, self identifier, self annotationBlock optional
+!
+
+annotationBlock
+ ^ BlockParser new
+ openBlockChar: $(;
+ closeBlockChar: $);
+ yourself;
+ trim
+
+ "Modified: / 07-04-2011 / 21:46:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+argument
+ ^ (self finalKW optional, self type, self threeDotsKW optional, self typeIdentifier) trim
+!
+
+argumentList
+ ^ (self argument separatedBy: ($, asParser trim) ==> [:token | nil]) ==> [: token | token select: [:each | each notNil ]].
+!
+
+block
+ ^ BlockParser new trim
+
+ "Modified: / 07-04-2011 / 21:46:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classBody
+ ^ (${ asParser trim, self classContents star, $} asParser trim)
+ foldLeft: [:a :contents :b | contents select: [:each | each notNil ]]
+
+ "Modified: / 30-12-2010 / 11:21:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+classContents
+ ^ self methodDecl trim /
+ self constructor trim /
+ self staticInitializer trim /
+ self comment /
+ "Since classes may be nested recursively we have to use this syntax - without self"
+ classDecl trim /
+ "TODO JK: This will cause problems - sooner or later"
+ self statement.
+
+ "Modified: / 29-12-2010 / 22:12:11 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+classDecl
+ ^ self classModifiers,
+ (self classKW / self interfaceKW),
+ (self identifier, self genericBlock optional) flatten,
+ (self extends optional),
+ (self implements optional),
+ self classBody
+!
+
+classModifiers
+ ^ ('public' asParser /
+ 'private' asParser /
+ 'static' asParser /
+ 'abstract' asParser /
+ 'final' asParser
+
+ ) trim star
+!
+
+comment
+ ^ (self oneLineComment / self multilineComment) ==> [ :token | nil ]
+
+ "Modified: / 30-12-2010 / 11:20:56 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+constructor
+ ^ (
+ self lineNumber,
+ self javadoc optional,
+ self methodModifiers optional,
+ self identifier,
+ self methodArguments,
+ self methodBody optional) trim
+ foldLeft: [:startLine :javadoc :modifiers :name :arguments :body |
+ JavaMethodDeclarationNode new
+ startLine: startLine;
+ javadoc: javadoc;
+ modifiers: modifiers;
+ retval: nil;
+ methodName: name;
+ arguments: arguments
+ ].
+
+ "Modified: / 08-01-2011 / 16:27:25 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+extends
+ ^ self extendsKW, self type
+!
+
+fileHeader
+ ^ self comment star, self package optional, self imports optional, self comment star
+!
+
+fullIdentifier
+ ^ (self identifier separatedBy: $. asParser) trim flatten
+
+!
+
+genericBlock
+ ^ BlockParser new
+ openBlockChar: $<;
+ closeBlockChar: $>;
+ yourself;
+ trim
+
+ "Modified: / 07-04-2011 / 21:46:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+identifier
+ ^ (#letter asParser, #word asParser star) trim flatten
+
+!
+
+implements
+ ^ self implementsKW, (self type separatedBy: $, asParser trim)
+!
+
+import
+ ^ self comment star, 'import' asParser trim, self statement.
+!
+
+imports
+ ^ self import star
+!
+
+javaFile
+ ^ (self fileHeader, classDecl trim) foldLeft: [:header :c | c ]
+!
+
+javadoc
+ ^ JavaDocParser new trim
+
+ "Modified: / 07-04-2011 / 22:06:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodArguments
+ ^ ($( asParser, self argumentList optional, $) asParser) trim foldLeft: [:a :args :b | args].
+!
+
+methodBody
+ ^ self block.
+!
+
+methodDecl
+ ^ (
+ self lineNumber,
+ self javadoc optional,
+ self methodModifiers optional,
+ self genericBlock optional,
+ self methodRetval,
+ self identifier,
+ self methodArguments,
+ self throwsStatement optional,
+ self methodBody optional) trim
+ foldLeft: [:startLine :javadoc :modifiers :generic :retval :name :arguments :throws :body |
+ JavaMethodDeclarationNode new
+ javadoc: javadoc;
+ modifiers: modifiers;
+ retval: retval;
+ methodName: name;
+ arguments: arguments;
+ startLine: startLine
+ ].
+
+ "Modified: / 29-12-2010 / 22:47:53 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+methodModifiers
+ ^ ('public' asParser /
+ 'static' asParser /
+ 'abstract' asParser /
+ 'private' asParser /
+ 'protected' asParser /
+ 'native' asParser /
+ 'final' asParser /
+ 'synchronized' asParser /
+ self annotation
+ ) trim star
+!
+
+methodRetval
+ ^ self type
+!
+
+multilineComment
+ ^ MultilineCommentParser new trim
+
+ "Modified: / 07-04-2011 / 22:03:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+nameToken
+ ^ #word asParser
+
+!
+
+oneLineComment
+ ^ CommentParser new trim
+
+ "Modified: / 07-04-2011 / 22:03:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+otherClassContent
+ ^ self statement.
+!
+
+package
+ ^ 'package' asParser trim, self statement.
+!
+
+primitiveType
+ ^ ( 'int' asParser /
+ 'byte' asParser /
+ 'boolean' asParser /
+ 'float' asParser /
+ 'double' asParser /
+ 'char' asParser
+ ) trim
+!
+
+reference
+ ^ self fullIdentifier
+!
+
+statement
+ ^ StatementParser new trim ==> [: token | nil ].
+
+ "Modified: / 30-12-2010 / 11:20:45 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:05:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+staticInitializer
+ ^ 'static' asParser trim, BlockParser new ==> [:token | nil]
+
+ "Modified: / 07-04-2011 / 21:47:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+throwsStatement
+ ^ self throwsKW, (self identifier separatedBy: $, asParser trim)
+!
+
+type
+ ^
+ (
+ ('void' asParser / self primitiveType / self reference) trim,
+ self genericBlock optional,
+ '[]' asParser optional
+ )
+ flatten
+!
+
+typeIdentifier
+ ^ self identifier
+! !
+
+!JavaParser methodsFor:'keywords'!
+
+classKW
+ ^ 'class' asParser trim
+!
+
+extendsKW
+ ^ 'extends' asParser trim
+!
+
+finalKW
+ ^ 'final' asParser trim
+!
+
+implementsKW
+ ^ 'implements' asParser trim
+!
+
+interfaceKW
+ ^ 'interface' asParser trim
+!
+
+threeDotsKW
+ ^ '...' asParser trim
+!
+
+throwsKW
+ ^ 'throws' asParser trim
+!
+
+voidKW
+ ^ 'void' asParser trim
+! !
+
+!JavaParser methodsFor:'parsing'!
+
+parseOn: ppStream
+ ^ super parseOn: (LineNumberStream on: ppStream collection).
+"/ ^ super parseOn: ppStream.
+
+ "Created: / 29-12-2010 / 22:35:30 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 30-12-2010 / 10:01:20 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:06:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParser::BlockParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::BlockParser methodsFor:'accessing'!
+
+closeBlockChar: anObject
+ closeBlockChar := anObject
+!
+
+openBlockChar: anObject
+ openBlockChar := anObject
+! !
+
+!JavaParser::BlockParser methodsFor:'initialization'!
+
+initialize
+ innerBlockCount := 0.
+ openBlockChar := ${.
+ closeBlockChar := $}.
+! !
+
+!JavaParser::BlockParser methodsFor:'parsing'!
+
+decInnerBlockCount
+ innerBlockCount := innerBlockCount - 1.
+!
+
+incInnerBlockCount
+ innerBlockCount := innerBlockCount + 1.
+!
+
+parseLoop: aStream
+ | literal |
+
+ aStream atEnd ifFalse:
+ [
+ literal := aStream uncheckedPeek.
+ literal = openBlockChar ifTrue: [ self incInnerBlockCount].
+ literal = closeBlockChar ifTrue: [ self decInnerBlockCount].
+ aStream next.
+ ^true
+ ].
+ ^false
+!
+
+parseOn: aStream
+ | literal |
+" self halt.
+"
+ (self parseLoop: aStream) ifFalse:
+ [
+ ^ PPFailure message: 'unexpected end of input' at: aStream position
+ ].
+
+ self zeroBlockCount ifTrue: [ ^ PPFailure message: ('expected ' copyWith: openBlockChar) at: aStream position ].
+
+ [self zeroBlockCount] whileFalse: [
+ (self parseLoop: aStream) ifFalse:
+ [
+ ^ PPFailure message: 'unexpected end of input' at: aStream position
+ ]
+ ].
+ ^ nil.
+!
+
+zeroBlockCount
+ ^ innerBlockCount = 0
+! !
+
+!JavaParser::CommentParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::CommentParser methodsFor:'parsing'!
+
+parseOn: aStream
+ | literal wasStar |
+ wasStar := false.
+
+ (aStream next: 2) = '//' ifFalse: [
+ ^ PPFailure message: '// expected' at: aStream position.
+ ].
+
+ [literal := aStream next.
+ literal = (Character cr) or: [ aStream atEnd ]
+ ] whileFalse.
+
+ ^ nil.
+! !
+
+!JavaParser::MultilineCommentParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::MultilineCommentParser methodsFor:'parsing'!
+
+checkStart: aStream
+ ^ (aStream next: self startSequence size) = self startSequence
+!
+
+parseOn: aStream
+ | literal wasStar line |
+ wasStar := false.
+ line := aStream lineNumber.
+
+ (self checkStart: aStream) ifFalse: [
+ ^ PPFailure message: self startSequence, ' expected' at: aStream position.
+ ].
+
+ [literal := aStream next.
+ aStream atEnd ifTrue:
+ [
+ ^ PPFailure message: 'unexpected end of input' at: aStream position.
+ ].
+
+ wasStar and: [literal = $/]
+ ] whileFalse: [
+ wasStar := literal = $*
+ ].
+ ^ PPBlockNode new
+ startLine: line
+
+ "Modified: / 29-12-2010 / 21:29:26 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+startSequence
+ ^ '/*'
+! !
+
+!JavaParser::LineNumberParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::LineNumberParser methodsFor:'parsing'!
+
+parseOn: aStream
+ ^ aStream lineNumber.
+
+ "Created: / 29-12-2010 / 22:13:22 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParser::LineNumberStream class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::LineNumberStream class methodsFor:'initialization'!
+
+initialize
+ CR := Character cr.
+ Smalltalk isSmalltalkX ifTrue:[
+ CR := Character return.
+ ].
+ LF := Character nl.
+
+ "Created: / 29-12-2010 / 23:11:17 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParser::LineNumberStream methodsFor:'accessing'!
+
+lineNumber
+ | index start stop pos |
+ pos := position.
+ pos >= eolPositions last ifTrue: [^eolPositions size].
+ start := 1.
+ stop := eolPositions size.
+ [start + 1 < stop] whileTrue:
+ [index := (start + stop) // 2.
+ (eolPositions at: index) <= pos
+ ifTrue: [start := index]
+ ifFalse: [stop := index]].
+ ^start
+
+ "Created: / 30-12-2010 / 10:23:27 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+next
+ | character |
+ character := super next.
+ position - 1 == lastPosition
+ ifTrue:
+ [
+"/ self halt.
+ lastPosition := lastPosition + 1.
+ character == CR
+ ifTrue:
+ [eolPositions add: position.
+ previousWasCR := true]
+ ifFalse:
+ [(previousWasCR not and: [character == LF])
+ ifTrue: [eolPositions add: position].
+ previousWasCR := false]].
+ ^character
+
+ "Modified: / 30-12-2010 / 10:55:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+next: anInteger
+ "Override for positioning purposes"
+
+ | answer num |
+ num:= readLimit - position min: anInteger.
+ answer := OrderedCollection new: num.
+
+ num timesRepeat: [
+ answer add: self next.
+ ].
+ ^ answer asString.
+
+
+"/ | answer endPosition |
+"/ endPosition := position + anInteger min: readLimit.
+"/ answer := collection copyFrom: position + 1 to: endPosition.
+"/ position := endPosition.
+"/ ^ answer
+
+ "Modified: / 30-12-2010 / 10:57:37 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+uncheckedPeek
+ "An unchecked version of peek that throws an error if we try to peek over the end of the stream, even faster than #peek."
+
+ ^ collection at: position + 1
+! !
+
+!JavaParser::LineNumberStream methodsFor:'converting'!
+
+asPetitStream
+ ^ self
+! !
+
+!JavaParser::LineNumberStream methodsFor:'initialization'!
+
+initialize
+ eolPositions := OrderedCollection with: ZeroPosition.
+ lastPosition := ZeroPosition.
+ previousWasCR := false
+
+ "Created: / 30-12-2010 / 10:22:41 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+on: aCollection
+ super on: aCollection.
+ eolPositions := OrderedCollection with: ZeroPosition.
+ lastPosition := ZeroPosition.
+ previousWasCR := false
+
+ "Created: / 30-12-2010 / 10:26:17 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParser::LineNumberStream methodsFor:'printing'!
+
+printOn: aStream
+ collection isString
+ ifFalse: [ ^ super printOn: aStream ].
+ aStream
+ nextPutAll: (collection copyFrom: 1 to: position);
+ nextPutAll: '·';
+ nextPutAll: (collection copyFrom: position + 1 to: readLimit)
+! !
+
+!JavaParser::JavaDocParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::JavaDocParser methodsFor:'parsing'!
+
+parseOn: aStream
+ | blockNode |
+ blockNode := super parseOn: aStream.
+
+ blockNode isPetitFailure ifTrue: [
+ ^ blockNode.
+ ].
+
+ ^ JavadocDeclarationNode new
+ startLine: blockNode startLine.
+
+ "Created: / 29-12-2010 / 21:22:42 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+startSequence
+ ^ '/**'
+! !
+
+!JavaParser::StatementParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+!JavaParser::StatementParser methodsFor:'parsing'!
+
+parseOn: aStream
+ | literal |
+ [literal = $;] whileFalse: [
+ aStream atEnd ifFalse:
+ [
+ literal := aStream uncheckedPeek.
+ aStream next.
+ ]
+ ifTrue:
+ [
+ ^ PPFailure message: 'unexpected end of input' at: aStream position.
+ ].
+
+ "TODO JK: This will cause problems - sooner or later"
+ (literal = $}) ifTrue: [ ^
+ PPFailure message: 'cannot parser $}' at: aStream position.
+ ].
+ ].
+ ^ nil
+! !
+
+!JavaParser class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaParser::LineNumberStream initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaParserNavigationTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,261 @@
+"
+ 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' }"
+
+JavaParserTestCase subclass:#JavaParserNavigationTests
+ instanceVariableNames:'result'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaParserNavigationTests 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.
+
+"
+! !
+
+!JavaParserNavigationTests methodsFor:'accessing'!
+
+firstMethod
+ ^ self methods first
+
+ "Created: / 29-12-2010 / 21:05:13 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+methods
+ ^ self result methods.
+
+ "Created: / 29-12-2010 / 21:05:11 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 08-01-2011 / 16:07:17 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+result
+ ^ result
+!
+
+result:something
+ result := something.
+!
+
+secondMethod
+ ^ self methods second
+
+ "Created: / 30-12-2010 / 11:01:21 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+thirdMethod
+ ^ self methods third
+
+ "Created: / 30-12-2010 / 11:01:47 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParserNavigationTests methodsFor:'testing'!
+
+testConstructor
+ self parse: '
+public class Foo
+{
+ private Foo() {
+ }
+}
+'.
+ self assert: (self methods size = 1).
+ self assert: (self firstMethod startLine = 4).
+
+ "Created: / 08-01-2011 / 16:25:18 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testConstructor2
+ self parse: '
+public class Foo
+{
+ private Foo() {
+ }
+
+ public Foo(O o) {}
+}
+'.
+ self assert: (self methods size = 2).
+ self assert: (self firstMethod startLine = 4).
+ self assert: (self secondMethod startLine = 7).
+
+ "Created: / 08-01-2011 / 16:25:57 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testFoo
+ self parse: '
+public class Foo
+{
+ public void foo() {}
+}
+'.
+ self assert: (self methods size = 1).
+ self assert: (self firstMethod startLine = 4).
+
+ "Created: / 29-12-2010 / 21:05:13 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testMethod
+ self parse: '
+public class Foo
+{
+ // some comment
+ public void foo() {
+ }
+}
+'.
+ self assert: (self methods size = 1).
+ self assert: (self firstMethod startLine = 5).
+
+ "Created: / 30-12-2010 / 10:59:37 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testMethodJavadoc
+ self parse: '
+public class Foo
+{
+ // some comment
+ /**
+ * This is javadoc
+ */
+ public void foo() {
+ }
+}
+'.
+ self assert: (self methods size = 1).
+ self assert: (self firstMethod startLine = 5).
+
+ "Created: / 30-12-2010 / 11:00:18 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testMethodJavadoc2
+ self parse: '
+public class Foo
+{
+ // some comment
+ /** javadoc */
+ /**
+ * This is javadoc
+ */
+ public void foo() {
+ }
+}
+'.
+ self assert: (self methods size = 1).
+ self assert: (self firstMethod startLine = 6).
+
+ "Created: / 30-12-2010 / 11:00:29 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testMultipleMethods
+ self parse: '
+public class Foo
+{
+ public void foo() {
+ }
+
+ abstract void foo2()
+}
+'.
+ self assert: (self methods size = 2).
+ self assert: (self firstMethod startLine = 4).
+ self assert: (self secondMethod startLine = 7).
+
+ "Created: / 30-12-2010 / 11:00:37 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParserNavigationTests methodsFor:'utilities'!
+
+parse: string
+ self result: (super parse: string).
+ ^ self result.
+
+ "Modified: / 29-12-2010 / 21:07:06 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParserNavigationTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaParserTestCase.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,127 @@
+"
+ 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:#JavaParserTestCase
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaParserTestCase 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.
+
+"
+! !
+
+!JavaParserTestCase class methodsFor:'testing'!
+
+isAbstract
+
+ ^self == JavaParserTestCase
+
+ "Created: / 16-03-2011 / 16:27:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-04-2011 / 22:16:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParserTestCase methodsFor:'utilities'!
+
+assertParse: string
+ self assert: (JavaParser new matches: string).
+
+ "Modified: / 07-04-2011 / 22:07:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parse: string
+ ^ JavaParser parse: string
+
+ "Created: / 29-12-2010 / 21:02:23 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:07:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParserTestCase class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaParserTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,6095 @@
+"
+ 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' }"
+
+JavaParserTestCase subclass:#JavaParserTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaParserTests 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.
+
+"
+! !
+
+!JavaParserTests methodsFor:'arguments'!
+
+testMethodWithArgs
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs2
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(Object o, Object o2)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs3
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs4
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i, Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs5
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(final int i, Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs6
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(final int i, final Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs7
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(java.lang.Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs8
+ ^ self assertParse: '
+ public class Foo {
+ public void fooMethod(int ... numbers)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArgs9
+ ^ self assertParse: '
+ public class Foo {
+ public void fooMethod(Object<T> ... numbers)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArrayArgs
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(Object[] o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArrayArgs2
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int[] o)
+ {
+ int i = 0;
+ }
+ }
+ '
+! !
+
+!JavaParserTests methodsFor:'classOrInterface'!
+
+testClassWithComment
+ ^ self assertParse: '
+// this is one line comment
+public class Object {
+}
+ '
+!
+
+testClassWithComment2
+ ^ self assertParse: '
+// this is one line comment
+public class Object {
+ // this is one line comment
+}
+'
+
+ "Modified: / 29-12-2010 / 20:28:27 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testClassWithComment3
+ ^ self assertParse: '
+public class Object {
+ // this is one line comment
+}
+'
+
+ "Modified: / 29-12-2010 / 20:28:40 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testClassWithJavadoc
+ ^ self assertParse: '
+ /** this is class javadoc */
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testClassWithJavadoc2
+ ^ self assertParse: '
+/*
+ * Possible end/of javadoc?
+ */
+public class Object {
+}
+ '
+!
+
+testClassWithStaticInitializer
+ ^ self assertParse: '
+ public class Foo {
+ int i = 0;
+
+ static {
+ //cokoli
+ int i = 0;
+ }
+
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testClassWithStaticInitializer2
+ ^ self assertParse: '
+ public class Foo {
+ static {
+ //cokoli
+ int i = 0;
+ }
+ }
+ '
+!
+
+testClassWithStaticInitializer3
+ ^ self assertParse: '
+ public class Foo {
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ static {
+ //cokoli
+ int i = 0;
+ }
+ }
+ '
+!
+
+testEmptyAbstractClass
+ ^ self assertParse: '
+ public abstract class Foo {}
+ '
+!
+
+testEmptyClass
+ ^ self assertParse: '
+ public class Foo {}
+ '
+!
+
+testEmptyStatement
+ ^ self
+ assertParse:
+ '
+ public class Foo {
+ ;;;
+ }
+ '
+!
+
+testFinalClass
+ ^ self assertParse: '
+ public final class Foo {
+ public Foo fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testFoo
+ self assert: true.
+!
+
+testGenericClass
+ ^ self assertParse: '
+ public class Foo<T> {
+ public T fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testGenericClass2
+ ^ self assertParse: '
+ public class Foo<T extends Foo> {
+ public T fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testHeader
+ ^ self assertParse: '
+ package a.b.c;
+
+ import a.b.*;
+ import c.d.*;
+
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testHeader2
+ ^ self assertParse: '
+ package a.b.c;
+
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testHeader3
+ ^ self assertParse: '
+ import a.b.c;
+
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testHeader4
+ ^ self assertParse: '
+ /* some doc */
+ package a.b;
+
+ import a.b.c;
+
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testHeader5
+ ^ self assertParse: '
+ /* some doc */
+ package a.b;
+ /* another doc */
+ import a.b.c;
+ /* ane another doc */
+ /** class javadoc */
+ public class Foo {
+ public void foo() {}
+ }
+ '
+!
+
+testHeader6
+ ^ self assertParse: '
+/*
+ * simple doc
+ */
+public class Object {
+}
+ '
+!
+
+testHeader7
+ ^ self assertParse: '
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates.
+ */
+public class Object {
+}
+ '
+!
+
+testInnerClass
+ ^ self assertParse: '
+ public class Foo {
+ private class A
+ {
+ public void foo() {}
+ }
+
+ }
+ '
+!
+
+testInnerClass2
+ ^ self assertParse: '
+ public class Foo {
+ private class A
+ {
+ public void foo() {}
+ }
+ }
+ '
+!
+
+testInnerClass3
+ ^ self
+ assertParse:
+ '
+ public class Foo {
+ private class A
+ {
+ public void foo() {}
+ }
+
+ private int foo2() {int i = 9;}
+ }
+ '
+!
+
+testInnerClass4
+ ^ self assertParse: '
+ public class Foo {
+ public void foo() {}
+
+ /** class javadoc */
+ private class A
+ {
+ /* comment */
+ public void foo() {}
+ }
+
+ /**
+ * javadoc */
+ private int foo2() {int i = 9;}
+ /**
+ * javadoc */
+ private int foo2() {int i = 9;}
+ }
+ '
+!
+
+testInnerClass5
+ ^ self assertParse: '
+ public class Foo {
+ private class A
+ {
+ public void foo() {}
+ }
+ int i;
+ }
+ '
+!
+
+testInterface1
+ ^ self assertParse: '
+public interface MyVisitor
+{
+}
+ '
+!
+
+testInterface2
+ ^ self assertParse: '
+public interface Visitor
+{
+ public void process(Circle c);
+ public void process(Square s);
+}
+ '
+!
+
+testInterface3
+ ^ self assertParse: '
+public interface MyVisitor extends Visitor
+{
+ public void foo();
+}
+ '
+!
+
+testInterface4
+ ^ self assertParse: '
+public interface MyVisitor extends Visitor
+{
+ public void foo() {};
+}
+ '
+!
+
+testInterface5
+ ^ self assertParse: '
+public class MyVisitor implements Visitor
+{
+ public void foo() {};
+}
+ '
+!
+
+testInterface6
+ ^ self assertParse: '
+public class MyVisitor implements Visitor, Iterator<Foo>
+{
+ public void foo() {};
+}
+ '
+!
+
+testSubclass
+ ^ self assertParse: '
+public class MyVisitor extends Visitor
+{
+ public void foo() {};
+}
+ '
+!
+
+testSubclass2
+ ^ self assertParse: '
+public class MyVisitor extends ArrayList<Foo>
+{
+ public void foo() {};
+}
+ '
+! !
+
+!JavaParserTests methodsFor:'fields'!
+
+testClassWithFields
+ ^ self assertParse: '
+ public class Foo {
+ int i = 0;
+
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testClassWithFields2
+ ^ self assertParse: '
+ public class Foo {
+ int i = 0;
+ private Object[] o = new Array[3];
+
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testClassWithFields3
+ ^ self assertParse: '
+ public class Foo {
+ public static int i = 0;
+
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ private Object[] o = new Array[3];
+
+ public void fooMethod2()
+ {
+ int i = 0;
+ }
+
+ }
+ '
+!
+
+testClassWithFields4
+ ^ self assertParse: '
+ public class Foo {
+ private List<Foo> l = new ArrayList<Foo>();
+ }
+ '
+! !
+
+!JavaParserTests methodsFor:'methods'!
+
+testAbstractMethod
+ ^ self assertParse: '
+ public class Foo {
+
+ public abstract void fooMethod();
+ }
+ '
+!
+
+testAbstractMethod2
+ ^ self assertParse: '
+ public class Foo {
+
+ public abstract void fooMethod();
+ public abstract void fooMethod2();
+ }
+ '
+!
+
+testAbstractMethod3
+ ^ self assertParse: '
+ public class Foo {
+ int i = 0;
+ /** javadoc */
+ public abstract void fooMethod();
+ /* another javadoc */
+ public abstract void fooMethod2();
+
+ public void method() {int b = 3;}
+ }
+ '
+!
+
+testAnnotation
+ ^ self assertParse: '
+ public class Foo {
+ @Override
+ public void fooMethod() {};
+ }
+ '
+!
+
+testAnnotation2
+ ^ self assertParse: '
+ public class Foo {
+
+ public @Interface void fooMethod() {};
+ }
+ '
+!
+
+testAnnotation3
+ ^ self assertParse: '
+ public class Foo {
+ @Test
+ public @Interface void fooMethod() {};
+ }
+ '
+!
+
+testClassWithMethod
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testClassWithMethod10
+ ^ self assertParse: '
+ public class Foo {
+
+ public java.lang.Object fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod11
+ ^ self assertParse: '
+ public class Foo {
+
+ public java.util.Map<Foo, String> fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod12
+ ^ self assertParse: '
+ public class Foo {
+
+ public Constructor<?> getConstructors()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod13
+ ^ self assertParse: '
+ public class Foo {
+
+ public Constructor<?>[] getConstructors()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod14
+ ^ self assertParse: '
+ public class Foo {
+
+ public Constructor[] getConstructors()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod15
+ ^ self assertParse: '
+ public class Foo {
+
+ public Constructor<Foo>[] getConstructors()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod16
+ ^ self assertParse: '
+ public class Foo {
+ public <U> Class<? extends U> asSubclass(Class<U> clazz) {
+ if (clazz.isAssignableFrom(this))
+ return (Class<? extends U>) this;
+ else
+ throw new ClassCastException(this.toString());
+ }
+ }
+ '
+!
+
+testClassWithMethod2
+ ^ self assertParse: '
+ public class Foo {
+
+ public Object fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod3
+ ^ self assertParse: '
+ public class Foo {
+
+ public int fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod4
+ ^ self assertParse: '
+ public class Foo {
+
+ public byte fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod5
+ ^ self assertParse: '
+ public class Foo {
+
+ public boolean fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod6
+ ^ self assertParse: '
+ public class Foo {
+
+ public float fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod7
+ ^ self assertParse: '
+ public class Foo {
+
+ public double fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ }
+ }
+ '
+!
+
+testClassWithMethod8
+ ^ self assertParse: '
+ public class Foo {
+
+ public double fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testClassWithMethod9
+ ^ self assertParse: '
+ public class Foo {
+
+ public List<Foo> fooMethod()
+ {
+ int i = 0;
+ return new Object();
+ };
+ }
+ '
+!
+
+testConstructor
+ ^ self assertParse: '
+public class MyVisitor
+{
+ public Myvisitor() {
+ super();
+ }
+}
+ '
+!
+
+testConstructor2
+ ^ self assertParse: '
+public class MyVisitor
+{
+ /** this is constructor */
+ protected Myvisitor() {
+ super();
+ }
+}
+ '
+!
+
+testConstructor3
+ ^ self assertParse: '
+public class MyVisitor
+{
+ /** this is constructor */
+ Myvisitor() {
+ super();
+ }
+}
+ '
+!
+
+testConstructor4
+ ^ self assertParse: '
+public class MyVisitor
+{
+ /** this is constructor */
+ private Myvisitor() {
+ super();
+ }
+}
+ '
+!
+
+testFinalMethod
+ ^ self assertParse: '
+ public class Foo {
+
+ public final void fooMethod() {};
+ }
+ '
+!
+
+testFinalMethod2
+ ^ self assertParse: '
+ public class Foo {
+
+ static final void fooMethod() {};
+ }
+ '
+!
+
+testMethodWithArrayRetval
+ ^ self assertParse: '
+ public class Foo {
+
+ public Object[] fooMethod(Object[] o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithArrayRetval2
+ ^ self assertParse: '
+ public class Foo {
+
+ public int[] fooMethod(Object[] o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithComment
+ ^ self assertParse: '
+ public class Foo {
+ // Some comment
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+
+ "Modified: / 29-12-2010 / 20:29:01 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testMethodWithJavadoc
+ ^ self assertParse: '
+ public class Foo {
+ /**
+ * This is a javadoc, isnt it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithJavadoc2
+ ^ self assertParse: '
+ public class Foo {
+ /*
+ * This is not a javadoc, but it is before method, is it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithJavadoc3
+ ^ self assertParse: '
+ public class Foo {
+ /** constant with javadoc */
+ private static String MY_CONSTANT = "This is a constant";
+
+ /*
+ * This is not a javadoc, but it is before method, is it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithJavadoc4
+ ^ self assertParse: '
+ public class Foo {
+ /** constant with javadoc */
+ private static String MY_CONSTANT = "This is a constant";
+
+ /* random comment */
+
+ /**
+ * This is not a javadoc, but it is before method, is it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithJavadoc5
+ ^ self assertParse: '
+ public class Foo {
+ /** constant with javadoc */
+ private static String MY_CONSTANT = "This is a constant";
+
+ /* random comment */
+ int i = 0;
+ /* another random comment */
+
+ /**
+ * This is not a javadoc, but it is before method, is it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMethodWithJavadoc6
+ ^ self assertParse: '
+ public class Foo {
+ /**
+ * Multiple Javadoc per methods :)
+ */
+ /**
+ * This is not a javadoc, but it is before method, is it?
+ */
+ public void fooMethod()
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMultipleMethods
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i, Object o)
+ {
+ int i = 0;
+ }
+
+ public void fooMethod2(Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMultipleMethods2
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i, Object o)
+ {
+ int i = 0;
+ };
+
+ public void fooMethod2(Object o)
+ {
+ int i = 0;
+ }
+ }
+ '
+!
+
+testMultipleMethods3
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i, Object o)
+ {
+ int i = 0;
+ };
+
+ public void fooMethod2(Object o)
+ {
+ int i = 0;
+ };
+ }
+ '
+!
+
+testMultipleMethods4
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod(int i, Object o)
+ {
+ int i = 0;
+ };
+
+ int i = 9;
+
+ public void fooMethod2(Object o)
+ {
+ int i = 0;
+ };
+ }
+ '
+!
+
+testNativeMethod
+ ^ self assertParse: '
+ public class Foo {
+
+ public native void wait();
+ }
+ '
+!
+
+testNativeMethod2
+ ^ self assertParse: '
+ public class Foo {
+
+ public native void wait(long millis);
+ }
+ '
+!
+
+testNativeMethod3
+ ^ self assertParse: '
+ public class Foo {
+
+ private static native Object wait(long millis);
+ }
+ '
+!
+
+testSynchronizedMethod
+ ^ self assertParse: '
+ public class Foo {
+
+ public final synchronized void fooMethod() {};
+ }
+ '
+!
+
+testThrow
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod() throws MyException;
+ }
+ '
+!
+
+testThrow2
+ ^ self assertParse: '
+ public class Foo {
+
+ public void fooMethod() throws MyException, YourException;
+ }
+ '
+! !
+
+!JavaParserTests methodsFor:'realClasses'!
+
+testJavaLangClass6
+ | res time |
+ time := Time millisecondsToRun: [
+ res := self assertParse: '
+/*
+ * %W% %E%
+ *
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package java.lang;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.GenericDeclaration;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.ref.SoftReference;
+import java.io.InputStream;
+import java.io.ObjectStreamField;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import sun.misc.Unsafe;
+import sun.reflect.ConstantPool;
+import sun.reflect.Reflection;
+import sun.reflect.ReflectionFactory;
+import sun.reflect.SignatureIterator;
+import sun.reflect.generics.factory.CoreReflectionFactory;
+import sun.reflect.generics.factory.GenericsFactory;
+import sun.reflect.generics.repository.ClassRepository;
+import sun.reflect.generics.repository.MethodRepository;
+import sun.reflect.generics.repository.ConstructorRepository;
+import sun.reflect.generics.scope.ClassScope;
+import sun.security.util.SecurityConstants;
+import java.lang.annotation.Annotation;
+import sun.reflect.annotation.*;
+
+/**
+ * Instances of the class <code>Class</code> represent classes and
+ * interfaces in a running Java application. An enum is a kind of
+ * class and an annotation is a kind of interface. Every array also
+ * belongs to a class that is reflected as a <code>Class</code> object
+ * that is shared by all arrays with the same element type and number
+ * of dimensions. The primitive Java types (<code>boolean</code>,
+ * <code>byte</code>, <code>char</code>, <code>short</code>,
+ * <code>int</code>, <code>long</code>, <code>float</code>, and
+ * <code>double</code>), and the keyword <code>void</code> are also
+ * represented as <code>Class</code> objects.
+ *
+ * <p> <code>Class</code> has no public constructor. Instead <code>Class</code>
+ * objects are constructed automatically by the Java Virtual Machine as classes
+ * are loaded and by calls to the <code>defineClass</code> method in the class
+ * loader.
+ *
+ * <p> The following example uses a <code>Class</code> object to print the
+ * class name of an object:
+ *
+ * <p> <blockquote><pre>
+ * void printClassName(Object obj) {
+ * System.out.println("The class of " + obj +
+ * " is " + obj.getClass().getName());
+ * }
+ * </pre></blockquote>
+ *
+ * <p> It is also possible to get the <code>Class</code> object for a named
+ * type (or for void) using a class literal
+ * (JLS Section <A HREF="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530">15.8.2</A>).
+ * For example:
+ *
+ * <p> <blockquote><pre>
+ * System.out.println("The name of class Foo is: "+Foo.class.getName());
+ * </pre></blockquote>
+ *
+ * @param <T> the type of the class modeled by this {@code Class}
+ * object. For example, the type of {@code String.class} is {@code
+ * Class<String>}. Use {@code Class<?>} if the class being modeled is
+ * unknown.
+ *
+ * @author unascribed
+ * @version %I%, %G%
+ * @see java.lang.ClassLoader#defineClass(byte[], int, int)
+ * @since JDK1.0
+ */
+public final
+ class Class<T> implements java.io.Serializable,
+ java.lang.reflect.GenericDeclaration,
+ java.lang.reflect.Type,
+ java.lang.reflect.AnnotatedElement {
+ private static final int ANNOTATION= 0x00002000;
+ private static final int ENUM = 0x00004000;
+ private static final int SYNTHETIC = 0x00001000;
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ /*
+ * Constructor. Only the Java Virtual Machine creates Class
+ * objects.
+ */
+ private Class() {}
+
+
+ /**
+ * Converts the object to a string. The string representation is the
+ * string "class" or "interface", followed by a space, and then by the
+ * fully qualified name of the class in the format returned by
+ * <code>getName</code>. If this <code>Class</code> object represents a
+ * primitive type, this method returns the name of the primitive type. If
+ * this <code>Class</code> object represents void this method returns
+ * "void".
+ *
+ * @return a string representation of this class object.
+ */
+ public String toString() {
+ return (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
+ + getName();
+ }
+
+
+ /**
+ * Returns the <code>Class</code> object associated with the class or
+ * interface with the given string name. Invoking this method is
+ * equivalent to:
+ *
+ * <blockquote><pre>
+ * Class.forName(className, true, currentLoader)
+ * </pre></blockquote>
+ *
+ * where <code>currentLoader</code> denotes the defining class loader of
+ * the current class.
+ *
+ * <p> For example, the following code fragment returns the
+ * runtime <code>Class</code> descriptor for the class named
+ * <code>java.lang.Thread</code>:
+ *
+ * <blockquote><pre>
+ * Class t = Class.forName("java.lang.Thread")
+ * </pre></blockquote>
+ * <p>
+ * A call to <tt>forName("X")</tt> causes the class named
+ * <tt>X</tt> to be initialized.
+ *
+ * @param className the fully qualified name of the desired class.
+ * @return the <code>Class</code> object for the class with the
+ * specified name.
+ * @exception LinkageError if the linkage fails
+ * @exception ExceptionInInitializerError if the initialization provoked
+ * by this method fails
+ * @exception ClassNotFoundException if the class cannot be located
+ */
+ public static Class<?> forName(String className)
+ throws ClassNotFoundException {
+ return forName0(className, true, ClassLoader.getCallerClassLoader());
+ }
+
+
+ /**
+ * Returns the <code>Class</code> object associated with the class or
+ * interface with the given string name, using the given class loader.
+ * Given the fully qualified name for a class or interface (in the same
+ * format returned by <code>getName</code>) this method attempts to
+ * locate, load, and link the class or interface. The specified class
+ * loader is used to load the class or interface. If the parameter
+ * <code>loader</code> is null, the class is loaded through the bootstrap
+ * class loader. The class is initialized only if the
+ * <code>initialize</code> parameter is <code>true</code> and if it has
+ * not been initialized earlier.
+ *
+ * <p> If <code>name</code> denotes a primitive type or void, an attempt
+ * will be made to locate a user-defined class in the unnamed package whose
+ * name is <code>name</code>. Therefore, this method cannot be used to
+ * obtain any of the <code>Class</code> objects representing primitive
+ * types or void.
+ *
+ * <p> If <code>name</code> denotes an array class, the component type of
+ * the array class is loaded but not initialized.
+ *
+ * <p> For example, in an instance method the expression:
+ *
+ * <blockquote><pre>
+ * Class.forName("Foo")
+ * </pre></blockquote>
+ *
+ * is equivalent to:
+ *
+ * <blockquote><pre>
+ * Class.forName("Foo", true, this.getClass().getClassLoader())
+ * </pre></blockquote>
+ *
+ * Note that this method throws errors related to loading, linking or
+ * initializing as specified in Sections 12.2, 12.3 and 12.4 of <em>The
+ * Java Language Specification</em>.
+ * Note that this method does not check whether the requested class
+ * is accessible to its caller.
+ *
+ * <p> If the <code>loader</code> is <code>null</code>, and a security
+ * manager is present, and the caller''s class loader is not null, then this
+ * method calls the security manager''s <code>checkPermission</code> method
+ * with a <code>RuntimePermission("getClassLoader")</code> permission to
+ * ensure it''s ok to access the bootstrap class loader.
+ *
+ * @param name fully qualified name of the desired class
+ * @param initialize whether the class must be initialized
+ * @param loader class loader from which the class must be loaded
+ * @return class object representing the desired class
+ *
+ * @exception LinkageError if the linkage fails
+ * @exception ExceptionInInitializerError if the initialization provoked
+ * by this method fails
+ * @exception ClassNotFoundException if the class cannot be located by
+ * the specified class loader
+ *
+ * @see java.lang.Class#forName(String)
+ * @see java.lang.ClassLoader
+ * @since 1.2
+ */
+ public static Class<?> forName(String name, boolean initialize,
+ ClassLoader loader)
+ throws ClassNotFoundException
+ {
+ if (loader == null) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm !!= null) {
+ ClassLoader ccl = ClassLoader.getCallerClassLoader();
+ if (ccl !!= null) {
+ sm.checkPermission(
+ SecurityConstants.GET_CLASSLOADER_PERMISSION);
+ }
+ }
+ }
+ return forName0(name, initialize, loader);
+ }
+
+ /** Called after security checks have been made. */
+ private static native Class forName0(String name, boolean initialize,
+ ClassLoader loader)
+ throws ClassNotFoundException;
+
+ /**
+ * Creates a new instance of the class represented by this <tt>Class</tt>
+ * object. The class is instantiated as if by a <code>new</code>
+ * expression with an empty argument list. The class is initialized if it
+ * has not already been initialized.
+ *
+ * <p>Note that this method propagates any exception thrown by the
+ * nullary constructor, including a checked exception. Use of
+ * this method effectively bypasses the compile-time exception
+ * checking that would otherwise be performed by the compiler.
+ * The {@link
+ * java.lang.reflect.Constructor#newInstance(java.lang.Object...)
+ * Constructor.newInstance} method avoids this problem by wrapping
+ * any exception thrown by the constructor in a (checked) {@link
+ * java.lang.reflect.InvocationTargetException}.
+ *
+ * @return a newly allocated instance of the class represented by this
+ * object.
+ * @exception IllegalAccessException if the class or its nullary
+ * constructor is not accessible.
+ * @exception InstantiationException
+ * if this <code>Class</code> represents an abstract class,
+ * an interface, an array class, a primitive type, or void;
+ * or if the class has no nullary constructor;
+ * or if the instantiation fails for some other reason.
+ * @exception ExceptionInInitializerError if the initialization
+ * provoked by this method fails.
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * creation of new instances of this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ */
+ public T newInstance()
+ throws InstantiationException, IllegalAccessException
+ {
+ if (System.getSecurityManager() !!= null) {
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ }
+ return newInstance0();
+ }
+
+ private T newInstance0()
+ throws InstantiationException, IllegalAccessException
+ {
+ // NOTE: the following code may not be strictly correct under
+ // the current Java memory model.
+
+ // Constructor lookup
+ if (cachedConstructor == null) {
+ if (this == Class.class) {
+ throw new IllegalAccessException(
+ "Can not call newInstance() on the Class for java.lang.Class"
+ );
+ }
+ try {
+ Class[] empty = {};
+ final Constructor<T> c = getConstructor0(empty, Member.DECLARED);
+ // Disable accessibility checks on the constructor
+ // since we have to do the security check here anyway
+ // (the stack depth is wrong for the Constructor''s
+ // security check to work)
+ java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction() {
+ public Object run() {
+ c.setAccessible(true);
+ return null;
+ }
+ });
+ cachedConstructor = c;
+ } catch (NoSuchMethodException e) {
+ throw new InstantiationException(getName());
+ }
+ }
+ Constructor<T> tmpConstructor = cachedConstructor;
+ // Security check (same as in java.lang.reflect.Constructor)
+ int modifiers = tmpConstructor.getModifiers();
+ if (!!Reflection.quickCheckMemberAccess(this, modifiers)) {
+ Class caller = Reflection.getCallerClass(3);
+ if (newInstanceCallerCache !!= caller) {
+ Reflection.ensureMemberAccess(caller, this, null, modifiers);
+ newInstanceCallerCache = caller;
+ }
+ }
+ // Run constructor
+ try {
+ return tmpConstructor.newInstance((Object[])null);
+ } catch (InvocationTargetException e) {
+ Unsafe.getUnsafe().throwException(e.getTargetException());
+ // Not reached
+ return null;
+ }
+ }
+ private volatile transient Constructor<T> cachedConstructor;
+ private volatile transient Class newInstanceCallerCache;
+
+
+ /**
+ * Determines if the specified <code>Object</code> is assignment-compatible
+ * with the object represented by this <code>Class</code>. This method is
+ * the dynamic equivalent of the Java language <code>instanceof</code>
+ * operator. The method returns <code>true</code> if the specified
+ * <code>Object</code> argument is non-null and can be cast to the
+ * reference type represented by this <code>Class</code> object without
+ * raising a <code>ClassCastException.</code> It returns <code>false</code>
+ * otherwise.
+ *
+ * <p> Specifically, if this <code>Class</code> object represents a
+ * declared class, this method returns <code>true</code> if the specified
+ * <code>Object</code> argument is an instance of the represented class (or
+ * of any of its subclasses); it returns <code>false</code> otherwise. If
+ * this <code>Class</code> object represents an array class, this method
+ * returns <code>true</code> if the specified <code>Object</code> argument
+ * can be converted to an object of the array class by an identity
+ * conversion or by a widening reference conversion; it returns
+ * <code>false</code> otherwise. If this <code>Class</code> object
+ * represents an interface, this method returns <code>true</code> if the
+ * class or any superclass of the specified <code>Object</code> argument
+ * implements this interface; it returns <code>false</code> otherwise. If
+ * this <code>Class</code> object represents a primitive type, this method
+ * returns <code>false</code>.
+ *
+ * @param obj the object to check
+ * @return true if <code>obj</code> is an instance of this class
+ *
+ * @since JDK1.1
+ */
+ public native boolean isInstance(Object obj);
+
+
+ /**
+ * Determines if the class or interface represented by this
+ * <code>Class</code> object is either the same as, or is a superclass or
+ * superinterface of, the class or interface represented by the specified
+ * <code>Class</code> parameter. It returns <code>true</code> if so;
+ * otherwise it returns <code>false</code>. If this <code>Class</code>
+ * object represents a primitive type, this method returns
+ * <code>true</code> if the specified <code>Class</code> parameter is
+ * exactly this <code>Class</code> object; otherwise it returns
+ * <code>false</code>.
+ *
+ * <p> Specifically, this method tests whether the type represented by the
+ * specified <code>Class</code> parameter can be converted to the type
+ * represented by this <code>Class</code> object via an identity conversion
+ * or via a widening reference conversion. See <em>The Java Language
+ * Specification</em>, sections 5.1.1 and 5.1.4 , for details.
+ *
+ * @param cls the <code>Class</code> object to be checked
+ * @return the <code>boolean</code> value indicating whether objects of the
+ * type <code>cls</code> can be assigned to objects of this class
+ * @exception NullPointerException if the specified Class parameter is
+ * null.
+ * @since JDK1.1
+ */
+ public native boolean isAssignableFrom(Class<?> cls);
+
+
+ /**
+ * Determines if the specified <code>Class</code> object represents an
+ * interface type.
+ *
+ * @return <code>true</code> if this object represents an interface;
+ * <code>false</code> otherwise.
+ */
+ public native boolean isInterface();
+
+
+ /**
+ * Determines if this <code>Class</code> object represents an array class.
+ *
+ * @return <code>true</code> if this object represents an array class;
+ * <code>false</code> otherwise.
+ * @since JDK1.1
+ */
+ public native boolean isArray();
+
+
+ /**
+ * Determines if the specified <code>Class</code> object represents a
+ * primitive type.
+ *
+ * <p> There are nine predefined <code>Class</code> objects to represent
+ * the eight primitive types and void. These are created by the Java
+ * Virtual Machine, and have the same names as the primitive types that
+ * they represent, namely <code>boolean</code>, <code>byte</code>,
+ * <code>char</code>, <code>short</code>, <code>int</code>,
+ * <code>long</code>, <code>float</code>, and <code>double</code>.
+ *
+ * <p> These objects may only be accessed via the following public static
+ * final variables, and are the only <code>Class</code> objects for which
+ * this method returns <code>true</code>.
+ *
+ * @return true if and only if this class represents a primitive type
+ *
+ * @see java.lang.Boolean#TYPE
+ * @see java.lang.Character#TYPE
+ * @see java.lang.Byte#TYPE
+ * @see java.lang.Short#TYPE
+ * @see java.lang.Integer#TYPE
+ * @see java.lang.Long#TYPE
+ * @see java.lang.Float#TYPE
+ * @see java.lang.Double#TYPE
+ * @see java.lang.Void#TYPE
+ * @since JDK1.1
+ */
+ public native boolean isPrimitive();
+
+ /**
+ * Returns true if this <tt>Class</tt> object represents an annotation
+ * type. Note that if this method returns true, {@link #isInterface()}
+ * would also return true, as all annotation types are also interfaces.
+ *
+ * @return <tt>true</tt> if this class object represents an annotation
+ * type; <tt>false</tt> otherwise
+ * @since 1.5
+ */
+ public boolean isAnnotation() {
+ return (getModifiers() & ANNOTATION) !!= 0;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this class is a synthetic class;
+ * returns <tt>false</tt> otherwise.
+ * @return <tt>true</tt> if and only if this class is a synthetic class as
+ * defined by the Java Language Specification.
+ * @since 1.5
+ */
+ public boolean isSynthetic() {
+ return (getModifiers() & SYNTHETIC) !!= 0;
+ }
+
+ /**
+ * Returns the name of the entity (class, interface, array class,
+ * primitive type, or void) represented by this <tt>Class</tt> object,
+ * as a <tt>String</tt>.
+ *
+ * <p> If this class object represents a reference type that is not an
+ * array type then the binary name of the class is returned, as specified
+ * by the Java Language Specification, Second Edition.
+ *
+ * <p> If this class object represents a primitive type or void, then the
+ * name returned is a <tt>String</tt> equal to the Java language
+ * keyword corresponding to the primitive type or void.
+ *
+ * <p> If this class object represents a class of arrays, then the internal
+ * form of the name consists of the name of the element type preceded by
+ * one or more ''<tt>[</tt>'' characters representing the depth of the array
+ * nesting. The encoding of element type names is as follows:
+ *
+ * <blockquote><table summary="Element types and encodings">
+ * <tr><th> Element Type <th> <th> Encoding
+ * <tr><td> boolean <td> <td align=center> Z
+ * <tr><td> byte <td> <td align=center> B
+ * <tr><td> char <td> <td align=center> C
+ * <tr><td> class or interface
+ * <td> <td align=center> L<i>classname</i>;
+ * <tr><td> double <td> <td align=center> D
+ * <tr><td> float <td> <td align=center> F
+ * <tr><td> int <td> <td align=center> I
+ * <tr><td> long <td> <td align=center> J
+ * <tr><td> short <td> <td align=center> S
+ * </table></blockquote>
+ *
+ * <p> The class or interface name <i>classname</i> is the binary name of
+ * the class specified above.
+ *
+ * <p> Examples:
+ * <blockquote><pre>
+ * String.class.getName()
+ * returns "java.lang.String"
+ * byte.class.getName()
+ * returns "byte"
+ * (new Object[3]).getClass().getName()
+ * returns "[Ljava.lang.Object;"
+ * (new int[3][4][5][6][7][8][9]).getClass().getName()
+ * returns "[[[[[[[I"
+ * </pre></blockquote>
+ *
+ * @return the name of the class or interface
+ * represented by this object.
+ */
+ public String getName() {
+ if (name == null)
+ name = getName0();
+ return name;
+ }
+
+ // cache the name to reduce the number of calls into the VM
+ private transient String name;
+ private native String getName0();
+
+ /**
+ * Returns the class loader for the class. Some implementations may use
+ * null to represent the bootstrap class loader. This method will return
+ * null in such implementations if this class was loaded by the bootstrap
+ * class loader.
+ *
+ * <p> If a security manager is present, and the caller''s class loader is
+ * not null and the caller''s class loader is not the same as or an ancestor of
+ * the class loader for the class whose class loader is requested, then
+ * this method calls the security manager''s <code>checkPermission</code>
+ * method with a <code>RuntimePermission("getClassLoader")</code>
+ * permission to ensure it''s ok to access the class loader for the class.
+ *
+ * <p>If this object
+ * represents a primitive type or void, null is returned.
+ *
+ * @return the class loader that loaded the class or interface
+ * represented by this object.
+ * @throws SecurityException
+ * if a security manager exists and its
+ * <code>checkPermission</code> method denies
+ * access to the class loader for the class.
+ * @see java.lang.ClassLoader
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ */
+ public ClassLoader getClassLoader() {
+ ClassLoader cl = getClassLoader0();
+ if (cl == null)
+ return null;
+ SecurityManager sm = System.getSecurityManager();
+ if (sm !!= null) {
+ ClassLoader ccl = ClassLoader.getCallerClassLoader();
+ if (ccl !!= null && ccl !!= cl && !!cl.isAncestor(ccl)) {
+ sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
+ }
+ }
+ return cl;
+ }
+
+ // Package-private to allow ClassLoader access
+ native ClassLoader getClassLoader0();
+
+
+ /**
+ * Returns an array of <tt>TypeVariable</tt> objects that represent the
+ * type variables declared by the generic declaration represented by this
+ * <tt>GenericDeclaration</tt> object, in declaration order. Returns an
+ * array of length 0 if the underlying generic declaration declares no type
+ * variables.
+ *
+ * @return an array of <tt>TypeVariable</tt> objects that represent
+ * the type variables declared by this generic declaration
+ * @throws GenericSignatureFormatError if the generic
+ * signature of this generic declaration does not conform to
+ * the format specified in the Java Virtual Machine Specification,
+ * 3rd edition
+ * @since 1.5
+ */
+ public TypeVariable<Class<T>>[] getTypeParameters() {
+ if (getGenericSignature() !!= null)
+ return (TypeVariable<Class<T>>[])getGenericInfo().getTypeParameters();
+ else
+ return (TypeVariable<Class<T>>[])new TypeVariable[0];
+ }
+
+
+ /**
+ * Returns the <code>Class</code> representing the superclass of the entity
+ * (class, interface, primitive type or void) represented by this
+ * <code>Class</code>. If this <code>Class</code> represents either the
+ * <code>Object</code> class, an interface, a primitive type, or void, then
+ * null is returned. If this object represents an array class then the
+ * <code>Class</code> object representing the <code>Object</code> class is
+ * returned.
+ *
+ * @return the superclass of the class represented by this object.
+ */
+ public native Class<? super T> getSuperclass();
+
+
+ /**
+ * Returns the <tt>Type</tt> representing the direct superclass of
+ * the entity (class, interface, primitive type or void) represented by
+ * this <tt>Class</tt>.
+ *
+ * <p>If the superclass is a parameterized type, the <tt>Type</tt>
+ * object returned must accurately reflect the actual type
+ * parameters used in the source code. The parameterized type
+ * representing the superclass is created if it had not been
+ * created before. See the declaration of {@link
+ * java.lang.reflect.ParameterizedType ParameterizedType} for the
+ * semantics of the creation process for parameterized types. If
+ * this <tt>Class</tt> represents either the <tt>Object</tt>
+ * class, an interface, a primitive type, or void, then null is
+ * returned. If this object represents an array class then the
+ * <tt>Class</tt> object representing the <tt>Object</tt> class is
+ * returned.
+ *
+ * @throws GenericSignatureFormatError if the generic
+ * class signature does not conform to the format specified in the
+ * Java Virtual Machine Specification, 3rd edition
+ * @throws TypeNotPresentException if the generic superclass
+ * refers to a non-existent type declaration
+ * @throws MalformedParameterizedTypeException if the
+ * generic superclass refers to a parameterized type that cannot be
+ * instantiated for any reason
+ * @return the superclass of the class represented by this object
+ * @since 1.5
+ */
+ public Type getGenericSuperclass() {
+ if (getGenericSignature() !!= null) {
+ // Historical irregularity:
+ // Generic signature marks interfaces with superclass = Object
+ // but this API returns null for interfaces
+ if (isInterface())
+ return null;
+ return getGenericInfo().getSuperclass();
+ } else
+ return getSuperclass();
+ }
+
+ /**
+ * Gets the package for this class. The class loader of this class is used
+ * to find the package. If the class was loaded by the bootstrap class
+ * loader the set of packages loaded from CLASSPATH is searched to find the
+ * package of the class. Null is returned if no package object was created
+ * by the class loader of this class.
+ *
+ * <p> Packages have attributes for versions and specifications only if the
+ * information was defined in the manifests that accompany the classes, and
+ * if the class loader created the package instance with the attributes
+ * from the manifest.
+ *
+ * @return the package of the class, or null if no package
+ * information is available from the archive or codebase.
+ */
+ public Package getPackage() {
+ return Package.getPackage(this);
+ }
+
+
+ /**
+ * Determines the interfaces implemented by the class or interface
+ * represented by this object.
+ *
+ * <p> If this object represents a class, the return value is an array
+ * containing objects representing all interfaces implemented by the
+ * class. The order of the interface objects in the array corresponds to
+ * the order of the interface names in the <code>implements</code> clause
+ * of the declaration of the class represented by this object. For
+ * example, given the declaration:
+ * <blockquote><pre>
+ * class Shimmer implements FloorWax, DessertTopping { ... }
+ * </pre></blockquote>
+ * suppose the value of <code>s</code> is an instance of
+ * <code>Shimmer</code>; the value of the expression:
+ * <blockquote><pre>
+ * s.getClass().getInterfaces()[0]
+ * </pre></blockquote>
+ * is the <code>Class</code> object that represents interface
+ * <code>FloorWax</code>; and the value of:
+ * <blockquote><pre>
+ * s.getClass().getInterfaces()[1]
+ * </pre></blockquote>
+ * is the <code>Class</code> object that represents interface
+ * <code>DessertTopping</code>.
+ *
+ * <p> If this object represents an interface, the array contains objects
+ * representing all interfaces extended by the interface. The order of the
+ * interface objects in the array corresponds to the order of the interface
+ * names in the <code>extends</code> clause of the declaration of the
+ * interface represented by this object.
+ *
+ * <p> If this object represents a class or interface that implements no
+ * interfaces, the method returns an array of length 0.
+ *
+ * <p> If this object represents a primitive type or void, the method
+ * returns an array of length 0.
+ *
+ * @return an array of interfaces implemented by this class.
+ */
+ public native Class<?>[] getInterfaces();
+
+ /**
+ * Returns the <tt>Type</tt>s representing the interfaces
+ * directly implemented by the class or interface represented by
+ * this object.
+ *
+ * <p>If a superinterface is a parameterized type, the
+ * <tt>Type</tt> object returned for it must accurately reflect
+ * the actual type parameters used in the source code. The
+ * parameterized type representing each superinterface is created
+ * if it had not been created before. See the declaration of
+ * {@link java.lang.reflect.ParameterizedType ParameterizedType}
+ * for the semantics of the creation process for parameterized
+ * types.
+ *
+ * <p> If this object represents a class, the return value is an
+ * array containing objects representing all interfaces
+ * implemented by the class. The order of the interface objects in
+ * the array corresponds to the order of the interface names in
+ * the <tt>implements</tt> clause of the declaration of the class
+ * represented by this object. In the case of an array class, the
+ * interfaces <tt>Cloneable</tt> and <tt>Serializable</tt> are
+ * returned in that order.
+ *
+ * <p>If this object represents an interface, the array contains
+ * objects representing all interfaces directly extended by the
+ * interface. The order of the interface objects in the array
+ * corresponds to the order of the interface names in the
+ * <tt>extends</tt> clause of the declaration of the interface
+ * represented by this object.
+ *
+ * <p>If this object represents a class or interface that
+ * implements no interfaces, the method returns an array of length
+ * 0.
+ *
+ * <p>If this object represents a primitive type or void, the
+ * method returns an array of length 0.
+ *
+ * @throws GenericSignatureFormatError
+ * if the generic class signature does not conform to the format
+ * specified in the Java Virtual Machine Specification, 3rd edition
+ * @throws TypeNotPresentException if any of the generic
+ * superinterfaces refers to a non-existent type declaration
+ * @throws MalformedParameterizedTypeException if any of the
+ * generic superinterfaces refer to a parameterized type that cannot
+ * be instantiated for any reason
+ * @return an array of interfaces implemented by this class
+ * @since 1.5
+ */
+ public Type[] getGenericInterfaces() {
+ if (getGenericSignature() !!= null)
+ return getGenericInfo().getSuperInterfaces();
+ else
+ return getInterfaces();
+ }
+
+
+ /**
+ * Returns the <code>Class</code> representing the component type of an
+ * array. If this class does not represent an array class this method
+ * returns null.
+ *
+ * @return the <code>Class</code> representing the component type of this
+ * class if this class is an array
+ * @see java.lang.reflect.Array
+ * @since JDK1.1
+ */
+ public native Class<?> getComponentType();
+
+
+ /**
+ * Returns the Java language modifiers for this class or interface, encoded
+ * in an integer. The modifiers consist of the Java Virtual Machine''s
+ * constants for <code>public</code>, <code>protected</code>,
+ * <code>private</code>, <code>final</code>, <code>static</code>,
+ * <code>abstract</code> and <code>interface</code>; they should be decoded
+ * using the methods of class <code>Modifier</code>.
+ *
+ * <p> If the underlying class is an array class, then its
+ * <code>public</code>, <code>private</code> and <code>protected</code>
+ * modifiers are the same as those of its component type. If this
+ * <code>Class</code> represents a primitive type or void, its
+ * <code>public</code> modifier is always <code>true</code>, and its
+ * <code>protected</code> and <code>private</code> modifiers are always
+ * <code>false</code>. If this object represents an array class, a
+ * primitive type or void, then its <code>final</code> modifier is always
+ * <code>true</code> and its interface modifier is always
+ * <code>false</code>. The values of its other modifiers are not determined
+ * by this specification.
+ *
+ * <p> The modifier encodings are defined in <em>The Java Virtual Machine
+ * Specification</em>, table 4.1.
+ *
+ * @return the <code>int</code> representing the modifiers for this class
+ * @see java.lang.reflect.Modifier
+ * @since JDK1.1
+ */
+ public native int getModifiers();
+
+
+ /**
+ * Gets the signers of this class.
+ *
+ * @return the signers of this class, or null if there are no signers. In
+ * particular, this method returns null if this object represents
+ * a primitive type or void.
+ * @since JDK1.1
+ */
+ public native Object[] getSigners();
+
+
+ /**
+ * Set the signers of this class.
+ */
+ native void setSigners(Object[] signers);
+
+
+ /**
+ * If this <tt>Class</tt> object represents a local or anonymous
+ * class within a method, returns a {@link
+ * java.lang.reflect.Method Method} object representing the
+ * immediately enclosing method of the underlying class. Returns
+ * <tt>null</tt> otherwise.
+ *
+ * In particular, this method returns <tt>null</tt> if the underlying
+ * class is a local or anonymous class immediately enclosed by a type
+ * declaration, instance initializer or static initializer.
+ *
+ * @return the immediately enclosing method of the underlying class, if
+ * that class is a local or anonymous class; otherwise <tt>null</tt>.
+ * @since 1.5
+ */
+ public Method getEnclosingMethod() {
+ EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo();
+
+ if (enclosingInfo == null)
+ return null;
+ else {
+ if (!!enclosingInfo.isMethod())
+ return null;
+
+ MethodRepository typeInfo = MethodRepository.make(enclosingInfo.getDescriptor(),
+ getFactory());
+ Class returnType = toClass(typeInfo.getReturnType());
+ Type [] parameterTypes = typeInfo.getParameterTypes();
+ Class<?>[] parameterClasses = new Class<?>[parameterTypes.length];
+
+ // Convert Types to Classes; returned types *should*
+ // be class objects since the methodDescriptor''s used
+ // don''t have generics information
+ for(int i = 0; i < parameterClasses.length; i++)
+ parameterClasses[i] = toClass(parameterTypes[i]);
+
+ /*
+ * Loop over all declared methods; match method name,
+ * number of and type of parameters, *and* return
+ * type. Matching return type is also necessary
+ * because of covariant returns, etc.
+ */
+ for(Method m: enclosingInfo.getEnclosingClass().getDeclaredMethods()) {
+ if (m.getName().equals(enclosingInfo.getName()) ) {
+ Class<?>[] candidateParamClasses = m.getParameterTypes();
+ if (candidateParamClasses.length == parameterClasses.length) {
+ boolean matches = true;
+ for(int i = 0; i < candidateParamClasses.length; i++) {
+ if (!!candidateParamClasses[i].equals(parameterClasses[i])) {
+ matches = false;
+ break;
+ }
+ }
+
+ if (matches) { // finally, check return type
+ if (m.getReturnType().equals(returnType) )
+ return m;
+ }
+ }
+ }
+ }
+
+ throw new InternalError("Enclosing method not found");
+ }
+ }
+
+ private native Object[] getEnclosingMethod0();
+
+ private EnclosingMethodInfo getEnclosingMethodInfo() {
+ Object[] enclosingInfo = getEnclosingMethod0();
+ if (enclosingInfo == null)
+ return null;
+ else {
+ return new EnclosingMethodInfo(enclosingInfo);
+ }
+ }
+
+ private final static class EnclosingMethodInfo {
+ private Class<?> enclosingClass;
+ private String name;
+ private String descriptor;
+
+ private EnclosingMethodInfo(Object[] enclosingInfo) {
+ if (enclosingInfo.length !!= 3)
+ throw new InternalError("Malformed enclosing method information");
+ try {
+ // The array is expected to have three elements:
+
+ // the immediately enclosing class
+ enclosingClass = (Class<?>) enclosingInfo[0];
+ assert(enclosingClass !!= null);
+
+ // the immediately enclosing method or constructor''s
+ // name (can be null).
+ name = (String) enclosingInfo[1];
+
+ // the immediately enclosing method or constructor''s
+ // descriptor (null iff name is).
+ descriptor = (String) enclosingInfo[2];
+ assert((name !!= null && descriptor !!= null) || name == descriptor);
+ } catch (ClassCastException cce) {
+ throw new InternalError("Invalid type in enclosing method information");
+ }
+ }
+
+ boolean isPartial() {
+ return enclosingClass == null || name == null || descriptor == null;
+ }
+
+ boolean isConstructor() { return !!isPartial() && "<init>".equals(name); }
+
+ boolean isMethod() { return !!isPartial() && !!isConstructor() && !!"<clinit>".equals(name); }
+
+ Class<?> getEnclosingClass() { return enclosingClass; }
+
+ String getName() { return name; }
+
+ String getDescriptor() { return descriptor; }
+
+ }
+
+ private static Class toClass(Type o) {
+ if (o instanceof GenericArrayType)
+ return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
+ 0)
+ .getClass();
+ return (Class)o;
+ }
+
+ /**
+ * If this <tt>Class</tt> object represents a local or anonymous
+ * class within a constructor, returns a {@link
+ * java.lang.reflect.Constructor Constructor} object representing
+ * the immediately enclosing constructor of the underlying
+ * class. Returns <tt>null</tt> otherwise. In particular, this
+ * method returns <tt>null</tt> if the underlying class is a local
+ * or anonymous class immediately enclosed by a type declaration,
+ * instance initializer or static initializer.
+ *
+ * @return the immediately enclosing constructor of the underlying class, if
+ * that class is a local or anonymous class; otherwise <tt>null</tt>.
+ * @since 1.5
+ */
+ public Constructor<?> getEnclosingConstructor() {
+ EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo();
+
+ if (enclosingInfo == null)
+ return null;
+ else {
+ if (!!enclosingInfo.isConstructor())
+ return null;
+
+ ConstructorRepository typeInfo = ConstructorRepository.make(enclosingInfo.getDescriptor(),
+ getFactory());
+ Type [] parameterTypes = typeInfo.getParameterTypes();
+ Class<?>[] parameterClasses = new Class<?>[parameterTypes.length];
+
+ // Convert Types to Classes; returned types *should*
+ // be class objects since the methodDescriptor''s used
+ // don''t have generics information
+ for(int i = 0; i < parameterClasses.length; i++)
+ parameterClasses[i] = toClass(parameterTypes[i]);
+
+ /*
+ * Loop over all declared constructors; match number
+ * of and type of parameters.
+ */
+ for(Constructor c: enclosingInfo.getEnclosingClass().getDeclaredConstructors()) {
+ Class<?>[] candidateParamClasses = c.getParameterTypes();
+ if (candidateParamClasses.length == parameterClasses.length) {
+ boolean matches = true;
+ for(int i = 0; i < candidateParamClasses.length; i++) {
+ if (!!candidateParamClasses[i].equals(parameterClasses[i])) {
+ matches = false;
+ break;
+ }
+ }
+
+ if (matches)
+ return c;
+ }
+ }
+
+ throw new InternalError("Enclosing constructor not found");
+ }
+ }
+
+
+ /**
+ * If the class or interface represented by this <code>Class</code> object
+ * is a member of another class, returns the <code>Class</code> object
+ * representing the class in which it was declared. This method returns
+ * null if this class or interface is not a member of any other class. If
+ * this <code>Class</code> object represents an array class, a primitive
+ * type, or void,then this method returns null.
+ *
+ * @return the declaring class for this class
+ * @since JDK1.1
+ */
+ public native Class<?> getDeclaringClass();
+
+
+ /**
+ * Returns the immediately enclosing class of the underlying
+ * class. If the underlying class is a top level class this
+ * method returns <tt>null</tt>.
+ * @return the immediately enclosing class of the underlying class
+ * @since 1.5
+ */
+ public Class<?> getEnclosingClass() {
+ // There are five kinds of classes (or interfaces):
+ // a) Top level classes
+ // b) Nested classes (static member classes)
+ // c) Inner classes (non-static member classes)
+ // d) Local classes (named classes declared within a method)
+ // e) Anonymous classes
+
+
+ // JVM Spec 4.8.6: A class must have an EnclosingMethod
+ // attribute if and only if it is a local class or an
+ // anonymous class.
+ EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo();
+
+ if (enclosingInfo == null) {
+ // This is a top level or a nested class or an inner class (a, b, or c)
+ return getDeclaringClass();
+ } else {
+ Class<?> enclosingClass = enclosingInfo.getEnclosingClass();
+ // This is a local class or an anonymous class (d or e)
+ if (enclosingClass == this || enclosingClass == null)
+ throw new InternalError("Malformed enclosing method information");
+ else
+ return enclosingClass;
+ }
+ }
+
+ /**
+ * Returns the simple name of the underlying class as given in the
+ * source code. Returns an empty string if the underlying class is
+ * anonymous.
+ *
+ * <p>The simple name of an array is the simple name of the
+ * component type with "[]" appended. In particular the simple
+ * name of an array whose component type is anonymous is "[]".
+ *
+ * @return the simple name of the underlying class
+ * @since 1.5
+ */
+ public String getSimpleName() {
+ if (isArray())
+ return getComponentType().getSimpleName()+"[]";
+
+ String simpleName = getSimpleBinaryName();
+ if (simpleName == null) { // top level class
+ simpleName = getName();
+ return simpleName.substring(simpleName.lastIndexOf(".")+1); // strip the package name
+ }
+ // According to JLS3 "Binary Compatibility" (13.1) the binary
+ // name of non-package classes (not top level) is the binary
+ // name of the immediately enclosing class followed by a ''$'' followed by:
+ // (for nested and inner classes): the simple name.
+ // (for local classes): 1 or more digits followed by the simple name.
+ // (for anonymous classes): 1 or more digits.
+
+ // Since getSimpleBinaryName() will strip the binary name of
+ // the immediatly enclosing class, we are now looking at a
+ // string that matches the regular expression "\$[0-9]*"
+ // followed by a simple name (considering the simple of an
+ // anonymous class to be the empty string).
+
+ // Remove leading "\$[0-9]*" from the name
+ int length = simpleName.length();
+ if (length < 1 || simpleName.charAt(0) !!= ''$'')
+ throw new InternalError("Malformed class name");
+ int index = 1;
+ while (index < length && isAsciiDigit(simpleName.charAt(index)))
+ index++;
+ // Eventually, this is the empty string iff this is an anonymous class
+ return simpleName.substring(index);
+ }
+
+ /**
+ * Character.isDigit answers <tt>true</tt> to some non-ascii
+ * digits. This one does not.
+ */
+ private static boolean isAsciiDigit(char c) {
+ return ''0'' <= c && c <= ''9'';
+ }
+
+ /**
+ * Returns the canonical name of the underlying class as
+ * defined by the Java Language Specification. Returns null if
+ * the underlying class does not have a canonical name (i.e., if
+ * it is a local or anonymous class or an array whose component
+ * type does not have a canonical name).
+ * @return the canonical name of the underlying class if it exists, and
+ * <tt>null</tt> otherwise.
+ * @since 1.5
+ */
+ public String getCanonicalName() {
+ if (isArray()) {
+ String canonicalName = getComponentType().getCanonicalName();
+ if (canonicalName !!= null)
+ return canonicalName + "[]";
+ else
+ return null;
+ }
+ if (isLocalOrAnonymousClass())
+ return null;
+ Class<?> enclosingClass = getEnclosingClass();
+ if (enclosingClass == null) { // top level class
+ return getName();
+ } else {
+ String enclosingName = enclosingClass.getCanonicalName();
+ if (enclosingName == null)
+ return null;
+ return enclosingName + "." + getSimpleName();
+ }
+ }
+
+ /**
+ * Returns <tt>true</tt> if and only if the underlying class
+ * is an anonymous class.
+ *
+ * @return <tt>true</tt> if and only if this class is an anonymous class.
+ * @since 1.5
+ */
+ public boolean isAnonymousClass() {
+ return "".equals(getSimpleName());
+ }
+
+ /**
+ * Returns <tt>true</tt> if and only if the underlying class
+ * is a local class.
+ *
+ * @return <tt>true</tt> if and only if this class is a local class.
+ * @since 1.5
+ */
+ public boolean isLocalClass() {
+ return isLocalOrAnonymousClass() && !!isAnonymousClass();
+ }
+
+ /**
+ * Returns <tt>true</tt> if and only if the underlying class
+ * is a member class.
+ *
+ * @return <tt>true</tt> if and only if this class is a member class.
+ * @since 1.5
+ */
+ public boolean isMemberClass() {
+ return getSimpleBinaryName() !!= null && !!isLocalOrAnonymousClass();
+ }
+
+ /**
+ * Returns the "simple binary name" of the underlying class, i.e.,
+ * the binary name without the leading enclosing class name.
+ * Returns <tt>null</tt> if the underlying class is a top level
+ * class.
+ */
+ private String getSimpleBinaryName() {
+ Class<?> enclosingClass = getEnclosingClass();
+ if (enclosingClass == null) // top level class
+ return null;
+ // Otherwise, strip the enclosing class'' name
+ try {
+ return getName().substring(enclosingClass.getName().length());
+ } catch (IndexOutOfBoundsException ex) {
+ throw new InternalError("Malformed class name");
+ }
+ }
+
+ /**
+ * Returns <tt>true</tt> if this is a local class or an anonymous
+ * class. Returns <tt>false</tt> otherwise.
+ */
+ private boolean isLocalOrAnonymousClass() {
+ // JVM Spec 4.8.6: A class must have an EnclosingMethod
+ // attribute if and only if it is a local class or an
+ // anonymous class.
+ return getEnclosingMethodInfo() !!= null;
+ }
+
+ /**
+ * Returns an array containing <code>Class</code> objects representing all
+ * the public classes and interfaces that are members of the class
+ * represented by this <code>Class</code> object. This includes public
+ * class and interface members inherited from superclasses and public class
+ * and interface members declared by the class. This method returns an
+ * array of length 0 if this <code>Class</code> object has no public member
+ * classes or interfaces. This method also returns an array of length 0 if
+ * this <code>Class</code> object represents a primitive type, an array
+ * class, or void.
+ *
+ * @return the array of <code>Class</code> objects representing the public
+ * members of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> method
+ * denies access to the classes within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Class<?>[] getClasses() {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+
+ // Privileged so this implementation can look at DECLARED classes,
+ // something the caller might not have privilege to do. The code here
+ // is allowed to look at DECLARED classes because (1) it does not hand
+ // out anything other than public members and (2) public member access
+ // has already been ok''d by the SecurityManager.
+
+ Class[] result = (Class[]) java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction() {
+ public Object run() {
+ java.util.List<Class> list = new java.util.ArrayList();
+ Class currentClass = Class.this;
+ while (currentClass !!= null) {
+ Class[] members = currentClass.getDeclaredClasses();
+ for (int i = 0; i < members.length; i++) {
+ if (Modifier.isPublic(members[i].getModifiers())) {
+ list.add(members[i]);
+ }
+ }
+ currentClass = currentClass.getSuperclass();
+ }
+ Class[] empty = {};
+ return list.toArray(empty);
+ }
+ });
+
+ return result;
+ }
+
+
+ /**
+ * Returns an array containing <code>Field</code> objects reflecting all
+ * the accessible public fields of the class or interface represented by
+ * this <code>Class</code> object. The elements in the array returned are
+ * not sorted and are not in any particular order. This method returns an
+ * array of length 0 if the class or interface has no accessible public
+ * fields, or if it represents an array class, a primitive type, or void.
+ *
+ * <p> Specifically, if this <code>Class</code> object represents a class,
+ * this method returns the public fields of this class and of all its
+ * superclasses. If this <code>Class</code> object represents an
+ * interface, this method returns the fields of this interface and of all
+ * its superinterfaces.
+ *
+ * <p> The implicit length field for array class is not reflected by this
+ * method. User code should use the methods of class <code>Array</code> to
+ * manipulate arrays.
+ *
+ * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
+ *
+ * @return the array of <code>Field</code> objects representing the
+ * public fields
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the fields within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Field[] getFields() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ return copyFields(privateGetPublicFields(null));
+ }
+
+
+ /**
+ * Returns an array containing <code>Method</code> objects reflecting all
+ * the public <em>member</em> methods of the class or interface represented
+ * by this <code>Class</code> object, including those declared by the class
+ * or interface and those inherited from superclasses and
+ * superinterfaces. Array classes return all the (public) member methods
+ * inherited from the <code>Object</code> class. The elements in the array
+ * returned are not sorted and are not in any particular order. This
+ * method returns an array of length 0 if this <code>Class</code> object
+ * represents a class or interface that has no public member methods, or if
+ * this <code>Class</code> object represents a primitive type or void.
+ *
+ * <p> The class initialization method <code><clinit></code> is not
+ * included in the returned array. If the class declares multiple public
+ * member methods with the same parameter types, they are all included in
+ * the returned array.
+ *
+ * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
+ *
+ * @return the array of <code>Method</code> objects representing the
+ * public methods of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the methods within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Method[] getMethods() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ return copyMethods(privateGetPublicMethods());
+ }
+
+
+ /**
+ * Returns an array containing <code>Constructor</code> objects reflecting
+ * all the public constructors of the class represented by this
+ * <code>Class</code> object. An array of length 0 is returned if the
+ * class has no public constructors, or if the class is an array class, or
+ * if the class reflects a primitive type or void.
+ *
+ * Note that while this method returns an array of {@code
+ * Constructor<T>} objects (that is an array of constructors from
+ * this class), the return type of this method is {@code
+ * Constructor<?>[]} and <em>not</em> {@code Constructor<T>[]} as
+ * might be expected. This less informative return type is
+ * necessary since after being returned from this method, the
+ * array could be modified to hold {@code Constructor} objects for
+ * different classes, which would violate the type guarantees of
+ * {@code Constructor<T>[]}.
+ *
+ * @return the array of <code>Constructor</code> objects representing the
+ * public constructors of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the constructors within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Constructor<?>[] getConstructors() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ return copyConstructors(privateGetDeclaredConstructors(true));
+ }
+
+
+ /**
+ * Returns a <code>Field</code> object that reflects the specified public
+ * member field of the class or interface represented by this
+ * <code>Class</code> object. The <code>name</code> parameter is a
+ * <code>String</code> specifying the simple name of the desired field.
+ *
+ * <p> The field to be reflected is determined by the algorithm that
+ * follows. Let C be the class represented by this object:
+ * <OL>
+ * <LI> If C declares a public field with the name specified, that is the
+ * field to be reflected.</LI>
+ * <LI> If no field was found in step 1 above, this algorithm is applied
+ * recursively to each direct superinterface of C. The direct
+ * superinterfaces are searched in the order they were declared.</LI>
+ * <LI> If no field was found in steps 1 and 2 above, and C has a
+ * superclass S, then this algorithm is invoked recursively upon S.
+ * If C has no superclass, then a <code>NoSuchFieldException</code>
+ * is thrown.</LI>
+ * </OL>
+ *
+ * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
+ *
+ * @param name the field name
+ * @return the <code>Field</code> object of this class specified by
+ * <code>name</code>
+ * @exception NoSuchFieldException if a field with the specified name is
+ * not found.
+ * @exception NullPointerException if <code>name</code> is <code>null</code>
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the field
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Field getField(String name)
+ throws NoSuchFieldException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ Field field = getField0(name);
+ if (field == null) {
+ throw new NoSuchFieldException(name);
+ }
+ return field;
+ }
+
+
+ /**
+ * Returns a <code>Method</code> object that reflects the specified public
+ * member method of the class or interface represented by this
+ * <code>Class</code> object. The <code>name</code> parameter is a
+ * <code>String</code> specifying the simple name of the desired method. The
+ * <code>parameterTypes</code> parameter is an array of <code>Class</code>
+ * objects that identify the method''s formal parameter types, in declared
+ * order. If <code>parameterTypes</code> is <code>null</code>, it is
+ * treated as if it were an empty array.
+ *
+ * <p> If the <code>name</code> is "{@code <init>};"or "{@code <clinit>}" a
+ * <code>NoSuchMethodException</code> is raised. Otherwise, the method to
+ * be reflected is determined by the algorithm that follows. Let C be the
+ * class represented by this object:
+ * <OL>
+ * <LI> C is searched for any <I>matching methods</I>. If no matching
+ * method is found, the algorithm of step 1 is invoked recursively on
+ * the superclass of C.</LI>
+ * <LI> If no method was found in step 1 above, the superinterfaces of C
+ * are searched for a matching method. If any such method is found, it
+ * is reflected.</LI>
+ * </OL>
+ *
+ * To find a matching method in a class C: If C declares exactly one
+ * public method with the specified name and exactly the same formal
+ * parameter types, that is the method reflected. If more than one such
+ * method is found in C, and one of these methods has a return type that is
+ * more specific than any of the others, that method is reflected;
+ * otherwise one of the methods is chosen arbitrarily.
+ *
+ * <p>Note that there may be more than one matching method in a
+ * class because while the Java language forbids a class to
+ * declare multiple methods with the same signature but different
+ * return types, the Java virtual machine does not. This
+ * increased flexibility in the virtual machine can be used to
+ * implement various language features. For example, covariant
+ * returns can be implemented with {@linkplain
+ * java.lang.reflect.Method#isBridge bridge methods}; the bridge
+ * method and the method being overridden would have the same
+ * signature but different return types.
+ *
+ * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
+ *
+ * @param name the name of the method
+ * @param parameterTypes the list of parameters
+ * @return the <code>Method</code> object that matches the specified
+ * <code>name</code> and <code>parameterTypes</code>
+ * @exception NoSuchMethodException if a matching method is not found
+ * or if the name is "<init>"or "<clinit>".
+ * @exception NullPointerException if <code>name</code> is <code>null</code>
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the method
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Method getMethod(String name, Class<?>... parameterTypes)
+ throws NoSuchMethodException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ Method method = getMethod0(name, parameterTypes);
+ if (method == null) {
+ throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
+ }
+ return method;
+ }
+
+
+ /**
+ * Returns a <code>Constructor</code> object that reflects the specified
+ * public constructor of the class represented by this <code>Class</code>
+ * object. The <code>parameterTypes</code> parameter is an array of
+ * <code>Class</code> objects that identify the constructor''s formal
+ * parameter types, in declared order.
+ *
+ * If this <code>Class</code> object represents an inner class
+ * declared in a non-static context, the formal parameter types
+ * include the explicit enclosing instance as the first parameter.
+ *
+ * <p> The constructor to reflect is the public constructor of the class
+ * represented by this <code>Class</code> object whose formal parameter
+ * types match those specified by <code>parameterTypes</code>.
+ *
+ * @param parameterTypes the parameter array
+ * @return the <code>Constructor</code> object of the public constructor that
+ * matches the specified <code>parameterTypes</code>
+ * @exception NoSuchMethodException if a matching method is not found.
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.PUBLIC)}</tt> denies
+ * access to the constructor
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Constructor<T> getConstructor(Class<?>... parameterTypes)
+ throws NoSuchMethodException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
+ return getConstructor0(parameterTypes, Member.PUBLIC);
+ }
+
+
+ /**
+ * Returns an array of <code>Class</code> objects reflecting all the
+ * classes and interfaces declared as members of the class represented by
+ * this <code>Class</code> object. This includes public, protected, default
+ * (package) access, and private classes and interfaces declared by the
+ * class, but excludes inherited classes and interfaces. This method
+ * returns an array of length 0 if the class declares no classes or
+ * interfaces as members, or if this <code>Class</code> object represents a
+ * primitive type, an array class, or void.
+ *
+ * @return the array of <code>Class</code> objects representing all the
+ * declared members of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared classes within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Class<?>[] getDeclaredClasses() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ return getDeclaredClasses0();
+ }
+
+
+ /**
+ * Returns an array of <code>Field</code> objects reflecting all the fields
+ * declared by the class or interface represented by this
+ * <code>Class</code> object. This includes public, protected, default
+ * (package) access, and private fields, but excludes inherited fields.
+ * The elements in the array returned are not sorted and are not in any
+ * particular order. This method returns an array of length 0 if the class
+ * or interface declares no fields, or if this <code>Class</code> object
+ * represents a primitive type, an array class, or void.
+ *
+ * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
+ *
+ * @return the array of <code>Field</code> objects representing all the
+ * declared fields of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared fields within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Field[] getDeclaredFields() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ return copyFields(privateGetDeclaredFields(false));
+ }
+
+
+ /**
+ * Returns an array of <code>Method</code> objects reflecting all the
+ * methods declared by the class or interface represented by this
+ * <code>Class</code> object. This includes public, protected, default
+ * (package) access, and private methods, but excludes inherited methods.
+ * The elements in the array returned are not sorted and are not in any
+ * particular order. This method returns an array of length 0 if the class
+ * or interface declares no methods, or if this <code>Class</code> object
+ * represents a primitive type, an array class, or void. The class
+ * initialization method <code><clinit></code> is not included in the
+ * returned array. If the class declares multiple public member methods
+ * with the same parameter types, they are all included in the returned
+ * array.
+ *
+ * <p> See <em>The Java Language Specification</em>, section 8.2.
+ *
+ * @return the array of <code>Method</code> objects representing all the
+ * declared methods of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared methods within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Method[] getDeclaredMethods() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ return copyMethods(privateGetDeclaredMethods(false));
+ }
+
+
+ /**
+ * Returns an array of <code>Constructor</code> objects reflecting all the
+ * constructors declared by the class represented by this
+ * <code>Class</code> object. These are public, protected, default
+ * (package) access, and private constructors. The elements in the array
+ * returned are not sorted and are not in any particular order. If the
+ * class has a default constructor, it is included in the returned array.
+ * This method returns an array of length 0 if this <code>Class</code>
+ * object represents an interface, a primitive type, an array class, or
+ * void.
+ *
+ * <p> See <em>The Java Language Specification</em>, section 8.2.
+ *
+ * @return the array of <code>Constructor</code> objects representing all the
+ * declared constructors of this class
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared constructors within this class
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Constructor<?>[] getDeclaredConstructors() throws SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ return copyConstructors(privateGetDeclaredConstructors(false));
+ }
+
+
+ /**
+ * Returns a <code>Field</code> object that reflects the specified declared
+ * field of the class or interface represented by this <code>Class</code>
+ * object. The <code>name</code> parameter is a <code>String</code> that
+ * specifies the simple name of the desired field. Note that this method
+ * will not reflect the <code>length</code> field of an array class.
+ *
+ * @param name the name of the field
+ * @return the <code>Field</code> object for the specified field in this
+ * class
+ * @exception NoSuchFieldException if a field with the specified name is
+ * not found.
+ * @exception NullPointerException if <code>name</code> is <code>null</code>
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared field
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Field getDeclaredField(String name)
+ throws NoSuchFieldException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ Field field = searchFields(privateGetDeclaredFields(false), name);
+ if (field == null) {
+ throw new NoSuchFieldException(name);
+ }
+ return field;
+ }
+
+
+ /**
+ * Returns a <code>Method</code> object that reflects the specified
+ * declared method of the class or interface represented by this
+ * <code>Class</code> object. The <code>name</code> parameter is a
+ * <code>String</code> that specifies the simple name of the desired
+ * method, and the <code>parameterTypes</code> parameter is an array of
+ * <code>Class</code> objects that identify the method''s formal parameter
+ * types, in declared order. If more than one method with the same
+ * parameter types is declared in a class, and one of these methods has a
+ * return type that is more specific than any of the others, that method is
+ * returned; otherwise one of the methods is chosen arbitrarily. If the
+ * name is "<init>"or "<clinit>" a <code>NoSuchMethodException</code>
+ * is raised.
+ *
+ * @param name the name of the method
+ * @param parameterTypes the parameter array
+ * @return the <code>Method</code> object for the method of this class
+ * matching the specified name and parameters
+ * @exception NoSuchMethodException if a matching method is not found.
+ * @exception NullPointerException if <code>name</code> is <code>null</code>
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared method
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
+ throws NoSuchMethodException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ Method method = searchMethods(privateGetDeclaredMethods(false), name, parameterTypes);
+ if (method == null) {
+ throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
+ }
+ return method;
+ }
+
+
+ /**
+ * Returns a <code>Constructor</code> object that reflects the specified
+ * constructor of the class or interface represented by this
+ * <code>Class</code> object. The <code>parameterTypes</code> parameter is
+ * an array of <code>Class</code> objects that identify the constructor''s
+ * formal parameter types, in declared order.
+ *
+ * If this <code>Class</code> object represents an inner class
+ * declared in a non-static context, the formal parameter types
+ * include the explicit enclosing instance as the first parameter.
+ *
+ * @param parameterTypes the parameter array
+ * @return The <code>Constructor</code> object for the constructor with the
+ * specified parameter list
+ * @exception NoSuchMethodException if a matching method is not found.
+ * @exception SecurityException
+ * If a security manager, <i>s</i>, is present and any of the
+ * following conditions is met:
+ *
+ * <ul>
+ *
+ * <li> invocation of
+ * <tt>{@link SecurityManager#checkMemberAccess
+ * s.checkMemberAccess(this, Member.DECLARED)}</tt> denies
+ * access to the declared constructor
+ *
+ * <li> the caller''s class loader is not the same as or an
+ * ancestor of the class loader for the current class and
+ * invocation of <tt>{@link SecurityManager#checkPackageAccess
+ * s.checkPackageAccess()}</tt> denies access to the package
+ * of this class
+ *
+ * </ul>
+ *
+ * @since JDK1.1
+ */
+ public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
+ throws NoSuchMethodException, SecurityException {
+ // be very careful not to change the stack depth of this
+ // checkMemberAccess call for security reasons
+ // see java.lang.SecurityManager.checkMemberAccess
+ checkMemberAccess(Member.DECLARED, ClassLoader.getCallerClassLoader());
+ return getConstructor0(parameterTypes, Member.DECLARED);
+ }
+
+ /**
+ * Finds a resource with a given name. The rules for searching resources
+ * associated with a given class are implemented by the defining
+ * {@linkplain ClassLoader class loader} of the class. This method
+ * delegates to this object''s class loader. If this object was loaded by
+ * the bootstrap class loader, the method delegates to {@link
+ * ClassLoader#getSystemResourceAsStream}.
+ *
+ * <p> Before delegation, an absolute resource name is constructed from the
+ * given resource name using this algorithm:
+ *
+ * <ul>
+ *
+ * <li> If the <tt>name</tt> begins with a <tt>''/''</tt>
+ * (<tt>''\u002f''</tt>), then the absolute name of the resource is the
+ * portion of the <tt>name</tt> following the <tt>''/''</tt>.
+ *
+ * <li> Otherwise, the absolute name is of the following form:
+ *
+ * <blockquote><pre>
+ * <tt>modified_package_name</tt>/<tt>name</tt>
+ * </pre></blockquote>
+ *
+ * <p> Where the <tt>modified_package_name</tt> is the package name of this
+ * object with <tt>''/''</tt> substituted for <tt>''.''</tt>
+ * (<tt>''\u002e''</tt>).
+ *
+ * </ul>
+ *
+ * @param name name of the desired resource
+ * @return A {@link java.io.InputStream} object or <tt>null</tt> if
+ * no resource with this name is found
+ * @throws NullPointerException If <tt>name</tt> is <tt>null</tt>
+ * @since JDK1.1
+ */
+ public InputStream getResourceAsStream(String name) {
+ name = resolveName(name);
+ ClassLoader cl = getClassLoader0();
+ if (cl==null) {
+ // A system class.
+ return ClassLoader.getSystemResourceAsStream(name);
+ }
+ return cl.getResourceAsStream(name);
+ }
+
+ /**
+ * Finds a resource with a given name. The rules for searching resources
+ * associated with a given class are implemented by the defining
+ * {@linkplain ClassLoader class loader} of the class. This method
+ * delegates to this object''s class loader. If this object was loaded by
+ * the bootstrap class loader, the method delegates to {@link
+ * ClassLoader#getSystemResource}.
+ *
+ * <p> Before delegation, an absolute resource name is constructed from the
+ * given resource name using this algorithm:
+ *
+ * <ul>
+ *
+ * <li> If the <tt>name</tt> begins with a <tt>''/''</tt>
+ * (<tt>''\u002f''</tt>), then the absolute name of the resource is the
+ * portion of the <tt>name</tt> following the <tt>''/''</tt>.
+ *
+ * <li> Otherwise, the absolute name is of the following form:
+ *
+ * <blockquote><pre>
+ * <tt>modified_package_name</tt>/<tt>name</tt>
+ * </pre></blockquote>
+ *
+ * <p> Where the <tt>modified_package_name</tt> is the package name of this
+ * object with <tt>''/''</tt> substituted for <tt>''.''</tt>
+ * (<tt>''\u002e''</tt>).
+ *
+ * </ul>
+ *
+ * @param name name of the desired resource
+ * @return A {@link java.net.URL} object or <tt>null</tt> if no
+ * resource with this name is found
+ * @since JDK1.1
+ */
+ public java.net.URL getResource(String name) {
+ name = resolveName(name);
+ ClassLoader cl = getClassLoader0();
+ if (cl==null) {
+ // A system class.
+ return ClassLoader.getSystemResource(name);
+ }
+ return cl.getResource(name);
+ }
+
+
+
+ /** protection domain returned when the internal domain is null */
+ private static java.security.ProtectionDomain allPermDomain;
+
+
+ /**
+ * Returns the <code>ProtectionDomain</code> of this class. If there is a
+ * security manager installed, this method first calls the security
+ * manager''s <code>checkPermission</code> method with a
+ * <code>RuntimePermission("getProtectionDomain")</code> permission to
+ * ensure it''s ok to get the
+ * <code>ProtectionDomain</code>.
+ *
+ * @return the ProtectionDomain of this class
+ *
+ * @throws SecurityException
+ * if a security manager exists and its
+ * <code>checkPermission</code> method doesn''t allow
+ * getting the ProtectionDomain.
+ *
+ * @see java.security.ProtectionDomain
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ * @since 1.2
+ */
+ public java.security.ProtectionDomain getProtectionDomain() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(SecurityConstants.GET_PD_PERMISSION);
+ }
+ java.security.ProtectionDomain pd = getProtectionDomain0();
+ if (pd == null) {
+ if (allPermDomain == null) {
+ java.security.Permissions perms =
+ new java.security.Permissions();
+ perms.add(SecurityConstants.ALL_PERMISSION);
+ allPermDomain =
+ new java.security.ProtectionDomain(null, perms);
+ }
+ pd = allPermDomain;
+ }
+ return pd;
+ }
+
+
+ /**
+ * Returns the ProtectionDomain of this class.
+ */
+ private native java.security.ProtectionDomain getProtectionDomain0();
+
+
+ /**
+ * Set the ProtectionDomain for this class. Called by
+ * ClassLoader.defineClass.
+ */
+ native void setProtectionDomain0(java.security.ProtectionDomain pd);
+
+
+ /*
+ * Return the Virtual Machine''s Class object for the named
+ * primitive type.
+ */
+ static native Class getPrimitiveClass(String name);
+
+
+ /*
+ * Check if client is allowed to access members. If access is denied,
+ * throw a SecurityException.
+ *
+ * Be very careful not to change the stack depth of this checkMemberAccess
+ * call for security reasons.
+ * See java.lang.SecurityManager.checkMemberAccess.
+ *
+ * <p> Default policy: allow all clients access with normal Java access
+ * control.
+ */
+ private void checkMemberAccess(int which, ClassLoader ccl) {
+ SecurityManager s = System.getSecurityManager();
+ if (s !!= null) {
+ s.checkMemberAccess(this, which);
+ ClassLoader cl = getClassLoader0();
+ if ((ccl !!= null) && (ccl !!= cl) &&
+ ((cl == null) || !!cl.isAncestor(ccl))) {
+ String name = this.getName();
+ int i = name.lastIndexOf(''.'');
+ if (i !!= -1) {
+ s.checkPackageAccess(name.substring(0, i));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a package name prefix if the name is not absolute Remove leading "/"
+ * if name is absolute
+ */
+ private String resolveName(String name) {
+ if (name == null) {
+ return name;
+ }
+ if (!!name.startsWith("/")) {
+ Class c = this;
+ while (c.isArray()) {
+ c = c.getComponentType();
+ }
+ String baseName = c.getName();
+ int index = baseName.lastIndexOf(''.'');
+ if (index !!= -1) {
+ name = baseName.substring(0, index).replace(''.'', ''/'')
+ +"/"+name;
+ }
+ } else {
+ name = name.substring(1);
+ }
+ return name;
+ }
+
+ /**
+ * Reflection support.
+ */
+
+ // Caches for certain reflective results
+ private static boolean useCaches = true;
+ private volatile transient SoftReference declaredFields;
+ private volatile transient SoftReference publicFields;
+ private volatile transient SoftReference declaredMethods;
+ private volatile transient SoftReference publicMethods;
+ private volatile transient SoftReference declaredConstructors;
+ private volatile transient SoftReference publicConstructors;
+ // Intermediate results for getFields and getMethods
+ private volatile transient SoftReference declaredPublicFields;
+ private volatile transient SoftReference declaredPublicMethods;
+
+ // Incremented by the VM on each call to JVM TI RedefineClasses()
+ // that redefines this class or a superclass.
+ private volatile transient int classRedefinedCount = 0;
+
+ // Value of classRedefinedCount when we last cleared the cached values
+ // that are sensitive to class redefinition.
+ private volatile transient int lastRedefinedCount = 0;
+
+ // Clears cached values that might possibly have been obsoleted by
+ // a class redefinition.
+ private void clearCachesOnClassRedefinition() {
+ if (lastRedefinedCount !!= classRedefinedCount) {
+ declaredFields = publicFields = declaredPublicFields = null;
+ declaredMethods = publicMethods = declaredPublicMethods = null;
+ declaredConstructors = publicConstructors = null;
+ annotations = declaredAnnotations = null;
+
+ // Use of "volatile" (and synchronization by caller in the case
+ // of annotations) ensures that no thread sees the update to
+ // lastRedefinedCount before seeing the caches cleared.
+ // We do not guard against brief windows during which multiple
+ // threads might redundantly work to fill an empty cache.
+ lastRedefinedCount = classRedefinedCount;
+ }
+ }
+
+ // Generic signature handling
+ private native String getGenericSignature();
+
+ // Generic info repository; lazily initialized
+ private transient ClassRepository genericInfo;
+
+ // accessor for factory
+ private GenericsFactory getFactory() {
+ // create scope and factory
+ return CoreReflectionFactory.make(this, ClassScope.make(this));
+ }
+
+ // accessor for generic info repository
+ private ClassRepository getGenericInfo() {
+ // lazily initialize repository if necessary
+ if (genericInfo == null) {
+ // create and cache generic info repository
+ genericInfo = ClassRepository.make(getGenericSignature(),
+ getFactory());
+ }
+ return genericInfo; //return cached repository
+ }
+
+ // Annotations handling
+ private native byte[] getRawAnnotations();
+
+ native ConstantPool getConstantPool();
+
+ //
+ //
+ // java.lang.reflect.Field handling
+ //
+ //
+
+ // Returns an array of "root" fields. These Field objects must NOT
+ // be propagated to the outside world, but must instead be copied
+ // via ReflectionFactory.copyField.
+ private Field[] privateGetDeclaredFields(boolean publicOnly) {
+ checkInitted();
+ Field[] res = null;
+ if (useCaches) {
+ clearCachesOnClassRedefinition();
+ if (publicOnly) {
+ if (declaredPublicFields !!= null) {
+ res = (Field[]) declaredPublicFields.get();
+ }
+ } else {
+ if (declaredFields !!= null) {
+ res = (Field[]) declaredFields.get();
+ }
+ }
+ if (res !!= null) return res;
+ }
+ // No cached value available; request value from VM
+ res = Reflection.filterFields(this, getDeclaredFields0(publicOnly));
+ if (useCaches) {
+ if (publicOnly) {
+ declaredPublicFields = new SoftReference(res);
+ } else {
+ declaredFields = new SoftReference(res);
+ }
+ }
+ return res;
+ }
+
+ // Returns an array of "root" fields. These Field objects must NOT
+ // be propagated to the outside world, but must instead be copied
+ // via ReflectionFactory.copyField.
+ private Field[] privateGetPublicFields(Set traversedInterfaces) {
+ checkInitted();
+ Field[] res = null;
+ if (useCaches) {
+ clearCachesOnClassRedefinition();
+ if (publicFields !!= null) {
+ res = (Field[]) publicFields.get();
+ }
+ if (res !!= null) return res;
+ }
+
+ // No cached value available; compute value recursively.
+ // Traverse in correct order for getField().
+ List fields = new ArrayList();
+ if (traversedInterfaces == null) {
+ traversedInterfaces = new HashSet();
+ }
+
+ // Local fields
+ Field[] tmp = privateGetDeclaredFields(true);
+ addAll(fields, tmp);
+
+ // Direct superinterfaces, recursively
+ Class[] interfaces = getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ Class c = interfaces[i];
+ if (!!traversedInterfaces.contains(c)) {
+ traversedInterfaces.add(c);
+ addAll(fields, c.privateGetPublicFields(traversedInterfaces));
+ }
+ }
+
+ // Direct superclass, recursively
+ if (!!isInterface()) {
+ Class c = getSuperclass();
+ if (c !!= null) {
+ addAll(fields, c.privateGetPublicFields(traversedInterfaces));
+ }
+ }
+
+ res = new Field[fields.size()];
+ fields.toArray(res);
+ if (useCaches) {
+ publicFields = new SoftReference(res);
+ }
+ return res;
+ }
+
+ private static void addAll(Collection c, Field[] o) {
+ for (int i = 0; i < o.length; i++) {
+ c.add(o[i]);
+ }
+ }
+
+
+ //
+ //
+ // java.lang.reflect.Constructor handling
+ //
+ //
+
+ // Returns an array of "root" constructors. These Constructor
+ // objects must NOT be propagated to the outside world, but must
+ // instead be copied via ReflectionFactory.copyConstructor.
+ private Constructor[] privateGetDeclaredConstructors(boolean publicOnly) {
+ checkInitted();
+ Constructor[] res = null;
+ if (useCaches) {
+ clearCachesOnClassRedefinition();
+ if (publicOnly) {
+ if (publicConstructors !!= null) {
+ res = (Constructor[]) publicConstructors.get();
+ }
+ } else {
+ if (declaredConstructors !!= null) {
+ res = (Constructor[]) declaredConstructors.get();
+ }
+ }
+ if (res !!= null) return res;
+ }
+ // No cached value available; request value from VM
+ if (isInterface()) {
+ res = new Constructor[0];
+ } else {
+ res = getDeclaredConstructors0(publicOnly);
+ }
+ if (useCaches) {
+ if (publicOnly) {
+ publicConstructors = new SoftReference(res);
+ } else {
+ declaredConstructors = new SoftReference(res);
+ }
+ }
+ return res;
+ }
+
+ //
+ //
+ // java.lang.reflect.Method handling
+ //
+ //
+
+ // Returns an array of "root" methods. These Method objects must NOT
+ // be propagated to the outside world, but must instead be copied
+ // via ReflectionFactory.copyMethod.
+ private Method[] privateGetDeclaredMethods(boolean publicOnly) {
+ checkInitted();
+ Method[] res = null;
+ if (useCaches) {
+ clearCachesOnClassRedefinition();
+ if (publicOnly) {
+ if (declaredPublicMethods !!= null) {
+ res = (Method[]) declaredPublicMethods.get();
+ }
+ } else {
+ if (declaredMethods !!= null) {
+ res = (Method[]) declaredMethods.get();
+ }
+ }
+ if (res !!= null) return res;
+ }
+ // No cached value available; request value from VM
+ res = getDeclaredMethods0(publicOnly);
+ if (useCaches) {
+ if (publicOnly) {
+ declaredPublicMethods = new SoftReference(res);
+ } else {
+ declaredMethods = new SoftReference(res);
+ }
+ }
+ return res;
+ }
+
+ static class MethodArray {
+ private Method[] methods;
+ private int length;
+
+ MethodArray() {
+ methods = new Method[20];
+ length = 0;
+ }
+
+ void add(Method m) {
+ if (length == methods.length) {
+ methods = Arrays.copyOf(methods, 2 * methods.length);
+ }
+ methods[length++] = m;
+ }
+
+ void addAll(Method[] ma) {
+ for (int i = 0; i < ma.length; i++) {
+ add(ma[i]);
+ }
+ }
+
+ void addAll(MethodArray ma) {
+ for (int i = 0; i < ma.length(); i++) {
+ add(ma.get(i));
+ }
+ }
+
+ void addIfNotPresent(Method newMethod) {
+ for (int i = 0; i < length; i++) {
+ Method m = methods[i];
+ if (m == newMethod || (m !!= null && m.equals(newMethod))) {
+ return;
+ }
+ }
+ add(newMethod);
+ }
+
+ void addAllIfNotPresent(MethodArray newMethods) {
+ for (int i = 0; i < newMethods.length(); i++) {
+ Method m = newMethods.get(i);
+ if (m !!= null) {
+ addIfNotPresent(m);
+ }
+ }
+ }
+
+ int length() {
+ return length;
+ }
+
+ Method get(int i) {
+ return methods[i];
+ }
+
+ void removeByNameAndSignature(Method toRemove) {
+ for (int i = 0; i < length; i++) {
+ Method m = methods[i];
+ if (m !!= null &&
+ m.getReturnType() == toRemove.getReturnType() &&
+ m.getName() == toRemove.getName() &&
+ arrayContentsEq(m.getParameterTypes(),
+ toRemove.getParameterTypes())) {
+ methods[i] = null;
+ }
+ }
+ }
+
+ void compactAndTrim() {
+ int newPos = 0;
+ // Get rid of null slots
+ for (int pos = 0; pos < length; pos++) {
+ Method m = methods[pos];
+ if (m !!= null) {
+ if (pos !!= newPos) {
+ methods[newPos] = m;
+ }
+ newPos++;
+ }
+ }
+ if (newPos !!= methods.length) {
+ methods = Arrays.copyOf(methods, newPos);
+ }
+ }
+
+ Method[] getArray() {
+ return methods;
+ }
+ }
+
+
+ // Returns an array of "root" methods. These Method objects must NOT
+ // be propagated to the outside world, but must instead be copied
+ // via ReflectionFactory.copyMethod.
+ private Method[] privateGetPublicMethods() {
+ checkInitted();
+ Method[] res = null;
+ if (useCaches) {
+ clearCachesOnClassRedefinition();
+ if (publicMethods !!= null) {
+ res = (Method[]) publicMethods.get();
+ }
+ if (res !!= null) return res;
+ }
+
+ // No cached value available; compute value recursively.
+ // Start by fetching public declared methods
+ MethodArray methods = new MethodArray();
+ {
+ Method[] tmp = privateGetDeclaredMethods(true);
+ methods.addAll(tmp);
+ }
+ // Now recur over superclass and direct superinterfaces.
+ // Go over superinterfaces first so we can more easily filter
+ // out concrete implementations inherited from superclasses at
+ // the end.
+ MethodArray inheritedMethods = new MethodArray();
+ Class[] interfaces = getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ inheritedMethods.addAll(interfaces[i].privateGetPublicMethods());
+ }
+ if (!!isInterface()) {
+ Class c = getSuperclass();
+ if (c !!= null) {
+ MethodArray supers = new MethodArray();
+ supers.addAll(c.privateGetPublicMethods());
+ // Filter out concrete implementations of any
+ // interface methods
+ for (int i = 0; i < supers.length(); i++) {
+ Method m = supers.get(i);
+ if (m !!= null && !!Modifier.isAbstract(m.getModifiers())) {
+ inheritedMethods.removeByNameAndSignature(m);
+ }
+ }
+ // Insert superclass''s inherited methods before
+ // superinterfaces'' to satisfy getMethod''s search
+ // order
+ supers.addAll(inheritedMethods);
+ inheritedMethods = supers;
+ }
+ }
+ // Filter out all local methods from inherited ones
+ for (int i = 0; i < methods.length(); i++) {
+ Method m = methods.get(i);
+ inheritedMethods.removeByNameAndSignature(m);
+ }
+ methods.addAllIfNotPresent(inheritedMethods);
+ methods.compactAndTrim();
+ res = methods.getArray();
+ if (useCaches) {
+ publicMethods = new SoftReference(res);
+ }
+ return res;
+ }
+
+
+ //
+ // Helpers for fetchers of one field, method, or constructor
+ //
+
+ private Field searchFields(Field[] fields, String name) {
+ String internedName = name.intern();
+ for (int i = 0; i < fields.length; i++) {
+ if (fields[i].getName() == internedName) {
+ return getReflectionFactory().copyField(fields[i]);
+ }
+ }
+ return null;
+ }
+
+ private Field getField0(String name) throws NoSuchFieldException {
+ // Note: the intent is that the search algorithm this routine
+ // uses be equivalent to the ordering imposed by
+ // privateGetPublicFields(). It fetches only the declared
+ // public fields for each class, however, to reduce the number
+ // of Field objects which have to be created for the common
+ // case where the field being requested is declared in the
+ // class which is being queried.
+ Field res = null;
+ // Search declared public fields
+ if ((res = searchFields(privateGetDeclaredFields(true), name)) !!= null) {
+ return res;
+ }
+ // Direct superinterfaces, recursively
+ Class[] interfaces = getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ Class c = interfaces[i];
+ if ((res = c.getField0(name)) !!= null) {
+ return res;
+ }
+ }
+ // Direct superclass, recursively
+ if (!!isInterface()) {
+ Class c = getSuperclass();
+ if (c !!= null) {
+ if ((res = c.getField0(name)) !!= null) {
+ return res;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static Method searchMethods(Method[] methods,
+ String name,
+ Class[] parameterTypes)
+ {
+ Method res = null;
+ String internedName = name.intern();
+ for (int i = 0; i < methods.length; i++) {
+ Method m = methods[i];
+ if (m.getName() == internedName
+ && arrayContentsEq(parameterTypes, m.getParameterTypes())
+ && (res == null
+ || res.getReturnType().isAssignableFrom(m.getReturnType())))
+ res = m;
+ }
+
+ return (res == null ? res : getReflectionFactory().copyMethod(res));
+ }
+
+
+ private Method getMethod0(String name, Class[] parameterTypes) {
+ // Note: the intent is that the search algorithm this routine
+ // uses be equivalent to the ordering imposed by
+ // privateGetPublicMethods(). It fetches only the declared
+ // public methods for each class, however, to reduce the
+ // number of Method objects which have to be created for the
+ // common case where the method being requested is declared in
+ // the class which is being queried.
+ Method res = null;
+ // Search declared public methods
+ if ((res = searchMethods(privateGetDeclaredMethods(true),
+ name,
+ parameterTypes)) !!= null) {
+ return res;
+ }
+ // Search superclass''s methods
+ if (!!isInterface()) {
+ Class c = getSuperclass();
+ if (c !!= null) {
+ if ((res = c.getMethod0(name, parameterTypes)) !!= null) {
+ return res;
+ }
+ }
+ }
+ // Search superinterfaces'' methods
+ Class[] interfaces = getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ Class c = interfaces[i];
+ if ((res = c.getMethod0(name, parameterTypes)) !!= null) {
+ return res;
+ }
+ }
+ // Not found
+ return null;
+ }
+
+ private Constructor<T> getConstructor0(Class[] parameterTypes,
+ int which) throws NoSuchMethodException
+ {
+ Constructor[] constructors = privateGetDeclaredConstructors((which == Member.PUBLIC));
+ for (int i = 0; i < constructors.length; i++) {
+ if (arrayContentsEq(parameterTypes,
+ constructors[i].getParameterTypes())) {
+ return getReflectionFactory().copyConstructor(constructors[i]);
+ }
+ }
+ throw new NoSuchMethodException(getName() + ".<init>" + argumentTypesToString(parameterTypes));
+ }
+
+ //
+ // Other helpers and base implementation
+ //
+
+ private static boolean arrayContentsEq(Object[] a1, Object[] a2) {
+ if (a1 == null) {
+ return a2 == null || a2.length == 0;
+ }
+
+ if (a2 == null) {
+ return a1.length == 0;
+ }
+
+ if (a1.length !!= a2.length) {
+ return false;
+ }
+
+ for (int i = 0; i < a1.length; i++) {
+ if (a1[i] !!= a2[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static Field[] copyFields(Field[] arg) {
+ Field[] out = new Field[arg.length];
+ ReflectionFactory fact = getReflectionFactory();
+ for (int i = 0; i < arg.length; i++) {
+ out[i] = fact.copyField(arg[i]);
+ }
+ return out;
+ }
+
+ private static Method[] copyMethods(Method[] arg) {
+ Method[] out = new Method[arg.length];
+ ReflectionFactory fact = getReflectionFactory();
+ for (int i = 0; i < arg.length; i++) {
+ out[i] = fact.copyMethod(arg[i]);
+ }
+ return out;
+ }
+
+ private static Constructor[] copyConstructors(Constructor[] arg) {
+ Constructor[] out = new Constructor[arg.length];
+ ReflectionFactory fact = getReflectionFactory();
+ for (int i = 0; i < arg.length; i++) {
+ out[i] = fact.copyConstructor(arg[i]);
+ }
+ return out;
+ }
+
+ private native Field[] getDeclaredFields0(boolean publicOnly);
+ private native Method[] getDeclaredMethods0(boolean publicOnly);
+ private native Constructor[] getDeclaredConstructors0(boolean publicOnly);
+ private native Class[] getDeclaredClasses0();
+
+ private static String argumentTypesToString(Class[] argTypes) {
+ StringBuilder buf = new StringBuilder();
+ buf.append("(");
+ if (argTypes !!= null) {
+ for (int i = 0; i < argTypes.length; i++) {
+ if (i > 0) {
+ buf.append(", ");
+ }
+ Class c = argTypes[i];
+ buf.append((c == null) ? "null" : c.getName());
+ }
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ /** use serialVersionUID from JDK 1.1 for interoperability */
+ private static final long serialVersionUID = 3206093459760846163L;
+
+
+ /**
+ * Class Class is special cased within the Serialization Stream Protocol.
+ *
+ * A Class instance is written initially into an ObjectOutputStream in the
+ * following format:
+ * <pre>
+ * <code>TC_CLASS</code> ClassDescriptor
+ * A ClassDescriptor is a special cased serialization of
+ * a <code>java.io.ObjectStreamClass</code> instance.
+ * </pre>
+ * A new handle is generated for the initial time the class descriptor
+ * is written into the stream. Future references to the class descriptor
+ * are written as references to the initial class descriptor instance.
+ *
+ * @see java.io.ObjectStreamClass
+ */
+ private static final ObjectStreamField[] serialPersistentFields =
+ new ObjectStreamField[0];
+
+
+ /**
+ * Returns the assertion status that would be assigned to this
+ * class if it were to be initialized at the time this method is invoked.
+ * If this class has had its assertion status set, the most recent
+ * setting will be returned; otherwise, if any package default assertion
+ * status pertains to this class, the most recent setting for the most
+ * specific pertinent package default assertion status is returned;
+ * otherwise, if this class is not a system class (i.e., it has a
+ * class loader) its class loader''s default assertion status is returned;
+ * otherwise, the system class default assertion status is returned.
+ * <p>
+ * Few programmers will have any need for this method; it is provided
+ * for the benefit of the JRE itself. (It allows a class to determine at
+ * the time that it is initialized whether assertions should be enabled.)
+ * Note that this method is not guaranteed to return the actual
+ * assertion status that was (or will be) associated with the specified
+ * class when it was (or will be) initialized.
+ *
+ * @return the desired assertion status of the specified class.
+ * @see java.lang.ClassLoader#setClassAssertionStatus
+ * @see java.lang.ClassLoader#setPackageAssertionStatus
+ * @see java.lang.ClassLoader#setDefaultAssertionStatus
+ * @since 1.4
+ */
+ public boolean desiredAssertionStatus() {
+ ClassLoader loader = getClassLoader();
+ // If the loader is null this is a system class, so ask the VM
+ if (loader == null)
+ return desiredAssertionStatus0(this);
+
+ synchronized(loader) {
+ // If the classloader has been initialized with
+ // the assertion directives, ask it. Otherwise,
+ // ask the VM.
+ return (loader.classAssertionStatus == null ?
+ desiredAssertionStatus0(this) :
+ loader.desiredAssertionStatus(getName()));
+ }
+ }
+
+ // Retrieves the desired assertion status of this class from the VM
+ private static native boolean desiredAssertionStatus0(Class clazz);
+
+ /**
+ * Returns true if and only if this class was declared as an enum in the
+ * source code.
+ *
+ * @return true if and only if this class was declared as an enum in the
+ * source code
+ * @since 1.5
+ */
+ public boolean isEnum() {
+ // An enum must both directly extend java.lang.Enum and have
+ // the ENUM bit set; classes for specialized enum constants
+ // don''t do the former.
+ return (this.getModifiers() & ENUM) !!= 0 &&
+ this.getSuperclass() == java.lang.Enum.class;
+ }
+
+ // Fetches the factory for reflective objects
+ private static ReflectionFactory getReflectionFactory() {
+ if (reflectionFactory == null) {
+ reflectionFactory = (ReflectionFactory)
+ java.security.AccessController.doPrivileged
+ (new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
+ }
+ return reflectionFactory;
+ }
+ private static ReflectionFactory reflectionFactory;
+
+ // To be able to query system properties as soon as they''re available
+ private static boolean initted = false;
+ private static void checkInitted() {
+ if (initted) return;
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ // Tests to ensure the system properties table is fully
+ // initialized. This is needed because reflection code is
+ // called very early in the initialization process (before
+ // command-line arguments have been parsed and therefore
+ // these user-settable properties installed.) We assume that
+ // if System.out is non-null then the System class has been
+ // fully initialized and that the bulk of the startup code
+ // has been run.
+
+ if (System.out == null) {
+ // java.lang.System not yet fully initialized
+ return null;
+ }
+
+ String val =
+ System.getProperty("sun.reflect.noCaches");
+ if (val !!= null && val.equals("true")) {
+ useCaches = false;
+ }
+
+ initted = true;
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Returns the elements of this enum class or null if this
+ * Class object does not represent an enum type.
+ *
+ * @return an array containing the values comprising the enum class
+ * represented by this Class object in the order they''re
+ * declared, or null if this Class object does not
+ * represent an enum type
+ * @since 1.5
+ */
+ public T[] getEnumConstants() {
+ T[] values = getEnumConstantsShared();
+ return (values !!= null) ? values.clone() : null;
+ }
+
+ /**
+ * Returns the elements of this enum class or null if this
+ * Class object does not represent an enum type;
+ * identical to getEnumConstantsShared except that
+ * the result is uncloned, cached, and shared by all callers.
+ */
+ T[] getEnumConstantsShared() {
+ if (enumConstants == null) {
+ if (!!isEnum()) return null;
+ try {
+ final Method values = getMethod("values");
+ java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction() {
+ public Object run() {
+ values.setAccessible(true);
+ return null;
+ }
+ });
+ enumConstants = (T[])values.invoke(null);
+ }
+ // These can happen when users concoct enum-like classes
+ // that don''t comply with the enum spec.
+ catch (InvocationTargetException ex) { return null; }
+ catch (NoSuchMethodException ex) { return null; }
+ catch (IllegalAccessException ex) { return null; }
+ }
+ return enumConstants;
+ }
+ private volatile transient T[] enumConstants = null;
+
+ /**
+ * Returns a map from simple name to enum constant. This package-private
+ * method is used internally by Enum to implement
+ * public static <T extends Enum<T>> T valueOf(Class<T>, String)
+ * efficiently. Note that the map is returned by this method is
+ * created lazily on first use. Typically it won''t ever get created.
+ */
+ Map<String, T> enumConstantDirectory() {
+ if (enumConstantDirectory == null) {
+ T[] universe = getEnumConstantsShared();
+ if (universe == null)
+ throw new IllegalArgumentException(
+ getName() + " is not an enum type");
+ Map<String, T> m = new HashMap<String, T>(2 * universe.length);
+ for (T constant : universe)
+ m.put(((Enum)constant).name(), constant);
+ enumConstantDirectory = m;
+ }
+ return enumConstantDirectory;
+ }
+ private volatile transient Map<String, T> enumConstantDirectory = null;
+
+ /**
+ * Casts an object to the class or interface represented
+ * by this <tt>Class</tt> object.
+ *
+ * @param obj the object to be cast
+ * @return the object after casting, or null if obj is null
+ *
+ * @throws ClassCastException if the object is not
+ * null and is not assignable to the type T.
+ *
+ * @since 1.5
+ */
+ public T cast(Object obj) {
+ if (obj !!= null && !!isInstance(obj))
+ throw new ClassCastException();
+ return (T) obj;
+ }
+
+ /**
+ * Casts this <tt>Class</tt> object to represent a subclass of the class
+ * represented by the specified class object. Checks that that the cast
+ * is valid, and throws a <tt>ClassCastException</tt> if it is not. If
+ * this method succeeds, it always returns a reference to this class object.
+ *
+ * <p>This method is useful when a client needs to "narrow" the type of
+ * a <tt>Class</tt> object to pass it to an API that restricts the
+ * <tt>Class</tt> objects that it is willing to accept. A cast would
+ * generate a compile-time warning, as the correctness of the cast
+ * could not be checked at runtime (because generic types are implemented
+ * by erasure).
+ *
+ * @return this <tt>Class</tt> object, cast to represent a subclass of
+ * the specified class object.
+ * @throws ClassCastException if this <tt>Class</tt> object does not
+ * represent a subclass of the specified class (here "subclass" includes
+ * the class itself).
+ * @since 1.5
+ */
+ public <U> Class<? extends U> asSubclass(Class<U> clazz) {
+ if (clazz.isAssignableFrom(this))
+ return (Class<? extends U>) this;
+ else
+ throw new ClassCastException(this.toString());
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.5
+ */
+ public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
+ if (annotationClass == null)
+ throw new NullPointerException();
+
+ initAnnotationsIfNecessary();
+ return (A) annotations.get(annotationClass);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.5
+ */
+ public boolean isAnnotationPresent(
+ Class<? extends Annotation> annotationClass) {
+ if (annotationClass == null)
+ throw new NullPointerException();
+
+ return getAnnotation(annotationClass) !!= null;
+ }
+
+
+ /**
+ * @since 1.5
+ */
+ public Annotation[] getAnnotations() {
+ initAnnotationsIfNecessary();
+ return AnnotationParser.toArray(annotations);
+ }
+
+ /**
+ * @since 1.5
+ */
+ public Annotation[] getDeclaredAnnotations() {
+ initAnnotationsIfNecessary();
+ return AnnotationParser.toArray(declaredAnnotations);
+ }
+
+ // Annotations cache
+ private transient Map<Class, Annotation> annotations;
+ private transient Map<Class, Annotation> declaredAnnotations;
+
+ private synchronized void initAnnotationsIfNecessary() {
+ clearCachesOnClassRedefinition();
+ if (annotations !!= null)
+ return;
+ declaredAnnotations = AnnotationParser.parseAnnotations(
+ getRawAnnotations(), getConstantPool(), this);
+ Class<?> superClass = getSuperclass();
+ if (superClass == null) {
+ annotations = declaredAnnotations;
+ } else {
+ annotations = new HashMap<Class, Annotation>();
+ superClass.initAnnotationsIfNecessary();
+ for (Map.Entry<Class, Annotation> e : superClass.annotations.entrySet()) {
+ Class annotationClass = e.getKey();
+ if (AnnotationType.getInstance(annotationClass).isInherited())
+ annotations.put(annotationClass, e.getValue());
+ }
+ annotations.putAll(declaredAnnotations);
+ }
+ }
+
+ // Annotation types cache their internal (AnnotationType) form
+
+ private AnnotationType annotationType;
+
+ void setAnnotationType(AnnotationType type) {
+ annotationType = type;
+ }
+
+ AnnotationType getAnnotationType() {
+ return annotationType;
+ }
+}
+'
+].
+ Transcript showCR: 'java.lang.Class parsed in ', time asString, ' miliseconds'.
+ ^ res.
+
+ "Modified: / 30-12-2010 / 11:39:50 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testJavaLangObject6
+ | res time |
+ time := Time millisecondsToRun: [
+ res := self assertParse: '
+/*
+ * %W% %E%
+ *
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package java.lang;
+
+/**
+ * Class <code>Object</code> is the root of the class hierarchy.
+ * Every class has <code>Object</code> as a superclass. All objects,
+ * including arrays, implement the methods of this class.
+ *
+ * @author unascribed
+ * @version %I%, %G%
+ * @see java.lang.Class
+ * @since JDK1.0
+ */
+public class Object {
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ /**
+ * Returns the runtime class of this {@code Object}. The returned
+ * {@code Class} object is the object that is locked by {@code
+ * static synchronized} methods of the represented class.
+ *
+ * <p><b>The actual result type is {@code Class<? extends |X|>}
+ * where {@code |X|} is the erasure of the static type of the
+ * expression on which {@code getClass} is called.</b> For
+ * example, no cast is required in this code fragment:</p>
+ *
+ * <p>
+ * {@code Number n = 0; }<br>
+ * {@code Class<? extends Number> c = n.getClass(); }
+ * </p>
+ *
+ * @return The {@code Class} object that represents the runtime
+ * class of this object.
+ * @see <a href="http://java.sun.com/docs/books/jls/">The Java
+ * Language Specification, Third Edition (15.8.2 Class
+ * Literals)</a>
+ */
+ public final native Class<?> getClass();
+
+ /**
+ * Returns a hash code value for the object. This method is
+ * supported for the benefit of hashtables such as those provided by
+ * <code>java.util.Hashtable</code>.
+ * <p>
+ * The general contract of <code>hashCode</code> is:
+ * <ul>
+ * <li>Whenever it is invoked on the same object more than once during
+ * an execution of a Java application, the <tt>hashCode</tt> method
+ * must consistently return the same integer, provided no information
+ * used in <tt>equals</tt> comparisons on the object is modified.
+ * This integer need not remain consistent from one execution of an
+ * application to another execution of the same application.
+ * <li>If two objects are equal according to the <tt>equals(Object)</tt>
+ * method, then calling the <code>hashCode</code> method on each of
+ * the two objects must produce the same integer result.
+ * <li>It is <em>not</em> required that if two objects are unequal
+ * according to the {@link java.lang.Object#equals(java.lang.Object)}
+ * method, then calling the <tt>hashCode</tt> method on each of the
+ * two objects must produce distinct integer results. However, the
+ * programmer should be aware that producing distinct integer results
+ * for unequal objects may improve the performance of hashtables.
+ * </ul>
+ * <p>
+ * As much as is reasonably practical, the hashCode method defined by
+ * class <tt>Object</tt> does return distinct integers for distinct
+ * objects. (This is typically implemented by converting the internal
+ * address of the object into an integer, but this implementation
+ * technique is not required by the
+ * Java<font size="-2"><sup>TM</sup></font> programming language.)
+ *
+ * @return a hash code value for this object.
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @see java.util.Hashtable
+ */
+ public native int hashCode();
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ * <p>
+ * The <code>equals</code> method implements an equivalence relation
+ * on non-null object references:
+ * <ul>
+ * <li>It is <i>reflexive</i>: for any non-null reference value
+ * <code>x</code>, <code>x.equals(x)</code> should return
+ * <code>true</code>.
+ * <li>It is <i>symmetric</i>: for any non-null reference values
+ * <code>x</code> and <code>y</code>, <code>x.equals(y)</code>
+ * should return <code>true</code> if and only if
+ * <code>y.equals(x)</code> returns <code>true</code>.
+ * <li>It is <i>transitive</i>: for any non-null reference values
+ * <code>x</code>, <code>y</code>, and <code>z</code>, if
+ * <code>x.equals(y)</code> returns <code>true</code> and
+ * <code>y.equals(z)</code> returns <code>true</code>, then
+ * <code>x.equals(z)</code> should return <code>true</code>.
+ * <li>It is <i>consistent</i>: for any non-null reference values
+ * <code>x</code> and <code>y</code>, multiple invocations of
+ * <tt>x.equals(y)</tt> consistently return <code>true</code>
+ * or consistently return <code>false</code>, provided no
+ * information used in <code>equals</code> comparisons on the
+ * objects is modified.
+ * <li>For any non-null reference value <code>x</code>,
+ * <code>x.equals(null)</code> should return <code>false</code>.
+ * </ul>
+ * <p>
+ * The <tt>equals</tt> method for class <code>Object</code> implements
+ * the most discriminating possible equivalence relation on objects;
+ * that is, for any non-null reference values <code>x</code> and
+ * <code>y</code>, this method returns <code>true</code> if and only
+ * if <code>x</code> and <code>y</code> refer to the same object
+ * (<code>x == y</code> has the value <code>true</code>).
+ * <p>
+ * Note that it is generally necessary to override the <tt>hashCode</tt>
+ * method whenever this method is overridden, so as to maintain the
+ * general contract for the <tt>hashCode</tt> method, which states
+ * that equal objects must have equal hash codes.
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this object is the same as the obj
+ * argument; <code>false</code> otherwise.
+ * @see #hashCode()
+ * @see java.util.Hashtable
+ */
+ public boolean equals(Object obj) {
+ return (this == obj);
+ }
+
+ /**
+ * Creates and returns a copy of this object. The precise meaning
+ * of "copy" may depend on the class of the object. The general
+ * intent is that, for any object <tt>x</tt>, the expression:
+ * <blockquote>
+ * <pre>
+ * x.clone() !!= x</pre></blockquote>
+ * will be true, and that the expression:
+ * <blockquote>
+ * <pre>
+ * x.clone().getClass() == x.getClass()</pre></blockquote>
+ * will be <tt>true</tt>, but these are not absolute requirements.
+ * While it is typically the case that:
+ * <blockquote>
+ * <pre>
+ * x.clone().equals(x)</pre></blockquote>
+ * will be <tt>true</tt>, this is not an absolute requirement.
+ * <p>
+ * By convention, the returned object should be obtained by calling
+ * <tt>super.clone</tt>. If a class and all of its superclasses (except
+ * <tt>Object</tt>) obey this convention, it will be the case that
+ * <tt>x.clone().getClass() == x.getClass()</tt>.
+ * <p>
+ * By convention, the object returned by this method should be independent
+ * of this object (which is being cloned). To achieve this independence,
+ * it may be necessary to modify one or more fields of the object returned
+ * by <tt>super.clone</tt> before returning it. Typically, this means
+ * copying any mutable objects that comprise the internal "deep structure"
+ * of the object being cloned and replacing the references to these
+ * objects with references to the copies. If a class contains only
+ * primitive fields or references to immutable objects, then it is usually
+ * the case that no fields in the object returned by <tt>super.clone</tt>
+ * need to be modified.
+ * <p>
+ * The method <tt>clone</tt> for class <tt>Object</tt> performs a
+ * specific cloning operation. First, if the class of this object does
+ * not implement the interface <tt>Cloneable</tt>, then a
+ * <tt>CloneNotSupportedException</tt> is thrown. Note that all arrays
+ * are considered to implement the interface <tt>Cloneable</tt>.
+ * Otherwise, this method creates a new instance of the class of this
+ * object and initializes all its fields with exactly the contents of
+ * the corresponding fields of this object, as if by assignment; the
+ * contents of the fields are not themselves cloned. Thus, this method
+ * performs a "shallow copy" of this object, not a "deep copy" operation.
+ * <p>
+ * The class <tt>Object</tt> does not itself implement the interface
+ * <tt>Cloneable</tt>, so calling the <tt>clone</tt> method on an object
+ * whose class is <tt>Object</tt> will result in throwing an
+ * exception at run time.
+ *
+ * @return a clone of this instance.
+ * @exception CloneNotSupportedException if the object''s class does not
+ * support the <code>Cloneable</code> interface. Subclasses
+ * that override the <code>clone</code> method can also
+ * throw this exception to indicate that an instance cannot
+ * be cloned.
+ * @see java.lang.Cloneable
+ */
+ protected native Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Returns a string representation of the object. In general, the
+ * <code>toString</code> method returns a string that
+ * "textually represents" this object. The result should
+ * be a concise but informative representation that is easy for a
+ * person to read.
+ * It is recommended that all subclasses override this method.
+ * <p>
+ * The <code>toString</code> method for class <code>Object</code>
+ * returns a string consisting of the name of the class of which the
+ * object is an instance, the at-sign character `<code>@</code>`, and
+ * the unsigned hexadecimal representation of the hash code of the
+ * object. In other words, this method returns a string equal to the
+ * value of:
+ * <blockquote>
+ * <pre>
+ * getClass().getName() + `@` + Integer.toHexString(hashCode())
+ * </pre></blockquote>
+ *
+ * @return a string representation of the object.
+ */
+ public String toString() {
+ return getClass().getName() + "@" + Integer.toHexString(hashCode());
+ }
+
+ /**
+ * Wakes up a single thread that is waiting on this objects
+ * monitor. If any threads are waiting on this object, one of them
+ * is chosen to be awakened. The choice is arbitrary and occurs at
+ * the discretion of the implementation. A thread waits on an objects
+ * monitor by calling one of the <code>wait</code> methods.
+ * <p>
+ * The awakened thread will not be able to proceed until the current
+ * thread relinquishes the lock on this object. The awakened thread will
+ * compete in the usual manner with any other threads that might be
+ * actively competing to synchronize on this object; for example, the
+ * awakened thread enjoys no reliable privilege or disadvantage in being
+ * the next thread to lock this object.
+ * <p>
+ * This method should only be called by a thread that is the owner
+ * of this object`s monitor. A thread becomes the owner of the
+ * object`s monitor in one of three ways:
+ * <ul>
+ * <li>By executing a synchronized instance method of that object.
+ * <li>By executing the body of a <code>synchronized</code> statement
+ * that synchronizes on the object.
+ * <li>For objects of type <code>Class,</code> by executing a
+ * synchronized static method of that class.
+ * </ul>
+ * <p>
+ * Only one thread at a time can own an object''s monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object''s monitor.
+ * @see java.lang.Object#notifyAll()
+ * @see java.lang.Object#wait()
+ */
+ public final native void notify();
+
+ /**
+ * Wakes up all threads that are waiting on this object`s monitor. A
+ * thread waits on an object`s monitor by calling one of the
+ * <code>wait</code> methods.
+ * <p>
+ * The awakened threads will not be able to proceed until the current
+ * thread relinquishes the lock on this object. The awakened threads
+ * will compete in the usual manner with any other threads that might
+ * be actively competing to synchronize on this object; for example,
+ * the awakened threads enjoy no reliable privilege or disadvantage in
+ * being the next thread to lock this object.
+ * <p>
+ * This method should only be called by a thread that is the owner
+ * of this object`s monitor. See the <code>notify</code> method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object`s monitor.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#wait()
+ */
+ public final native void notifyAll();
+
+ /**
+ * Causes the current thread to wait until either another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object, or a
+ * specified amount of time has elapsed.
+ * <p>
+ * The current thread must own this object`s monitor.
+ * <p>
+ * This method causes the current thread (call it <var>T</var>) to
+ * place itself in the wait set for this object and then to relinquish
+ * any and all synchronization claims on this object. Thread <var>T</var>
+ * becomes disabled for thread scheduling purposes and lies dormant
+ * until one of four things happens:
+ * <ul>
+ * <li>Some other thread invokes the <tt>notify</tt> method for this
+ * object and thread <var>T</var> happens to be arbitrarily chosen as
+ * the thread to be awakened.
+ * <li>Some other thread invokes the <tt>notifyAll</tt> method for this
+ * object.
+ * <li>Some other thread {@linkplain Thread#interrupt() interrupts}
+ * thread <var>T</var>.
+ * <li>The specified amount of real time has elapsed, more or less. If
+ * <tt>timeout</tt> is zero, however, then real time is not taken into
+ * consideration and the thread simply waits until notified.
+ * </ul>
+ * The thread <var>T</var> is then removed from the wait set for this
+ * object and re-enabled for thread scheduling. It then competes in the
+ * usual manner with other threads for the right to synchronize on the
+ * object; once it has gained control of the object, all its
+ * synchronization claims on the object are restored to the status quo
+ * ante - that is, to the situation as of the time that the <tt>wait</tt>
+ * method was invoked. Thread <var>T</var> then returns from the
+ * invocation of the <tt>wait</tt> method. Thus, on return from the
+ * <tt>wait</tt> method, the synchronization state of the object and of
+ * thread <tt>T</tt> is exactly as it was when the <tt>wait</tt> method
+ * was invoked.
+ * <p>
+ * A thread can also wake up without being notified, interrupted, or
+ * timing out, a so-called <i>spurious wakeup</i>. While this will rarely
+ * occur in practice, applications must guard against it by testing for
+ * the condition that should have caused the thread to be awakened, and
+ * continuing to wait if the condition is not satisfied. In other words,
+ * waits should always occur in loops, like this one:
+ * <pre>
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait(timeout);
+ * ... // Perform action appropriate to condition
+ * }
+ * </pre>
+ * (For more information on this topic, see Section 3.2.3 in Doug Lea`s
+ * "Concurrent Programming in Java (Second Edition)" (Addison-Wesley,
+ * 2000), or Item 50 in Joshua Bloch`s "Effective Java Programming
+ * Language Guide" (Addison-Wesley, 2001).
+ *
+ * <p>If the current thread is {@linkplain java.lang.Thread#interrupt()
+ * interrupted} by any thread before or while it is waiting, then an
+ * <tt>InterruptedException</tt> is thrown. This exception is not
+ * thrown until the lock status of this object has been restored as
+ * described above.
+ *
+ * <p>
+ * Note that the <tt>wait</tt> method, as it places the current thread
+ * into the wait set for this object, unlocks only this object; any
+ * other objects on which the current thread may be synchronized remain
+ * locked while the thread waits.
+ * <p>
+ * This method should only be called by a thread that is the owner
+ * of this object`s monitor. See the <code>notify</code> method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @param timeout the maximum time to wait in milliseconds.
+ * @exception IllegalArgumentException if the value of timeout is
+ * negative.
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of the object`s monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The <i>interrupted
+ * status</i> of the current thread is cleared when
+ * this exception is thrown.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#notifyAll()
+ */
+ public final native void wait(long timeout) throws InterruptedException;
+
+ /**
+ * Causes the current thread to wait until another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object, or
+ * some other thread interrupts the current thread, or a certain
+ * amount of real time has elapsed.
+ * <p>
+ * This method is similar to the <code>wait</code> method of one
+ * argument, but it allows finer control over the amount of time to
+ * wait for a notification before giving up. The amount of real time,
+ * measured in nanoseconds, is given by:
+ * <blockquote>
+ * <pre>
+ * 1000000*timeout+nanos</pre></blockquote>
+ * <p>
+ * In all other respects, this method does the same thing as the
+ * method {@link #wait(long)} of one argument. In particular,
+ * <tt>wait(0, 0)</tt> means the same thing as <tt>wait(0)</tt>.
+ * <p>
+ * The current thread must own this object`s monitor. The thread
+ * releases ownership of this monitor and waits until either of the
+ * following two conditions has occurred:
+ * <ul>
+ * <li>Another thread notifies threads waiting on this object`s monitor
+ * to wake up either through a call to the <code>notify</code> method
+ * or the <code>notifyAll</code> method.
+ * <li>The timeout period, specified by <code>timeout</code>
+ * milliseconds plus <code>nanos</code> nanoseconds arguments, has
+ * elapsed.
+ * </ul>
+ * <p>
+ * The thread then waits until it can re-obtain ownership of the
+ * monitor and resumes execution.
+ * <p>
+ * As in the one argument version, interrupts and spurious wakeups are
+ * possible, and this method should always be used in a loop:
+ * <pre>
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait(timeout, nanos);
+ * ... // Perform action appropriate to condition
+ * }
+ * </pre>
+ * This method should only be called by a thread that is the owner
+ * of this object`s monitor. See the <code>notify</code> method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @param timeout the maximum time to wait in milliseconds.
+ * @param nanos additional time, in nanoseconds range
+ * 0-999999.
+ * @exception IllegalArgumentException if the value of timeout is
+ * negative or the value of nanos is
+ * not in the range 0-999999.
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object`s monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The <i>interrupted
+ * status</i> of the current thread is cleared when
+ * this exception is thrown.
+ */
+ public final void wait(long timeout, int nanos) throws InterruptedException {
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout value is negative");
+ }
+
+ if (nanos < 0 || nanos > 999999) {
+ throw new IllegalArgumentException(
+ "nanosecond timeout value out of range");
+ }
+
+ if (nanos >= 500000 || (nanos !!= 0 && timeout == 0)) {
+ timeout++;
+ }
+
+ wait(timeout);
+ }
+
+ /**
+ * Causes the current thread to wait until another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object.
+ * In other words, this method behaves exactly as if it simply
+ * performs the call <tt>wait(0)</tt>.
+ * <p>
+ * The current thread must own this object`s monitor. The thread
+ * releases ownership of this monitor and waits until another thread
+ * notifies threads waiting on this object`s monitor to wake up
+ * either through a call to the <code>notify</code> method or the
+ * <code>notifyAll</code> method. The thread then waits until it can
+ * re-obtain ownership of the monitor and resumes execution.
+ * <p>
+ * As in the one argument version, interrupts and spurious wakeups are
+ * possible, and this method should always be used in a loop:
+ * <pre>
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait();
+ * ... // Perform action appropriate to condition
+ * }
+ * </pre>
+ * This method should only be called by a thread that is the owner
+ * of this object`s monitor. See the <code>notify</code> method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of the object`s monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The <i>interrupted
+ * status</i> of the current thread is cleared when
+ * this exception is thrown.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#notifyAll()
+ */
+ public final void wait() throws InterruptedException {
+ wait(0);
+ }
+
+ /**
+ * Called by the garbage collector on an object when garbage collection
+ * determines that there are no more references to the object.
+ * A subclass overrides the <code>finalize</code> method to dispose of
+ * system resources or to perform other cleanup.
+ * <p>
+ * The general contract of <tt>finalize</tt> is that it is invoked
+ * if and when the Java<font size="-2"><sup>TM</sup></font> virtual
+ * machine has determined that there is no longer any
+ * means by which this object can be accessed by any thread that has
+ * not yet died, except as a result of an action taken by the
+ * finalization of some other object or class which is ready to be
+ * finalized. The <tt>finalize</tt> method may take any action, including
+ * making this object available again to other threads; the usual purpose
+ * of <tt>finalize</tt>, however, is to perform cleanup actions before
+ * the object is irrevocably discarded. For example, the finalize method
+ * for an object that represents an input/output connection might perform
+ * explicit I/O transactions to break the connection before the object is
+ * permanently discarded.
+ * <p>
+ * The <tt>finalize</tt> method of class <tt>Object</tt> performs no
+ * special action; it simply returns normally. Subclasses of
+ * <tt>Object</tt> may override this definition.
+ * <p>
+ * The Java programming language does not guarantee which thread will
+ * invoke the <tt>finalize</tt> method for any given object. It is
+ * guaranteed, however, that the thread that invokes finalize will not
+ * be holding any user-visible synchronization locks when finalize is
+ * invoked. If an uncaught exception is thrown by the finalize method,
+ * the exception is ignored and finalization of that object terminates.
+ * <p>
+ * After the <tt>finalize</tt> method has been invoked for an object, no
+ * further action is taken until the Java virtual machine has again
+ * determined that there is no longer any means by which this object can
+ * be accessed by any thread that has not yet died, including possible
+ * actions by other objects or classes which are ready to be finalized,
+ * at which point the object may be discarded.
+ * <p>
+ * The <tt>finalize</tt> method is never invoked more than once by a Java
+ * virtual machine for any given object.
+ * <p>
+ * Any exception thrown by the <code>finalize</code> method causes
+ * the finalization of this object to be halted, but is otherwise
+ * ignored.
+ *
+ * @throws Throwable the <code>Exception</code> raised by this method
+ */
+ protected void finalize() throws Throwable { }
+}
+ '
+].
+ Transcript showCR: 'java.lang.Object parsed in ', time asString, ' miliseconds'.
+ ^ res.
+
+ "Modified: / 30-12-2010 / 11:39:56 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+testJavaLangSystem6
+ | res time |
+ time := Time millisecondsToRun: [
+ res := self assertParse: '
+/*
+ * %W% %E%
+ *
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+package java.lang;
+
+import java.io.*;
+import java.util.Properties;
+import java.util.PropertyPermission;
+import java.util.StringTokenizer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.AllPermission;
+import java.nio.channels.Channel;
+import java.nio.channels.spi.SelectorProvider;
+import sun.nio.ch.Interruptible;
+import sun.reflect.Reflection;
+import sun.security.util.SecurityConstants;
+import sun.reflect.annotation.AnnotationType;
+
+/**
+ * The <code>System</code> class contains several useful class fields
+ * and methods. It cannot be instantiated.
+ *
+ * <p>Among the facilities provided by the <code>System</code> class
+ * are standard input, standard output, and error output streams;
+ * access to externally defined properties and environment
+ * variables; a means of loading files and libraries; and a utility
+ * method for quickly copying a portion of an array.
+ *
+ * @author unascribed
+ * @version 1.162, 04/01/09
+ * @since JDK1.0
+ */
+public final class System {
+
+ /* First thing---register the natives */
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ /** Don''t let anyone instantiate this class */
+ private System() {
+ }
+
+ /**
+ * The "standard" input stream. This stream is already
+ * open and ready to supply input data. Typically this stream
+ * corresponds to keyboard input or another input source specified by
+ * the host environment or user.
+ */
+ public final static InputStream in = nullInputStream();
+
+ /**
+ * The "standard" output stream. This stream is already
+ * open and ready to accept output data. Typically this stream
+ * corresponds to display output or another output destination
+ * specified by the host environment or user.
+ * <p>
+ * For simple stand-alone Java applications, a typical way to write
+ * a line of output data is:
+ * <blockquote><pre>
+ * System.out.println(data)
+ * </pre></blockquote>
+ * <p>
+ * See the <code>println</code> methods in class <code>PrintStream</code>.
+ *
+ * @see java.io.PrintStream#println()
+ * @see java.io.PrintStream#println(boolean)
+ * @see java.io.PrintStream#println(char)
+ * @see java.io.PrintStream#println(char[])
+ * @see java.io.PrintStream#println(double)
+ * @see java.io.PrintStream#println(float)
+ * @see java.io.PrintStream#println(int)
+ * @see java.io.PrintStream#println(long)
+ * @see java.io.PrintStream#println(java.lang.Object)
+ * @see java.io.PrintStream#println(java.lang.String)
+ */
+ public final static PrintStream out = nullPrintStream();
+
+ /**
+ * The "standard" error output stream. This stream is already
+ * open and ready to accept output data.
+ * <p>
+ * Typically this stream corresponds to display output or another
+ * output destination specified by the host environment or user. By
+ * convention, this output stream is used to display error messages
+ * or other information that should come to the immediate attention
+ * of a user even if the principal output stream, the value of the
+ * variable <code>out</code>, has been redirected to a file or other
+ * destination that is typically not continuously monitored.
+ */
+ public final static PrintStream err = nullPrintStream();
+
+ /* The security manager for the system.
+ */
+ private static volatile SecurityManager security = null;
+
+ /**
+ * Reassigns the "standard" input stream.
+ *
+ * <p>First, if there is a security manager, its <code>checkPermission</code>
+ * method is called with a <code>RuntimePermission("setIO")</code> permission
+ * to see if it''s ok to reassign the "standard" input stream.
+ * <p>
+ *
+ * @param in the new standard input stream.
+ *
+ * @throws SecurityException
+ * if a security manager exists and its
+ * <code>checkPermission</code> method doesn''t allow
+ * reassigning of the standard input stream.
+ *
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ *
+ * @since JDK1.1
+ */
+ public static void setIn(InputStream in) {
+ checkIO();
+ setIn0(in);
+ }
+
+ /**
+ * Reassigns the "standard" output stream.
+ *
+ * <p>First, if there is a security manager, its <code>checkPermission</code>
+ * method is called with a <code>RuntimePermission("setIO")</code> permission
+ * to see if it''s ok to reassign the "standard" output stream.
+ *
+ * @param out the new standard output stream
+ *
+ * @throws SecurityException
+ * if a security manager exists and its
+ * <code>checkPermission</code> method doesn''t allow
+ * reassigning of the standard output stream.
+ *
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ *
+ * @since JDK1.1
+ */
+ public static void setOut(PrintStream out) {
+ checkIO();
+ setOut0(out);
+ }
+
+ /**
+ * Reassigns the "standard" error output stream.
+ *
+ * <p>First, if there is a security manager, its <code>checkPermission</code>
+ * method is called with a <code>RuntimePermission("setIO")</code> permission
+ * to see if it''s ok to reassign the "standard" error output stream.
+ *
+ * @param err the new standard error output stream.
+ *
+ * @throws SecurityException
+ * if a security manager exists and its
+ * <code>checkPermission</code> method doesn''t allow
+ * reassigning of the standard error output stream.
+ *
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ *
+ * @since JDK1.1
+ */
+ public static void setErr(PrintStream err) {
+ checkIO();
+ setErr0(err);
+ }
+
+ private static volatile Console cons = null;
+ /**
+ * Returns the unique {@link java.io.Console Console} object associated
+ * with the current Java virtual machine, if any.
+ *
+ * @return The system console, if any, otherwise <tt>null</tt>.
+ *
+ * @since 1.6
+ */
+ public static Console console() {
+ if (cons == null) {
+ synchronized (System.class) {
+ cons = sun.misc.SharedSecrets.getJavaIOAccess().console();
+ }
+ }
+ return cons;
+ }
+
+ /**
+ * Returns the channel inherited from the entity that created this
+ * Java virtual machine.
+ *
+ * <p> This method returns the channel obtained by invoking the
+ * {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
+ * inheritedChannel} method of the system-wide default
+ * {@link java.nio.channels.spi.SelectorProvider} object. </p>
+ *
+ * <p> In addition to the network-oriented channels described in
+ * {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
+ * inheritedChannel}, this method may return other kinds of
+ * channels in the future.
+ *
+ * @return The inherited channel, if any, otherwise <tt>null</tt>.
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ *
+ * @throws SecurityException
+ * If a security manager is present and it does not
+ * permit access to the channel.
+ *
+ * @since 1.5
+ */
+ public static Channel inheritedChannel() throws IOException {
+ return SelectorProvider.provider().inheritedChannel();
+ }
+
+ private static void checkIO() {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(new RuntimePermission("setIO"));
+ }
+ }
+
+ private static native void setIn0(InputStream in);
+ private static native void setOut0(PrintStream out);
+ private static native void setErr0(PrintStream err);
+
+ /**
+ * Sets the System security.
+ *
+ * <p> If there is a security manager already installed, this method first
+ * calls the security manager''s <code>checkPermission</code> method
+ * with a <code>RuntimePermission("setSecurityManager")</code>
+ * permission to ensure it''s ok to replace the existing
+ * security manager.
+ * This may result in throwing a <code>SecurityException</code>.
+ *
+ * <p> Otherwise, the argument is established as the current
+ * security manager. If the argument is <code>null</code> and no
+ * security manager has been established, then no action is taken and
+ * the method simply returns.
+ *
+ * @param s the security manager.
+ * @exception SecurityException if the security manager has already
+ * been set and its <code>checkPermission</code> method
+ * doesn''t allow it to be replaced.
+ * @see #getSecurityManager
+ * @see SecurityManager#checkPermission
+ * @see java.lang.RuntimePermission
+ */
+ public static
+ void setSecurityManager(final SecurityManager s) {
+ try {
+ s.checkPackageAccess("java.lang");
+ } catch (Exception e) {
+ // no-op
+ }
+ setSecurityManager0(s);
+ }
+
+ private static synchronized
+ void setSecurityManager0(final SecurityManager s) {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ // ask the currently installed security manager if we
+ // can replace it.
+ sm.checkPermission(new RuntimePermission
+ ("setSecurityManager"));
+ }
+
+ if ((s !!= null) && (s.getClass().getClassLoader() !!= null)) {
+ // New security manager class is not on bootstrap classpath.
+ // Cause policy to get initialized before we install the new
+ // security manager, in order to prevent infinite loops when
+ // trying to initialize the policy (which usually involves
+ // accessing some security and/or system properties, which in turn
+ // calls the installed security manager''s checkPermission method
+ // which will loop infinitely if there is a non-system class
+ // (in this case: the new security manager class) on the stack).
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ s.getClass().getProtectionDomain().implies
+ (SecurityConstants.ALL_PERMISSION);
+ return null;
+ }
+ });
+ }
+
+ security = s;
+ }
+
+ /**
+ * Gets the system security interface.
+ *
+ * @return if a security manager has already been established for the
+ * current application, then that security manager is returned;
+ * otherwise, <code>null</code> is returned.
+ * @see #setSecurityManager
+ */
+ public static SecurityManager getSecurityManager() {
+ return security;
+ }
+
+ /**
+ * Returns the current time in milliseconds. Note that
+ * while the unit of time of the return value is a millisecond,
+ * the granularity of the value depends on the underlying
+ * operating system and may be larger. For example, many
+ * operating systems measure time in units of tens of
+ * milliseconds.
+ *
+ * <p> See the description of the class <code>Date</code> for
+ * a discussion of slight discrepancies that may arise between
+ * "computer time" and coordinated universal time (UTC).
+ *
+ * @return the difference, measured in milliseconds, between
+ * the current time and midnight, January 1, 1970 UTC.
+ * @see java.util.Date
+ */
+ public static native long currentTimeMillis();
+
+ /**
+ * Returns the current value of the most precise available system
+ * timer, in nanoseconds.
+ *
+ * <p>This method can only be used to measure elapsed time and is
+ * not related to any other notion of system or wall-clock time.
+ * The value returned represents nanoseconds since some fixed but
+ * arbitrary time (perhaps in the future, so values may be
+ * negative). This method provides nanosecond precision, but not
+ * necessarily nanosecond accuracy. No guarantees are made about
+ * how frequently values change. Differences in successive calls
+ * that span greater than approximately 292 years (2<sup>63</sup>
+ * nanoseconds) will not accurately compute elapsed time due to
+ * numerical overflow.
+ *
+ * <p> For example, to measure how long some code takes to execute:
+ * <pre>
+ * long startTime = System.nanoTime();
+ * // ... the code being measured ...
+ * long estimatedTime = System.nanoTime() - startTime;
+ * </pre>
+ *
+ * @return The current value of the system timer, in nanoseconds.
+ * @since 1.5
+ */
+ public static native long nanoTime();
+
+ /**
+ * Copies an array from the specified source array, beginning at the
+ * specified position, to the specified position of the destination array.
+ * A subsequence of array components are copied from the source
+ * array referenced by <code>src</code> to the destination array
+ * referenced by <code>dest</code>. The number of components copied is
+ * equal to the <code>length</code> argument. The components at
+ * positions <code>srcPos</code> through
+ * <code>srcPos+length-1</code> in the source array are copied into
+ * positions <code>destPos</code> through
+ * <code>destPos+length-1</code>, respectively, of the destination
+ * array.
+ * <p>
+ * If the <code>src</code> and <code>dest</code> arguments refer to the
+ * same array object, then the copying is performed as if the
+ * components at positions <code>srcPos</code> through
+ * <code>srcPos+length-1</code> were first copied to a temporary
+ * array with <code>length</code> components and then the contents of
+ * the temporary array were copied into positions
+ * <code>destPos</code> through <code>destPos+length-1</code> of the
+ * destination array.
+ * <p>
+ * If <code>dest</code> is <code>null</code>, then a
+ * <code>NullPointerException</code> is thrown.
+ * <p>
+ * If <code>src</code> is <code>null</code>, then a
+ * <code>NullPointerException</code> is thrown and the destination
+ * array is not modified.
+ * <p>
+ * Otherwise, if any of the following is true, an
+ * <code>ArrayStoreException</code> is thrown and the destination is
+ * not modified:
+ * <ul>
+ * <li>The <code>src</code> argument refers to an object that is not an
+ * array.
+ * <li>The <code>dest</code> argument refers to an object that is not an
+ * array.
+ * <li>The <code>src</code> argument and <code>dest</code> argument refer
+ * to arrays whose component types are different primitive types.
+ * <li>The <code>src</code> argument refers to an array with a primitive
+ * component type and the <code>dest</code> argument refers to an array
+ * with a reference component type.
+ * <li>The <code>src</code> argument refers to an array with a reference
+ * component type and the <code>dest</code> argument refers to an array
+ * with a primitive component type.
+ * </ul>
+ * <p>
+ * Otherwise, if any of the following is true, an
+ * <code>IndexOutOfBoundsException</code> is
+ * thrown and the destination is not modified:
+ * <ul>
+ * <li>The <code>srcPos</code> argument is negative.
+ * <li>The <code>destPos</code> argument is negative.
+ * <li>The <code>length</code> argument is negative.
+ * <li><code>srcPos+length</code> is greater than
+ * <code>src.length</code>, the length of the source array.
+ * <li><code>destPos+length</code> is greater than
+ * <code>dest.length</code>, the length of the destination array.
+ * </ul>
+ * <p>
+ * Otherwise, if any actual component of the source array from
+ * position <code>srcPos</code> through
+ * <code>srcPos+length-1</code> cannot be converted to the component
+ * type of the destination array by assignment conversion, an
+ * <code>ArrayStoreException</code> is thrown. In this case, let
+ * <b><i>k</i></b> be the smallest nonnegative integer less than
+ * length such that <code>src[srcPos+</code><i>k</i><code>]</code>
+ * cannot be converted to the component type of the destination
+ * array; when the exception is thrown, source array components from
+ * positions <code>srcPos</code> through
+ * <code>srcPos+</code><i>k</i><code>-1</code>
+ * will already have been copied to destination array positions
+ * <code>destPos</code> through
+ * <code>destPos+</code><i>k</I><code>-1</code> and no other
+ * positions of the destination array will have been modified.
+ * (Because of the restrictions already itemized, this
+ * paragraph effectively applies only to the situation where both
+ * arrays have component types that are reference types.)
+ *
+ * @param src the source array.
+ * @param srcPos starting position in the source array.
+ * @param dest the destination array.
+ * @param destPos starting position in the destination data.
+ * @param length the number of array elements to be copied.
+ * @exception IndexOutOfBoundsException if copying would cause
+ * access of data outside array bounds.
+ * @exception ArrayStoreException if an element in the <code>src</code>
+ * array could not be stored into the <code>dest</code> array
+ * because of a type mismatch.
+ * @exception NullPointerException if either <code>src</code> or
+ * <code>dest</code> is <code>null</code>.
+ */
+ public static native void arraycopy(Object src, int srcPos,
+ Object dest, int destPos,
+ int length);
+
+ /**
+ * Returns the same hash code for the given object as
+ * would be returned by the default method hashCode(),
+ * whether or not the given object''s class overrides
+ * hashCode().
+ * The hash code for the null reference is zero.
+ *
+ * @param x object for which the hashCode is to be calculated
+ * @return the hashCode
+ * @since JDK1.1
+ */
+ public static native int identityHashCode(Object x);
+
+ /**
+ * System properties. The following properties are guaranteed to be defined:
+ * <dl>
+ * <dt>java.version <dd>Java version number
+ * <dt>java.vendor <dd>Java vendor specific string
+ * <dt>java.vendor.url <dd>Java vendor URL
+ * <dt>java.home <dd>Java installation directory
+ * <dt>java.class.version <dd>Java class version number
+ * <dt>java.class.path <dd>Java classpath
+ * <dt>os.name <dd>Operating System Name
+ * <dt>os.arch <dd>Operating System Architecture
+ * <dt>os.version <dd>Operating System Version
+ * <dt>file.separator <dd>File separator ("/" on Unix)
+ * <dt>path.separator <dd>Path separator (":" on Unix)
+ * <dt>line.separator <dd>Line separator ("\n" on Unix)
+ * <dt>user.name <dd>User account name
+ * <dt>user.home <dd>User home directory
+ * <dt>user.dir <dd>User''s current working directory
+ * </dl>
+ */
+
+ private static Properties props;
+ private static native Properties initProperties(Properties props);
+
+ /**
+ * Determines the current system properties.
+ * <p>
+ * First, if there is a security manager, its
+ * <code>checkPropertiesAccess</code> method is called with no
+ * arguments. This may result in a security exception.
+ * <p>
+ * The current set of system properties for use by the
+ * {@link #getProperty(String)} method is returned as a
+ * <code>Properties</code> object. If there is no current set of
+ * system properties, a set of system properties is first created and
+ * initialized. This set of system properties always includes values
+ * for the following keys:
+ * <table summary="Shows property keys and associated values">
+ * <tr><th>Key</th>
+ * <th>Description of Associated Value</th></tr>
+ * <tr><td><code>java.version</code></td>
+ * <td>Java Runtime Environment version</td></tr>
+ * <tr><td><code>java.vendor</code></td>
+ * <td>Java Runtime Environment vendor</td></tr
+ * <tr><td><code>java.vendor.url</code></td>
+ * <td>Java vendor URL</td></tr>
+ * <tr><td><code>java.home</code></td>
+ * <td>Java installation directory</td></tr>
+ * <tr><td><code>java.vm.specification.version</code></td>
+ * <td>Java Virtual Machine specification version</td></tr>
+ * <tr><td><code>java.vm.specification.vendor</code></td>
+ * <td>Java Virtual Machine specification vendor</td></tr>
+ * <tr><td><code>java.vm.specification.name</code></td>
+ * <td>Java Virtual Machine specification name</td></tr>
+ * <tr><td><code>java.vm.version</code></td>
+ * <td>Java Virtual Machine implementation version</td></tr>
+ * <tr><td><code>java.vm.vendor</code></td>
+ * <td>Java Virtual Machine implementation vendor</td></tr>
+ * <tr><td><code>java.vm.name</code></td>
+ * <td>Java Virtual Machine implementation name</td></tr>
+ * <tr><td><code>java.specification.version</code></td>
+ * <td>Java Runtime Environment specification version</td></tr>
+ * <tr><td><code>java.specification.vendor</code></td>
+ * <td>Java Runtime Environment specification vendor</td></tr>
+ * <tr><td><code>java.specification.name</code></td>
+ * <td>Java Runtime Environment specification name</td></tr>
+ * <tr><td><code>java.class.version</code></td>
+ * <td>Java class format version number</td></tr>
+ * <tr><td><code>java.class.path</code></td>
+ * <td>Java class path</td></tr>
+ * <tr><td><code>java.library.path</code></td>
+ * <td>List of paths to search when loading libraries</td></tr>
+ * <tr><td><code>java.io.tmpdir</code></td>
+ * <td>Default temp file path</td></tr>
+ * <tr><td><code>java.compiler</code></td>
+ * <td>Name of JIT compiler to use</td></tr>
+ * <tr><td><code>java.ext.dirs</code></td>
+ * <td>Path of extension directory or directories</td></tr>
+ * <tr><td><code>os.name</code></td>
+ * <td>Operating system name</td></tr>
+ * <tr><td><code>os.arch</code></td>
+ * <td>Operating system architecture</td></tr>
+ * <tr><td><code>os.version</code></td>
+ * <td>Operating system version</td></tr>
+ * <tr><td><code>file.separator</code></td>
+ * <td>File separator ("/" on UNIX)</td></tr>
+ * <tr><td><code>path.separator</code></td>
+ * <td>Path separator (":" on UNIX)</td></tr>
+ * <tr><td><code>line.separator</code></td>
+ * <td>Line separator ("\n" on UNIX)</td></tr>
+ * <tr><td><code>user.name</code></td>
+ * <td>User''s account name</td></tr>
+ * <tr><td><code>user.home</code></td>
+ * <td>User''s home directory</td></tr>
+ * <tr><td><code>user.dir</code></td>
+ * <td>User''s current working directory</td></tr>
+ * </table>
+ * <p>
+ * Multiple paths in a system property value are separated by the path
+ * separator character of the platform.
+ * <p>
+ * Note that even if the security manager does not permit the
+ * <code>getProperties</code> operation, it may choose to permit the
+ * {@link #getProperty(String)} operation.
+ *
+ * @return the system properties
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn''t allow access
+ * to the system properties.
+ * @see #setProperties
+ * @see java.lang.SecurityException
+ * @see java.lang.SecurityManager#checkPropertiesAccess()
+ * @see java.util.Properties
+ */
+ public static Properties getProperties() {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPropertiesAccess();
+ }
+
+ return props;
+ }
+
+ /**
+ * Sets the system properties to the <code>Properties</code>
+ * argument.
+ * <p>
+ * First, if there is a security manager, its
+ * <code>checkPropertiesAccess</code> method is called with no
+ * arguments. This may result in a security exception.
+ * <p>
+ * The argument becomes the current set of system properties for use
+ * by the {@link #getProperty(String)} method. If the argument is
+ * <code>null</code>, then the current set of system properties is
+ * forgotten.
+ *
+ * @param props the new system properties.
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertiesAccess</code> method doesn''t allow access
+ * to the system properties.
+ * @see #getProperties
+ * @see java.util.Properties
+ * @see java.lang.SecurityException
+ * @see java.lang.SecurityManager#checkPropertiesAccess()
+ */
+ public static void setProperties(Properties props) {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPropertiesAccess();
+ }
+ if (props == null) {
+ props = new Properties();
+ initProperties(props);
+ }
+ System.props = props;
+ }
+
+ /**
+ * Gets the system property indicated by the specified key.
+ * <p>
+ * First, if there is a security manager, its
+ * <code>checkPropertyAccess</code> method is called with the key as
+ * its argument. This may result in a SecurityException.
+ * <p>
+ * If there is no current set of system properties, a set of system
+ * properties is first created and initialized in the same manner as
+ * for the <code>getProperties</code> method.
+ *
+ * @param key the name of the system property.
+ * @return the string value of the system property,
+ * or <code>null</code> if there is no property with that key.
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertyAccess</code> method doesn''t allow
+ * access to the specified system property.
+ * @exception NullPointerException if <code>key</code> is
+ * <code>null</code>.
+ * @exception IllegalArgumentException if <code>key</code> is empty.
+ * @see #setProperty
+ * @see java.lang.SecurityException
+ * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
+ * @see java.lang.System#getProperties()
+ */
+ public static String getProperty(String key) {
+ checkKey(key);
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPropertyAccess(key);
+ }
+
+ return props.getProperty(key);
+ }
+
+ /**
+ * Gets the system property indicated by the specified key.
+ * <p>
+ * First, if there is a security manager, its
+ * <code>checkPropertyAccess</code> method is called with the
+ * <code>key</code> as its argument.
+ * <p>
+ * If there is no current set of system properties, a set of system
+ * properties is first created and initialized in the same manner as
+ * for the <code>getProperties</code> method.
+ *
+ * @param key the name of the system property.
+ * @param def a default value.
+ * @return the string value of the system property,
+ * or the default value if there is no property with that key.
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertyAccess</code> method doesn''t allow
+ * access to the specified system property.
+ * @exception NullPointerException if <code>key</code> is
+ * <code>null</code>.
+ * @exception IllegalArgumentException if <code>key</code> is empty.
+ * @see #setProperty
+ * @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
+ * @see java.lang.System#getProperties()
+ */
+ public static String getProperty(String key, String def) {
+ checkKey(key);
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPropertyAccess(key);
+ }
+
+ return props.getProperty(key, def);
+ }
+
+ /**
+ * Sets the system property indicated by the specified key.
+ * <p>
+ * First, if a security manager exists, its
+ * <code>SecurityManager.checkPermission</code> method
+ * is called with a <code>PropertyPermission(key, "write")</code>
+ * permission. This may result in a SecurityException being thrown.
+ * If no exception is thrown, the specified property is set to the given
+ * value.
+ * <p>
+ *
+ * @param key the name of the system property.
+ * @param value the value of the system property.
+ * @return the previous value of the system property,
+ * or <code>null</code> if it did not have one.
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPermission</code> method doesn''t allow
+ * setting of the specified property.
+ * @exception NullPointerException if <code>key</code> or
+ * <code>value</code> is <code>null</code>.
+ * @exception IllegalArgumentException if <code>key</code> is empty.
+ * @see #getProperty
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ * @see java.util.PropertyPermission
+ * @see SecurityManager#checkPermission
+ * @since 1.2
+ */
+ public static String setProperty(String key, String value) {
+ checkKey(key);
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(new PropertyPermission(key,
+ SecurityConstants.PROPERTY_WRITE_ACTION));
+ }
+
+ return (String) props.setProperty(key, value);
+ }
+
+ /**
+ * Removes the system property indicated by the specified key.
+ * <p>
+ * First, if a security manager exists, its
+ * <code>SecurityManager.checkPermission</code> method
+ * is called with a <code>PropertyPermission(key, "write")</code>
+ * permission. This may result in a SecurityException being thrown.
+ * If no exception is thrown, the specified property is removed.
+ * <p>
+ *
+ * @param key the name of the system property to be removed.
+ * @return the previous string value of the system property,
+ * or <code>null</code> if there was no property with that key.
+ *
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkPropertyAccess</code> method doesn''t allow
+ * access to the specified system property.
+ * @exception NullPointerException if <code>key</code> is
+ * <code>null</code>.
+ * @exception IllegalArgumentException if <code>key</code> is empty.
+ * @see #getProperty
+ * @see #setProperty
+ * @see java.util.Properties
+ * @see java.lang.SecurityException
+ * @see java.lang.SecurityManager#checkPropertiesAccess()
+ * @since 1.5
+ */
+ public static String clearProperty(String key) {
+ checkKey(key);
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(new PropertyPermission(key, "write"));
+ }
+
+ return (String) props.remove(key);
+ }
+
+ private static void checkKey(String key) {
+ if (key == null) {
+ throw new NullPointerException("key can''t be null");
+ }
+ if (key.equals("")) {
+ throw new IllegalArgumentException("key can''t be empty");
+ }
+ }
+
+ /**
+ * Gets the value of the specified environment variable. An
+ * environment variable is a system-dependent external named
+ * value.
+ *
+ * <p>If a security manager exists, its
+ * {@link SecurityManager#checkPermission checkPermission}
+ * method is called with a
+ * <code>{@link RuntimePermission}("getenv."+name)</code>
+ * permission. This may result in a {@link SecurityException}
+ * being thrown. If no exception is thrown the value of the
+ * variable <code>name</code> is returned.
+ *
+ * <p><a name="EnvironmentVSSystemProperties"><i>System
+ * properties</i> and <i>environment variables</i></a> are both
+ * conceptually mappings between names and values. Both
+ * mechanisms can be used to pass user-defined information to a
+ * Java process. Environment variables have a more global effect,
+ * because they are visible to all descendants of the process
+ * which defines them, not just the immediate Java subprocess.
+ * They can have subtly different semantics, such as case
+ * insensitivity, on different operating systems. For these
+ * reasons, environment variables are more likely to have
+ * unintended side effects. It is best to use system properties
+ * where possible. Environment variables should be used when a
+ * global effect is desired, or when an external system interface
+ * requires an environment variable (such as <code>PATH</code>).
+ *
+ * <p>On UNIX systems the alphabetic case of <code>name</code> is
+ * typically significant, while on Microsoft Windows systems it is
+ * typically not. For example, the expression
+ * <code>System.getenv("FOO").equals(System.getenv("foo"))</code>
+ * is likely to be true on Microsoft Windows.
+ *
+ * @param name the name of the environment variable
+ * @return the string value of the variable, or <code>null</code>
+ * if the variable is not defined in the system environment
+ * @throws NullPointerException if <code>name</code> is <code>null</code>
+ * @throws SecurityException
+ * if a security manager exists and its
+ * {@link SecurityManager#checkPermission checkPermission}
+ * method doesn''t allow access to the environment variable
+ * <code>name</code>
+ * @see #getenv()
+ * @see ProcessBuilder#environment()
+ */
+ public static String getenv(String name) {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(new RuntimePermission("getenv."+name));
+ }
+
+ return ProcessEnvironment.getenv(name);
+ }
+
+
+ /**
+ * Returns an unmodifiable string map view of the current system environment.
+ * The environment is a system-dependent mapping from names to
+ * values which is passed from parent to child processes.
+ *
+ * <p>If the system does not support environment variables, an
+ * empty map is returned.
+ *
+ * <p>The returned map will never contain null keys or values.
+ * Attempting to query the presence of a null key or value will
+ * throw a {@link NullPointerException}. Attempting to query
+ * the presence of a key or value which is not of type
+ * {@link String} will throw a {@link ClassCastException}.
+ *
+ * <p>The returned map and its collection views may not obey the
+ * general contract of the {@link Object#equals} and
+ * {@link Object#hashCode} methods.
+ *
+ * <p>The returned map is typically case-sensitive on all platforms.
+ *
+ * <p>If a security manager exists, its
+ * {@link SecurityManager#checkPermission checkPermission}
+ * method is called with a
+ * <code>{@link RuntimePermission}("getenv.*")</code>
+ * permission. This may result in a {@link SecurityException} being
+ * thrown.
+ *
+ * <p>When passing information to a Java subprocess,
+ * <a href=#EnvironmentVSSystemProperties>system properties</a>
+ * are generally preferred over environment variables.
+ *
+ * @return the environment as a map of variable names to values
+ * @throws SecurityException
+ * if a security manager exists and its
+ * {@link SecurityManager#checkPermission checkPermission}
+ * method doesn''t allow access to the process environment
+ * @see #getenv(String)
+ * @see ProcessBuilder#environment()
+ * @since 1.5
+ */
+ public static java.util.Map<String,String> getenv() {
+ SecurityManager sm = getSecurityManager();
+ if (sm !!= null) {
+ sm.checkPermission(new RuntimePermission("getenv.*"));
+ }
+
+ return ProcessEnvironment.getenv();
+ }
+
+ /**
+ * Terminates the currently running Java Virtual Machine. The
+ * argument serves as a status code; by convention, a nonzero status
+ * code indicates abnormal termination.
+ * <p>
+ * This method calls the <code>exit</code> method in class
+ * <code>Runtime</code>. This method never returns normally.
+ * <p>
+ * The call <code>System.exit(n)</code> is effectively equivalent to
+ * the call:
+ * <blockquote><pre>
+ * Runtime.getRuntime().exit(n)
+ * </pre></blockquote>
+ *
+ * @param status exit status.
+ * @throws SecurityException
+ * if a security manager exists and its <code>checkExit</code>
+ * method doesn''t allow exit with the specified status.
+ * @see java.lang.Runtime#exit(int)
+ */
+ public static void exit(int status) {
+ Runtime.getRuntime().exit(status);
+ }
+
+ /**
+ * Runs the garbage collector.
+ * <p>
+ * Calling the <code>gc</code> method suggests that the Java Virtual
+ * Machine expend effort toward recycling unused objects in order to
+ * make the memory they currently occupy available for quick reuse.
+ * When control returns from the method call, the Java Virtual
+ * Machine has made a best effort to reclaim space from all discarded
+ * objects.
+ * <p>
+ * The call <code>System.gc()</code> is effectively equivalent to the
+ * call:
+ * <blockquote><pre>
+ * Runtime.getRuntime().gc()
+ * </pre></blockquote>
+ *
+ * @see java.lang.Runtime#gc()
+ */
+ public static void gc() {
+ Runtime.getRuntime().gc();
+ }
+
+ /**
+ * Runs the finalization methods of any objects pending finalization.
+ * <p>
+ * Calling this method suggests that the Java Virtual Machine expend
+ * effort toward running the <code>finalize</code> methods of objects
+ * that have been found to be discarded but whose <code>finalize</code>
+ * methods have not yet been run. When control returns from the
+ * method call, the Java Virtual Machine has made a best effort to
+ * complete all outstanding finalizations.
+ * <p>
+ * The call <code>System.runFinalization()</code> is effectively
+ * equivalent to the call:
+ * <blockquote><pre>
+ * Runtime.getRuntime().runFinalization()
+ * </pre></blockquote>
+ *
+ * @see java.lang.Runtime#runFinalization()
+ */
+ public static void runFinalization() {
+ Runtime.getRuntime().runFinalization();
+ }
+
+ /**
+ * Enable or disable finalization on exit; doing so specifies that the
+ * finalizers of all objects that have finalizers that have not yet been
+ * automatically invoked are to be run before the Java runtime exits.
+ * By default, finalization on exit is disabled.
+ *
+ * <p>If there is a security manager,
+ * its <code>checkExit</code> method is first called
+ * with 0 as its argument to ensure the exit is allowed.
+ * This could result in a SecurityException.
+ *
+ * @deprecated This method is inherently unsafe. It may result in
+ * finalizers being called on live objects while other threads are
+ * concurrently manipulating those objects, resulting in erratic
+ * behavior or deadlock.
+ * @param value indicating enabling or disabling of finalization
+ * @throws SecurityException
+ * if a security manager exists and its <code>checkExit</code>
+ * method doesn''t allow the exit.
+ *
+ * @see java.lang.Runtime#exit(int)
+ * @see java.lang.Runtime#gc()
+ * @see java.lang.SecurityManager#checkExit(int)
+ * @since JDK1.1
+ */
+ @Deprecated
+ public static void runFinalizersOnExit(boolean value) {
+ Runtime.getRuntime().runFinalizersOnExit(value);
+ }
+
+ /**
+ * Loads a code file with the specified filename from the local file
+ * system as a dynamic library. The filename
+ * argument must be a complete path name.
+ * <p>
+ * The call <code>System.load(name)</code> is effectively equivalent
+ * to the call:
+ * <blockquote><pre>
+ * Runtime.getRuntime().load(name)
+ * </pre></blockquote>
+ *
+ * @param filename the file to load.
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkLink</code> method doesn''t allow
+ * loading of the specified dynamic library
+ * @exception UnsatisfiedLinkError if the file does not exist.
+ * @exception NullPointerException if <code>filename</code> is
+ * <code>null</code>
+ * @see java.lang.Runtime#load(java.lang.String)
+ * @see java.lang.SecurityManager#checkLink(java.lang.String)
+ */
+ public static void load(String filename) {
+ Runtime.getRuntime().load0(getCallerClass(), filename);
+ }
+
+ /**
+ * Loads the system library specified by the <code>libname</code>
+ * argument. The manner in which a library name is mapped to the
+ * actual system library is system dependent.
+ * <p>
+ * The call <code>System.loadLibrary(name)</code> is effectively
+ * equivalent to the call
+ * <blockquote><pre>
+ * Runtime.getRuntime().loadLibrary(name)
+ * </pre></blockquote>
+ *
+ * @param libname the name of the library.
+ * @exception SecurityException if a security manager exists and its
+ * <code>checkLink</code> method doesn''t allow
+ * loading of the specified dynamic library
+ * @exception UnsatisfiedLinkError if the library does not exist.
+ * @exception NullPointerException if <code>libname</code> is
+ * <code>null</code>
+ * @see java.lang.Runtime#loadLibrary(java.lang.String)
+ * @see java.lang.SecurityManager#checkLink(java.lang.String)
+ */
+ public static void loadLibrary(String libname) {
+ Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
+ }
+
+ /**
+ * Maps a library name into a platform-specific string representing
+ * a native library.
+ *
+ * @param libname the name of the library.
+ * @return a platform-dependent native library name.
+ * @exception NullPointerException if <code>libname</code> is
+ * <code>null</code>
+ * @see java.lang.System#loadLibrary(java.lang.String)
+ * @see java.lang.ClassLoader#findLibrary(java.lang.String)
+ * @since 1.2
+ */
+ public static native String mapLibraryName(String libname);
+
+ /**
+ * The following two methods exist because in, out, and err must be
+ * initialized to null. The compiler, however, cannot be permitted to
+ * inline access to them, since they are later set to more sensible values
+ * by initializeSystemClass().
+ */
+ private static InputStream nullInputStream() throws NullPointerException {
+ if (currentTimeMillis() > 0) {
+ return null;
+ }
+ throw new NullPointerException();
+ }
+
+ private static PrintStream nullPrintStream() throws NullPointerException {
+ if (currentTimeMillis() > 0) {
+ return null;
+ }
+ throw new NullPointerException();
+ }
+
+ /**
+ * Initialize the system class. Called after thread initialization.
+ */
+ private static void initializeSystemClass() {
+ props = new Properties();
+ initProperties(props);
+ sun.misc.Version.init();
+
+ // Workaround until DownloadManager initialization is revisited.
+ // Make JavaLangAccess available early enough for internal
+ // Shutdown hooks to be registered
+ setJavaLangAccess();
+
+ // Gets and removes system properties that configure the Integer
+ // cache used to support the object identity semantics of autoboxing.
+ // At this time, the size of the cache may be controlled by the
+ // vm option -XX:AutoBoxCacheMax=<size>.
+ Integer.getAndRemoveCacheProperties();
+
+ // Load the zip library now in order to keep java.util.zip.ZipFile
+ // from trying to use itself to load this library later.
+ loadLibrary("zip");
+
+ FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
+ FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
+ FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
+ setIn0(new BufferedInputStream(fdIn));
+ setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
+ setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));
+
+ // Setup Java signal handlers for HUP, TERM, and INT (where available).
+ Terminator.setup();
+
+ // Initialize any miscellenous operating system settings that need to be
+ // set for the class libraries. Currently this is no-op everywhere except
+ // for Windows where the process-wide error mode is set before the java.io
+ // classes are used.
+ sun.misc.VM.initializeOSEnvironment();
+
+ // Set the maximum amount of direct memory. This value is controlled
+ // by the vm option -XX:MaxDirectMemorySize=<size>. This method acts
+ // as an initializer only if it is called before sun.misc.VM.booted().
+ sun.misc.VM.maxDirectMemory();
+
+ // Set a boolean to determine whether ClassLoader.loadClass accepts
+ // array syntax. This value is controlled by the system property
+ // "sun.lang.ClassLoader.allowArraySyntax". This method acts as
+ // an initializer only if it is called before sun.misc.VM.booted().
+ sun.misc.VM.allowArraySyntax();
+
+ // Subsystems that are invoked during initialization can invoke
+ // sun.misc.VM.isBooted() in order to avoid doing things that should
+ // wait until the application class loader has been set up.
+ sun.misc.VM.booted();
+
+ // The main thread is not added to its thread group in the same
+ // way as other threads; we must do it ourselves here.
+ Thread current = Thread.currentThread();
+ current.getThreadGroup().add(current);
+ }
+
+ private static void setJavaLangAccess() {
+ // Allow privileged classes outside of java.lang
+ sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
+ public sun.reflect.ConstantPool getConstantPool(Class klass) {
+ return klass.getConstantPool();
+ }
+ public void setAnnotationType(Class klass, AnnotationType type) {
+ klass.setAnnotationType(type);
+ }
+ public AnnotationType getAnnotationType(Class klass) {
+ return klass.getAnnotationType();
+ }
+ public <E extends Enum<E>>
+ E[] getEnumConstantsShared(Class<E> klass) {
+ return klass.getEnumConstantsShared();
+ }
+ public void blockedOn(Thread t, Interruptible b) {
+ t.blockedOn(b);
+ }
+ public void registerShutdownHook(int slot, Runnable r) {
+ Shutdown.add(slot, r);
+ }
+ });
+ }
+
+ /* returns the class of the caller. */
+ static Class getCallerClass() {
+ // NOTE use of more generic Reflection.getCallerClass()
+ return Reflection.getCallerClass(3);
+ }
+}
+
+ '
+].
+ Transcript showCR: 'java.lang.System parsed in ', time asString, ' miliseconds'.
+ ^ res.
+
+ "Modified: / 30-12-2010 / 11:40:03 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaParserTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaPopUpView.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaPopUpView.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1999 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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' }"
PopUpView subclass:#JavaPopUpView
@@ -24,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1999 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,8 +65,34 @@
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
@@ -140,5 +198,9 @@
!JavaPopUpView class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaPopUpView.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaPopUpView.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaProcess.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaProcess.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,9 +12,33 @@
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' }"
Process subclass:#JavaProcess
@@ -20,12 +48,23 @@
category:'Languages-Java-Classes'
!
+Object subclass:#Helper
+ instanceVariableNames:'javaThreadObject javaProcess'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaProcess
+!
+
!JavaProcess class methodsFor:'documentation'!
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -33,8 +72,43 @@
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.
+
"
+! !
+!JavaProcess class methodsFor:'instance creation'!
+
+newHelper
+
+ ^Helper new
+
+ "Created: / 15-12-2010 / 11:11:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaProcess methodsFor:'accessing'!
@@ -84,8 +158,147 @@
"Created: / 10.4.1998 / 15:21:15 / cg"
! !
+!JavaProcess methodsFor:'suspend & resume'!
+
+terminateNoSignal
+
+ | jThread |
+ jThread := Java threads keyAtValue: self.
+ JavaVM wakeup: jThread.
+
+ super terminateNoSignal
+
+ "Created: / 15-12-2010 / 00:18:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-12-2010 / 11:19:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaProcess::Helper methodsFor:'initialization'!
+
+javaProcess:something
+ javaProcess := something.
+!
+
+javaThreadObject:something
+ javaThreadObject := something.
+! !
+
+!JavaProcess::Helper methodsFor:'support'!
+
+value
+ |procName|
+
+ Object abortSignal
+ handle:[:ex |
+ procName := javaProcess name.
+ (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
+ ('JAVA [info]: thread ' , procName , ' aborted - restarting process.')
+ infoPrintCR.
+ ex restart.
+ ] ifFalse:[
+ (javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread')
+ or:[javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread')])
+ ifTrue:[
+ ('JAVA [info]: thread ' , procName , ' aborted - restarting process.')
+ infoPrintCR.
+ ex restart
+ ]
+ ifFalse:[('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR.]
+ ].
+ ]
+ do:[
+ [
+ JavaVM javaExceptionSignal
+ handle:[:ex |
+ |exClass|
+
+ procName := javaProcess name.
+ exClass := ex parameter class.
+ exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
+ ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
+ ] ifFalse:[
+ Transcript
+ showCR:('JAVA: thread ''' , procName , ''' terminated with exception: '
+ , exClass name).
+ ].
+ ex return.
+ ]
+ do:[
+ Object messageNotUnderstoodSignal
+ handle:[:ex |
+ |
+ "/ remap doesNotUnderstand with nil-receiver to
+ "/ a nullPointerException ...
+ con m|
+
+ con := ex suspendedContext.
+ con receiver isNil ifTrue:[
+ ((m := con sender method) notNil and:[m isJavaMethod]) ifTrue:[
+ JavaVM throwNullPointerException.
+ AbortSignal raise.
+
+ "/ ex proceed.
+ ]
+ ].
+ ex reject.
+ ]
+ do:[
+ "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
+ javaThreadObject perform:#'run()V'.
+ (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+ ('JAVA: thread ' , javaProcess name , ' terminated') infoPrintCR.
+ ].
+ javaThreadObject perform:#'exit()V'.
+ (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+ ('JAVA: after exit of thread ' , javaProcess name) infoPrintCR.
+ ]
+ ]
+ ]
+ ] ensure:[
+ |monitors|
+
+ monitors := (Smalltalk at:#'JavaVM:EnteredMonitorsPerProcess')
+ at:javaProcess
+ ifAbsent:nil.
+ monitors notNil ifTrue:[
+ monitors do:[:obj |
+ |mon|
+
+ mon := JavaVM monitorFor:obj.
+ mon notNil ifTrue:[
+ mon owningProcess == javaProcess ifTrue:[
+ ('JAVA: release monitor owned by dying thread: ' , javaProcess name)
+ infoPrintCR.
+ self breakPoint: #jv.
+ mon exit
+ ].
+ ].
+ ].
+ (Smalltalk at:#'JavaVM:EnteredMonitorsPerProcess') removeKey:javaProcess.
+ javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') ifTrue:[
+ Smalltalk at:#'JavaVM:JavaScreenUpdaterThread' put:nil.
+ ].
+ javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread') ifTrue:[
+ Smalltalk at:#'JavaVM:JavaEventQueueThread' put:nil.
+ ].
+
+"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.
+"/ screenUpdaterClass notNil ifTrue:[
+"/ screenUpdaterClass instVarNamed:'updater' put:nil.
+"/ ].
+ ].
+ Java threads removeKey:javaThreadObject ifAbsent:[].
+ ]
+ ]
+
+ "Created: / 15-12-2010 / 11:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaProcess class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaProcess.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaProcess.st,v 1.15 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,319 @@
+"
+ 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:#JavaRef2
+ instanceVariableNames:'valueCache constantPool'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaRef2 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 am parent of all reference types found in runtime constant pool. I define basic api - resolve and invalidate.
+ Basic use case is to call resolve on my instance to get resolved thing, or to call invalidate to tell me,
+ that world has changed and my cache is no longer valid.
+
+ [author:]
+ Marcel Hlopko <hlopkmar@fel.cvut.cz>
+
+ [instance variables:]
+ isResolved - flag telling whether instance is resolved
+ valueCache - field holding resolved object
+ owner - java class owning constant pool
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavaRef2 class methodsFor:'instance creation'!
+
+new
+ "Don't call me directly"
+
+ '[JavaRef] Dont instantiate me with new. Call my custom overriden object creation method'
+ infoPrintCR.
+ ^ self basicNew initialize.
+
+ "Modified: / 11-04-2011 / 19:44:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 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>"
+!
+
+isResolved
+ ^ valueCache isNil not.
+
+ "Created: / 08-04-2011 / 11:36:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-04-2011 / 17:39:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+name
+^ self subclassResponsibility.
+
+ "Created: / 08-04-2011 / 13:53:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+owner
+ ^ constantPool owner.
+
+ "Modified: / 12-05-2011 / 18:31:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+owner: javaClass
+ constantPool owner: javaClass.
+
+ "Modified: / 12-05-2011 / 18:32:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+valueCache
+ ^ valueCache.
+
+ "Created: / 08-04-2011 / 11:37:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 methodsFor:'comparing'!
+
+= anotherJavaRef
+^ self subclassResponsibility.
+
+ "Created: / 08-04-2011 / 12:15:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+hash
+
+^ self subclassResponsibility.
+
+ "Created: / 08-04-2011 / 12:15:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 methodsFor:'initialization'!
+
+initialize
+ valueCache := nil.
+ super initialize.
+
+ "Modified: / 08-04-2011 / 17:39:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 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>"
+! !
+
+!JavaRef2 methodsFor:'printing'!
+
+displayString
+
+ ^self subclassResponsibility
+
+ "Created: / 14-08-2011 / 21:18:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRef2 methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+findResolvedValue
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+! !
+
+!JavaRef2 methodsFor:'queries'!
+
+isJavaRef
+"return true if object represents reference in java constant pool"
+^ true.
+
+ "Created: / 08-04-2011 / 16:15:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+isNewJavaRef
+ "only temporary, to know if ref is old (claus' version) or new (m version)"
+
+ ^ true.
+
+ "Created: / 10-05-2011 / 12:20:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 methodsFor:'resolving'!
+
+invalidate
+ "Invalidate reference. Cache will be cleared and next call to resolve will cause resolving from scratch."
+
+ valueCache := nil.
+
+ "Created: / 08-04-2011 / 11:42:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 08-04-2011 / 17:39:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invalidateForClass: internalJavaClassName
+ "Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
+ Return true, if reference was invalidated."
+
+ ^ self subclassResponsibility.
+
+ "Created: / 08-04-2011 / 15:59:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolve
+ "
+ Do it all method - resolves current reference and returns expected element (JavaMethod, JavaField etc.)
+ Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything
+ else."
+
+ self isResolved ifFalse: [ self findResolvedValue ].
+ ^ valueCache.
+
+ "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveStatic
+ "
+ Do it all method - resolves current reference and returns expected element (JavaMethod, JavaField etc.)
+ Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything
+ else."
+
+ self isResolved ifFalse: [ self findResolvedStaticValue ].
+ ^ valueCache.
+
+ "Created: / 26-04-2011 / 13:19:15 / 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 / 17:54:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRef2 methodsFor:'testing'!
+
+isUnresolved
+
+ ^valueCache isNil
+
+ "Created: / 22-05-2011 / 14:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaRefMock.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,155 @@
+"
+ 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' }"
+
+JavaRef2 subclass:#JavaRefMock
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaRefMock 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.
+
+"
+! !
+
+!JavaRefMock methodsFor:'accessing'!
+
+name
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ 'mock name'
+
+ "Modified: / 08-04-2011 / 16:15:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRefMock methodsFor:'comparing'!
+
+= anotherJavaRef
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+!
+
+hash
+ "superclass JavaRef2 says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+! !
+
+!JavaRefMock methodsFor:'private - resolving'!
+
+findResolvedStaticValue
+ "Resolve reference and set valueCache and isResolved."
+
+ valueCache := 'static'.
+
+ "Created: / 26-04-2011 / 13:20:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+findResolvedValue
+ "Resolve reference and set valueCache and isResolved."
+
+ valueCache := 'ok'.
+
+ "Modified: / 08-04-2011 / 17:39:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRefMock methodsFor:'resolving'!
+
+invalidateForClass: internalJavaClassName
+ "Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
+ Return true, if reference was invalidated."
+
+ internalJavaClassName = 'mock' ifTrue: [self invalidate. ^ true] ifFalse: [^ false].
+
+ "Modified: / 08-04-2011 / 16:16:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRefMock class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaRefTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,200 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaRefTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaRefTests 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.
+
+"
+! !
+
+!JavaRefTests methodsFor:'javaRef tests'!
+
+testCorrectInstanceCreation
+ | javaRef |
+
+ javaRef := JavaRef2 new.
+ self assertFalse: (javaRef isResolved).
+ self assertTrue: (javaRef valueCache isNil).
+ self should: [ javaRef resolve ] raise: SubclassResponsibilityError.
+ self should: [ javaRef resolveStatic ] raise: SubclassResponsibilityError.
+
+ "Created: / 08-04-2011 / 11:40:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-04-2011 / 13:21:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMockedInvalidating
+ | javaRefMock |
+
+ javaRefMock := JavaRefMock new.
+ self assertFalse: (javaRefMock isResolved).
+ self assertTrue: (javaRefMock valueCache isNil).
+ self assertTrue: (javaRefMock resolve = 'ok').
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidate.
+ self assertFalse: (javaRefMock isResolved).
+ self assertTrue: (javaRefMock valueCache isNil).
+ self assertTrue: (javaRefMock resolveStatic = 'static').
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidate.
+ self assertFalse: (javaRefMock isResolved).
+ self assertTrue: (javaRefMock valueCache isNil).
+
+ "Created: / 08-04-2011 / 11:50:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-04-2011 / 13:21:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMockedInvalidatingForClassNegative
+ | javaRefMock |
+
+ javaRefMock := JavaRefMock new.
+ self assertTrue: (javaRefMock isResolved not).
+ javaRefMock resolve.
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidateForClass: 'Ljava/lang/String;'.
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidate.
+ self assertTrue: (javaRefMock isResolved not).
+ javaRefMock resolveStatic.
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidateForClass: 'Ljava/lang/String;'.
+ self assertTrue: (javaRefMock isResolved).
+
+ "Created: / 08-04-2011 / 16:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-04-2011 / 13:22:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMockedInvalidatingForClassPositive
+ | javaRefMock |
+
+ javaRefMock := JavaRefMock new.
+ self assertTrue: (javaRefMock isResolved not).
+ javaRefMock resolve.
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidateForClass: 'mock'.
+ self assertTrue: (javaRefMock isResolved not).
+ javaRefMock resolveStatic.
+ self assertTrue: (javaRefMock isResolved).
+ javaRefMock invalidateForClass: 'mock'.
+ self assertTrue: (javaRefMock isResolved not).
+
+ "Created: / 08-04-2011 / 16:19:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 26-04-2011 / 13:23:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMockedResolving
+ | javaRefMock |
+
+ javaRefMock := JavaRefMock new.
+ self assertFalse: (javaRefMock isResolved).
+ self assertTrue: (javaRefMock valueCache isNil).
+ self assertTrue: (javaRefMock resolve = 'ok').
+ self assertTrue: (javaRefMock isResolved).
+
+ "Created: / 08-04-2011 / 11:47:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testMockedResolvingStatic
+ | javaRefMock |
+
+ javaRefMock := JavaRefMock new.
+ self assertFalse: (javaRefMock isResolved).
+ self assertTrue: (javaRefMock valueCache isNil).
+ self assertTrue: (javaRefMock resolveStatic = 'static').
+ self assertTrue: (javaRefMock isResolved).
+
+ "Created: / 26-04-2011 / 13:23:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRefTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaRelease.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,530 @@
+"
+ 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:#JavaRelease
+ instanceVariableNames:'javaHome classPath sourcePath'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+JavaRelease subclass:#OpenJDK6
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaRelease
+!
+
+JavaRelease subclass:#SunJDK122
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaRelease
+!
+
+JavaRelease subclass:#SunJDK6
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaRelease
+!
+
+!JavaRelease 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.
+
+"
+! !
+
+!JavaRelease class methodsFor:'instance creation'!
+
+any
+
+ | releases |
+
+ releases := self allSubclasses reject: [:rel|rel isAbstract] thenCollect:[:rel|rel new].
+ releases := releases asSortedCollection:[:a :b|a priority > b priority].
+ releases := releases select:[:rel|rel isAvailable].
+ ^releases isEmpty
+ ifTrue:[self error: 'No Java release found']
+ ifFalse:[releases first]
+
+ "
+ JavaRelease any
+ "
+
+ "Created: / 22-11-2010 / 13:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+openJDK6
+
+ ^OpenJDK6 new
+
+ "Created: / 27-10-2010 / 21:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sunJDK122
+
+ ^SunJDK122 new
+
+ "Created: / 27-10-2010 / 21:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sunJDK6
+
+ ^SunJDK6 new
+
+ "Created: / 22-11-2010 / 13:33:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease class methodsFor:'queries'!
+
+isAbstract
+
+ ^self class == JavaRelease
+
+ "Created: / 22-11-2010 / 13:33:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease methodsFor:'accessing'!
+
+classPath
+
+ "Returns a default class path"
+
+ classPath ifNil:[self searchForClassPath].
+ ^classPath
+
+ "
+ JavaRelease openJDK6 classPath
+ "
+
+ "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-10-2010 / 21:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHome
+
+ "Answer a Java home"
+
+ javaHome ifNil:
+ [javaHome := self searchForJavaHome.
+ javaHome ifNil:[self error:'No java home found!!']].
+ ^javaHome
+
+ "
+ JavaRelease openJDK6 javaHome
+ "
+
+ "Created: / 27-10-2010 / 18:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2010 / 11:37:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomeOrNil
+
+ "Answer a Java home"
+
+ | home |
+ home := (javaHome
+ ifNotNil:[javaHome]
+ ifNil:[self searchForJavaHome]).
+ ^home
+
+ "
+ JavaRelease openJDK6 javaHome
+ "
+
+ "Created: / 22-11-2010 / 13:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomes
+
+ "Answer a set of possible java homes, those directories are searched"
+
+
+ OperatingSystem isUNIXlike ifTrue:[ ^ self javaHomesOnUNIX ].
+ OperatingSystem isMSWINDOWSlike ifTrue:[ ^ self javaHomesOnWindows ].
+ self error:'Unsupported platform'.
+ ^ #()
+
+ "Modified: / 22-11-2010 / 13:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomesOnUNIX
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+javaHomesOnWindows
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+!
+
+jreHome
+
+ "Answers the directory where the JRE lives"
+
+ | jreHome |
+
+ ^(jreHome := self javaHome asFilename / 'jre') exists
+ ifTrue:[jreHome]
+ ifFalse:[javaHome asFilename].
+
+ "Created: / 27-10-2010 / 21:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+name
+
+ "Answer a human readable name of the Java release such as Sun JDK 1.2.2 or OpenJDK 6"
+
+ ^self subclassResponsibility
+
+ "Created: / 27-10-2010 / 18:53:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+priority
+
+ ^50
+
+ "Created: / 22-11-2010 / 13:34:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+sourcePath
+
+ "Returns a paths where sources are located"
+
+ sourcePath ifNil:[self searchForSourcePath].
+ ^sourcePath
+
+ "
+ JavaRelease openJDK6 sourcePath
+ "
+
+ "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2010 / 11:55:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease methodsFor:'queries'!
+
+isAvailable
+
+ ^self javaHomeOrNil notNil
+
+ "
+ JavaRelease openJDK6 isAvailable
+ JavaRelease sunJDK6 isAvailable
+
+ "
+
+ "Created: / 22-11-2010 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease methodsFor:'searching'!
+
+searchForClassPath
+
+ | jreHome |
+ classPath := OrderedCollection new.
+ jreHome := self jreHome.
+ "Ensure, that rt.jar is first"
+ classPath add: (jreHome / 'lib' / 'rt.jar') asString.
+
+ self searchForClassPathIn: jreHome / 'lib' .
+ self searchForClassPathIn: jreHome / 'lib' / 'ext'.
+
+ "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+searchForClassPathIn: dir
+
+ dir exists ifFalse:[^self].
+
+ dir directoryContentsAsFilenames do:
+ [:file|
+ (file suffix = 'jar' and:[file baseName ~= 'rt.jar'])
+ ifTrue:[classPath add: file asString]]
+
+ "Created: / 27-10-2010 / 21:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+searchForJavaHome
+
+ | h |
+
+ h := (OperatingSystem getEnvironment:'JAVA_HOME').
+ h notNil ifTrue:[
+ javaHome := h asFilename.
+ (javaHome / 'jre') exists ifTrue:[
+ javaHome := javaHome / 'jre'.
+ ].
+ ^javaHome
+ ].
+
+ self javaHomes do:
+ [:home| | homeAsFilename |
+ homeAsFilename := home asFilename.
+ homeAsFilename exists ifTrue:
+ [(self validateJavaHome: homeAsFilename) ifTrue:
+ [^javaHome := home]]].
+
+ ^nil
+
+ "Created: / 27-10-2010 / 19:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 22-11-2010 / 13:18:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-03-2011 / 13:29:14 / Jan Kurs <kursjan@fit.cvut.cz>"
+ "Modified: / 15-03-2011 / 13:47:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+searchForSourcePath
+
+ | src_zip |
+
+ sourcePath := OrderedCollection new.
+ src_zip := self javaHome asFilename directory / 'src.zip'.
+ src_zip exists ifTrue:[sourcePath add: src_zip asString].
+
+ "
+ JavaRelease openJDK6 searchForSourcePath; sourcePath
+ "
+
+ "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2011 / 22:40:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease methodsFor:'validating'!
+
+validateJavaHome: home
+
+ "Just JRE"
+ ( home asFilename / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
+
+ "Full JDK"
+ ( home asFilename / 'jre' / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
+
+ ^ false
+
+ "
+ JavaRelease basicNew validateJavaHome: '/usr/lib/jvm/java-6-openjdk'
+ JavaRelease basicNew validateJavaHome: '/tmp'
+ "
+
+ "Created: / 27-10-2010 / 19:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-10-2010 / 21:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease::OpenJDK6 methodsFor:'accessing'!
+
+javaHomesOnUNIX
+ ^ #( '/usr/lib/jvm/java-6-openjdk/jre' )
+
+ "Modified: / 07-08-2011 / 20:38:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomesOnWindows
+ |vsn home heuristics|
+
+ self breakPoint:#jv.
+
+ heuristics :=
+ #(
+ 'C:\Program Files (x86)\Java\jdk1.6.0_24\jre'
+ 'C:\Program Files\Java\jdk1.6.0_24\jre'
+ ).
+
+ vsn := (OperatingSystem registryEntry
+ key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit')
+ valueNamed:'CurrentVersion'.
+ vsn notNil ifTrue:[
+ home := (OperatingSystem registryEntry
+ key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\',vsn)
+ valueNamed:'JavaHome'.
+ home notNil ifTrue:[
+ ^ (Array with:(home,'\jre'))
+ , heuristics
+ ].
+ ].
+ ^ heuristics
+
+ "
+ self basicNew javaHomesOnWindows
+ "
+
+ "Modified: / 07-08-2011 / 20:38:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 19-08-2011 / 00:46:40 / cg"
+!
+
+name
+ "superclass JavaRelease says that I am responsible to implement this method"
+
+ ^ 'Open JDK 6'
+
+ "Modified: / 27-10-2010 / 19:16:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+priority
+
+ ^80
+ "/^70
+
+ "Created: / 22-11-2010 / 13:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-02-2011 / 06:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease::SunJDK122 methodsFor:'accessing'!
+
+javaHomesOnUNIX
+ "superclass JavaRelease says that I am responsible to implement this method"
+
+ ^#(
+ '/home/jv/Projects/JavaX/jdk1.2.2' "/On Jan Vrany's machine :-)
+ )
+
+ "Created: / 22-11-2010 / 13:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomesOnWindows
+
+ ^ #()
+
+!
+
+name
+ "superclass JavaRelease says that I am responsible to implement this method"
+
+ ^ 'Sun JDK 1.2.2'
+
+ "Modified: / 27-10-2010 / 21:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+priority
+
+ ^10
+
+ "Created: / 22-11-2010 / 13:34:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease::SunJDK6 methodsFor:'accessing'!
+
+javaHomesOnUNIX
+
+ ^ #( '/usr/lib/jvm/java-6-sun' )
+
+ "Created: / 22-11-2010 / 13:31:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomesOnWindows
+
+ self breakPoint:#jv.
+
+ ^ #( 'C:\Program Files (x86)\Java\jdk1.6.0_24'
+ 'C:\Program Files\Java\jdk1.6.0_24'
+ )
+
+ "Created: / 22-11-2010 / 13:30:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+name
+
+ ^ 'Sun JDK 6'
+
+ "Created: / 22-11-2010 / 13:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+priority
+
+ ^75
+
+ "Created: / 22-11-2010 / 13:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaRelease class methodsFor:'documentation'!
+
+version_CVS
+ ^ '§Header: /cvs/stx/stx/libjava/JavaRelease.st,v 1.2 2011/08/18 22:47:38 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaResolver.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,754 @@
+"
+ 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:#JavaResolver
+ instanceVariableNames:'exceptionThrower'
+ classVariableNames:'uniqueInstance'
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaResolver 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.
+
+"
+! !
+
+!JavaResolver class methodsFor:'initialization'!
+
+initialize
+ uniqueInstance := JavaResolver new.
+ uniqueInstance exceptionThrower: JavaVM.
+
+ "/has methods at: and at: put:
+ "/uniqueInstance resolvedClasses: Java.
+
+ "Modified: / 10-04-2011 / 10:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:07:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver class methodsFor:'instance creation'!
+
+uniqueInstance
+ ^uniqueInstance.
+
+ "Created: / 08-04-2011 / 17:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 11-04-2011 / 19:06:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'accessing'!
+
+exceptionThrower
+ ^ exceptionThrower
+!
+
+exceptionThrower:something
+ exceptionThrower := something.
+! !
+
+!JavaResolver methodsFor:'class resolving'!
+
+checkIfPrimitiveArrayRef: aJavaClassRef andWrap: result
+
+ ^ (JavaDescriptor readFromString: aJavaClassRef name) javaClass.
+
+ "Created: / 23-05-2011 / 21:12:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveClassIndentifiedByRef: aJavaClassRef init: doInit
+ | classLoader result |
+
+ self validateClassRef: aJavaClassRef.
+ result := self lookupClassIfAlreadyResolved: aJavaClassRef javaClassName.
+"/ result notNil ifTrue:[
+"/ "/wrap result with array(s) if needed and return it
+"/ "/FIXME: Marcel, can you have a look? Is that correct?
+"/ ^self checkIfArrayRef: aJavaClassRef andWrap: result
+"/ ].
+ "
+ To resolve an unresolved symbolic reference from D to a class or interface C denoted by N,
+ the following steps are performed:
+ The defining class loader of D is used to create a class or interface denoted by N.
+ This class or interface is C. Any exception that can be thrown as a result of failure
+ of class or interface creation can thus be thrown as a result of failure of class and
+ interface resolution. The details of the process are given in Section 5.3.
+ "
+ result isNil ifTrue:[
+ classLoader := aJavaClassRef classLoader.
+ classLoader isNil ifTrue: [
+ result := self loadUnresolvedClass: aJavaClassRef
+ ] ifFalse: [
+ result := self loadUnresolvedClass: aJavaClassRef
+ withJavaClassLoader: classLoader.
+ ].
+ ].
+ result ifNil: [ self breakPoint: #mh ].
+
+ result isJavaPrimitiveType ifTrue: [
+ ^ self checkIfPrimitiveArrayRef: aJavaClassRef andWrap: result
+ ].
+ doInit ifTrue:[result classInit].
+ "
+ If C is an array class and its element type is a reference type, then the symbolic reference
+ to the class or interface representing the element type is resolved by invoking the algorithm
+ in Section 5.4.3.1 recursively."
+ result := self checkIfArrayRef: aJavaClassRef andWrap: result.
+ "Finally, access permissions to C are checked:
+ If C is not accessible (5.4.4) to D, class or interface resolution throws an IllegalAccessError.
+ This condition can occur, for example, if C is a class that was originally declared to be
+ public but was changed to be non-public after D was compiled.
+
+ If steps 1 and 2 succeed but step 3 fails, C is still valid and usable. Nevertheless, resolution
+ fails, and D is prohibited from accessing C."
+
+
+ "JV@2011-08-10: HACK FOR SAXON DEMO!!!!!!"
+ "(self checkPermissionsFrom: aJavaClassRef owner to: result)"true
+ ifTrue: [ ^ result ]
+ ifFalse: [ self throwIllegalAccessError ].
+
+ "Created: / 11-04-2011 / 19:07:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 21:11:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 12-08-2011 / 22:19:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'class resolving helpers'!
+
+checkIfArrayRef: aJavaClassRef andWrap: result
+ "/wrap result with array(s) if needed and return it
+ ^ aJavaClassRef isJavaArrayClassRef
+ ifFalse: [ result ]
+ ifTrue: [ self wrapJavaClass: result withArrayAsSpecifiedIn: aJavaClassRef ]
+
+ "Modified: / 11-04-2011 / 19:31:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+checkPermissionsFrom: refOwner to: resolvedClass
+ "
+ A class or interface C is accessible to a class or interface D if and only if either of the following conditions are true:
+ C is public.
+ C and D are members of the same runtime package (§5.3).
+ Finally, access permissions to C are checked:
+ If C is not accessible (§5.4.4) to D, class or interface resolution throws an IllegalAccessError.
+ This condition can occur, for example, if C is a class that was originally declared to be
+ public but was changed to be non-public after D was compiled.
+ At run time, a class or interface is determined not by its name alone,
+ but by a pair: its fully qualified name and its defining class loader.
+ Each such class or interface belongs to a single runtime package. The runtime
+ package of a class or interface is determined by the package name and
+ defining class loader of the class or interface."
+
+ resolvedClass isPublic ifTrue: [ ^ true ].
+ resolvedClass classLoader = refOwner classLoader ifFalse: [ ^ false ].
+ ^ refOwner javaPackage = resolvedClass javaPackage.
+
+ "Created: / 11-04-2011 / 19:35:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 23:13:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+loadUnresolvedClass: aJavaClassRef
+ | nm |
+
+ nm := aJavaClassRef javaClassName.
+ nm size == 1
+ and: [ JavaDescriptor baseTypes at: nm first ifPresent: [:cls | ^ cls ] ].
+ ^ Java classForName: aJavaClassRef javaClassName.
+
+ "Created: / 11-04-2011 / 19:27:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-05-2011 / 17:58:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-05-2011 / 21:06:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+loadUnresolvedClass: aJavaClassRef withJavaClassLoader: classLoader
+ | jClass clc |
+
+ "JV@2011-08-12: HACK HACK HACK!!!!!!"
+ (clc := Java at:'java.lang.ClassLoader') notNil ifTrue:[
+ (classLoader == (clc instVarNamed: #scl)) ifTrue:[
+ ^self loadUnresolvedClass: aJavaClassRef
+ ]
+ ].
+
+ jClass := classLoader
+ perform: #'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
+ with: (Java as_String: (aJavaClassRef name)).
+ ^JavaVM reflection classForJavaClassObject: jClass.
+
+ "Modified: / 18-05-2011 / 14:52:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 12-08-2011 / 09:14:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupClassIfAlreadyResolved: javaClassName
+
+ ^Java at: javaClassName
+
+ "Modified: / 13-04-2011 / 14:05:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 06-08-2011 / 16:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+validateClassRef: aJavaClassRef
+ self assert: aJavaClassRef isJavaRef.
+ self assert: aJavaClassRef isJavaClassRef .
+
+ "Modified: / 23-05-2011 / 21:04:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+wrapJavaClass:aJavaClass withArrayAsSpecifiedIn:aJavaClassRef
+ "wraps aJavaClass with as many array dimensions as needed (zero means no array)"
+
+ |arrayClass|
+
+ aJavaClassRef isJavaArrayClassRef ifFalse:[ ^ aJavaClass ].
+ aJavaClassRef arrayDimensions timesRepeat:
+ [ arrayClass := aJavaClass.
+ arrayClass := arrayClass javaArrayClass. ].
+ ^ arrayClass.
+
+ "Created: / 08-04-2011 / 18:40:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 22-05-2011 / 17:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-05-2011 / 21:06:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'common helpers'!
+
+checkPermissionsForMethodOrField: aJavaMethodOrField from: accessingJavaClass to: resolvedJavaClass
+ "A class or interface C is accessible to a class or interface D if
+ and only if either of the following conditions are true:
+ C is public.
+ C and D are members of the same runtime package (§5.3).
+ A field or method R is accessible to a class or interface D if and only
+ if any of the following conditions is true:
+ R is public.
+ R is protected and is declared in a class C, and D is either a subclass
+ of C or C itself.
+ R is either protected or package private (that is, neither public nor
+ protected nor private), and is declared by a class in the same runtime
+ package as D.
+ R is private and is declared in D.
+ This discussion of access control omits a related restriction on the target
+ of a protected field access or method invocation (the target must be of class
+ D or a subtype of D). That requirement is checked as part of the verification
+ process (§5.4.1); it is not part of link-time access control."
+
+ (self checkPermissionsFrom: accessingJavaClass to: resolvedJavaClass) ifFalse: [
+ ^ false
+ ].
+ aJavaMethodOrField isPublic ifTrue: [
+ ^ true
+ ].
+ ((aJavaMethodOrField isProtected
+ and: [
+ resolvedJavaClass javaComponentClass
+ equalsOrIsSubclassOf: aJavaMethodOrField javaClass
+ ])
+ and: [
+ accessingJavaClass javaComponentClass
+ equalsOrIsSubclassOf: aJavaMethodOrField javaClass
+ ])
+ ifTrue: [ ^ true ].
+ ((aJavaMethodOrField isPrivate not
+ and: [ resolvedJavaClass javaPackage = accessingJavaClass javaPackage ])
+ and: [ resolvedJavaClass classLoader = accessingJavaClass classLoader ])
+ ifTrue: [ ^ true ].
+ (aJavaMethodOrField isPrivate
+ and: [ aJavaMethodOrField javaClass name = accessingJavaClass name ])
+ ifTrue: [ ^ true ].
+ ^ false.
+
+ "Created: / 14-04-2011 / 14:19:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-06-2011 / 20:49:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'exceptions'!
+
+throwAbstractMethodError
+ exceptionThrower throwAbstractMethodError.
+
+ "Created: / 11-04-2011 / 20:19:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwIllegalAccessError
+ exceptionThrower throwIllegalAccessError.
+
+ "Created: / 11-04-2011 / 19:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 23:06:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwIncompatibleClassChangeError
+ exceptionThrower throwIncompatibleClassChangeError.
+
+ "Created: / 11-04-2011 / 20:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:07:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwNoSuchFieldException
+ exceptionThrower throwNoSuchFieldException.
+
+ "Created: / 11-04-2011 / 21:35:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwNoSuchMethodError
+ exceptionThrower throwNoSuchMethodError.
+
+ "Created: / 11-04-2011 / 20:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 14:08:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'field resolving'!
+
+resolveFieldIndentifiedByRef: aJavaFieldRef
+ | result class |
+
+ self validateFieldRef: aJavaFieldRef.
+ result := self lookupFieldIfAlreadyResolved: aJavaFieldRef.
+ result ifNotNil: [ ^ result ].
+ class := aJavaFieldRef classRef resolve.
+ class ifNil: [ self halt: 'should not happen - tell mh' ].
+ result := class lookupFieldByNameAndType: aJavaFieldRef nameAndType.
+ result ifNil: [ self throwNoSuchFieldException ].
+ (self
+ checkPermissionsForField: result
+ from: aJavaFieldRef classRef owner
+ to: class) ifFalse: [ self throwIllegalAccessError ].
+ ^ result.
+
+ "
+ To resolve an unresolved symbolic reference from D to a field in a class
+ or interface C, the symbolic reference to C given by the field reference
+ must first be resolved (§5.4.3.1). Therefore, any exception that can be
+ thrown as a result of failure of resolution of a class or interface reference
+ can be thrown as a result of failure of field resolution. If the reference
+ to C can be successfully resolved, an exception relating to the failure of
+ resolution of the field reference itself can be thrown.
+ When resolving a field reference, field resolution first attempts to look
+ up the referenced field in C and its superclasses:
+
+ If C declares a field with the name and descriptor specified by the field
+ reference, field lookup succeeds. The declared field is the result of the
+ field lookup.
+
+ Otherwise, field lookup is applied recursively to the direct superinterfaces
+ of the specified class or interface C.
+
+ Otherwise, if C has a superclass S, field lookup is applied recursively to S.
+
+ Otherwise, field lookup fails.
+ If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise,
+ if field lookup succeeds but the referenced field is not accessible (§5.4.4)
+ to D, field resolution throws an IllegalAccessError.
+ Otherwise, let <E, L1> be the class or interface in which the referenced
+ field is actually declared and let L2 be the defining loader of D. Let T be
+ the name of the type of the referenced field. The Java virtual machine must
+ impose the loading constraint that TL1=TL2(§5.3.4)."
+
+ "Created: / 11-04-2011 / 21:15:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 11:57:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+resolveStaticFieldIndentifiedByRef: aJavaFieldRef
+ | result class |
+
+ self validateFieldRef: aJavaFieldRef.
+ result := self lookupFieldIfAlreadyResolved: aJavaFieldRef.
+ result ifNotNil: [ ^ result ].
+ class := aJavaFieldRef classRef resolve.
+ class ifNil: [ self halt: 'should not happen - tell mh' ].
+ result := class lookupStaticFieldByNameAndType: aJavaFieldRef nameAndType.
+ result ifNil: [ self throwNoSuchFieldException ].
+ (self
+ checkPermissionsForField: result
+ from: aJavaFieldRef classRef owner
+ to: class) ifFalse: [ self throwIllegalAccessError ].
+ ^ result.
+
+ "
+ To resolve an unresolved symbolic reference from D to a field in a class
+ or interface C, the symbolic reference to C given by the field reference
+ must first be resolved (§5.4.3.1). Therefore, any exception that can be
+ thrown as a result of failure of resolution of a class or interface reference
+ can be thrown as a result of failure of field resolution. If the reference
+ to C can be successfully resolved, an exception relating to the failure of
+ resolution of the field reference itself can be thrown.
+ When resolving a field reference, field resolution first attempts to look
+ up the referenced field in C and its superclasses:
+
+ If C declares a field with the name and descriptor specified by the field
+ reference, field lookup succeeds. The declared field is the result of the
+ field lookup.
+
+ Otherwise, field lookup is applied recursively to the direct superinterfaces
+ of the specified class or interface C.
+
+ Otherwise, if C has a superclass S, field lookup is applied recursively to S.
+
+ Otherwise, field lookup fails.
+ If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise,
+ if field lookup succeeds but the referenced field is not accessible (§5.4.4)
+ to D, field resolution throws an IllegalAccessError.
+ Otherwise, let <E, L1> be the class or interface in which the referenced
+ field is actually declared and let L2 be the defining loader of D. Let T be
+ the name of the type of the referenced field. The Java virtual machine must
+ impose the loading constraint that TL1=TL2(§5.3.4)."
+
+ "Created: / 28-04-2011 / 22:31:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'field resolving helpers'!
+
+checkPermissionsForField: aJavaField from: accessingJavaClass to: resolvedJavaClass
+ "A class or interface C is accessible to a class or interface D if and only
+ if either of the following conditions are true:
+ C is public.
+ C and D are members of the same runtime package (5.3).
+ A field or method R is accessible to a class or interface D if and only
+ if any of the following conditions is true:
+ R is public.
+ R is protected and is declared in a class C, and D is either a subclass of
+ C or C itself.
+ R is either protected or package private (that is, neither public nor protected
+ nor private), and is declared by a class in the same runtime package as D.
+ R is private and is declared in D.
+ This discussion of access control omits a related restriction on the target of
+ a protected field access or method invocation (the target must be of class D or
+ a subtype of D). That requirement is checked as part of the verification process
+ (5.4.1); it is not part of link-time access control."
+
+ ^ self
+ checkPermissionsForMethodOrField: aJavaField from: accessingJavaClass
+ to: resolvedJavaClass.
+
+ "Created: / 11-04-2011 / 21:46:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-04-2011 / 14:21:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+lookupFieldIfAlreadyResolved: aJavaFieldRef
+ ^ nil.
+
+ "Created: / 11-04-2011 / 21:16:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 11:57:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+validateFieldRef: aJavaFieldRef
+ aJavaFieldRef isJavaRef ifFalse:[self halt:'I expected Java Ref'].
+ aJavaFieldRef isJavaFieldRef ifFalse:[self halt:'I expected Java Field Ref'].
+
+ "Created: / 11-04-2011 / 21:16:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'interface method resolving'!
+
+resolveInterfaceMethodIdentifiedByRef: aJavaInterfaceMethodRef
+ | result class |
+
+ self validateInterfaceMethodRef: aJavaInterfaceMethodRef.
+ result := self
+ lookupInterfaceMethodIfAlreadyResolved: aJavaInterfaceMethodRef.
+ result ifNotNil: [ ^ result ].
+ class := aJavaInterfaceMethodRef classRef resolve.
+ class ifNil: [ self halt: 'should not happen - tell mh' ].
+ class isInterface ifFalse: [ self throwIncompatibleClassChangeError ].
+ result := class
+ lookupMethodByNameAndType: aJavaInterfaceMethodRef nameAndType.
+ result ifNil: [ self throwNoSuchMethodError ].
+ (self
+ checkPermissionsForMethod: result
+ from: aJavaInterfaceMethodRef classRef owner
+ to: class) ifFalse: [ self throwIllegalAccessError ].
+^ result.
+ "
+ To resolve an unresolved symbolic reference from D to an interface method in an
+ interface C, the symbolic reference to C given by the interface method reference is
+ first resolved (§5.4.3.1). Therefore, any exceptions that can be thrown as a result
+ of failure of resolution of an interface reference can be thrown as a result of
+ failure of interface method resolution. If the reference to C can be successfully
+ resolved, exceptions relating to the resolution of the interface method reference
+ itself can be thrown.
+ When resolving an interface method reference:
+
+ If C is not an interface, interface method resolution throws an IncompatibleClassChangeError.""Otherwise, if the referenced method does not have the same name and descriptor as
+ a method in C or in one of the superinterfaces of C, or in class Object, interface
+ method resolution throws a NoSuchMethodError.
+ Otherwise, let <E, L1> be the interface in which the referenced interface method is
+ actually declared and let L2 be the defining loader of D. Let T0 be the name of
+ the type returned by the referenced method, and let T1, ..., Tn be the names of the
+ argument types of the referenced method. The Java virtual machine must impose the
+ loading constraints TiL1 = TiL2 for i = 0 to n (§5.3.4)."
+
+ "Modified: / 23-05-2011 / 17:56:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'interface method resolving helpers'!
+
+lookupInterfaceMethodIfAlreadyResolved: aJavaInterfaceMethodRef
+ ^ nil.
+
+ "Created: / 13-04-2011 / 11:53:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+validateInterfaceMethodRef: aJavaInterfaceMethodRef
+ aJavaInterfaceMethodRef isJavaRef
+ ifFalse: [ self halt: 'I expected JavaRef instance as an argument' ].
+ aJavaInterfaceMethodRef isJavaInterfaceMethodRef
+ ifFalse: [ self halt: 'I expected JavaMethodRef instance as an argument' ].
+
+ "Created: / 13-04-2011 / 11:53:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'method resolving'!
+
+resolveMethodIndentifiedByRef: aJavaMethodRef
+ | result class |
+
+ self validateMethodRef: aJavaMethodRef.
+ result := self lookupMethodIfAlreadyResolved: aJavaMethodRef.
+ result ifNotNil: [ ^ result ].
+ class := aJavaMethodRef classRef resolve.
+ class ifNil: [ self error: 'should not happen - tell mh' ].
+ "Array types responds to all method of class java.lang.Object"
+ class isJavaArrayClass ifTrue:[
+ class := Java classForName:'java.lang.Object'.
+ ].
+
+
+ "
+ To resolve an unresolved symbolic reference from D to a method in
+ a class C, the symbolic reference to C given by the method reference
+ is first resolved (§5.4.3.1). Therefore, any exceptions that can be
+ thrown due to resolution of a class reference can be thrown as a result
+ of method resolution. If the reference to C can be successfully resolved,
+ exceptions relating to the resolution of the method reference itself
+ can be thrown.
+ When resolving a method reference:
+
+ Method resolution checks whether C is a class or an interface.
+ If C is an interface, method resolution throws an IncompatibleClassChangeError."
+ class isInterface ifTrue: [ self throwIncompatibleClassChangeError ].
+ "Method resolution attempts to look up the referenced method in C and its
+ superclasses:
+ If C declares a method with the name and descriptor specified by the method
+ reference, method lookup succeeds.
+ Otherwise, if C has a superclass, step 2 of method lookup is recursively
+ invoked on the direct superclass of C.
+
+ Otherwise, method lookup attempts to locate the referenced method in any of
+ the superinterfaces of the specified class C.
+ If any superinterface of C declares a method with the name and descriptor
+ specified by the method reference, method lookup succeeds.
+ Otherwise, method lookup fails.
+ If method lookup fails, method resolution throws a NoSuchMethodError. If method
+ lookup succeeds and the method is abstract, but C is not abstract, method resolution
+ throws an AbstractMethodError. Otherwise, if the referenced method is not accessible
+ (§5.4.4) to D, method resolution throws an IllegalAccessError."
+ result := class lookupMethodByNameAndType: aJavaMethodRef nameAndType.
+ result ifNil: [ self throwNoSuchMethodError ].
+ (result isAbstract and:[result javaClass isInterface not and:[ class isAbstract not ]])
+ ifTrue: [ self throwAbstractMethodError ].
+ (self
+ checkPermissionsForMethod: result
+ from: aJavaMethodRef classRef owner
+ to: class) ifFalse: [ self throwIllegalAccessError ].
+ ^ result.
+
+ "Otherwise, let <E, L1> be the class or interface in which the referenced method is
+ actually declared and let L2 be the defining loader of D. Let T0 be the name of
+ the type returned by the referenced method, and let T1, ..., Tn be the names of
+ the argument types of the referenced method. The Java virtual machine must impose
+ the loading constraints TiL1=TiL2 for i = 0 to n (§5.3.4)."
+
+ "Created: / 11-04-2011 / 19:45:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-04-2011 / 00:01:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 10-08-2011 / 22:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+resolveStaticMethodIndentifiedByRef: aJavaMethodRef
+ | result class |
+
+ self validateMethodRef: aJavaMethodRef.
+ result := self lookupMethodIfAlreadyResolved: aJavaMethodRef.
+ result ifNotNil: [ ^ result ].
+ class := aJavaMethodRef classRef resolve.
+ class ifNil: [ self halt: 'should not happen - tell mh' ].
+ "
+ To resolve an unresolved symbolic reference from D to a method in
+ a class C, the symbolic reference to C given by the method reference
+ is first resolved (§5.4.3.1). Therefore, any exceptions that can be
+ thrown due to resolution of a class reference can be thrown as a result
+ of method resolution. If the reference to C can be successfully resolved,
+ exceptions relating to the resolution of the method reference itself
+ can be thrown.
+ When resolving a method reference:
+
+ Method resolution checks whether C is a class or an interface.
+ If C is an interface, method resolution throws an IncompatibleClassChangeError."
+ class isInterface ifTrue: [ self throwIncompatibleClassChangeError ].
+ "Method resolution attempts to look up the referenced method in C and its
+ superclasses:
+ If C declares a method with the name and descriptor specified by the method
+ reference, method lookup succeeds.
+ Otherwise, if C has a superclass, step 2 of method lookup is recursively
+ invoked on the direct superclass of C.
+
+ Otherwise, method lookup attempts to locate the referenced method in any of
+ the superinterfaces of the specified class C.
+ If any superinterface of C declares a method with the name and descriptor
+ specified by the method reference, method lookup succeeds.
+ Otherwise, method lookup fails.
+ If method lookup fails, method resolution throws a NoSuchMethodError. If method
+ lookup succeeds and the method is abstract, but C is not abstract, method resolution
+ throws an AbstractMethodError. Otherwise, if the referenced method is not accessible
+ (§5.4.4) to D, method resolution throws an IllegalAccessError."
+ result := class lookupStaticMethodByNameAndType: aJavaMethodRef nameAndType.
+ result ifNil: [ self throwNoSuchMethodError ].
+ (result isAbstract and: [ class isAbstract not ])
+ ifTrue: [ self throwAbstractMethodError ].
+ (self
+ checkPermissionsForMethod: result
+ from: aJavaMethodRef classRef owner
+ to: class) ifFalse: [ self throwIllegalAccessError ].
+ ^ result.
+
+ "Otherwise, let <E, L1> be the class or interface in which the referenced method is
+ actually declared and let L2 be the defining loader of D. Let T0 be the name of
+ the type returned by the referenced method, and let T1, ..., Tn be the names of
+ the argument types of the referenced method. The Java virtual machine must impose
+ the loading constraints TiL1=TiL2 for i = 0 to n (§5.3.4)."
+
+ "Created: / 28-04-2011 / 22:50:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver methodsFor:'method resolving helpers'!
+
+checkPermissionsForMethod: aJavaMethod from: accessingJavaClass to: resolvedJavaClass
+ "A class or interface C is accessible to a class or interface D if
+ and only if either of the following conditions are true:
+ C is public.
+ C and D are members of the same runtime package (§5.3).
+ A field or method R is accessible to a class or interface D if and only
+ if any of the following conditions is true:
+ R is public.
+ R is protected and is declared in a class C, and D is either a subclass
+ of C or C itself.
+ R is either protected or package private (that is, neither public nor
+ protected nor private), and is declared by a class in the same runtime
+ package as D.
+ R is private and is declared in D.
+ This discussion of access control omits a related restriction on the target
+ of a protected field access or method invocation (the target must be of class
+ D or a subtype of D). That requirement is checked as part of the verification
+ process (§5.4.1); it is not part of link-time access control."
+
+ "JV@2011-05-24: Temporary hack, since access checking
+ is somewhat broken. Marcle should fix it :-)"
+ OperatingSystem getLoginName = 'jv' ifTrue:[^true].
+
+ ^ self checkPermissionsForMethodOrField: aJavaMethod from: accessingJavaClass to: resolvedJavaClass.
+
+ "Created: / 11-04-2011 / 20:20:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 14-04-2011 / 14:20:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 24-05-2011 / 14:06:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupMethodIfAlreadyResolved: aJavaMethodRef
+ ^ nil.
+
+ "Created: / 11-04-2011 / 19:50:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-04-2011 / 11:57:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+validateMethodRef: aJavaMethodRef
+ aJavaMethodRef isJavaRef ifFalse:[self halt: 'I expected JavaRef instance as an argument'].
+ aJavaMethodRef isJavaMethodRef ifFalse: [self halt: 'I expected JavaMethodRef instance as an argument'].
+
+ "Created: / 11-04-2011 / 19:47:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaResolver class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaResolver initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaRuntimeConstantPoolTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,181 @@
+"
+ 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' }"
+
+AbstractJavaTestCase subclass:#JavaRuntimeConstantPoolTests
+ instanceVariableNames:'constantPoolCacheBackup'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests-RuntimeConstantPool'
+!
+
+!JavaRuntimeConstantPoolTests 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.
+
+"
+! !
+
+!JavaRuntimeConstantPoolTests methodsFor:'helpers'!
+
+cleanUpCPCache
+ "warning - counting with the fact that cp cache is backed up in setUp and restored in tearDown methods"
+ JavaConstantPool allConstantPools: OrderedCollection new.
+
+ "Created: / 13-05-2011 / 09:42:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRuntimeConstantPoolTests methodsFor:'running'!
+
+setUp
+ super setUp.
+ constantPoolCacheBackup := JavaConstantPool allConstantPools.
+
+ "Created: / 13-05-2011 / 09:33:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+tearDown
+super tearDown.
+ JavaConstantPool allConstantPools: constantPoolCacheBackup.
+
+ "Created: / 13-05-2011 / 09:33:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRuntimeConstantPoolTests methodsFor:'tests'!
+
+testConstantPoolCaching
+ | newConstantPool |
+
+ JavaConstantPool allConstantPools: OrderedCollection new.
+ newConstantPool := self getPrettyBigConstantPool.
+ self
+ assertTrue: (JavaConstantPool allConstantPools includes: newConstantPool).
+
+ "Created: / 13-05-2011 / 09:36:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidateAll
+ | cp |
+
+ cp := self getPrettyBigConstantPool.
+ cp do: [:each | each isJavaRef ifTrue: [each resolve]].
+ cp
+ do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ].
+ cp invalidateAll.
+
+ cp
+ do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved not) ] ].
+
+ "Created: / 08-04-2011 / 17:03:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-05-2011 / 09:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testInvalidateForClass
+ | cp |
+
+ self cleanUpCPCache.
+ cp := self getPrettyBigConstantPool.
+
+ cp do: [:each | each isJavaRef ifTrue: [ each resolve ] ].
+ cp
+ do: [:each | each isJavaRef ifTrue: [ self assertTrue: (each isResolved) ] ].
+ JavaConstantPool invalidateReferencesToClass: 'Ljava/lang/Runnable;'.
+ 1 to: 13
+ do:
+ [:index |
+ (cp at: index) isJavaRef
+ ifTrue: [ self assertTrue: (cp at: index) isResolved ] ].
+ 14 to: 20
+ do:
+ [:index |
+ (cp at: index) isJavaRef
+ ifTrue: [ self assertTrue: (cp at: index) isResolved not ] ].
+
+ "Created: / 08-04-2011 / 17:10:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 15:29:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaRuntimeConstantPoolTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaSlotIndexCache.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaSlotIndexCache.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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:#JavaSlotIndexCache
@@ -31,8 +58,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -40,9 +71,34 @@
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.
+
+"
! !
!JavaSlotIndexCache class methodsFor:'queries'!
@@ -307,5 +363,9 @@
!JavaSlotIndexCache class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaSlotIndexCache.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaSlotIndexCache.st,v 1.4 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaSourceCodeCache.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,184 @@
+"
+ 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:#JavaSourceCodeCache
+ instanceVariableNames:'parsedCodes'
+ classVariableNames:'parsedCode'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+JavaSourceCodeCache class instanceVariableNames:'instance'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+!JavaSourceCodeCache 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.
+
+"
+! !
+
+!JavaSourceCodeCache class methodsFor:'instance creation'!
+
+new
+ instance isNil ifTrue: [ instance := self basicNew initialize ].
+ ^ instance
+
+ "Created: / 13-12-2010 / 13:56:31 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaSourceCodeCache methodsFor:'adding & removing'!
+
+flush
+ self parsedCodes removeAll.
+
+ "Created: / 17-12-2010 / 16:32:49 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaSourceCodeCache methodsFor:'initialize'!
+
+initialize
+ parsedCodes := IdentityDictionary new.
+
+ "Created: / 13-12-2010 / 14:11:49 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-12-2010 / 13:35:36 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaSourceCodeCache methodsFor:'private - searching'!
+
+findMethodLine: javaMethod inMethods: methods
+ | bestMatchMethod pos |
+
+ pos := javaMethod firstInstructionLineNumber.
+ bestMatchMethod := Plug new respondTo: #startLine with: [^ 0].
+ methods do: [
+ :method |
+ method startLine > pos ifTrue: [
+ ^ bestMatchMethod startLine
+ ].
+ bestMatchMethod := method.
+ ].
+ ^ 0.
+
+ "Created: / 08-01-2011 / 16:10:37 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+getMethodsFor:class
+ ^ parsedCodes at: class fullName ifAbsentPut: [
+ [
+ JavaParser methodsIn: class source
+ ] on: Exception do:
+ [
+ OrderedCollection new.
+ ]
+ ].
+
+ "Created: / 08-01-2011 / 16:09:47 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 07-04-2011 / 22:07:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parsedCodes
+ ^ parsedCodes
+! !
+
+!JavaSourceCodeCache methodsFor:'queries'!
+
+findLineForMethod:javaMethod inClass:javaClass
+ | methods mdL |
+ methods := self getMethodsFor:javaClass.
+ mdL := self findMethodLine:javaMethod inMethods:methods.
+ ^ mdL
+
+ "Created: / 13-12-2010 / 13:47:26 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 08-01-2011 / 16:10:21 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaSourceCodeCache class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaSourceFileWriter.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,151 @@
+"
+ 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' }"
+
+AbstractSourceFileWriter subclass:#JavaSourceFileWriter
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaSourceFileWriter 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.
+
+"
+! !
+
+!JavaSourceFileWriter methodsFor:'source writing'!
+
+fileOut:class on:stream withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self shouldImplement
+!
+
+fileOutMethods:methods on:stream
+ "superclass AbstractSourceFileWriter says that I am responsible to implement this method"
+
+ ^ self shouldImplement
+!
+
+fileOutPackageDefinition:packageId on:stream
+ "Files out a package definition on the stream, so all subsequent
+ code entities will be placed in that package"
+
+ ^ self shouldImplement
+! !
+
+!JavaSourceFileWriter methodsFor:'source writing - comments'!
+
+fileOutCommentEndOn:aStream
+ "
+ Writes a comment end mark on aStream."
+
+ ^ aStream nextPutAll: ' */'
+
+ "Modified: / 27-10-2010 / 18:39:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileOutCommentLine:aString on:aStream
+ "superclass AbstractSourceFileWriter says that I am responsible to implement this method"
+
+ ^ aStream nextPutAll: '// '; nextPutAll: aString
+
+ "Modified: / 27-10-2010 / 18:40:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileOutCommentStartOn:aStream
+ "
+ Writes a comment end mark on aStream."
+
+ ^ aStream nextPutAll: '/* '
+
+ "Modified: / 27-10-2010 / 18:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaSourceFileWriter class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaStartup.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,176 @@
+"
+ 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' }"
+
+StandaloneStartup subclass:#JavaStartup
+ instanceVariableNames:''
+ classVariableNames:'ClassPath'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaStartup 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.
+
+"
+! !
+
+!JavaStartup class methodsFor:'constants & defaults'!
+
+applicationRegistryPath
+ "the key under which this application stores its process ID in the registry
+ as a collection of path-components.
+ i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
+ in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
+ (would also be used as a relative path for a temporary lock file under unix).
+ Used to detect if another instance of this application is already running."
+
+ ^ #('stx' 'java_x')
+
+ "Created: / 07-02-2011 / 10:55:08 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+applicationUUID
+ "answer an application-specific unique uuid.
+ This is used as the name of some exclusive OS-resource, which is used to find out,
+ if another instance of this application is already running.
+ Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used."
+
+ ^ 'ST_X_JAVA_X'.
+
+ "Created: / 07-02-2011 / 10:52:50 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaStartup class methodsFor:'startup'!
+
+main:argv
+ "Currently only -c option for classpath setting working"
+
+ |class arguments classAndArguments classpath classpathFromEnv|
+
+ classpath := OrderedCollection new.
+ classpathFromEnv := OperatingSystem getEnvironment:#CLASSPATH.
+ classpathFromEnv isNil ifFalse:[
+ (classpathFromEnv asArrayOfSubstringsSeparatedBy:$:) do:[:each |
+ classpath add:each
+ ]
+ ].
+ classAndArguments := OrderedCollection new.
+ (GetOpt new)
+ at:$c
+ put:[:opt :arg | (arg asArrayOfSubstringsSeparatedBy:$:) do: [:each | classpath add: each]];
+ at:$?
+ put:[:arg | self error:'not yet implemented'];
+ default:[:arg | classAndArguments add:arg];
+ parse:argv.
+ class := classAndArguments at:1.
+ arguments := classAndArguments
+ removeFirst;
+ yourself.
+ Java flushAllJavaResources.
+ self breakPoint:#mh.
+ Java initialize.
+ JavaVM initializeVM.
+ classpath do:[:each |
+ Java addToClassPath:each
+ ].
+ (Java classForName:class) main:arguments asArray.
+
+ "Created: / 07-02-2011 / 10:55:41 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 08-02-2011 / 00:55:42 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified (format): / 19-08-2011 / 01:55:24 / cg"
+! !
+
+!JavaStartup class methodsFor:'documentation'!
+
+version
+ ^ '$Id$'
+!
+
+version_CVS
+ ^ '§Header: /cvs/stx/stx/libjava/JavaStartup.st,v 1.2 2011/08/19 08:48:04 cg Exp §'
+!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaStringRef2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,145 @@
+"
+ 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' }"
+
+JavaRef2 subclass:#JavaStringRef2
+ instanceVariableNames:'nameIndex'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Reader-Support-new'
+!
+
+!JavaStringRef2 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.
+
+"
+! !
+
+!JavaStringRef2 methodsFor:'accessing'!
+
+= another
+ another isJavaRef ifFalse: [^false].
+ constantPool = another constantPool ifFalse: [^ false].
+ nameIndex = another nameIndex 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 := Java as_String: (constantPool at: nameIndex).
+ ^ valueCache.
+
+ "Created: / 13-05-2011 / 17:21:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+hash
+ ^ constantPool hash bitXor: nameIndex hash.
+
+ "Created: / 13-05-2011 / 17:20:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+invalidateForClass: internalJavaClassName
+ "am I really meaningful?"
+ self breakPoint:#mh.
+
+ "Created: / 13-05-2011 / 17:22:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+name
+ ^ constantPool at: nameIndex.
+
+ "Created: / 13-05-2011 / 17:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaStringRef2 class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaTestCaseProxy.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,241 @@
+"
+ 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:#JavaTestCaseProxy
+ instanceVariableNames:''
+ classVariableNames:'TestCases'
+ poolDictionaries:''
+ category:'Languages-Java-Tests-Proxies'
+!
+
+JavaTestCaseProxy class instanceVariableNames:'javaClassName shouldFork'
+
+"
+ The following class instance variables are inherited by this class:
+
+ TestCase - lastTestRunResultOrNil lastTestRunsPassedTests lastTestRunsFailedTests lastTestRunsErrorTests
+ TestAsserter -
+ Object -
+"
+!
+
+!JavaTestCaseProxy 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.
+
+"
+! !
+
+!JavaTestCaseProxy class methodsFor:'initialization'!
+
+initialize
+
+ TestCases := Dictionary new.
+
+ "Created: / 01-03-2011 / 10:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setJavaClassName: aSymbol
+
+ javaClassName ifNotNil:
+ [self error: 'Attempting to set java class name twice'].
+ javaClassName := aSymbol.
+
+ "Created: / 01-03-2011 / 10:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'accessing'!
+
+javaClass
+
+ ^Java classForName: javaClassName
+
+ "Created: / 01-03-2011 / 11:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 21-06-2011 / 17:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassName
+
+ ^javaClassName
+
+ "Created: / 01-03-2011 / 11:30:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+shouldFork
+ ^ shouldFork ? false
+
+ "Modified: / 13-06-2011 / 16:34:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+shouldFork:aBoolean
+ shouldFork := aBoolean.
+!
+
+sunitName
+
+ ^javaClassName
+
+ "Created: / 10-08-2011 / 21:21:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'private'!
+
+testSelectors
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^ self subclassResponsibility
+! !
+
+!JavaTestCaseProxy class methodsFor:'queries'!
+
+isAbstract
+
+ ^self == JavaTestCaseProxy or:[self superclass == JavaTestCaseProxy]
+
+ "Created: / 21-06-2011 / 16:56:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isTestlet
+
+ ^false
+
+ "Created: / 21-06-2011 / 16:57:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy class methodsFor:'subclass creation'!
+
+for: javaClass
+
+ self subclassResponsibility
+
+ "Modified: / 21-06-2011 / 17:08:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+forClassNamed: name
+ "Answers a new (anonymous) testcase proxy for
+ given javaClass"
+
+ | meta cls |
+ TestCases at: name ifPresent: [:c | ^ c ].
+ meta := Metaclass new.
+ meta setSuperclass: self class.
+ meta instSize: self class instSize.
+ cls := meta new.
+ cls setSuperclass: self.
+ cls flags: self flags.
+ cls instSize: self instSize.
+ cls setJavaClassName: name.
+ cls
+ setName: (self name , ' for: (Java classForName: ' , name storeString
+ , ')') asSymbol.
+ cls setCategory: #'(java test case proxies)'.
+ TestCases at: name put: cls.
+ ^ cls
+
+ "Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 21-06-2011 / 17:07:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestCaseProxy methodsFor:'accessing'!
+
+javaClass
+
+ | javaClass |
+
+ self
+ assert: (javaClass := self class javaClass) isJavaClass
+ description: 'java class does not exists'.
+ ^javaClass
+
+ "Created: / 01-03-2011 / 14:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+! !
+
+!JavaTestCaseProxy class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
+
+JavaTestCaseProxy initialize!
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaTestsLoader.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,277 @@
+"
+ 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:#JavaTestsLoader
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaTestsLoader 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.
+
+"
+! !
+
+!JavaTestsLoader class methodsFor:'accessing'!
+
+buildSuiteForLibjava
+
+ ^self buildSuiteFrom:
+ (self loadLibjava)
+
+ "
+ JavaTestsLoader buildSuiteForLibjava
+ "
+
+ "Created: / 21-06-2011 / 17:39:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+buildSuiteForMauve
+
+ ^self buildSuiteFrom:
+ (self loadMauve)
+
+ "
+ JavaTestsLoader buildSuiteForMauve
+ "
+
+ "Created: / 21-06-2011 / 17:40:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+buildSuiteForMauveToFix
+
+ ^self buildSuiteFrom:
+ (self loadMauveToFix)
+
+ "
+ JavaTestsLoader buildSuiteForMauveToFix
+ "
+
+ "Created: / 21-06-2011 / 17:40:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsLoader class methodsFor:'loading'!
+
+load
+ JavaTestsResource build.
+ self loadIn:JavaTestsResource classpath
+
+ "Created: / 07-05-2011 / 18:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+load:testdir
+ |base dirs|
+
+ base := (UserPreferences current javaTestsDirectory asFilename / testdir)
+ pathName.
+ dirs := JavaTestsResource classpath
+ select:[:each | each startsWith:base ].
+ self loadIn:dirs.
+
+ "
+ JavaTestsLoader load: 'libjava'"
+ "Created: / 07-05-2011 / 18:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsLoader class methodsFor:'loading - test suites'!
+
+loadLibjava
+ |cp|
+
+ JavaTestsResource new setUp.
+ cp := JavaTestsResource classpathForLibjava.
+ ^self loadIn: cp
+
+ "Created: / 21-06-2011 / 17:35:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadMauve
+ |cp|
+
+ JavaTestsResource new setUp.
+ cp := JavaTestsResource classpathForMauve.
+ ^self loadIn: cp
+
+ "Created: / 11-06-2011 / 16:03:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadMauve: pattern
+ |cp|
+
+ JavaTestsResource new setUp.
+ cp := JavaTestsResource classpathForMauve.
+ ^self loadIn: cp matching: pattern.
+
+ "
+ JavaTestsLoader loadMauve:'gnu.testlet.java.lang.String.*'
+ "
+
+ "Created: / 12-06-2011 / 21:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 20-06-2011 / 19:00:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadMauveToFix
+ |cp|
+
+ JavaTestsResource new setUp.
+ cp := JavaTestsResource classpathForMauve.
+ self
+ loadIn: cp matching:'gnu.testlet.java.lang.*';
+ loadIn: cp matching:'gnu.testlet.java.lang.reflect.*';
+ loadIn: cp matching:'gnu.testlet.java.util.*';
+ loadIn: cp matching:'gnu.testlet.java.io.*';
+ loadIn: cp matching:'gnu.testlet.java.nio.*'.
+
+ "
+ JavaTestsLoader loadMauveToFix
+ "
+
+ "Created: / 11-06-2011 / 16:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsLoader class methodsFor:'private'!
+
+buildSuiteFrom: classes
+
+ | javaTestCases suite |
+
+ javaTestCases := OrderedCollection new.
+ suite := TestSuite new.
+
+ classes do:
+ [:jclass|
+ (jclass ~~ (Java at:'stx.libjava.tests.JUnit3Tests')
+ and:[jclass ~~ (Java at:'stx.libjava.tests.JUnit4Tests')
+ and:[jclass isTestCaseLike]])
+ ifTrue:
+ [ | tc |
+ tc := jclass asTestCase.
+ (tc askFor:#isTestlet) ifTrue:[
+ tc shouldFork: true.
+ ].
+ tc isAbstract ifFalse:[javaTestCases add:tc ]]].
+
+ javaTestCases do:
+ [:each |
+ suite addTests:each buildSuite tests ].
+
+ ^suite
+
+ "Modified: / 21-06-2011 / 17:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadIn: directories
+
+ ^self loadIn: directories matching: '*'
+
+ "Created: / 11-06-2011 / 16:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+loadIn: directories matching: pattern
+
+ | classes |
+
+ JavaInitializedResource new setUp.
+ JavaLibrariesResource new setUp.
+ JavaTestsResource new setUp.
+ classes := OrderedCollection new.
+
+ directories do:
+ [:each|
+ each asFilename exists ifTrue:
+ [classes addAll: (JavaClassReader loadClassesIn: each matching: pattern)]].
+
+ ^classes
+
+ "Created: / 11-06-2011 / 16:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 20-06-2011 / 19:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsLoader class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaTestsResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,165 @@
+"
+ 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' }"
+
+JavaAntProjectResource subclass:#JavaTestsResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaTestsResource 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.
+
+"
+! !
+
+!JavaTestsResource class methodsFor:'accessing'!
+
+classpath
+ |cp|
+
+ cp := OrderedCollection new.
+ self antProjectDir
+ directoryContentsDo:[:dir | cp := cp , (self classpathFor:dir) ].
+ ^ cp
+
+ "
+ JavaTestsResource classpath"
+ "Created: / 07-05-2011 / 18:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-06-2011 / 16:40:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classpathFor:testProject
+ |cp dir|
+
+ cp := OrderedCollection new.
+ dir := self antProjectDir / testProject.
+ dir isDirectory
+ ifTrue:
+ [ (dir / 'bin') exists ifTrue:[ cp add:(dir / 'bin') asString ].
+ (dir / 'lib') exists
+ ifTrue:
+ [ cp addAll:((dir / 'lib') directoryContentsAsFilenames
+ select:[:jar | jar suffix = 'jar' ]) ] ].
+ ^ cp
+
+ "
+ JavaTestsResource testsClasspath"
+ "Created: / 11-06-2011 / 15:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classpathForLibjava
+ ^ self classpathFor:'libjava'
+
+ "
+ JavaTestsResource classpathForLibjava
+ "
+
+ "Created: / 21-06-2011 / 17:34:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classpathForMauve
+ ^ self classpathFor:'libjava-mauve'
+
+ "
+ JavaTestsResource testsClasspathForMauve"
+ "Created: / 11-06-2011 / 15:59:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsResource class methodsFor:'accessing - ant project'!
+
+antProjectDir
+
+ ^ UserPreferences current javaTestsDirectory asFilename
+
+ "Modified: / 07-05-2011 / 17:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 18-07-2011 / 18:15:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaTestsResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaTopView.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaTopView.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1999 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
StandardSystemView subclass:#JavaTopView
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1999 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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
@@ -133,5 +189,9 @@
!JavaTopView class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaTopView.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaTopView.st,v 1.8 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,118 @@
+"
+ 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' }"
+
+JavaNode subclass:#JavaTypeNode
+ instanceVariableNames:'token'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaTypeNode 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.
+
+"
+! !
+
+!JavaTypeNode methodsFor:'accessing'!
+
+selector
+ self subclassResponsibility.
+
+ "Created: / 17-12-2010 / 16:36:46 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+token
+ ^ token
+!
+
+token:something
+ token := something.
+! !
+
+!JavaTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaUTF8Tests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,185 @@
+"
+ 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:#JavaUTF8Tests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+!JavaUTF8Tests 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.
+
+"
+! !
+
+!JavaUTF8Tests methodsFor:'loadingTests'!
+
+testSingleByteCharacters
+ |bytes|
+
+ bytes := ByteArray new:1.
+ bytes at:1 put:65.
+ self assert:((CharacterArray decodeFromJavaUTF8:bytes) = 'A').
+
+ "Created: / 04-02-2011 / 14:18:10 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+testSixByteCharacters
+ | bytes convertedString expectedString |
+
+ bytes := ByteArray new: 6.
+ bytes at: 1 put: 2r11101101.
+ bytes at: 2 put: 2r10101111.
+ bytes at: 3 put: 2r10111111.
+ bytes at: 4 put: 2r11101101.
+ bytes at: 5 put: 2r10111111.
+ bytes at: 6 put: 2r10101111.
+ expectedString := Unicode32String new: 1.
+ expectedString at: 1
+ put: (Character codePoint: (((((2r11111111111111111111)))))).
+ convertedString := CharacterArray decodeFromJavaUTF8: bytes.
+ self assert: convertedString = expectedString.
+
+ "Created: / 04-02-2011 / 15:25:27 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 13-03-2011 / 15:44:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSixByteCharactersTrap
+ |bytes convertedString expectedString|
+
+ bytes := ByteArray new:6.
+ bytes at:1 put:2r11101101.
+ bytes at:2 put:2r10101111.
+ bytes at:3 put:2r10111111.
+ bytes at:4 put:2r11101101.
+ bytes at:5 put:2r10101111.
+ bytes at:6 put:2r10111111.
+ expectedString := Unicode32String new:2.
+ expectedString at:1
+ put:(Character codePoint:2r1101101111111111).
+ expectedString at:2
+ put:(Character codePoint:2r1101101111111111).
+ convertedString := CharacterArray decodeFromJavaUTF8:bytes.
+ self assert:convertedString = expectedString.
+
+ "Created: / 04-02-2011 / 16:01:32 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+testThreeByteCharacters
+ |bytes convertedString expectedString|
+
+ bytes := ByteArray new:3.
+ bytes at:1 put:2r11101111.
+ bytes at:2 put:2r10001111.
+ bytes at:3 put:2r10101111.
+ expectedString := Unicode16String new:1.
+ expectedString at:1 put:(Character codePoint:2r1111001111101111).
+ convertedString := CharacterArray decodeFromJavaUTF8:bytes.
+ self assert:convertedString = expectedString.
+
+ "Created: / 04-02-2011 / 15:06:03 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+testTwoByteCharacters
+ |bytes convertedString expectedString|
+
+ bytes := ByteArray new:2.
+ bytes at:1 put:2r11011111.
+ bytes at:2 put:2r10001111.
+ expectedString := Unicode16String new:1.
+ expectedString at:1 put:(Character codePoint:2r11111001111).
+ convertedString := CharacterArray decodeFromJavaUTF8:bytes.
+ self assert:convertedString = expectedString.
+
+ "Created: / 04-02-2011 / 14:31:26 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 04-02-2011 / 16:02:16 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaUTF8Tests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaUnhandledExceptionError.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,102 @@
+"
+ 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' }"
+
+JavaError subclass:#JavaUnhandledExceptionError
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!JavaUnhandledExceptionError 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.
+
+"
+! !
+
+!JavaUnhandledExceptionError class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/JavaUnresolvedClassConstant.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaUnresolvedClassConstant.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
JavaUnresolvedConstant subclass:#JavaUnresolvedClassConstant
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaUnresolvedClassConstant class methodsFor:'instance creation'!
@@ -69,6 +125,15 @@
"Modified: / 4.2.1998 / 22:13:38 / cg"
! !
+!JavaUnresolvedClassConstant methodsFor:'* As yet uncategorized *'!
+
+javaClassForNew
+
+ ^self javaClass
+
+ "Created: / 16-03-2011 / 16:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!JavaUnresolvedClassConstant methodsFor:'accessing'!
className
@@ -114,7 +179,9 @@
!
javaClass
- |clsName|
+ | cls clsName |
+
+ "/fullName first == $[ ifTrue:[self halt].
fullName isNil ifTrue:[
self preResolve.
@@ -122,14 +189,41 @@
self halt.
]
].
+ (fullName first = $[)
+ ifTrue:
+ [cls := (JavaDescriptor fromString: fullName) javaClass]
+ ifFalse:
+ [cls := Java classForName:fullName].
+ constantPool at: constantPoolIndex put: cls.
+ ^cls
+
+ "old code:"
+ "
(fullName startsWith:$[) ifTrue:[
- clsName := self className
+ self halt.
+ clsName := self className.
+ (Java classForName:clsName) ifNil:
+ [self error: 'Cannot resolve class ' , clsName].
+ cls := (JavaDescriptor fromString: fullName) javaClass.
] ifFalse:[
clsName := fullName
].
- ^ Java classForName:clsName.
+ cls := Java classForName:clsName.
+ constantPool at: constantPoolIndex put: cls.
+ ^cls
+ "
- "Modified: / 10.11.1998 / 19:29:28 / cg"
+ "Modified: / 10-11-1998 / 19:29:28 / cg"
+ "Modified: / 11-02-2011 / 07:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lastName
+
+ | idx |
+ idx := fullName lastIndexOf: $/.
+ ^idx ifNil:[fullName] ifNotNil:[fullName copyFrom: idx + 1].
+
+ "Created: / 18-10-2010 / 22:20:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
name
@@ -238,7 +332,7 @@
!JavaUnresolvedClassConstant methodsFor:'resolving'!
preResolve
- |clsName cls nm s ref|
+ |clsName cls nm ref|
fullName isNil ifTrue:[
"/ first, resolve my name ...
@@ -248,198 +342,62 @@
clsName isString ifFalse:[
self halt:'oops - no class name string in const pool'.
].
-
fullName := clsName
].
"/ try to resolve the class
- "/ 'resolve: ' print. fullName printCR.
-
- cls := Java classNamed:fullName.
- cls notNil ifTrue:[
- "/ good - the class is already loaded.
-
- constantPool at:constantPoolIndex put:cls.
- ^ cls
- ].
-
- fullName size == 2 ifTrue:[
- "/ look for specials like byte[], int[] etc.
- "/ there are only a few of them - forgive me nameing them here ...
- fullName = '[B' ifTrue:[ "/ byte[]
- ref := JavaBuiltInClassPointerRef class:ByteArray nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[Z' ifTrue:[ "/ boolean[]
- ref := JavaBuiltInClassPointerRef class:ByteArray nameandType:fullName.
+ (fullName size == 1) ifTrue:[
+ "/ good - this is a primitive
+ ref := JavaBuiltInClassPointerRef class:(JavaDescriptor fromString: fullName) javaClass nameandType:fullName.
constantPool at:constantPoolIndex put:ref.
^ ref
- ].
- fullName = '[I' ifTrue:[ "/ int[]
- ref := JavaBuiltInClassPointerRef class:SignedIntegerArray nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[J' ifTrue:[ "/ long[]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
+ ].
+
+ (fullName includes:$[) ifFalse:[
+ cls := Java classNamed:fullName.
+ cls notNil ifTrue:[
+ "/ good - the class is already loaded.
+ constantPool at:constantPoolIndex put:cls.
+ ^ cls
].
- fullName = '[S' ifTrue:[ "/ short[]
- ref := JavaBuiltInClassPointerRef class:SignedWordArray nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[C' ifTrue:[ "/ char[]
- "/ should be TwoByteString ...
- ref := JavaBuiltInClassPointerRef class:String nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[F' ifTrue:[ "/ float[]
- ref := JavaBuiltInClassPointerRef class:FloatArray nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[D' ifTrue:[ "/ double[]
- ref := JavaBuiltInClassPointerRef class:DoubleArray nameandType:fullName.
+ ] ifTrue:[
+ "
+ Deal with Sun's malformed class refs generated by
+ sun.misc.ProxyGenerator - it generates
+ java/lang/annotation/ElementType[] instead of
+ [Ljava/lang/annotation/ElementType[];
+ as the spec requires!!
+ "
+ (fullName last == $] and:[(fullName at: fullName size - 1) == $[]) ifTrue:
+ [fullName := '[L', (fullName copyTo: fullName size - 2) , ';'].
+
+ (fullName includes: $L) ifFalse:[
+ "/ good - this is a primitive array
+ ref := JavaBuiltInClassPointerRef class:(JavaDescriptor fromString: fullName) javaClass nameandType:fullName.
constantPool at:constantPoolIndex put:ref.
^ ref
].
].
- (fullName startsWith:$[) ifTrue:[
- "/ a ref for newarray or new
- s := fullName readStream.
- [s peek == $[ ] whileTrue:[
- s next
- ].
- nm := s upToEnd.
-
- (nm startsWith:$L) ifFalse:[
- nm = 'F' ifTrue:[ "/ float[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'D' ifTrue:[ "/ double[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'I' ifTrue:[ "/ int[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'C' ifTrue:[ "/ char[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'B' ifTrue:[ "/ byte[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'Z' ifTrue:[ "/ bool[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- nm = 'S' ifTrue:[ "/ short[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- self halt.
- ].
- nm := nm copyFrom:2.
- (nm endsWith:$;) ifFalse:[
- self halt.
- ].
- nm := nm copyWithoutLast:1.
-
- cls := Java classNamed:nm.
- cls notNil ifTrue:[
- ref := JavaClassPointerRef class:cls nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- self rememberForResolveWith:nm.
- ^ self.
-
- nm := JavaMethod retvalSpecFromStream:(ReadStream on:fullName) in:nil.
- [nm endsWith:'[]'] whileTrue:[
- nm := nm copyWithoutLast:2
- ].
-
- cls := Java classNamed:nm.
- cls notNil ifTrue:[
- ref := JavaClassPointerRef class:cls nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
-
- (fullName startsWith:'[[') ifTrue:[
- fullName = '[[F' ifTrue:[ "/ float[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[D' ifTrue:[ "/ double[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[I' ifTrue:[ "/ int[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[C' ifTrue:[ "/ char[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[B' ifTrue:[ "/ byte[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[Z' ifTrue:[ "/ bool[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- fullName = '[[S' ifTrue:[ "/ short[][]
- ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
- constantPool at:constantPoolIndex put:ref.
- ^ ref
- ].
- ].
- (fullName startsWith:'[L') ifFalse:[
- (fullName startsWith:'[[L') ifFalse:[
- ('JAVA: oops - unresolvable funny class: ' , fullName) errorPrintCR.
- self halt.
- ]
- ]
- ] ifFalse:[
+ (fullName startsWith:$[) ifFalse:[
nm := self className.
+ self rememberForResolveWith:nm.
].
-
- self rememberForResolveWith:nm.
^ self
- "Created: / 15.4.1996 / 15:51:42 / cg"
- "Modified: / 6.7.1999 / 23:41:04 / cg"
+ "Created: / 15-04-1996 / 15:51:42 / cg"
+ "Modified: / 06-07-1999 / 23:41:04 / cg"
+ "Modified: / 11-02-2011 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaUnresolvedClassConstant class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaUnresolvedClassConstant.st,v 1.44 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaUnresolvedClassConstant.st,v 1.44 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaUnresolvedConstant.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaUnresolvedConstant.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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:#JavaUnresolvedConstant
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaUnresolvedConstant class methodsFor:'instance creation'!
@@ -246,5 +302,9 @@
!JavaUnresolvedConstant class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaUnresolvedConstant.st,v 1.13 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaUnresolvedConstant.st,v 1.13 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaUnresolvedStringConstant.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaUnresolvedStringConstant.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
JavaUnresolvedConstant subclass:#JavaUnresolvedStringConstant
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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.
+
+"
! !
!JavaUnresolvedStringConstant class methodsFor:'instance creation'!
@@ -67,7 +123,7 @@
chars isString ifFalse:[
self halt:'should not happen'
].
- jString := Java as_String:chars.
+ jString := JavaVM javaStringObjectForString:chars interned:true.
"/constantPool owner == (Java at:'java/awt/Container') ifTrue:[
"/self halt
@@ -80,11 +136,16 @@
self rememberForResolveWith:'java/lang/String'.
^ self
- "Modified: 7.8.1997 / 21:17:23 / cg"
+ "Modified: / 07-08-1997 / 21:17:23 / cg"
+ "Modified: / 10-08-2011 / 23:28:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaUnresolvedStringConstant class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaUnresolvedStringConstant.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaUnresolvedStringConstant.st,v 1.9 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/JavaVM.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaVM.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,6 +12,32 @@
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' }"
@@ -25,26 +55,41 @@
FileOpenConfirmation SocketConnectConfirmation FileIOTrace
OpenFileTable CachedNativeMethodTable ExceptionDebug ExitDebug
JavaConsoleStream StandardThreadGroup EnteredMonitorsPerProcess
- JavaClasses JavaMethods DUMMY_LONG_HIGHWORD DUMMY_DOUBLE_HIGHWORD
- NoAudio FirstWindowCreationSemaphore PermittedDirectories
+ JavaMethods DUMMY_LONG_HIGHWORD DUMMY_DOUBLE_HIGHWORD NoAudio
+ FirstWindowCreationSemaphore PermittedDirectories
PermittedHostConnects SimulatedOS O_WGgraphics_originX
O_WGgraphics_originY O_WGgraphics_pData O_FramePeer_pNativeWidget
O_FramePeer_pData ImageStretchCache LastGraphics LastGC
EnteredMonitorObject EnteredMonitorObjectCount
EnteredMonitorProcess LeftMonitorObject JavaEventThread
JavaScreenUpdaterThread JavaEventQueueThread SystemProperties
- NullPointerExceptionDebug DivisionByZeroExceptionDebug
- IOExceptionDebug StdinReplacementFileQuerySignal'
+ ExceptionDebugPatterns NullPointerExceptionDebug
+ DivisionByZeroExceptionDebug IOExceptionDebug
+ StdinReplacementFileQuerySignal AssertionsEnabled
+ SimulatedNativeMemory Reflection ZipCache ZipEntryCache
+ ZipLastModTimesCache ZipInflaters'
poolDictionaries:''
category:'Languages-Java-Support'
!
+Object subclass:#Reflection
+ instanceVariableNames:'vm constantPoolMapping javaClasses javaArrayClasses javaMethods
+ returnNilIfMissing'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:JavaVM
+!
+
!JavaVM class methodsFor:'documentation'!
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -52,9 +97,45 @@
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
+"Runtime support and environment for Java.
+You shouldn't communicate with JavaVM directly,
+use Java class instead. JavaVM is layer between
+the native interpret and the rest of the system.
+JavaVM implements native java virtual machine
+methods called by interpret, hides java primitive
+types handling, and gives the ST world ways to
+control class loading and reflection"
!
nativeMethods
@@ -1246,27 +1327,24 @@
StandardThreadGroup := nil.
self releaseAllMonitors.
-
KnownWindows notNil ifTrue:[
- KnownWindows do:[:v |
- v isTopView ifTrue:[
- v destroy
- ]
- ]
- ].
-
+ KnownWindows do:[:v |
+ v isTopView ifTrue:[
+ v destroy
+ ]
+ ]
+ ].
JavaWindowGroup := nil.
KnownWindows := nil.
- OpenFileTable := nil.
- JavaClasses := nil.
+ OpenFileTable := nil.
JavaMethods := nil.
"
- JavaVM deinitialize
- "
-
- "Created: / 3.1.1998 / 21:28:14 / cg"
- "Modified: / 3.12.1998 / 20:33:21 / cg"
+ JavaVM deinitialize"
+
+ "Created: / 03-01-1998 / 21:28:14 / cg"
+ "Modified: / 03-12-1998 / 20:33:21 / cg"
+ "Modified: / 28-01-2011 / 14:11:35 / Marcel Hlopko <hlopik@gmail.com>"
!
deinitializeAdditionalJavaProtocol
@@ -1294,68 +1372,63 @@
!
initialize
- |table|
-
DUMMY_LONG_HIGHWORD := 1.
DUMMY_DOUBLE_HIGHWORD := 2.
-
StandardThreadGroup := nil.
NoAudio := true.
+
"/ NoAudio := false.
-
+
JavaConsoleStream := Transcript.
-
FullExceptionTrace := StackTrace := false.
WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false.
MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false.
ExceptionDebug := ExitDebug := false.
+ ExceptionDebugPatterns := Set new.
WindowCreationTrace := false.
-
FileOpenConfirmation := true.
SocketConnectConfirmation := true.
-
-"/ WindowOPTrace := true.
-"/ MonitorTrace := true.
-"/ ThreadTrace := true.
-
- UnhandledJavaExceptionSignal := (Signal new) mayProceed:true.
- UnhandledJavaExceptionSignal nameClass:self message:#unhandledJavaExceptionSignal.
- UnhandledJavaExceptionSignal notifierString:'unhandled java exception'.
-
- JavaExceptionSignal := (Signal new) mayProceed:false.
- JavaExceptionSignal nameClass:self message:#javaExceptionSignal.
- JavaExceptionSignal notifierString:'java exception'.
-
- UnimplementedInstructionSignal := (Signal new) mayProceed:false.
- UnimplementedInstructionSignal nameClass:self message:#unimplementedInstructionSignal.
- UnimplementedInstructionSignal notifierString:'unimplemented instruction'.
-
- UnimplementedNativeMethodSignal := (Signal new) mayProceed:false.
- UnimplementedNativeMethodSignal nameClass:self message:#unimplementedNativeMethodSignal.
- UnimplementedNativeMethodSignal notifierString:'unimplemented native method'.
-
- BadMessageSignal := (Signal new) mayProceed:false.
- BadMessageSignal nameClass:self message:#badMessageSignal.
- BadMessageSignal notifierString:'invalid message to JAVA object'.
-
- InternalErrorSignal := (Signal new) mayProceed:false.
- InternalErrorSignal nameClass:self message:#internalErrorSignal.
- InternalErrorSignal notifierString:'internal error'.
-
- CallHandlerSignal := (Signal new) mayProceed:false.
- CallHandlerSignal nameClass:self message:#callHandlerSignal.
- CallHandlerSignal notifierString:'internal signal'.
-
+ WindowOPTrace := false.
+ MonitorTrace := false.
+ ThreadTrace := false.
+ UnhandledJavaExceptionSignal := (Signal new) mayProceed: true.
+ UnhandledJavaExceptionSignal nameClass: self
+ message: #unhandledJavaExceptionSignal.
+ UnhandledJavaExceptionSignal notifierString: 'unhandled java exception'.
+ JavaExceptionSignal := (Signal new) mayProceed: false.
+ JavaExceptionSignal nameClass: self message: #javaExceptionSignal.
+ JavaExceptionSignal notifierString: 'java exception'.
+ UnimplementedInstructionSignal := (Signal new) mayProceed: false.
+ UnimplementedInstructionSignal nameClass: self
+ message: #unimplementedInstructionSignal.
+ UnimplementedInstructionSignal notifierString: 'unimplemented instruction'.
+ UnimplementedNativeMethodSignal := (Signal new) mayProceed: false.
+ UnimplementedNativeMethodSignal nameClass: self
+ message: #unimplementedNativeMethodSignal.
+ UnimplementedNativeMethodSignal
+ notifierString: 'unimplemented native method'.
+ BadMessageSignal := (Signal new) mayProceed: false.
+ BadMessageSignal nameClass: self message: #badMessageSignal.
+ BadMessageSignal notifierString: 'invalid message to JAVA object'.
+ InternalErrorSignal := (Signal new) mayProceed: false.
+ InternalErrorSignal nameClass: self message: #internalErrorSignal.
+ InternalErrorSignal notifierString: 'internal error'.
+ CallHandlerSignal := (Signal new) mayProceed: false.
+ CallHandlerSignal nameClass: self message: #callHandlerSignal.
+ CallHandlerSignal notifierString: 'internal signal'.
StdinReplacementFileQuerySignal := QuerySignal new.
- StdinReplacementFileQuerySignal nameClass:self message:#stdinReplacementFileQuerySignal.
- StdinReplacementFileQuerySignal notifierString:'asking for stdin stream'.
-
- "
- JavaVM initialize
- "
-
- "Created: / 2.1.1998 / 18:02:34 / cg"
- "Modified: / 2.12.1998 / 23:02:22 / cg"
+ StdinReplacementFileQuerySignal nameClass: self
+ message: #stdinReplacementFileQuerySignal.
+ StdinReplacementFileQuerySignal notifierString: 'asking for stdin stream'.
+ AssertionsEnabled := true.
+
+ "
+ JavaVM initialize"
+
+ "Created: / 02-01-1998 / 18:02:34 / cg"
+ "Modified: / 02-12-1998 / 23:02:22 / cg"
+ "Modified: / 25-02-2011 / 08:05:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-04-2011 / 12:33:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
initializeAdditionalJavaProtocol
@@ -1450,15 +1523,37 @@
^ JavaVM javaClassObjectForClass:self class'
in:Object.
+ "/ ------------------------------------------------------------
+
+ self
+ compile:'__hashCode
+ "this is smalltalk code with a java selector ...
+ (This source cannot be accepted in the browser,
+ since it has a funny selector.)
+ Has been added by JavaVM>>initializeAdditionalJavaProtocol"
+
+ ^ self identityHash'
+ selector:#'__hashCode'
+ asJavaMethod:#'hashCode()I'
+ fakedSource:'#''hashCode()I''
+ "this is smalltalk code with a java selector ...
+ (This source cannot be accepted in the browser,
+ since it has a funny selector.)
+ Has been added by JavaVM>>initializeAdditionalJavaProtocol"
+
+ ^ self identityHash'
+ in:Object.
+
"
self initializeAdditionalJavaProtocol
"
- "Modified: / 28.1.1997 / 19:38:58 / stefan"
- "Modified: / 22.1.1998 / 21:23:40 / av"
- "Created: / 4.2.1998 / 21:35:46 / cg"
- "Modified: / 30.12.1998 / 21:07:55 / cg"
+ "Modified: / 28-01-1997 / 19:38:58 / stefan"
+ "Modified: / 22-01-1998 / 21:23:40 / av"
+ "Created: / 04-02-1998 / 21:35:46 / cg"
+ "Modified: / 30-12-1998 / 21:07:55 / cg"
+ "Modified: / 25-10-2010 / 16:26:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeBaseClasses
@@ -1502,40 +1597,44 @@
!
initializePrimitiveClasses
- JavaClasses isNil ifTrue:[
- JavaClasses := Dictionary new.
- ].
-
- #(
- (#byte 'B' 1)
- (#short 'S' 2)
- (#int 'I' 4)
- (#long 'J' 8)
- (#boolean 'Z' 1)
- (#char 'C' 2)
- (#float 'F' 4)
- (#double 'D' 8)
- (#void 'V' 0)
- ) triplesDo:[:nm :sig :len |
- |jClass classInst|
-
- "/
- "/ create a javaClass for it.
- "/
- jClass := Java at:'java.lang.Class'.
- jClass notNil ifTrue:[
- classInst := jClass new.
- JavaClasses at:nm put:classInst.
- JavaClasses at:classInst put:nm.
- ]
- ].
-
- "
- self initializePrimitiveClasses
- "
-
- "Modified: / 22.10.1998 / 01:56:02 / cg"
-
+
+
+ "/ #(
+ "/ (#byte 'B' 1)
+ "/ (#short 'S' 2)
+ "/ (#int 'I' 4)
+ "/ (#long 'J' 8)
+ "/ (#boolean 'Z' 1)
+ "/ (#char 'C' 2)
+ "/ (#float 'F' 4)
+ "/ (#double 'D' 8)
+ "/ (#void 'V' 0)
+ "/ ) triplesDo:[:nm :sig :len |
+ "/ |jClass classInst|
+ "/
+ "/ "/
+ "/ "/ create a javaClass for it.
+ "/ "/
+ "/ jClass := Java at:'java.lang.Class'.
+ "/ jClass notNil ifTrue:[
+ "/ classInst := jClass new.
+ "/ JavaClasses at:nm put:classInst.
+ "/ JavaClasses at:classInst put:nm.
+ "/ ]
+ "/ ].
+ "
+ self initializePrimitiveClasses"
+
+ "Modified: / 22-10-1998 / 01:56:02 / cg"
+ "Modified: / 20-12-2010 / 23:39:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 14:57:38 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+initializeReflection
+
+ Reflection := JavaVM::Reflection for: self.
+
+ "Created: / 21-12-2010 / 19:48:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeSimulatedLibs
@@ -1582,17 +1681,41 @@
"return a collection of native libs which are considered
being already loaded (used with jdk >= 1.2)"
- SimulatedNativeLibs := #(
- '/libawt.so'
- '/libnet.so'
- '/libcmm.so'
- ).
+ OperatingSystem isUNIXlike ifTrue:[
+ SimulatedNativeLibs := #(
+ 'libawt.so'
+ 'libnet.so'
+ 'libcmm.so'
+ 'libzip.so'
+ ).
+ ^self.
+ ].
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ SimulatedNativeLibs := #(
+ 'awt.dll'
+ 'net.dll'
+ 'cmm.dll'
+ 'zip.dll'
+ ).
+ ^self.
+ ].
+ SimulatedNativeLibs := #().
+
"
self initializeSimulatedNativeLibs
"
- "Modified: / 27.1.1998 / 18:43:10 / cg"
+ "Modified: / 27-01-1998 / 18:43:10 / cg"
+ "Modified: / 01-04-2011 / 23:02:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeSimulatedNativeMemory
+
+ SimulatedNativeMemory := JavaNativeMemory new.
+
+ "Created: / 07-12-2010 / 21:07:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-12-2010 / 23:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeSystemPropertiesInto:props
@@ -1611,8 +1734,9 @@
].
props at:'java.version' put:'1'.
- props at:'java.vendor' put:'eXept Software AG'.
- props at:'java.vendor.url' put:'http://www.exept.de'.
+ props at:'java.vendor' put:'eXept Software AG & SWING Reseach Group'.
+ props at:'java.vendor.url' put:'http://www.exept.de & http://swing.fit.cvut.cz'.
+ props at:'java.vm.name' put:'Smalltalk/X'.
(jHome := self defaultJAVAHome) notNil ifTrue:[
props at:'java.home' put:(jHome asFilename pathName).
].
@@ -1623,21 +1747,23 @@
props at:'os.version' put:'1'.
props at:'file.separator' put:(Filename separator asString).
- props at:'path.separator' put:':'.
+ props at:'path.separator' put: OperatingSystem pathSeparator asString.
props at:'line.separator' put:(Character cr asString).
props at:'user.name' put:(OperatingSystem getLoginName).
props at:'user.home' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name).
props at:'user.dir' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name).
"/ props at:'user.dir' put:(Filename currentDirectory pathName).
- props at:'awt.toolkit' put:(self defaultWindowingToolKit).
+ "/props at:'awt.toolkit' put:(self defaultWindowingToolKit).
+
+ props at: 'user.country' put: 'US'.
props at:'hotjava.home' put:(self defaultHotJavaHome).
"/ new with jdk 1.1.8
"/ undocumented ?
props at:'file.encoding.pkg' put:'sun.io'.
- props at:'file.encoding' put:'8859_1'.
+ props at:'file.encoding' put:'UTF-8'.
"/ suppress copyright view in appletViewer ...
props at:'appletviewer.version' put:'1.1'.
@@ -1647,9 +1773,14 @@
props at:'java.awt.fonts' put:'/usr/lib/X11/fonts'.
"/ jws
- props at:'jws.home' put:(self defaultJWSHome).
+ "/props at:'jws.home' put:(self defaultJWSHome).
"/ new with jws 2.0 ...
- props at:'jws.startcmd' put:'jws.showwin.mainide'.
+ "/props at:'jws.startcmd' put:'jws.showwin.mainide'.
+
+ props at: 'java.library.path' put: self defaultJavaLibraryPath.
+ props at: 'sun.boot.library.path' put: self defaultSunBootLibraryPath.
+
+"/ props at: 'sun.misc.URLClassPath.debug' put: 'true'.
^ props
@@ -1657,54 +1788,74 @@
self initializeSystemPropertiesInto:(Dictionary new)
"
- "Created: / 3.1.1998 / 14:26:39 / cg"
- "Modified: / 27.1.2000 / 02:20:18 / cg"
+ "Created: / 03-01-1998 / 14:26:39 / cg"
+ "Modified: / 27-01-2000 / 02:20:18 / cg"
+ "Modified: / 12-08-2011 / 19:51:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeVM
+ "Force off JIT compiler for Java code - it hasn't been
+ updated to reflect changes in jinterpret.c.
+ Following >>make it working, make it fast<< rule"
+
+ ObjectMemory
+ javaJustInTimeCompilation: false;
+ javaNativeCodeOptimization: false.
JavaObject autoload.
JavaContext autoload.
-
+ MonitorTrace ifNil: [ self initialize ].
self initializeAdditionalJavaProtocol.
-
self releaseAllJavaResources.
-
JavaConsoleStream := Transcript.
-
Java initAllStaticFields.
Java markAllClassesUninitialized.
+ ZipCache := OrderedCollection new.
+ ZipEntryCache := OrderedCollection new.
+ ZipInflaters := OrderedCollection new.
+
"/ force re-resolving;
"/ otherwise, class-inits would not be called
"/ by resolver ... (sigh)
-
+
JavaNativeMethod flushAllCachedNativeMethods.
- JavaMethod allSubInstancesDo:[:m |
- m checked:false.
- m code:nil.
- ].
- ObjectMemory flushCaches. "/ sigh - must flush inline caches.
-
+ JavaMethod allSubInstancesDo:
+ [:m |
+ m checked: false.
+ m code: nil. ].
+ ObjectMemory flushCaches.
+
+ "/ sigh - must flush inline caches.
+
JavaClass startRememberingOrderOfClassInits.
-
- self initializeSimulatedLibs. "/ < jdk 1.2
- self initializeSimulatedNativeLibs. "/ >= jdk 1.2
+ self initializeSimulatedLibs.
+
+ "/ < jdk 1.2
+
+ self initializeSimulatedNativeLibs.
+
+ "/ >= jdk 1.2
+
+ self initializeSimulatedNativeMemory.
+
+ "/> jdk 6
+
self initializeOpenFileTable.
-
+ self initializeReflection.
self initializeBaseClasses.
self initializePrimitiveClasses.
-
Java initSystemClass.
-
- ObjectMemory addDependent:self.
+ ObjectMemory addDependent: self.
"
JavaVM initialize.
- JavaVM initializeVM.
- "
-
- "Created: / 3.1.1998 / 21:29:09 / cg"
- "Modified: / 14.12.1999 / 18:58:56 / cg"
+ JavaVM initializeVM."
+
+ "Created: / 03-01-1998 / 21:29:09 / cg"
+ "Modified: / 14-12-1999 / 18:58:56 / cg"
+ "Modified: / 15-10-2010 / 15:27:45 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 01-04-2011 / 15:33:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 11-08-2011 / 00:57:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeVMIfNoEventThreadRunning
@@ -1790,6 +1941,10 @@
ImageStretchCache := nil.
LastGraphics := LastGC := nil.
+ SimulatedNativeMemory := nil.
+
+ self initializePrimitiveClasses.
+
self terminateAllThreads.
self releaseAllWindows.
@@ -1799,15 +1954,18 @@
JavaVM releaseAllJavaResources
"
- "Created: / 7.1.1998 / 22:49:42 / cg"
- "Modified: / 24.12.1999 / 02:33:11 / cg"
+ "Created: / 07-01-1998 / 22:49:42 / cg"
+ "Modified: / 24-12-1999 / 02:33:11 / cg"
+ "Modified: / 17-12-2010 / 17:51:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
releaseAllMonitors
LockTable := WeakIdentityDictionary new.
- LockTableAccess := Semaphore forMutualExclusion.
+ LockTableAccess := Semaphore"RecursionLock" forMutualExclusion.
+ LockTableAccess name: 'JavaVM lock table access mutex'.
WaitTable := IdentityDictionary new.
- WaitTableAccess := Semaphore forMutualExclusion.
+ WaitTableAccess := Semaphore"RecursionLock" forMutualExclusion.
+ WaitTableAccess name: 'JavaVM wait table access mutex'.
EnteredMonitorsPerProcess := IdentityDictionary new.
@@ -1815,8 +1973,9 @@
JavaVM releaseAllMonitors
"
- "Created: / 2.1.1998 / 18:04:05 / cg"
- "Modified: / 7.1.1998 / 22:58:10 / cg"
+ "Created: / 02-01-1998 / 18:04:05 / cg"
+ "Modified: / 07-01-1998 / 22:58:10 / cg"
+ "Modified: / 25-10-2010 / 19:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
releaseAllStreams
@@ -1944,9 +2103,11 @@
!
javaExceptionSignal
- ^ JavaExceptionSignal
-
- "Created: / 2.1.1998 / 18:05:58 / cg"
+ "^ JavaExceptionSignal"
+ ^JavaError
+
+ "Created: / 02-01-1998 / 18:05:58 / cg"
+ "Modified: / 01-03-2011 / 21:50:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
stdinReplacementFileQuerySignal
@@ -1975,11 +2136,38 @@
!JavaVM class methodsFor:'accessing'!
-addSelector:newSelector withMethod:newMethod
+addSelector:newSelector withMethod:newMethod
super addSelector:newSelector withMethod:newMethod.
- JavaNativeMethod flushAllCachedNativeMethods.
-
- "Created: / 24.12.1999 / 03:12:05 / cg"
+
+ "/JavaNativeMethod may not be loaded..."
+
+ (Smalltalk at:#JavaNativeMethod)
+ ifNotNil:[JavaNativeMethod flushAllCachedNativeMethods].
+
+ "Created: / 24-12-1999 / 03:12:05 / cg"
+ "Modified: / 02-02-2011 / 04:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-02-2011 / 23:38:08 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+assertionsEnabled: aBoolean
+
+ AssertionsEnabled := aBoolean
+
+ "
+ JavaVM assertionsEnabled: true.
+ JavaVM assertionsEnabled: false.
+ "
+
+ "Created: / 24-11-2010 / 09:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classForName:aString
+
+ ^ Java classForName:aString.
+
+ "Created: / 21-12-2010 / 19:50:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-02-2011 / 23:48:57 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-02-2011 / 21:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
javaEventQueueThread
@@ -1998,6 +2186,50 @@
^ JavaScreenUpdaterThread
"Created: / 8.1.1999 / 17:06:52 / cg"
+!
+
+reflection
+ ^ Reflection.
+
+ "Created: / 28-01-2011 / 15:09:19 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+useSmalltalkInterpreter
+
+ JavaMethod makeMetaMethod
+
+ "Created: / 23-02-2011 / 12:59:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+useVMInterpreter
+
+ JavaMethod makeJavaMethod
+
+ "Created: / 23-02-2011 / 12:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'debugging support'!
+
+exceptionDebug
+ ^ ExceptionDebug
+
+ "Created: / 27.1.1999 / 20:14:51 / cg"
+!
+
+exceptionDebug:aBoolean
+ ExceptionDebug := aBoolean
+
+ "Created: / 27.1.1999 / 20:15:00 / cg"
+!
+
+exceptionDebugPatterns
+
+ ^ ExceptionDebugPatterns
+ "
+ ExceptionDebugPatterns add: 'java/lang/ArrayIndex*'
+ "
+
+ "Created: / 25-02-2011 / 08:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaVM class methodsFor:'defaults'!
@@ -2018,21 +2250,21 @@
|s|
s := '' writeStream.
- Java classPath do:[:p |
- s size == 0 ifFalse:[
- s nextPut:$:
- ].
- s nextPutAll:p.
+ Java effectiveClassPath do:[:p |
+ s size == 0 ifFalse:[
+ s nextPut:$:
+ ].
+ s nextPutAll:p.
].
^ s contents
"
- self defaultCLASSPATH
- "
-
- "Modified: / 6.8.1997 / 00:51:17 / cg"
- "Created: / 3.1.1998 / 14:27:21 / cg"
+ self defaultCLASSPATH
+ "
+
+ "Created: / 03-01-1998 / 14:27:21 / cg"
+ "Modified: / 22-11-2010 / 13:44:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
defaultHotJavaHome
@@ -2060,6 +2292,67 @@
"Modified: / 3.12.1998 / 14:54:08 / cg"
!
+defaultJavaLibraryPath
+
+ | dirs |
+ dirs := OrderedCollection new
+ add: Java release javaHome asFilename / 'lib';
+ add: Java release javaHome asFilename / 'lib' / 'amd64';
+ add: Java release javaHome asFilename / 'lib' / 'i386';
+ add: Java release javaHome asFilename / 'jre' / 'lib' ;
+ add: Java release javaHome asFilename / 'jre' / 'lib' / 'amd64' ;
+ add: Java release javaHome asFilename / 'jre' / 'lib' / 'i386' ;
+ add: Java release javaHome asFilename / 'jre' / 'bin' ;
+ yourself.
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ dirs
+ add: Java release javaHome asFilename / 'bin'.
+ ].
+
+ ^String streamContents:
+ [:path|
+ (dirs select:[:d|d exists])
+ do:[:d|path nextPutAll:d pathName]
+ separatedBy:[path nextPut: OperatingSystem pathSeparator]]
+
+ "
+ JavaVM defaultJavaLibraryPath
+ "
+
+ "Created: / 10-12-2010 / 14:09:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-04-2011 / 18:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultSunBootLibraryPath
+
+ | dirs |
+ dirs := OrderedCollection new
+ add: Java release javaHome asFilename / 'lib';
+ add: Java release javaHome asFilename / 'lib' / 'amd64';
+ add: Java release javaHome asFilename / 'lib' / 'i386';
+ add: Java release javaHome asFilename / 'jre' / 'lib' ;
+ add: Java release javaHome asFilename / 'jre' / 'lib' / 'amd64' ;
+ add: Java release javaHome asFilename / 'jre' / 'lib' / 'i386' ;
+ yourself.
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ dirs
+ add: Java release javaHome asFilename / 'bin'.
+ ].
+
+
+ ^String streamContents:
+ [:path|
+ (dirs select:[:d|d exists])
+ do:[:d|path nextPutAll:d pathName]
+ separatedBy:[path nextPut: OperatingSystem pathSeparator]]
+
+ "
+ JavaVM defaultJavaLibraryPath
+ "
+
+ "Created: / 10-12-2010 / 14:37:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
defaultWindowingToolKit
"/ prefer the windows toolkit ...
@@ -2086,18 +2379,6 @@
"Modified: / 27.1.1998 / 21:52:52 / cg"
!
-exceptionDebug
- ^ ExceptionDebug
-
- "Created: / 27.1.1999 / 20:14:51 / cg"
-!
-
-exceptionDebug:aBoolean
- ExceptionDebug := aBoolean
-
- "Created: / 27.1.1999 / 20:15:00 / cg"
-!
-
fileAccessTrace
^ FileAccessTrace
@@ -2191,54 +2472,102 @@
!JavaVM class methodsFor:'helpers'!
-classForJavaClassObject:aJavaClassObject
- "given java.lang.class instance, return the real class for it."
-
- ^ JavaClasses at:aJavaClassObject ifAbsent:nil.
-
- "Created: / 23.1.1998 / 17:44:09 / cg"
-!
-
-javaClassObjectForClass:aClass
- "given a real class, return the corresponding java.lang.class
- instance for it."
-
- |jClass|
-
-aClass == SignedIntegerArray ifTrue:[self halt].
-
- jClass := JavaClasses at:aClass ifAbsent:nil.
- jClass isNil ifTrue:[
- "/ class must be initialized (with all of its superclasses ?).
- aClass isJavaClass ifTrue:[
- aClass classInit.
- ].
- JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new).
- JavaClasses at:jClass put:aClass.
- ].
- ^ jClass
-
- "Created: / 23.1.1998 / 17:43:38 / cg"
- "Modified: / 5.12.1998 / 15:29:32 / cg"
-!
-
-javaMethodObjectForMethod:aMethod
- "given a real method, return the corresponding java.lang.reflect.Method
- instance for it."
-
- |jMethod|
-
- jMethod := JavaMethods at:aMethod ifAbsent:nil.
- jMethod isNil ifTrue:[
- "/ class must be initialized (with all of its superclasses ?).
-
- JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new).
- JavaMethods at:jMethod put:aMethod.
- ].
- ^ jMethod
-
- "Modified: / 23.1.1998 / 17:46:51 / cg"
- "Created: / 9.2.1998 / 15:59:16 / cg"
+canCast: s to: t
+ "Helper for _CHECKCAST:_:"
+ | sc tc |
+
+ "Not specified in JVM spec, sigh"
+ s isJavaPrimitiveType ifTrue:[
+ "FIXME"
+ ^s == t
+ ].
+ "
+ Java VM Spec, 3rd edition, p 280:
+
+ The following rules are used to determine whether an objectref that is not
+ null can be cast to the resolved type: if S is the class of the object
+ referred to by objectref and T is the resolved class, array, or interface type,
+ checkcast determines whether objectref can be cast to type T as follows:
+
+ - If S is an ordinary (nonarray) class, then:
+ - If T is a class type, then S must be the same class as T, or a subclass
+ of T.
+ - If T is an interface type, then S must implement interface T.
+ "
+ (s isJavaArrayClass not and:[s isInterface not]) ifTrue:
+ [^s includesBehavior: t].
+
+ "
+ - If S is an interface type, then:
+ - If T is a class type, then T must be Object.
+ - If T is an interface type, then T must be the same interface as S or a
+ superinterface of S.
+ "
+ s isInterface ifTrue:
+ [^t isInterface not
+ ifTrue: [t == (self classForName:'java.lang.Object')]
+ ifFalse:[s includesBehavior: t]].
+ "
+ - If S is a class representing the array type SC[], that is, an array of com-
+ ponents of type SC , then:
+ "
+ self assert: s isJavaArrayClass description: 'S should be array type'.
+ sc := s javaComponentClass.
+ "
+ - If T is a class type, then T must be Object.
+ "
+ t isJavaClassType ifTrue:
+ [^t == (self classForName: 'java.lang.Object')].
+ "
+ - If T is an array type TC[], that is, an array of components of type TC ,
+ then one of the following must be true:
+ - TC and SC are the same primitive type.
+ - TC and SC are reference types, and type SC can be cast to TC by
+ recursive application of these rules.
+ "
+ t isJavaArrayClass ifTrue:
+ [tc := t javaComponentClass.
+ ^tc isJavaPrimitiveType
+ ifTrue:[tc == sc]
+ ifFalse:[self canCast: sc to: tc]].
+ "
+ - If T is an interface type, T must be one of the interfaces implemented
+ by arrays (JLS3 4.10.3).
+ "
+ ((t name == #'java/lang/Cloneable') or:
+ [t name == #'java/lang/Serializable'])
+ ifTrue:[^true].
+
+ ^false
+
+ "Modified: / 09-01-1999 / 00:45:21 / cg"
+ "Created: / 11-02-2011 / 08:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-08-2011 / 23:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaArrayClassFor:aClass
+ ^ self reflection javaArrayClassObjectForClass:aClass
+ ifAbsentPut:[JavaArray javaArrayClassFor:aClass]
+
+ "Created: / 17-12-2010 / 13:46:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 14:59:16 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaStringObjectForString:string
+ self breakPoint:#mh info:'refactor my sender to use reflection directly'.
+ ^ self reflection javaStringObjectForString:string interned:false
+
+ "Created: / 22-11-2010 / 16:31:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 00:47:49 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaStringObjectForString:string interned:intern
+ self breakPoint:#mh info:'refactor my sender to use reflection directly'.
+ ^self reflection javaStringObjectForString:string interned:intern.
+
+ "Created: / 22-11-2010 / 16:28:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 22-11-2010 / 17:57:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:04:21 / Marcel Hlopko <hlopik@gmail.com>"
!
javaThreadForSTProcess:stProcess
@@ -2254,14 +2583,6 @@
"Created: / 3.1.1998 / 01:53:41 / cg"
!
-methodForJavaMethodObject:aJavaMethodObject
- "given java.lang.reflect.Method instance, return the real method for it."
-
- ^ JavaMethods at:aJavaMethodObject ifAbsent:nil.
-
- "Created: / 9.2.1998 / 16:01:48 / cg"
-!
-
newThread:name
|thread threadClass i|
@@ -2304,26 +2625,84 @@
|standardGroup threadClass|
StandardThreadGroup isNil ifTrue:[
- threadClass := Java at:'java.lang.Thread'.
-
- standardGroup := (Java at:'java.lang.ThreadGroup') new.
- standardGroup instVarNamed:'parent' put:nil.
- standardGroup instVarNamed:'name' put:(Java as_String:'main').
- standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY').
- standardGroup instVarNamed:'destroyed' put:0.
- standardGroup instVarNamed:'daemon' put:nil.
- (standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[
- standardGroup instVarNamed:'vmAllowSuspension' put:0.
- ].
- standardGroup instVarNamed:'nthreads' put:0.
- standardGroup instVarNamed:'ngroups' put:0.
- standardGroup instVarNamed:'groups' put:nil.
- StandardThreadGroup := standardGroup.
+ threadClass := Java at:'java.lang.Thread'.
+
+ standardGroup := (self classForName:'java.lang.ThreadGroup') new.
+ standardGroup instVarNamed:'parent' put:nil.
+ standardGroup instVarNamed:'name' put:(Java as_String:'main').
+ standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY').
+ standardGroup instVarNamed:'destroyed' put:0.
+ standardGroup instVarNamed:'daemon' put:nil.
+ (standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[
+ standardGroup instVarNamed:'vmAllowSuspension' put:0.
+ ].
+ standardGroup instVarNamed:'nthreads' put:0.
+ standardGroup instVarNamed:'ngroups' put:0.
+ standardGroup instVarNamed:'groups' put:nil.
+ StandardThreadGroup := standardGroup.
].
^ StandardThreadGroup
- "Created: / 3.1.1998 / 01:41:54 / cg"
- "Modified: / 17.11.1998 / 22:55:30 / cg"
+ "Created: / 03-01-1998 / 01:41:54 / cg"
+ "Modified: / 17-11-1998 / 22:55:30 / cg"
+ "Modified: / 25-04-2011 / 20:27:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+threadStart:nativeContext
+ "start the thread"
+
+ |jThread jName name stProcess helper |
+
+ jThread := nativeContext receiver.
+ (jThread instVarNamed:'priority') < 1 ifTrue:[
+ self halt.
+ jThread instVarNamed:'priority' put:1.
+ ].
+
+
+ stProcess := JavaProcess
+ for: (helper := JavaProcess newHelper)
+ priority:(Processor activePriority).
+ helper javaThreadObject: jThread.
+ helper javaProcess: stProcess.
+
+ jName := jThread instVarNamed:'name'.
+ jName isString ifFalse:[
+ name := Java as_ST_String:jName.
+ ] ifTrue:[
+ name := jName
+ ].
+
+ "/ kludge - remember the ScreenUpdater ...
+ name = 'Screen Updater' ifTrue:[
+ JavaScreenUpdaterThread := stProcess.
+ ] ifFalse:[
+ name = 'AWT-Windows' ifTrue:[
+ JavaEventThread := stProcess.
+ ] ifFalse:[
+ (name startsWith:'AWT-EventQueue') ifTrue:[
+ JavaEventQueueThread := stProcess.
+ ].
+ ]
+ ].
+
+"/name = 'UserDialogShowThread' ifTrue:[
+"/self halt
+"/].
+ "/ when that process terminates, wakup any waiters
+ "/stProcess addExitAction:[self wakeup:jThread].
+
+ stProcess name:'JAVA-' , name.
+ stProcess restartable:true.
+ stProcess resume.
+
+ Java threads at:jThread put:stProcess.
+
+ ^ nil
+
+ "Modified: / 24-12-1999 / 03:14:33 / cg"
+ "Created: / 14-12-2010 / 21:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-12-2010 / 11:19:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
wakeup:anObject
@@ -2605,6 +2984,13 @@
!JavaVM class methodsFor:'helpers - exceptions'!
+throwAbstractMethodError
+ ^ self throwExceptionClassName: 'java.lang.AbstractMethodError'
+ withMessage: 'resolving a method ref failed'.
+
+ "Created: / 11-04-2011 / 20:32:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
throwArrayIndexOutOfBoundsException:badIndex
|exClass ex|
@@ -2629,8 +3015,10 @@
throwArrayStoreException:badArray
^ self
- throwExceptionClassName:'java.lang.ArrayStoreException'
- withMessage:('bad array store: ' , badArray printString)
+ throwExceptionClassName:'java.lang.ArrayStoreException'
+ withMessage:('bad array store: ' , badArray class printString)
+
+ "Modified: / 23-06-2011 / 09:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
throwClassCastException
@@ -2642,6 +3030,16 @@
"Created: / 8.1.1999 / 18:55:31 / cg"
!
+throwClassFormatError
+ ^ self
+ throwExceptionClassName:'java.lang.ClassFormatError'
+ withMessage:'Invalid class format'
+
+ "Created: / 04-01-1998 / 22:26:09 / cg"
+ "Modified: / 10-11-1998 / 13:20:31 / cg"
+ "Created: / 08-08-2011 / 17:57:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
throwClassNotFoundException
^ self
throwExceptionClassName:'java.lang.ClassNotFoundException'
@@ -2672,9 +3070,14 @@
!
throwException:aJavaException
+
+ <resource: #skipInDebuggersWalkBack>
+
|con jMsg msg exClass srchCon handlerContext handlerPC method pc hPC
monitorObject|
+
+
ExceptionTrace ifTrue:[
'JAVA: exception: ' print. aJavaException class fullName print.
msg := aJavaException instVarNamed:'detailMessage'.
@@ -2686,8 +3089,11 @@
'' printCR.
].
ExceptionDebug ifTrue:[
- self halt:('JAVA: exceptionDebug: ' , aJavaException class fullName).
-"/ self internalError:('JAVA: exception: ' , aJavaException class fullName).
+"/ self internalError:('JAVA: exception: ' , aJavaException class fullName).
+ (ExceptionDebugPatterns isNilOrEmptyCollection or:
+ [ExceptionDebugPatterns anySatisfy: [:pattern|pattern match:aJavaException class fullName]])
+ ifTrue:
+ [self halt:('JAVA: exceptionDebug: ' , aJavaException class fullName)]
].
"/
@@ -2699,13 +3105,21 @@
method := srchCon method.
pc := srchCon pc.
(hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[
- handlerPC := hPC.
- handlerContext := srchCon
+ "JV@2011-02-25: Another crap in JVM and Java VM Spec?
+ Or theri proxu generator? Assume that if athrow's pc
+ is same as the handler's pc it means rethrow to
+ handling context - so DO NOT HANDLE IT!!"
+ "Hack disabled for now"
+ "pc ~~ hPC"true ifTrue:[
+ handlerPC := hPC.
+ handlerContext := srchCon
+ ].
] ifFalse:[
"/ on the fly, release any monitor
method isSynchronized ifTrue:[
method isStatic ifTrue:[
- monitorObject := method javaClass
+ self assert: srchCon receiver == method javaClass.
+ monitorObject := method javaClass.
] ifFalse:[
monitorObject := srchCon receiver
].
@@ -2735,8 +3149,7 @@
con := con sender
].
con isNil ifTrue:[con := thisContext sender].
-
- JavaVM javaExceptionSignal
+ JavaUnhandledExceptionError
raiseWith:aJavaException
errorString:msg
in:con.
@@ -2754,8 +3167,9 @@
Processor activeProcess == JavaEventQueueThread ifTrue:[self halt].
Processor activeProcess terminate.
- "Created: / 7.1.1998 / 15:28:22 / cg"
- "Modified: / 24.12.1999 / 02:33:25 / cg"
+ "Created: / 07-01-1998 / 15:28:22 / cg"
+ "Modified: / 24-12-1999 / 02:33:25 / cg"
+ "Modified: / 10-08-2011 / 20:23:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
throwExceptionClassName:aJavaExceptionClassName withMessage:someMessage
@@ -2769,6 +3183,24 @@
"Modified: / 14.1.1998 / 23:38:30 / cg"
!
+throwExceptionInInitializerError:className
+ ^ self
+ throwExceptionClassName:'java.lang.ExceptionInInitializerError'
+ withMessage:'error when initializing class: ' , className
+
+ "Created: / 24-11-2010 / 09:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+throwFileNotFoundException: message
+ ^ self
+ throwExceptionClassName:'java.io.FileNotFoundException'
+ withMessage: message
+
+ "Created: / 04-01-1998 / 22:26:09 / cg"
+ "Modified: / 10-11-1998 / 13:20:31 / cg"
+ "Created: / 10-08-2011 / 14:19:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
throwIOExceptionWithMessage:message
IOExceptionDebug == true ifTrue:[
self halt:'IO Exception'.
@@ -2781,6 +3213,13 @@
"Modified: / 7.1.1998 / 15:26:25 / cg"
!
+throwIllegalAccessError
+ ^ self throwExceptionClassName: 'java.lang.IllegalAccessError'
+ withMessage: 'illegal access'
+
+ "Created: / 13-04-2011 / 23:07:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
throwIllegalAccessException
^ self
throwExceptionClassName:'java.lang.IllegalAccessException'
@@ -2790,6 +3229,13 @@
"Created: / 14.1.1998 / 23:13:44 / cg"
!
+throwIncompatibleClassChangeError
+ ^ self throwExceptionClassName: 'java.lang.IncompatibleClassChangeError'
+ withMessage: 'illegal change'.
+
+ "Created: / 11-04-2011 / 20:03:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
throwInstantiationException
^ self
throwExceptionClassName:'java.lang.InstantiationException'
@@ -2808,17 +3254,41 @@
"Created: / 14.1.1998 / 23:17:02 / cg"
!
+throwLinkageError: message
+ ^ self
+ throwExceptionClassName:'java.lang.LinkageError'
+ withMessage: message
+
+ "Modified: / 10-11-1998 / 13:20:31 / cg"
+ "Created: / 26-11-2010 / 11:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+throwNoSuchFieldException
+ ^ self throwExceptionClassName: 'java.lang.NoSuchFieldError'
+ withMessage: 'looking up a field failed'.
+
+ "Created: / 13-04-2011 / 12:16:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+throwNoSuchMethodError
+ ^ self throwExceptionClassName: 'java.lang.NoSuchMethodError'
+ withMessage: 'looking up a method failed'.
+
+ "Created: / 11-04-2011 / 20:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
throwNullPointerException
NullPointerExceptionDebug == true ifTrue:[
- self halt:'Null Pointer exception'.
+ self halt:'Null Pointer exception'.
].
^ self
- throwExceptionClassName:'java.lang.NullPointerException'
- withMessage:'null pointer'
-
- "Created: / 9.1.1998 / 02:26:08 / cg"
- "Modified: / 28.1.1998 / 02:30:09 / cg"
+ throwExceptionClassName:'java.lang.NullPointerException'
+ withMessage:'null pointer'
+
+ "Created: / 09-01-1998 / 02:26:08 / cg"
+ "Modified: / 28-01-1998 / 02:30:09 / cg"
+ "Modified: / 13-08-2011 / 01:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
throwNumberFormatException
@@ -2828,6 +3298,13 @@
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 11.1.1998 / 16:08:22 / cg"
+!
+
+throwZipException
+ ^ self throwExceptionClassName: 'java.util.zip.ZipException'
+ withMessage: 'error in opening zip file'.
+
+ "Created: / 27-03-2011 / 16:25:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaVM class methodsFor:'helpers - io'!
@@ -2890,47 +3367,50 @@
"/ should always be bytes
bytes class isBytes ifFalse:[
- self halt.
+ self halt.
].
stream == Stdin ifTrue:[
- stream := StdinReplacementFileQuerySignal raiseRequest.
- stream isNil ifTrue:[
- ^ -1 "/ 0 EOF
- ]
+ stream := StdinReplacementFileQuerySignal raiseRequest.
+ stream isNil ifTrue:[
+ ^ -1 "/ 0 EOF
+ ]
].
FileIOTrace ifTrue:[
- ('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR.
+ ('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR.
].
stream isPositionable ifFalse:[
- "/ mhmh - some kind of socket or pipe
-
- stream readWait.
- ].
+ "/ mhmh - some kind of socket or pipe
+
+ stream readWait.
+ ].
+
+ count == 0 ifTrue:[^0].
Stream readErrorSignal handle:[:ex |
- nRead := -1
+ nRead := -1
] do:[
- nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1.
+ nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1.
].
nRead == 0 ifTrue:[
- stream atEnd ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: at EOF ' , nRead printString) infoPrintCR.
- ].
- ^ -1
- ].
+ stream atEnd ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: at EOF ' , nRead printString) infoPrintCR.
+ ].
+ ^ -1
+ ].
].
count ~~ nRead ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: only got ' , nRead printString) infoPrintCR.
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: only got ' , nRead printString) infoPrintCR.
+ ]
].
^ nRead
- "Created: / 4.2.1998 / 15:20:00 / cg"
- "Modified: / 10.11.1998 / 19:56:47 / cg"
+ "Created: / 04-02-1998 / 15:20:00 / cg"
+ "Modified: / 10-11-1998 / 19:56:47 / cg"
+ "Modified: / 10-08-2011 / 21:35:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
anyStream_writeBytes:nativeContext
@@ -2943,33 +3423,39 @@
stream := self validateFile:(nativeContext receiver).
FileIOTrace ifTrue:[
- stream isFileStream ifTrue:[
- ('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR.
- ] ifFalse:[
- stream ~~ Stdout ifTrue:[
- stream ~~ Stderr ifTrue:[
- ('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR.
- ]
- ]
- ]
+ stream isFileStream ifTrue:[
+ ('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR.
+ ] ifFalse:[
+ stream ~~ Stdout ifTrue:[
+ stream ~~ Stderr ifTrue:[
+ ('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR.
+ ]
+ ]
+ ]
].
"/ should always be bytes
Stream writeErrorSignal handle:[:ex |
- ex return
+ ex return
] do:[
- Socket brokenConnectionSignal handle:[:ex |
- ex return
- ] do:[
- stream nextPutBytes:count from:bytes startingAt:offset+1
- ].
- stream == Transcript ifTrue:[
- Transcript endEntry
- ]
- ].
-
- "Created: / 4.2.1998 / 15:23:58 / cg"
- "Modified: / 16.2.1999 / 11:32:45 / cg"
+ Socket brokenConnectionSignal handle:[:ex |
+ ex return
+ ] do:[
+ stream isBinary ifTrue:[
+ stream nextPutBytes:count from:bytes startingAt:offset+1
+ ] ifFalse:[
+ stream nextPutAll: (bytes asString copyFrom: offset + 1 to: offset + count).
+ ]
+
+ ].
+ stream == Transcript ifTrue:[
+ Transcript endEntry
+ ]
+ ].
+
+ "Created: / 04-02-1998 / 15:23:58 / cg"
+ "Modified: / 16-02-1999 / 11:32:45 / cg"
+ "Modified: / 11-12-2010 / 20:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
checkWritePermissionOfDirectory:dir message:msg
@@ -3002,97 +3488,137 @@
"Modified: / 3.12.1998 / 15:16:55 / cg"
!
+commonClose:nativeContext
+
+ | fdobj fd stream |
+ fdobj := (nativeContext receiver instVarNamed: #fd).
+ fd := fdobj instVarNamed: #fd.
+ stream := self getOpenFileAt:fd.
+ stream notNil ifTrue:[
+ stream close.
+ ] ifFalse:[
+ self breakPoint: #jv.
+ ].
+ self setOpenFile: nil at: fd.
+ fdobj instVarNamed:#fd put: -1.
+
+ "Created: / 10-08-2011 / 14:02:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
commonOpen:nativeContext forAppend:forAppend
|fs fd fn name dir stream fileNo answer readonly|
fs := nativeContext receiver.
fd := fs instVarNamed:'fd'.
- (fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
+ (fd instVarNamed:'fd') ~~ -1 ifTrue:[
+ "/self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
].
name := nativeContext argAt:1.
name := Java as_ST_String:name.
FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
- ].
-
- fn := name asFilename.
+ ('JAVA: opening ' , name) infoPrintCR.
+ ].
+
+ fn := name utf8Decoded asFilename.
dir := fn directory pathName.
readonly := false.
- (PermittedDirectories notNil
- and:[PermittedDirectories includes:dir]) ifFalse:[
- FileOpenConfirmation ifTrue:[
- answer := Dialog
- confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
- labels:#('no' 'grant' 'readonly')
- values:#(false true #readonly)
- default:3.
- answer == false ifTrue:[
- self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
- ^ self
- ].
- readonly := (answer == #readonly).
-
- readonly ifFalse:[
- (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
- ifTrue:[
- PermittedDirectories isNil ifTrue:[
- PermittedDirectories := Set new
- ].
- PermittedDirectories add:dir.
- ]
- ]
- ]
- ].
+"/ (PermittedDirectories notNil
+"/ and:[PermittedDirectories includes:dir]) ifFalse:[
+"/ FileOpenConfirmation ifTrue:[
+"/ answer := Dialog
+"/ confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
+"/ labels:#('no' 'grant' 'readonly')
+"/ values:#(false true #readonly)
+"/ default:3.
+"/ answer == false ifTrue:[
+"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
+"/ ^ self
+"/ ].
+"/ readonly := (answer == #readonly).
+"/
+"/ readonly ifFalse:[
+"/ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
+"/ ifTrue:[
+"/ PermittedDirectories isNil ifTrue:[
+"/ PermittedDirectories := Set new
+"/ ].
+"/ PermittedDirectories add:dir.
+"/ ]
+"/ ]
+"/ ]
+"/ ].
readonly ifTrue:[
- stream := fn readStream.
- ] ifFalse:[
- forAppend ifTrue:[
- stream := fn appendingWriteStream.
- ] ifFalse:[
- stream := fn writeStream.
- ]
+ (fn exists and:[fn isReadable not]) ifTrue:[
+ ^self throwFileNotFoundException: 'File is not readable'
+ ].
+ stream := fn readStream.
+ ] ifFalse:[
+ fn exists ifFalse:[
+ ^self throwFileNotFoundException: 'File does not exist'
+ ].
+ fn isDirectory ifTrue:[
+ ^self throwFileNotFoundException: 'File is directory'
+ ].
+ fn isWritable ifFalse:[
+ ^self throwFileNotFoundException: 'File does not writable'
+ ].
+ forAppend ifTrue:[
+ stream := fn appendingWriteStream.
+ ] ifFalse:[
+ stream := fn writeStream.
+ ]
].
stream isNil ifTrue:[
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
+ self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
].
fileNo := self addOpenFile:stream.
FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
].
fd instVarNamed:'fd' put:fileNo.
- "Created: / 7.4.1998 / 19:14:09 / cg"
- "Modified: / 4.1.1999 / 14:34:42 / cg"
+ "Created: / 07-04-1998 / 19:14:09 / cg"
+ "Modified: / 04-01-1999 / 14:34:42 / cg"
+ "Modified: / 10-08-2011 / 23:49:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fileStreamForReading:name
|fn stream tryAlongClassPath|
FileOpenTrace ifTrue:[
- ('JAVA: opening for read:' , name) infoPrintCR.
+ ('JAVA: opening for read:' , name) infoPrintCR.
].
fn := name asFilename.
+ fn exists ifFalse:[
+ ^self throwFileNotFoundException: 'File does not exists'
+ ].
+ fn isDirectory ifTrue:[
+ ^self throwFileNotFoundException: 'File is directory'
+ ].
+ fn isReadable ifFalse:[
+ ^self throwFileNotFoundException: 'File is not readable'
+ ].
+
stream := fn readStream.
stream notNil ifTrue:[^ stream].
fn isAbsolute ifFalse:[
- "/ if not absolute, try along classPath
- "/ This allows classes to open local files (JEdit)
- "/ even if they have NOT been loaded by a Java classLoader.
- "/ Only do this for image files
- "/ (and maybe some other config files in the future),
- "/ to avoid security holes.
- tryAlongClassPath := true.
+ "/ if not absolute, try along classPath
+ "/ This allows classes to open local files (JEdit)
+ "/ even if they have NOT been loaded by a Java classLoader.
+ "/ Only do this for image files
+ "/ (and maybe some other config files in the future),
+ "/ to avoid security holes.
+ tryAlongClassPath := true.
"/ tryAlongClassPath := false.
"/ (fn hasSuffix:'gif') ifTrue:[
"/ tryAlongClassPath := true.
@@ -3101,20 +3627,25 @@
"/ tryAlongClassPath := true.
"/ ].
- tryAlongClassPath ifTrue:[
- Java classPath do:[:dirName |
- |fn|
-
- (fn := dirName asFilename construct:name) exists ifTrue:[
- stream := fn readStream.
- stream notNil ifTrue:[^ stream].
- ]
- ]
- ]
+ tryAlongClassPath ifTrue:[
+ Java effectiveClassPath do:[:dirName |
+ |fn|
+
+ (fn := dirName asFilename construct:name) exists ifTrue:[
+ fn isReadable ifFalse:[
+ self throwFileNotFoundException: 'File is not readable'.
+ ^nil
+ ].
+ stream := fn readStream.
+ stream notNil ifTrue:[^ stream].
+ ]
+ ]
+ ]
].
^ nil.
- "Modified: / 27.1.1999 / 18:54:46 / cg"
+ "Modified: / 27-01-1999 / 18:54:46 / cg"
+ "Modified: / 10-08-2011 / 19:22:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fixFilename:path
@@ -3165,70 +3696,4003 @@
fileNo := javaStream instVarNamed:'fd'.
fileNo isInteger ifFalse:[
- descriptor := fileNo.
- descriptor notNil ifTrue:[
- fileNo := descriptor instVarNamed:'fd'.
- ]
+ descriptor := fileNo.
+ descriptor notNil ifTrue:[
+ fileNo := descriptor instVarNamed:'fd'.
+ ((fileNo == -1) and:[OperatingSystem isMSWINDOWSlike]) ifTrue:[
+ fileNo := descriptor instVarNamed:'handle'.
+ ]
+ ]
].
fileNo isInteger ifFalse:[
"/ self halt:'invalid fileNo in read'.
"/ self internalError:'invalid fileNo in read'.
- self throwIOExceptionWithMessage:'invalid fileNo in read'.
- ^ nil
+ self throwIOExceptionWithMessage:'invalid fileNo in read'.
+ ^ nil
].
^ fileNo.
- "Created: / 4.1.1998 / 17:49:08 / cg"
- "Modified: / 13.1.1998 / 14:07:47 / cg"
+ "Created: / 04-01-1998 / 17:49:08 / cg"
+ "Modified: / 13-01-1998 / 14:07:47 / cg"
+ "Modified: / 18-08-2011 / 20:03:37 / jv"
+! !
+
+!JavaVM class methodsFor:'helpers - reflection'!
+
+classForJavaClassObject:aJavaClassObject
+ "given java.lang.class instance, return the real class for it."
+
+ ^ self reflection classForJavaClassObject:aJavaClassObject
+
+ "Created: / 23-01-1998 / 17:44:09 / cg"
+ "Modified: / 03-02-2011 / 21:33:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:02:17 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaClassObjectForClass:aClass
+ "given a real class, return the corresponding java.lang.class
+ instance for it."
+
+ |class|
+
+ "find reflection of StClass in the Java World"
+ (JavaObjectDictionary new hasReflection:aClass name) ifTrue:[
+ class := JavaObjectDictionary new reflectionOf:aClass name
+ ] ifFalse:[
+ class := aClass.
+ ].
+ ^self reflection javaClassObjectForClass:class.
+
+ "Created: / 23-01-1998 / 17:43:38 / cg"
+ "Modified: / 05-12-1998 / 15:29:32 / cg"
+ "Modified: / 17-01-2011 / 19:24:22 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 14:31:25 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-02-2011 / 21:31:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaConstructorObjectForMethod:method
+ "given a real method, return the corresponding java.lang.reflect.Constructor
+ instance for it."
+ self breakPoint:#mh info:'refactor my sender to call reflection directly'.
+ ^ self reflection javaConstructorObjectForMethod: method.
+
+ "Modified: / 09-02-2011 / 00:58:09 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaFieldObjectForField: aJavaField in: aJavaLangClass
+ "given a java field, return the corresponding java.lang.Field
+ instance for it."
+ "
+ See OpenJDK7 source:
+ jdk7/hotspot/src/share/vm/runtime/reflection.cpp,
+ oop Reflection::new_field"
+
+ | field clazz name slot type modifiers |
+
+ clazz := aJavaLangClass.
+ name := self reflection javaStringObjectForString: aJavaField name
+ interned: true.
+ slot := aJavaField index.
+ type := self javaClassObjectForClass: aJavaField typeClass.
+ modifiers := aJavaField accessFlags.
+ field := (Java classForName: 'java.lang.reflect.Field') new.
+ field
+ instVarNamed: #clazz put: clazz;
+ instVarNamed: #name put: name;
+ instVarNamed: #slot put: slot;
+ instVarNamed: #type put: type;
+ instVarNamed: #modifiers put: modifiers;
+ yourself.
+ aJavaField annotations ifNotNil: [field instVarNamed: #annotations
+ put: aJavaField annotations runtimeVisible rawAnnotations].
+ ^ field.
+
+ "Modified: / 05-12-1998 / 15:29:32 / cg"
+ "Created: / 22-11-2010 / 17:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:06:20 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 01-04-2011 / 12:11:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 25-04-2011 / 20:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaMethodObjectForMethod:method
+ "given a real method, return the corresponding java.lang.reflect.Constructor
+ instance for it."
+
+ ^ self reflection javaMethodObjectForMethod:method.
+
+ "Modified: / 28-02-2011 / 17:08:36 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+methodForJavaConstructorObject:constructor
+ "given a java.lang.reflect.Constructor, return the corresponding method
+ it."
+ self breakPoint:#mh info: 'refactor my sender to call reflection directly'.
+ ^ self reflection methodForJavaConstructorObject: constructor.
+
+ "Modified: / 09-02-2011 / 00:59:43 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+methodForJavaMethodObject:aJavaMethodObject
+ "
+ Given an instance of java.lang.reflect.Method, answers
+ real method associated with it."
+ ^ self reflection methodForJavaMethodObject:aJavaMethodObject.
+
+ "Modified: / 07-02-2011 / 09:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-02-2011 / 16:58:05 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaVM class methodsFor:'native - java.awt'!
+
+_java_awt_AWTEvent_initIDs: nativeContext
+
+ <javanative: 'java/awt/AWTEvent' name: 'initIDs'>
+
+ "Intentionally left blank"
+
+ "Modified: / 12-08-2011 / 19:08:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_awt_Component_initIDs: nativeContext
+
+ <javanative: 'java/awt/Component' name: 'initIDs'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 19:53:29 / cg"
+!
+
+_java_awt_Container_initIDs: nativeContext
+
+ <javanative: 'java/awt/Container' name: 'initIDs'>
+
+ "Intentionally left blank"
+
+ "Modified: / 12-08-2011 / 19:09:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_awt_Dimension_initIDs: nativeContext
+
+ <javanative: 'java/awt/Dimension' name: 'initIDs'>
+
+ "Intentionally left blank"
+
+ "Modified: / 12-08-2011 / 19:08:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_awt_Toolkit_initIDs: nativeContext
+
+ <javanative: 'java/awt/Toolkit' name: 'initIDs'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 19:53:50 / cg"
+! !
+
+!JavaVM class methodsFor:'native - java.io'!
+
+_java_io_FileDescriptor_initIDs: nativeContext
+
+ <javanative: 'java/io/FileDescriptor' name: 'initIDs'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:16:29 / cg"
+!
+
+_java_io_FileDescriptor_set: nativeContext
+
+ <javanative: 'java/io/FileDescriptor' name: 'set(I)J'>
+
+ "SunJDK Speciofic method, we don't need handles, so return
+ FD instead"
+
+ ^nativeContext argAt:1
+
+ "Modified: / 18-08-2011 / 19:54:36 / jv"
+!
+
+_java_io_FileDescriptor_sync: nativeContext
+
+ <javanative: 'java/io/FileDescriptor' name: 'sync'>
+ "
+ /**
+ * Force all system buffers to synchronize with the underlying
+ * device. This method returns after all modified data and
+ * attributes of this FileDescriptor have been written to the
+ * relevant device(s). In particular, if this FileDescriptor
+ * refers to a physical storage medium, such as a file in a file
+ * system, sync will not return until all in-memory modified copies
+ * of buffers associated with this FileDescriptor have been
+ * written to the physical medium.
+ *
+ * sync is meant to be used by code that requires physical
+ * storage (such as a file) to be in a known state For
+ * example, a class that provided a simple transaction facility
+ * might use sync to ensure that all changes to a file caused
+ * by a given transaction were recorded on a storage medium.
+ *
+ * sync only affects buffers downstream of this FileDescriptor. If
+ * any in-memory buffering is being done by the application (for
+ * example, by a BufferedOutputStream object), those buffers must
+ * be flushed into the FileDescriptor (for example, by invoking
+ * OutputStream.flush) before that data will be affected by sync.
+ *
+ * @exception SyncFailedException
+ * Thrown when the buffers cannot be flushed,
+ * or because the system cannot guarantee that all the
+ * buffers have been synchronized with physical media.
+ * @since JDK1.1
+ */
+ public native void sync() throws SyncFailedException;
+ "
+
+ OpenFileTable do:[:stream|
+ stream notNil ifTrue:[stream flush].
+ ].
+
+ "Created: / 12-11-1998 / 19:26:25 / cg"
+ "Modified (format): / 10-08-2011 / 19:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileInputStream_available: nativeContext
+
+ <javanative: 'java/io/FileInputStream' name: 'available'>
+
+ |file|
+
+ file := self validateFile:(nativeContext receiver).
+ file isNil ifTrue:[
+ self throwIOExceptionWithMessage:'invalid fileNo in available'.
+ ^ self
+ ].
+ file == Stdin ifTrue:[
+ file := StdinReplacementFileQuerySignal raiseRequest.
+ file isNil ifTrue:[
+ ^ 1
+ ]
+ ].
+ file isFileStream ifTrue:[
+ ^ file size - file position + 1
+ ].
+ file atEnd ifTrue:[
+ ^ 0.
+ ].
+ self halt.
+ ^ 1
+
+ "Modified: / 14.1.1998 / 15:12:52 / cg"
+!
+
+_java_io_FileInputStream_close0: nativeContext
+
+ <javanative: 'java/io/FileInputStream' name: 'close0'>
+
+ ^self commonClose: nativeContext
+
+ "Modified: / 10-08-2011 / 14:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileInputStream_initIDs: nativeContext
+
+ <javanative: 'java/io/FileInputStream' name: 'initIDs'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:15:51 / cg"
+!
+
+_java_io_FileInputStream_open: nativeContext
+
+ <javanative: 'java/io/FileInputStream' name: 'open'>
+
+ |fs fd fn name stream fileNo|
+
+ fs := nativeContext receiver.
+ fd := fs instVarNamed:'fd'.
+ (fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[
+ fileNo ~~ -1 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
+ ]
+ ].
+
+ name := nativeContext argAt:1.
+ name := Java as_ST_String:name.
+
+ name := self fixFilename:name.
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: opening ' , name) infoPrintCR.
+ ].
+
+ stream := self fileStreamForReading:name.
+ stream isNil ifTrue:[
+ ^ self.
+ ].
+ stream buffered:false.
+
+"/ FileOpenConfirmation ifTrue:[
+"/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs)
+"/ ifFalse:[
+"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading').
+"/ ^ self
+"/ ]
+"/ ].
+
+ fileNo := self addOpenFile:stream.
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR.
+ ].
+
+ fd instVarNamed:'fd' put:fileNo.
+
+ "Created: / 04-01-1998 / 16:47:12 / cg"
+ "Modified: / 28-01-1999 / 17:24:07 / cg"
+ "Modified: / 10-08-2011 / 19:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileInputStream_readBytes: nativeContext
+
+ <javanative: 'java/io/FileInputStream' name: 'readBytes'>
+
+ ^ self anyStream_readBytes:nativeContext
+
+ "Modified: / 04-02-1998 / 15:23:08 / cg"
+ "Modified (format): / 10-08-2011 / 21:32:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileOutputStream_close0: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'close0'>
+
+ ^self commonClose: nativeContext
+
+ "Modified: / 10-08-2011 / 14:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileOutputStream_initIDs: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'initIDs'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:16:40 / cg"
+!
+
+_java_io_FileOutputStream_open: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'open'>
+
+ ^ self commonOpen:nativeContext forAppend:false
+
+ "Modified: / 07-04-1998 / 19:14:31 / cg"
+ "Modified (format): / 10-08-2011 / 14:25:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileOutputStream_openAppend: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'openAppend'>
+
+ ^ self commonOpen:nativeContext forAppend:true
+
+ "Modified: / 07-04-1998 / 19:13:42 / cg"
+ "Modified (format): / 10-08-2011 / 23:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileOutputStream_write: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'write'>
+ "
+ /**
+ * Writes the specified byte to this file output stream. Implements
+ * the <code>write</code> method of <code>OutputStream</code>.
+ *
+ * @param b the byte to be written.
+ * @exception IOException if an I/O error occurs.
+ */
+ public native void write(int b) throws IOException;
+ "
+
+ | fdobj fd stream b |
+ b := nativeContext argAt:1.
+ fdobj := (nativeContext receiver instVarNamed: #fd).
+ fd := fdobj instVarNamed: #fd.
+ stream := self getOpenFileAt:fd.
+ [
+ stream nextPut: b asCharacter
+ ] on: Error do:[:ex|
+ self throwIOExceptionWithMessage: ex description
+ ]
+
+ "Modified: / 10-08-2011 / 14:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_FileOutputStream_writeBytes: nativeContext
+
+ <javanative: 'java/io/FileOutputStream' name: 'writeBytes'>
+
+ ^ self anyStream_writeBytes:nativeContext
+
+ "Modified: / 4.2.1998 / 15:24:20 / cg"
+!
+
+_java_io_FileSystem_getFileSystem: aJavaContext
+
+ <javanative: 'java/io/FileSystem' name: 'getFileSystem'>
+
+
+ OperatingSystem isUNIXlike ifTrue:
+ [^(Java classForName:'java.io.UnixFileSystem') new].
+
+ OperatingSystem isMSWINDOWSlike ifTrue:
+ [^(Java classForName:'java.io.WinNTFileSystem') new].
+
+ self error:'Unknown/Unsupported platform'
+
+ "Created: / 09-12-2010 / 17:58:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-04-2011 / 18:09:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_ObjectInputStream_latestUserDefinedLoader: nativeContext
+
+ <javanative: 'java/io/ObjectInputStream' name: 'latestUserDefinedLoader'>
+
+ "
+ /**
+ * Returns the first non-null class loader (not counting class loaders of
+ * generated reflection implementation classes) up the execution stack, or
+ * null if only code from the null class loader is on the stack. This
+ * method is also called via reflection by the following RMI-IIOP class:
+ *
+ * com.sun.corba.se.internal.util.JDKClassLoader
+ *
+ * This method should not be removed or its signature changed without
+ * corresponding modifications to the above class.
+ */
+ // REMIND: change name to something more accurate?
+ private static native ClassLoader latestUserDefinedLoader();
+ "
+
+ | ctx cl |
+ ctx := nativeContext.
+ [ ctx notNil ] whileTrue:[
+ ctx receiver isJavaObject ifTrue:[
+ (cl := ctx receiver class classLoader) notNil ifTrue:[
+ self breakPoint: #jv info: 'Should not count class loaders of generated reflection implementation classes'.
+ "/Please check"
+ ^cl.
+ ]
+ ].
+ ctx := ctx sender.
+ ].
+ ^nil
+
+ "Modified: / 10-08-2011 / 01:38:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_ObjectStreamClass_hasStaticInitializer: nativeContext
+
+ <javanative: 'java/io/ObjectStreamClass' name: 'hasStaticInitializer'>
+
+ | cls |
+ cls := self reflection classForJavaClassObject: (nativeContext argAt:1).
+ ^(cls includesSelector: #'<clinit>()V') ifTrue:[1] ifFalse:[0]
+
+ "Modified: / 10-08-2011 / 01:13:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_ObjectStreamClass_initNative: aJavaContext
+
+ <javanative: 'java/io/ObjectStreamClass' name: 'initNative'>
+
+
+ "
+ /**
+ * Initializes native code.
+ */
+ "
+ "Nothing to do"
+
+ "Created: / 20-12-2010 / 17:43:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_RandomAccessFile_initIDs: nativeContext
+
+ <javanative: 'java/io/RandomAccessFile' name: 'initIDs'>
+
+ "Nothing to do"
+
+ "Modified: / 10-08-2011 / 21:49:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_RandomAccessFile_open: nativeContext
+
+ <javanative: 'java/io/RandomAccessFile' name: 'open'>
+
+ |fs fd name dir stream fileNo answer readonly|
+
+ readonly := false.
+
+ fs := nativeContext receiver.
+ fd := fs instVarNamed:'fd'.
+ (fd instVarNamed:'fd') ~~ 0 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
+ ].
+
+ name := nativeContext argAt:1.
+ name := Java as_ST_String:name.
+ name := self fixFilename:name.
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: opening ' , name) infoPrintCR.
+ ].
+
+ dir := name asFilename directory pathName.
+
+ (PermittedDirectories notNil
+ and:[PermittedDirectories includes:dir]) ifFalse:[
+ FileOpenConfirmation ifTrue:[
+ answer := Dialog
+ confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
+ labels:#('no' 'grant' 'readonly')
+ values:#(false true #readonly)
+ default:3.
+ answer == false ifTrue:[
+ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
+ ^ self
+ ].
+ readonly := (answer == #readonly).
+
+ readonly ifFalse:[
+ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
+ ifTrue:[
+ PermittedDirectories isNil ifTrue:[
+ PermittedDirectories := Set new
+ ].
+ PermittedDirectories add:dir.
+ ]
+ ]
+ ]
+ ].
+
+ readonly ifTrue:[
+ stream := name asFilename readStream.
+ ] ifFalse:[
+ stream := name asFilename readWriteStream.
+ ].
+ stream isNil ifTrue:[
+ self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
+ ].
+
+ fileNo := self addOpenFile:stream.
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
+ ].
+
+ fd instVarNamed:'fd' put:fileNo.
+
+ "Created: / 4.2.1998 / 00:14:48 / cg"
+ "Modified: / 12.11.1998 / 21:29:46 / cg"
+!
+
+_java_io_UnixFileSystem_canonicalize0: aJavaContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'canonicalize0'>
+
+ | path |
+
+ path := Java as_ST_String: (aJavaContext argAt: 1).
+ ^(Java as_String: path utf8Encoded asFilename asAbsoluteFilename pathName utf8Decoded)
+
+ "Created: / 10-12-2010 / 14:40:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_checkAccess: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'checkAccess'>
+
+ "
+ public static final int ACCESS_READ = 0x04;
+ public static final int ACCESS_WRITE = 0x02;
+ public static final int ACCESS_EXECUTE = 0x01;
+ "
+
+ | fileobj file access result |
+ fileobj := nativeContext argAt:1.
+ file := (Java as_ST_String:(fileobj instVarNamed:#path)) asFilename.
+ access := nativeContext argAt:2.
+ [
+ access == 16r01 ifTrue:[result := file isExecutable].
+ access == 16r02 ifTrue:[result := file isWritable].
+ access == 16r04 ifTrue:[result := file isReadable].
+ ] on: Error do:[
+ result := false.
+ ].
+ ^result ifTrue:[1] ifFalse:[0].
+
+ "Modified: / 09-08-2011 / 17:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_createDirectory: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'createDirectory'>
+
+ | fileobj file |
+ fileobj := (nativeContext argAt:1).
+ file := Java as_ST_String: (fileobj instVarNamed:#path).
+ file := file asFilename.
+ file exists ifFalse:[
+ [
+ file makeDirectory.
+ ^1.
+ ] on: Error do:[:ex|
+ self throwIOExceptionWithMessage:ex description.
+ ].
+ ].
+ ^0
+
+ "Modified: / 10-08-2011 / 13:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_createFileExclusively: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'createFileExclusively'>
+
+ | file |
+ file := Java as_ST_String: (nativeContext argAt:1).
+ file := file asFilename.
+ file exists ifFalse:[
+ [
+ file createAsEmptyFile
+ ] on: Error do:[:ex|
+ self throwIOExceptionWithMessage:ex description.
+ ].
+ ^1
+ ].
+ ^0
+
+ "Modified: / 10-08-2011 / 13:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_delete0: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'delete0'>
+ "
+ /**
+ * Delete the file or directory denoted by the given abstract pathname,
+ * returning <code>true</code> if and only if the operation succeeds.
+ */
+ public abstract boolean delete(File f);
+ "
+ | file |
+
+ file := (Java as_ST_String: ((nativeContext argAt:1) instVarNamed: #path)) asFilename.
+ file exists ifFalse:[^0].
+ ^[
+ file remove.
+ true
+ ] on: Error do:[
+ false
+ ]
+
+ "Modified: / 09-08-2011 / 17:09:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_getBooleanAttributes0: aJavaContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'getBooleanAttributes0'>
+
+ |file path retval fileSystemClass|
+
+ retval := 0.
+ file := aJavaContext argAt:1.
+ path := Java as_ST_String:(file instVarNamed:#path).
+ fileSystemClass := (Java classForName:'java.io.FileSystem').
+ path asFilename exists ifTrue:[
+ retval := retval bitOr:(fileSystemClass instVarNamed:#'BA_EXISTS')
+ ] ifFalse:[ ^ 0. ].
+ path asFilename isDirectory ifTrue:[
+ retval := retval bitOr:(fileSystemClass instVarNamed:#'BA_DIRECTORY')
+ ].
+ path asFilename isRegularFile ifTrue:[
+ retval := retval bitOr:(fileSystemClass instVarNamed:#'BA_REGULAR')
+ ].
+ path asFilename isHidden ifTrue:[
+ retval := retval bitOr:(fileSystemClass instVarNamed:#'BA_HIDDEN')
+ ].
+ ^ retval
+
+ "Modified: / 10-12-2010 / 14:43:31 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 10-12-2010 / 14:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-12-2010 / 19:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_getLastModifiedTime: aJavaContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'getLastModifiedTime'>
+
+ | file path retval |
+
+ retval := 0.
+ file := aJavaContext argAt: 1.
+ path := Java as_ST_String: (file instVarNamed: #path).
+ retval := path asFilename modificationTime asMilliseconds.
+ ^ retval
+
+ "Modified: / 10-12-2010 / 14:43:31 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 11-12-2010 / 19:44:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 27-03-2011 / 15:32:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_getLength: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'getLength'>
+
+ | file |
+
+ file := (Java as_ST_String: ((nativeContext argAt:1) instVarNamed: #path)) asFilename.
+ file exists ifFalse:[^0].
+ ^file fileSize
+
+ "Modified: / 09-08-2011 / 15:38:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_initIDs: aJavaContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'initIDs'>
+
+
+ self breakPoint: #libjava
+
+ "Created: / 10-12-2010 / 14:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-12-2010 / 20:58:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_list: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'list'>
+ "
+ /**
+ * Returns an array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname.
+ *
+ * <p> If this abstract pathname does not denote a directory, then this
+ * method returns {@code null}. Otherwise an array of strings is
+ * returned, one for each file or directory in the directory. Names
+ * denoting the directory itself and the directory's parent directory are
+ * not included in the result. Each string is a file name rather than a
+ * complete path.
+ *
+ * <p> There is no guarantee that the name strings in the resulting array
+ * will appear in any specific order; they are not, in particular,
+ * guaranteed to appear in alphabetical order.
+ *
+ * @return An array of strings naming the files and directories in the
+ * directory denoted by this abstract pathname. The array will be
+ * empty if the directory is empty. Returns {@code null} if
+ * this abstract pathname does not denote a directory, or if an
+ * I/O error occurs.
+ */
+ "
+ | fileobj file names jnames |
+ fileobj := (nativeContext argAt:1).
+ file := Java as_ST_String: (fileobj instVarNamed:#path).
+ file := file asFilename.
+ file exists ifFalse:[^nil].
+ file isDirectory ifFalse:[^nil].
+
+ names := file directoryContents.
+ jnames := String javaArrayClass new: names size.
+ 1 to: names size do:[:i|
+ jnames at: i put: (Java as_String:(names at: i))
+ ].
+ ^jnames
+
+ "Modified: / 10-08-2011 / 13:28:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_setPermission: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'setPermission'>
+ "
+ /**
+ * Set on or off the access permission (to owner only or to all) to the file
+ * or directory denoted by the given abstract pathname, based on the parameters
+ * enable, access and oweronly.
+ */
+ public abstract boolean setPermission(File f, int access, boolean enable, boolean owneronly);
+ "
+ | f access enable owneronly file perms |
+ f := nativeContext argAt: 1.
+ access := nativeContext argAt: 2.
+ enable := (nativeContext argAt: 3) == 1.
+ owneronly := (nativeContext argAt: 4) == 1.
+ file := (Java as_ST_String: (f instVarNamed: #path)) asFilename.
+ "
+ public static final int ACCESS_READ = 0x04;
+ public static final int ACCESS_WRITE = 0x02;
+ public static final int ACCESS_EXECUTE = 0x01;
+ "
+
+ access == 16r04 ifTrue:[
+ perms := owneronly ifFalse:[#(readUser readGroup readOthers)] ifTrue:[#(readUser)].
+ ].
+ access == 16r02 ifTrue:[
+ perms := owneronly ifFalse:[#(writeUser writeGroup writeOthers)] ifTrue:[#(writeUser)].
+ ].
+ access == 16r01 ifTrue:[
+ perms := owneronly ifFalse:[#(executeUser executeGroup executeOthers)] ifTrue:[#(executeUser)].
+ ].
+ [
+ enable ifTrue:[
+ file addAccessRights: perms
+ ] ifFalse:[
+ file removeAccessRights: perms
+ ].
+ ^ 1.
+ ] on: Error do:[
+ ^ 0
+ ].
+ ^0
+
+ "Modified: / 09-08-2011 / 17:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_UnixFileSystem_setReadOnly: nativeContext
+
+ <javanative: 'java/io/UnixFileSystem' name: 'setReadOnly'>
+
+ | fileobj file |
+ fileobj := (nativeContext argAt:1).
+ file := Java as_ST_String: (fileobj instVarNamed:#path).
+ file := file asFilename.
+ file exists ifFalse:[^0].
+ [
+ file removeAccessRights: #(writeUser writeGroup writeOthers).
+ ^1
+ ] on: Error do:[
+ ^0
+ ].
+ ^0
+
+ "Modified: / 10-08-2011 / 13:40:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_Win32FileSystem_initIDs: nativeContext
+
+ <javanative: 'java/io/Win32FileSystem' name: 'initIDs()V'>
+
+ "Intentionally left blank"
+!
+
+_java_io_WinNTFileSystem_canonicalize0: aJavaContext
+
+ <javanative: 'java/io/WinNTFileSystem' name: 'canonicalize0(Ljava/lang/String;)Ljava/lang/String;'>
+
+
+ | path |
+
+ path := Java as_ST_String: (aJavaContext argAt: 1).
+ ^(Java as_String: path asFilename asAbsoluteFilename pathName)
+
+ "Created: / 01-04-2011 / 23:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_WinNTFileSystem_createFileExclusively: nativeContext
+
+ <javanative: 'java/io/WinNTFileSystem' name: 'createFileExclusively(Ljava/lang/String;)Z'>
+
+ ^ self _java_io_UnixFileSystem_createFileExclusively: nativeContext
+
+ "Modified: / 18-08-2011 / 17:26:11 / jv"
+!
+
+_java_io_WinNTFileSystem_getBooleanAttributes: aJavaContext
+
+ <javanative: 'java/io/WinNTFileSystem' name: 'getBooleanAttributes(Ljava/io/File;)I'>
+
+ ^ self _java_io_UnixFileSystem_getBooleanAttributes0:aJavaContext
+
+ "Created: / 01-04-2011 / 18:10:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_io_WinNTFileSystem_getLastModifiedTime: nativeContext
+
+ <javanative: 'java/io/WinNTFileSystem' name: 'getLastModifiedTime(Ljava/io/File;)J'>
+
+ ^ self _java_io_UnixFileSystem_getLastModifiedTime: nativeContext
+
+ "Modified: / 18-08-2011 / 14:12:07 / jv"
+!
+
+_java_io_WinNTFileSystem_getLength: nativeContext
+
+ <javanative: 'java/io/WinNTFileSystem' name: 'getLength(Ljava/io/File;)J'>
+
+ ^ self _java_io_UnixFileSystem_getLength: nativeContext
+
+ "Modified: / 18-08-2011 / 14:15:36 / jv"
! !
-!JavaVM class methodsFor:'native - java.awt - ms'!
-
-_SystemColor_GetSysColor:nativeContext
- "/ int GetSysColor (int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 02:44:41 / cg"
+!JavaVM class methodsFor:'native - java.lang'!
+
+_java_lang_ClassLoader_NativeLibrary_load: nativeContext
+
+ <javanative: 'java/lang/ClassLoader$NativeLibrary' name: 'load'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ |nativeLoader jLibName libName libHandle index|
+
+ nativeLoader := nativeContext receiver.
+ jLibName := nativeContext argAt:1.
+ libName := (Java as_ST_String:jLibName) asFilename baseName.
+
+ (index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[
+"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL.
+ nativeLoader instVarNamed:'handle' put:index.
+ ^ self "/ void
+ ].
+ (LoadedNativeLibs notNil
+ and:[LoadedNativeLibs includesKey:libName]) ifTrue:[
+"/ ('JAVA: native library already loaded: ' , libName) printNL.
+ nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
+ ^ self "/ void
+ ].
+
+ (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
+ ^ self
+ ].
+self halt.
+
+ libName asFilename exists ifFalse:[
+ ('JAVA: no file to load nativeLib: ' , libName) printNL.
+ ^ self "/ void
+ ].
+
+ libHandle := ObjectFileLoader loadLibrary:libName.
+ libHandle isNil ifTrue:[
+ ('JAVA: failed to load nativeLib: ' , libName) printNL.
+ ^ self "/ void
+ ].
+
+ LoadedNativeLibs isNil ifTrue:[
+ LoadedNativeLibs := Dictionary new.
+ ].
+
+ LoadedNativeLibs at:libName put:libHandle.
+ nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
+ ^ self "/ void
+
+ "Modified: / 06-02-1998 / 03:12:17 / cg"
+ "Created: / 10-12-2010 / 15:11:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ClassLoader_defineClass1: nativeContext
+
+ <javanative: 'java/lang/ClassLoader' name: 'defineClass1'>
+ "
+ private native Class defineClass1(String name, byte[] b, int off, int len,
+ ProtectionDomain pd, String source);
+ "
+ | name b off len pd source bs cls |
+ name := Java as_ST_String: (nativeContext argAt:1).
+ b := nativeContext argAt:2.
+ off := nativeContext argAt:3.
+ len := nativeContext argAt:4.
+ pd := nativeContext argAt:5.
+ source := Java as_ST_String: (nativeContext argAt:6).
+
+ bs := (off = 0 and: [len = b size])
+ ifTrue:[b readStream]
+ ifFalse:[(b copyFrom: off + 1 to: off + len) readStream].
+ [
+ cls := JavaClassReader readStream: bs.
+ ] on: JavaClassReader invalidClassFormatSignal do:[
+ self throwClassFormatError.
+ ^self.
+ ].
+ cls classLoader: nativeContext receiver.
+ "FIXME: What to do with source?"
+
+ ^self reflection javaClassObjectForClass: cls.
+
+ "Modified: / 08-08-2011 / 17:57:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ClassLoader_findBootstrapClass: nativeContext
+
+ <javanative: 'java/lang/ClassLoader' name: 'findBootstrapClass'>
+
+ | nm class |
+ nm := Java as_ST_String: (nativeContext argAt:1).
+ class := JavaClassReader loadSystemClass: nm classpath: Java release classPath .
+ ^class notNil ifTrue:[
+ self reflection javaClassObjectForClass:class
+ ] ifFalse:[
+ self throwClassNotFoundException: nm
+ ]
+
+ "Modified: / 12-08-2011 / 09:07:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ClassLoader_findLoadedClass0: nativeContext
+
+ <javanative: 'java/lang/ClassLoader' name: 'findLoadedClass0'>
+
+ "
+ The <tt>Class</tt> object, or <tt>null</tt> if the class has not been loaded
+ "
+ | class |
+ class := Java at: (Java as_ST_String: (nativeContext argAt:1)).
+ ^(class notNil and:[class classLoader == nativeContext receiver]) ifTrue:[
+ self reflection javaClassObjectForClass:class
+ ] ifFalse:[
+ nil
+ ]
+
+ "Modified: / 12-08-2011 / 21:32:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ClassLoader_registerNatives: aJavaContext
+
+ <javanative: 'java/lang/ClassLoader' name: 'registerNatives'>
+
+
+ "Nothing to do"
+
+ "Created: / 09-11-2010 / 20:55:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ClassLoader_resolveClass0: nativeContext
+
+ <javanative: 'java/lang/ClassLoader' name: 'resolveClass0'>
+
+ "resolve a new class as previously created by defineClass0"
+
+ |jClassLoader jCls cls anyUnresolved|
+
+ jClassLoader := nativeContext receiver.
+ jCls := nativeContext argAt:1.
+ jCls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+ cls := self reflection classForJavaClassObject:jCls.
+ cls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+ ('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR.
+ JavaClassReader classLoaderQuerySignal answer:jClassLoader
+ do:[
+ JavaClassReader resolveClass:cls.
+
+"/ JavaClassReader postLoadActions:true.
+
+ anyUnresolved := false.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ anyUnresolved := true.
+ ]
+ ]
+ ].
+ anyUnresolved ifTrue:[
+ jClassLoader notNil ifTrue:[
+ "/ any unresolved left -> try resolving with standard loader
+ JavaClassReader classLoaderQuerySignal answer:nil
+ do:[
+ JavaClassReader postLoadActions:true.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ ]
+ ]
+ ]
+ ].
+ ].
+
+ "Created: / 07-01-1998 / 13:12:27 / cg"
+ "Modified: / 20-10-1998 / 19:01:57 / cg"
+ "Modified: / 28-01-2011 / 15:28:18 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 14-08-2011 / 10:36:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_desiredAssertionStatus0: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'desiredAssertionStatus0'>
+
+
+ ^AssertionsEnabled == true
+
+ "Created: / 24-11-2010 / 08:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_forName0: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'forName0'>
+
+
+ | name initialize loader class |
+ name := Java as_ST_String: (aJavaContext argAt: 1).
+ initialize := aJavaContext argAt: 2.
+ loader := aJavaContext argAt: 3.
+ JavaClassReader classLoaderQuerySignal answer: loader do:
+ [class := Java classForName: name].
+ class isNil ifTrue:
+ [^self throwClassNotFoundException: name].
+ initialize ~~ 0 ifTrue:
+ [[class classInit] on: Error do:[self throwExceptionInInitializerError:name]].
+ ^JavaVM javaClassObjectForClass: class.
+
+ "Created: / 24-11-2010 / 09:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-05-2011 / 13:27:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getClassLoader0: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'getClassLoader0'>
+
+ "get a classes loader"
+
+ |jClass cls clc loader |
+
+ jClass := aJavaContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ cls isJavaPrimitiveType ifTrue:[^nil].
+ [ cls isJavaArrayClass ] whileTrue:[cls := cls javaComponentClass].
+ loader := cls classLoader.
+"/ loader isNil ifTrue:[
+"/ cls := (Java at:'java/lang/ClassLoader').
+"/ clc notNil ifTrue:[loader := clc instVarNamed: #scl].
+"/ ].
+ ^ loader
+
+ "Created: / 25-10-2010 / 22:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:18:54 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 14-08-2011 / 23:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getComponentType: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getComponentType'>
+
+ |cls|
+
+ cls := self reflection classForJavaClassObject:(nativeContext receiver).
+ cls isJavaPrimitiveType ifTrue:[
+ self breakPoint:#jv.
+ ^ nil
+ ].
+ ^ self javaClassObjectForClass:cls javaComponentClass
+
+ "Created: / 12-11-1998 / 18:54:46 / cg"
+ "Modified: / 20-12-2010 / 22:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:18:59 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_java_lang_Class_getConstantPool: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'getConstantPool'>
+
+ | class |
+
+ class := self reflection classForJavaClassObject:aJavaContext receiver.
+ ^ self reflection javaConstantPoolObjectFor:class constantPool.
+
+ "Created: / 21-12-2010 / 20:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-02-2011 / 18:05:13 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_java_lang_Class_getDeclaredClasses0: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getDeclaredClasses0'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_lang_Class_getDeclaredConstructors0:aJavaContext
+ <javanative: 'java/lang/Class' name: 'getDeclaredConstructors0'>
+ |class publicOnly constructors|
+
+ class := self reflection classForJavaClassObject:(aJavaContext receiver).
+ publicOnly := (aJavaContext argAt:1) == 1.
+ constructors := OrderedCollection new.
+ class selectorsAndMethodsDo:
+ [:selector :method |
+ (method isJavaMethod and:
+ [ (selector at:1) == $< and:
+ [ (selector startsWith:'<init>(')
+ and:[ publicOnly not or:[ method isPublic ] ] ] ])
+ ifTrue:
+ [ constructors add:(self reflection javaConstructorObjectForMethod:method) ] ].
+ ^ (self classForName:'java.lang.reflect.Constructor') javaArrayClass
+ withAll:constructors
+
+ "Created: / 24-11-2010 / 09:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:24:03 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 11-02-2011 / 08:55:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getDeclaredFields0:aJavaContext
+ <javanative: 'java/lang/Class' name: 'getDeclaredFields0'>
+ |javaClassObject class fields publicOnly|
+
+ class := self reflection
+ classForJavaClassObject:(javaClassObject := aJavaContext argAt:0).
+ (class isJavaPrimitiveType or:[class isJavaArrayClass]) ifTrue:[
+ ^(self classForName:'java.lang.reflect.Field') javaArrayClass new:0.
+ ].
+
+ publicOnly := (aJavaContext argAt:1) == 1.
+ fields := class fields , class staticFields.
+ publicOnly ifTrue:[ fields := fields select:[:f | f isPublic ] ].
+ fields := fields
+ collect:[:f | self javaFieldObjectForField:f in:javaClassObject ].
+ ^ (self classForName:'java.lang.reflect.Field') javaArrayClass
+ withAll:fields
+
+ "Created: / 10-11-2010 / 16:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:19:06 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-08-2011 / 09:06:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getDeclaredMethods0:aJavaContext
+ <javanative: 'java/lang/Class' name: 'getDeclaredMethods0'>
+ |class publicOnly methods|
+
+ class := self reflection classForJavaClassObject:(aJavaContext receiver).
+ publicOnly := (aJavaContext argAt:1) == 1.
+ methods := OrderedCollection new.
+ class selectorsAndMethodsDo:
+ [:selector :method |
+ (method isJavaMethod and:
+ [ (selector at:1) ~~ $< and:
+ [ (selector startsWith:'<init>(') not
+ and:[ publicOnly not or:[ method isPublic ] ] ] ])
+ ifTrue:[ methods add:(self javaMethodObjectForMethod:method) ] ].
+ ^ (self classForName:'java.lang.reflect.Method') javaArrayClass
+ withAll:methods asArray
+
+ "Created: / 21-12-2010 / 22:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:19:09 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 11-02-2011 / 08:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:07:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_java_lang_Class_getDeclaringClass: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getDeclaringClass'>
+ "
+ /**
+ * If the class or interface represented by this {@code Class} object
+ * is a member of another class, returns the {@code Class} object
+ * representing the class in which it was declared. This method returns
+ * null if this class or interface is not a member of any other class. If
+ * this {@code Class} object represents an array class, a primitive
+ * type, or void,then this method returns null.
+ *
+ * @return the declaring class for this class
+ * @since JDK1.1
+ */
+ "
+
+ | cls enclosingClsName enclosingCls |
+
+ cls := self reflection classForJavaClassObject:(nativeContext receiver).
+ (cls isJavaPrimitiveType or:[cls isJavaArrayClass]) ifTrue:[^nil].
+ (cls name includes: $$) ifFalse:[^nil].
+ enclosingClsName := cls name copyTo: (cls name lastIndexOf: $$) - 1.
+ enclosingCls := Java classForName: enclosingClsName.
+ enclosingCls isNil ifTrue:[self error:'Cannot fins declaring class'].
+ ^self reflection javaClassObjectForClass: enclosingCls
+
+ "Modified: / 13-08-2011 / 02:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getEnclosingMethod0: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getEnclosingMethod0'>
+
+ ^nil "/Not true"
+
+ "Modified: / 14-08-2011 / 20:05:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getGenericSignature: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getGenericSignature'>
+
+ |cls sig |
+
+ cls := self reflection classForJavaClassObject:(nativeContext receiver).
+ (cls isJavaPrimitiveType or:[cls isJavaArrayClass]) ifTrue:[^nil].
+ sig := cls signatureJ.
+ ^sig notNil ifTrue:[
+ Java as_String: sig
+ ] ifFalse:[
+ nil
+ ]
+
+ "Modified: / 13-08-2011 / 02:19:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getInterfaces:nativeContext
+ <javanative: 'java/lang/Class' name: 'getInterfaces'>
+ |jClass cls interfaces jInterfaces|
+
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ (cls isJavaPrimitiveType or:[cls isJavaArrayClass])
+ ifTrue:[ ^ (self classForName:'java.lang.Class') javaArrayClass new ].
+ interfaces := cls interfaces.
+ interfaces
+ ifNil:[ ^ (self classForName:'java.lang.Class') javaArrayClass new ].
+ jInterfaces := (self classForName:'java.lang.Class') javaArrayClass
+ new:interfaces size.
+ interfaces
+ withIndexDo:[:iface :idx | jInterfaces at:idx put:(self javaClassObjectForClass:iface) ].
+ ^ jInterfaces
+
+ "Modified: / 28-01-2011 / 15:19:11 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 12-08-2011 / 22:27:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getModifiers: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'getModifiers'>
+
+ | cls |
+
+ cls := (self reflection classForJavaClassObject:aJavaContext receiver).
+ ^(cls isJavaPrimitiveType or:[cls isJavaArrayClass]) ifTrue:[
+ 1041"FIXME: make it symbolic"
+ ] ifFalse:[
+ cls accessFlags
+ ]
+
+ "Created: / 12-11-1998 / 18:54:53 / cg"
+ "Modified: / 28-01-2011 / 15:19:14 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 12-08-2011 / 22:34:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getName0: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'getName0'>
+
+ |class|
+
+ class := aJavaContext receiver.
+ class := self reflection classForJavaClassObject:aJavaContext receiver.
+ ^ self reflection
+ javaStringObjectForString:class javaName
+ interned:true.
+
+ "Created: / 22-11-2010 / 17:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:06:53 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 25-02-2011 / 19:00:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getPrimitiveClass: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getPrimitiveClass'>
+
+ "get a primitive class by name"
+
+ |jClassName className|
+
+ jClassName := nativeContext argAt:1.
+ className := Java as_ST_String:jClassName.
+ (JavaDescriptor baseTypesByTypeName keys includes: className)
+ ifFalse:[self throwClassNotFoundException:className].
+ ^self reflection javaClassObjectForClassNamed: className
+
+ "Created: / 04-01-1998 / 00:46:03 / cg"
+ "Modified: / 28-01-2011 / 15:30:45 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-02-2011 / 21:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getProtectionDomain0: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getProtectionDomain0'>
+
+ ^(self reflection classForJavaClassObject: nativeContext receiver)
+ protectionDomain
+
+ "Modified: / 10-08-2011 / 15:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getRawAnnotations: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'getRawAnnotations'>
+
+ |class |
+
+ class := self reflection classForJavaClassObject:aJavaContext receiver.
+ ^ class runtimeVisibleAnnotationsAsBytesOrNil
+
+ "Created: / 21-12-2010 / 19:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:19:20 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 25-02-2011 / 16:48:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_getSuperclass: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getSuperclass'>
+
+ "return a classes superclass"
+
+ |jClass cls superCls|
+
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ cls isJavaPrimitiveType ifTrue:[^nil].
+ cls isJavaArrayClass ifTrue:[^self javaClassObjectForClass:(Java at:'java.lang.Object')].
+ cls isInterface ifTrue:[^nil].
+
+ superCls := cls superclass.
+ superCls == JavaObject ifTrue:[
+ ^ nil.
+ ].
+ ^ self javaClassObjectForClass:superCls
+
+ "Created: / 12-01-1998 / 12:38:36 / cg"
+ "Modified: / 04-02-1998 / 14:51:22 / cg"
+ "Modified: / 28-01-2011 / 14:12:47 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 15-08-2011 / 09:09:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_isArray: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'isArray'>
+
+ ^ (self reflection classForJavaClassObject:nativeContext receiver) isJavaArrayClass
+ ifTrue:[1]
+ ifFalse:[0]
+
+ "Created: / 12-11-1998 / 18:54:24 / cg"
+ "Modified: / 20-12-2010 / 23:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:19:24 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_java_lang_Class_isAssignableFrom: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'isAssignableFrom'>
+
+ "
+ /**
+ * Determines if the class or interface represented by this
+ * {@code Class} object is either the same as, or is a superclass or
+ * superinterface of, the class or interface represented by the specified
+ * {@code Class} parameter. It returns {@code true} if so;
+ * otherwise it returns {@code false}. If this {@code Class}
+ * object represents a primitive type, this method returns
+ * {@code true} if the specified {@code Class} parameter is
+ * exactly this {@code Class} object; otherwise it returns
+ * {@code false}.
+ *
+ * <p> Specifically, this method tests whether the type represented by the
+ * specified {@code Class} parameter can be converted to the type
+ * represented by this {@code Class} object via an identity conversion
+ * or via a widening reference conversion. See <em>The Java Language
+ * Specification</em>, sections 5.1.1 and 5.1.4 , for details.
+ *
+ * @param cls the {@code Class} object to be checked
+ * @return the {@code boolean} value indicating whether objects of the
+ * type {@code cls} can be assigned to objects of this class
+ * @exception NullPointerException if the specified Class parameter is
+ * null.
+ * @since JDK1.1
+ */
+ "
+ | clsObj me other |
+ clsObj := nativeContext argAt: 1.
+ clsObj ifNil:[^self throwNullPointerException].
+ me := self reflection classForJavaClassObject: nativeContext receiver.
+ other := self reflection classForJavaClassObject: clsObj.
+
+ "/ Determines if the class or interface represented by this
+ "/ @code Class} object is either the same as, or is a superclass or
+ "/ superinterface of, the class or interface represented by the specified
+ "/ {@code Class} parameter.
+
+ ^(other includesBehavior: me)
+ ifTrue:[1]
+ ifFalse:[0]
+
+ "Created: / 12-11-1998 / 18:54:16 / cg"
+ "Modified: / 05-02-2011 / 23:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_isInstance: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'isInstance'>
+
+ "
+ /**
+ * Determines if the specified {@code Object} is assignment-compatible
+ * with the object represented by this {@code Class}. This method is
+ * the dynamic equivalent of the Java language {@code instanceof}
+ * operator. The method returns {@code true} if the specified
+ * {@code Object} argument is non-null and can be cast to the
+ * reference type represented by this {@code Class} object without
+ * raising a {@code ClassCastException.} It returns {@code false}
+ * otherwise.
+ *
+ * <p> Specifically, if this {@code Class} object represents a
+ * declared class, this method returns {@code true} if the specified
+ * {@code Object} argument is an instance of the represented class (or
+ * of any of its subclasses); it returns {@code false} otherwise. If
+ * this {@code Class} object represents an array class, this method
+ * returns {@code true} if the specified {@code Object} argument
+ * can be converted to an object of the array class by an identity
+ * conversion or by a widening reference conversion; it returns
+ * {@code false} otherwise. If this {@code Class} object
+ * represents an interface, this method returns {@code true} if the
+ * class or any superclass of the specified {@code Object} argument
+ * implements this interface; it returns {@code false} otherwise. If
+ * this {@code Class} object represents a primitive type, this method
+ * returns {@code false}.
+ *
+ * @param obj the object to check
+ * @return true if {@code obj} is an instance of this class
+ *
+ * @since JDK1.1
+ */
+ public native boolean isInstance(Object obj);
+ "
+
+ |jClass cls obj|
+
+ obj := nativeContext argAt:1.
+ obj isNil ifTrue:[^ 0].
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ ^self _INSTANCEOF:obj _:cls
+
+ "Modified: / 09-02-1998 / 14:56:23 / cg"
+ "Modified: / 28-01-2011 / 14:12:42 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 25-02-2011 / 18:37:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_isInterface: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'isInterface'>
+
+ "return true, if this class is an interface"
+
+ |jClass cls|
+
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ cls isJavaClass ifFalse:[
+ ^ 0
+ ].
+ cls isInterface ifTrue:[
+ ^ 1 "TRUE"
+ ].
+ ^ 0 "FALSE"
+
+ "Created: / 12-01-1998 / 12:37:02 / cg"
+ "Modified: / 28-01-2011 / 14:12:35 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-02-2011 / 21:50:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_isPrimitive: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'isPrimitive'>
+
+ "return true, if this class is builtin primitive class
+ (i.e. byteArray, array, string etc."
+
+ |jClass cls|
+
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ ^cls isJavaPrimitiveType
+ ifTrue:[1"true"]
+ ifFalse:[0"false"].
+
+ "Created: / 09-02-1998 / 14:46:07 / cg"
+ "Modified: / 28-01-2011 / 14:12:30 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 04-02-2011 / 11:56:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_registerNatives: aJavaContext
+
+ <javanative: 'java/lang/Class' name: 'registerNatives'>
+
+
+ "Nothing to do, native method are bound lazily"
+
+ "Created: / 20-10-2010 / 11:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Class_setProtectionDomain0: nativeContext
+
+ <javanative: 'java/lang/Class' name: 'getProtectionDomain0'>
+
+ (self reflection classForJavaClassObject: nativeContext receiver)
+ protectionDomain: (nativeContext argAt:1)
+
+ "Created: / 10-08-2011 / 15:20:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Double_doubleToRawLongBits: aJavaContext
+
+ <javanative: 'java/lang/Double' name: 'doubleToRawLongBits'>
+
+ "
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point 'double
+ * format' bit layout, preserving Not-a-Number (NaN) values.
+ *
+ * <p>Bit 63 (the bit that is selected by the mask
+ * {@code 0x8000000000000000L}) represents the sign of the
+ * floating-point number. Bits
+ * 62-52 (the bits that are selected by the mask
+ * {@code 0x7ff0000000000000L}) represent the exponent. Bits 51-0
+ * (the bits that are selected by the mask
+ * {@code 0x000fffffffffffffL}) represent the significand
+ * (sometimes called the mantissa) of the floating-point number.
+ *
+ * <p>If the argument is positive infinity, the result is
+ * {@code 0x7ff0000000000000L}.
+ *
+ * <p>If the argument is negative infinity, the result is
+ * {@code 0xfff0000000000000L}.
+ *
+ * <p>If the argument is NaN, the result is the {@code long}
+ * integer representing the actual NaN value. Unlike the
+ * {@code doubleToLongBits} method,
+ * {@code doubleToRawLongBits} does not collapse all the bit
+ * patterns encoding a NaN to a single 'canonical' NaN
+ * value.
+ *
+ * <p>In all cases, the result is a {@code long} integer that,
+ * when given to the {@link #longBitsToDouble(long)} method, will
+ * produce a floating-point value the same as the argument to
+ * {@code doubleToRawLongBits}.
+ *
+ * @param value a {@code double} precision floating-point number.
+ * @return the bits that represent the floating-point number.
+ * @since 1.3
+ */
+ "
+ | f b |
+ f := aJavaContext argAt:1.
+ (f = 0.0) ifTrue:[^0].
+ (f = -0.0) ifTrue:[^(1 bitShift: 63)].
+
+ b := ByteArray streamContents:[:s|Float storeBinaryIEEEDouble:f on:s].
+ ^ LargeInteger digitBytes: b MSB: UninterpretedBytes isBigEndian not.
+
+ "Created: / 10-11-2010 / 14:48:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2011 / 21:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Double_longBitsToDouble: nativeContext
+
+ <javanative: 'java/lang/Double' name: 'longBitsToDouble'>
+
+ |i aFloat|
+
+ i := nativeContext argAt:1.
+
+ aFloat := Float new.
+ UninterpretedBytes isBigEndian ifTrue:[
+ aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF).
+ aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF).
+ aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF).
+ aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF).
+ aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF).
+ aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF).
+ aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF).
+ aFloat basicAt:8 put:(i bitAnd:16rFF).
+ ] ifFalse:[
+ aFloat basicAt:1 put:(i bitAnd:16rFF).
+ aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF).
+ aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF).
+ aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF).
+ aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF).
+ aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF).
+ aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF).
+ aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF).
+ ].
+
+ ^ aFloat.
+
+ "Created: / 4.1.1998 / 01:45:00 / cg"
+!
+
+_java_lang_Float_floatToRawIntBits: aJavaContext
+
+ <javanative: 'java/lang/Float' name: 'floatToRawIntBits'>
+
+ "
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point 'single format' bit
+ * layout, preserving Not-a-Number (NaN) values.
+ *
+ * <p>Bit 31 (the bit that is selected by the mask
+ * {@code 0x80000000}) represents the sign of the floating-point
+ * number.
+ * Bits 30-23 (the bits that are selected by the mask
+ * {@code 0x7f800000}) represent the exponent.
+ * Bits 22-0 (the bits that are selected by the mask
+ * {@code 0x007fffff}) represent the significand (sometimes called
+ * the mantissa) of the floating-point number.
+ *
+ * <p>If the argument is positive infinity, the result is
+ * {@code 0x7f800000}.
+ *
+ * <p>If the argument is negative infinity, the result is
+ * {@code 0xff800000}.
+ *
+ * <p>If the argument is NaN, the result is the integer representing
+ * the actual NaN value. Unlike the {@code floatToIntBits}
+ * method, {@code floatToRawIntBits} does not collapse all the
+ * bit patterns encoding a NaN to a single 'canonical'
+ * NaN value.
+ *
+ * <p>In all cases, the result is an integer that, when given to the
+ * {@link #intBitsToFloat(int)} method, will produce a
+ * floating-point value the same as the argument to
+ * {@code floatToRawIntBits}.
+ *
+ * @param value a floating-point number.
+ * @return the bits that represent the floating-point number.
+ * @since 1.3
+ */
+ "
+ | f b |
+ f := aJavaContext argAt:1.
+ (f = 0.0) ifTrue:[^0].
+ (f = -0.0) ifTrue:[^(1 bitShift: 31) ].
+
+ b := ByteArray streamContents:[:s|ShortFloat storeBinaryIEEESingle:f on:s].
+ ^ (LargeInteger digitBytes: b MSB: UninterpretedBytes isBigEndian not) compressed
+
+ "Created: / 09-11-2010 / 20:59:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2011 / 21:45:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Object_clone: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'clone'>
+
+ "clone an object"
+
+ |o rslt|
+
+ o := nativeContext receiver.
+ rslt := o shallowCopy.
+ ^ rslt
+
+ "Created: / 4.1.1998 / 19:39:26 / cg"
+!
+
+_java_lang_Object_getClass: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'getClass'>
+
+ "return an objects class"
+
+ |o cls jClass|
+
+ o := nativeContext receiver.
+ cls := o class.
+
+ jClass := self javaClassObjectForClass:cls.
+ ^ jClass
+
+ "Created: / 6.1.1998 / 18:28:27 / cg"
+ "Modified: / 23.1.1998 / 17:48:22 / cg"
+!
+
+_java_lang_Object_hashCode: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'hashCode'>
+
+ "identityHash"
+
+ |o rslt|
+
+ o := nativeContext receiver.
+ rslt := o identityHash.
+ ^ rslt
+
+ "Created: / 4.1.1998 / 19:40:26 / cg"
+!
+
+_java_lang_Object_notify: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'notify'>
+
+ "wakeup"
+
+ self wakeup:(nativeContext receiver).
+
+ "Created: / 6.1.1998 / 21:09:26 / cg"
+!
+
+_java_lang_Object_notifyAll: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'notifyAll'>
+
+ self wakeupAll:(nativeContext receiver).
+
+ "Created: / 3.1.1998 / 03:06:56 / cg"
+!
+
+_java_lang_Object_registerNatives: aJavaContext
+
+ <javanative: 'java/lang/Object' name: 'registerNatives'>
+
+
+ "Nothing to do, native method are bound lazily"
+
+ "Created: / 19-10-2010 / 12:42:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 20-10-2010 / 10:57:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Object_wait: nativeContext
+
+ <javanative: 'java/lang/Object' name: 'wait'>
+
+ |tmo handle sema|
+
+ handle := nativeContext receiver.
+ tmo := nativeContext argAt:1.
+
+ sema := JavaVM semaphoreFor:handle.
+
+ [
+ self waitFor:sema state:#javaWait timeOut:tmo.
+ ] valueOnUnwindDo:[
+ JavaVM releaseSemaphoreFor:handle.
+ ].
+
+ ThreadTrace ifTrue:[
+ '====> thread continues ...' printCR.
+ ]
+
+ "Modified: / 30-12-1998 / 19:20:43 / cg"
+ "Modified: / 01-05-2011 / 13:26:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Package_getSystemPackage0: nativeContext
+
+ <javanative: 'java/lang/Package' name: 'getSystemPackage0'>
+
+ "Based on code on OpenJDK, it is ok to return nil here:"
+
+ ^nil
+
+ "Modified: / 12-08-2011 / 16:00:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_ProcessEnvironment_environ: nativeContext
+
+ <javanative: 'java/lang/ProcessEnvironment' name: 'environ'>
+
+ | env jenv i|
+ env := OperatingSystem getEnvironment.
+ jenv := ByteArray javaArrayClass new: env size * 2.
+ i := 1.
+ env keysAndValuesDo:
+ [:name :value|
+ jenv
+ at: i put: name asByteArray;
+ at: i+1 put: value asByteArray.
+ i := i + 2].
+ ^jenv
+
+ "Modified: / 25-06-2011 / 08:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Runtime_gc: nativeContext
+
+ <javanative: 'java/lang/Runtime' name: 'gc'>
+
+ "Runs the garbage collector.
+ Ignored, since the ST-gc runs all the time."
+
+ ^ self
+
+ "Modified: / 12.1.1998 / 12:58:32 / cg"
+!
+
+_java_lang_Runtime_runFinalization0: nativeContext
+
+ <javanative: 'java/lang/Runtime' name: 'runFinalization0'>
+
+ Smalltalk garbageCollect
+
+ "Modified: / 08-08-2011 / 17:48:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_SecurityManager_getClassContext: nativeContext
+
+ <javanative: 'java/lang/SecurityManager' name: 'getClassContext'>
+
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:56:06 / cg"
+!
+
+_java_lang_Shutdown_halt0: nativeContext
+
+ <javanative: 'java/lang/Shutdown' name: 'halt0'>
+
+ "Intentionally left empty!!!!!!"
+
+ "Modified: / 10-08-2011 / 22:20:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_cbrt: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cbrt'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_lang_StrictMath_cos: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f cos
+
+ "Modified: / 08-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_cosh: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f cosh
+
+ "Modified: / 08-08-2011 / 23:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_expm1: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'expm1'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_lang_StrictMath_floor: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'floor'>
+
+ | f |
+ f := nativeContext argAt:1.
+ ^f floor
+
+ "Modified: / 10-08-2011 / 01:14:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_floot: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f floor
+
+ "Created: / 08-08-2011 / 23:46:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_sin: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f sin
+
+ "Modified: / 08-08-2011 / 23:44:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_sinh: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f sinh
+
+ "Modified: / 08-08-2011 / 23:44:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_StrictMath_tanh: nativeContext
+
+ <javanative: 'java/lang/StrictMath' name: 'cos'>
+
+ | f |
+ f := nativeContext argAt: 1.
+ ^f tanh
+
+ "Modified: / 08-08-2011 / 23:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_String_intern: nativeContext
+
+ <javanative: 'java/lang/String' name: 'intern'>
+
+ |jString|
+
+ jString := nativeContext receiver.
+ ^ Java intern:jString
+!
+
+_java_lang_System_arraycopy: nativeContext
+
+ <javanative: 'java/lang/System' name: 'arraycopy'>
+
+ |srcArray srcIdx dstArray dstIdx srcArrayCC dstArrayCC count dstEndIdx|
+
+ srcArray := nativeContext argAt:1.
+ srcArray isNil ifTrue:[
+ ^ self throwNullPointerException
+ ].
+ srcArray isJavaArray ifFalse:[
+ ^ self throwArrayStoreException:srcArray
+ ].
+ srcIdx := nativeContext argAt:2.
+ dstArray := nativeContext argAt:3.
+ dstArray isNil ifTrue:[
+ ^ self throwNullPointerException
+ ].
+ dstArray isJavaArray ifFalse:[
+ ^ self throwArrayStoreException:dstArray
+ ].
+
+ srcArrayCC := srcArray class javaComponentClass.
+ dstArrayCC := dstArray class javaComponentClass.
+
+ srcArrayCC isJavaPrimitiveType == dstArrayCC isJavaPrimitiveType
+ ifTrue:
+ [srcArrayCC isJavaPrimitiveType
+ ifTrue:
+ [srcArrayCC ~~ dstArrayCC ifTrue:
+ [^ self throwArrayStoreException:dstArray]].
+ ]
+ ifFalse:
+ [^ self throwArrayStoreException:dstArray].
+
+ dstIdx := nativeContext argAt:4.
+ count := nativeContext argAt:5.
+
+ ((srcIdx < 0) or:[srcIdx + count > srcArray size]) ifTrue:[
+ srcArray size == 0 ifTrue:[
+ srcArray isVariable ifFalse:[
+ ^ self throwArrayStoreException:srcArray
+ ]
+ ].
+ ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
+ ].
+ ((dstIdx < 0) or:[dstIdx + count > dstArray size]) ifTrue:[
+ dstArray size == 0 ifTrue:[
+ dstArray isVariable ifFalse:[
+ ^ self throwArrayStoreException:dstArray
+ ]
+ ].
+ ^ self throwArrayIndexOutOfBoundsException:(dstIdx + count - 1)
+ ].
+
+ dstEndIdx := dstIdx + count.
+ dstIdx := dstIdx + 1. "/ ST uses 1-based indexing
+ srcIdx := srcIdx + 1. "/ ST uses 1-based indexing
+
+ (srcArray class isBytes and:[dstArray class isBytes]) ifTrue:[
+ dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ ] ifFalse:[
+ dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ ].
+ ^ nil.
+
+ "Modified: / 23-06-2011 / 09:17:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_System_currentTimeMillis: nativeContext
+
+ <javanative: 'java/lang/System' name: 'currentTimeMillis'>
+
+ "return the milliseconds since 1.jan.1970"
+
+ |delta|
+
+ "/ workaround win32 bug (use 01:01:01 as base)
+ delta := Timestamp now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1).
+ delta := delta - 3600 - 60 - 1.
+"/ "/ make certain, it fits 64 signed bits
+"/ delta := delta bitAnd:16r7FFFFFFFFFFFFFFF.
+"/ ^ delta max:0
+ ^ delta
+
+ "
+ JavaVM _System_currentTimeMillis:nil
+ "
+
+ "Modified: / 23.12.1998 / 21:54:50 / cg"
+!
+
+_java_lang_System_identityHashCode: nativeContext
+
+ <javanative: 'java/lang/System' name: 'identityHashCode'>
+
+ |obj|
+
+ obj := nativeContext argAt:1.
+ ^ obj identityHash
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:54:00 / cg"
+!
+
+_java_lang_System_initProperties: nativeContext
+
+ <javanative: 'java/lang/System' name: 'initProperties'>
+
+ |props stProps|
+
+ props := nativeContext argAt:1.
+ stProps := self systemProperties.
+
+ "/ recursively invoke myself on the Java HashTable.
+ "/ calling 'put' to stuff in the values ...
+
+ stProps keysAndValuesDo:[:key :value |
+ |keyObj valueObj|
+
+ keyObj := Java as_String:key.
+ valueObj := Java as_String:value.
+
+ props
+ perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;'
+ with:keyObj
+ with:valueObj.
+ ].
+ ^ props
+
+ "Created: / 3.1.1998 / 14:25:22 / cg"
+ "Modified: / 4.1.1998 / 14:23:18 / cg"
+!
+
+_java_lang_System_mapLibraryName: aJavaContext
+
+ <javanative: 'java/lang/System' name: 'mapLibraryName'>
+
+
+ | name |
+ name := Java as_ST_String: (aJavaContext argAt: 1).
+
+ OperatingSystem isUNIXlike ifTrue:[
+ ^Java as_String: ('lib' , name , '.so').
+ ].
+
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ ^Java as_String: ( name , '.dll').
+ ].
+
+ self error:'Unknown/Unsupported platform'
+
+ "Created: / 09-12-2010 / 18:16:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-04-2011 / 18:14:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_System_nanoTime: nativeContext
+
+ <javanative: 'java/lang/System' name: 'nanoTime'>
+
+ ^ OperatingSystem getMicrosecondTime * 1000
+
+ "Modified: / 07-08-2011 / 21:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_System_registerNatives: aJavaContext
+
+ <javanative: 'java/lang/System' name: 'registerNatives'>
+
+
+ "Nothing to do, native method are bound lazily"
+
+ "Created: / 20-10-2010 / 10:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_System_setErr0: nativeContext
+
+ <javanative: 'java/lang/System' name: 'setErr0'>
+
+ |stream|
+
+ stream := nativeContext argAt:1.
+
+ self setOpenFile:(self javaConsoleStream ? Stderr) at:2.
+
+ nativeContext receiver instVarNamed:'err' put:stream.
+
+ "Created: / 18.3.1997 / 15:02:05 / cg"
+ "Modified: / 4.1.1998 / 16:21:15 / cg"
+!
+
+_java_lang_System_setIn0: nativeContext
+
+ <javanative: 'java/lang/System' name: 'setIn0'>
+
+ |stream|
+
+ stream := nativeContext argAt:1.
+
+ self setOpenFile:Stdin at:0.
+
+ nativeContext receiver instVarNamed:'in' put:stream.
+
+ "Created: / 4.1.1998 / 16:16:38 / cg"
+ "Modified: / 4.1.1998 / 16:20:44 / cg"
+!
+
+_java_lang_System_setOut0: nativeContext
+
+ <javanative: 'java/lang/System' name: 'setOut0'>
+
+ |stream|
+
+ stream := nativeContext argAt:1.
+
+ self setOpenFile:(self javaConsoleStream ? Stdout) at:1.
+
+ nativeContext receiver instVarNamed:'out' put:stream.
+
+ "Created: / 4.1.1998 / 16:18:26 / cg"
+ "Modified: / 4.1.1998 / 16:20:23 / cg"
+!
+
+_java_lang_Thread_currentThread: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'currentThread'>
+
+ |t p|
+
+ p := Processor activeProcess.
+ t := self javaThreadForSTProcess:p.
+ t notNil ifTrue:[
+ ^ t
+ ].
+ t := self newThread:'main'.
+ Java threads at:t put:p.
+ ^ t
+
+ "Modified: / 01-05-2011 / 13:24:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Thread_holdsLock: aJavaContext
+
+ <javanative: 'java/lang/Thread' name: 'holdsLock'>
+
+
+ | obj |
+ obj := aJavaContext argAt: 1.
+
+ ^(self enteredMonitorsOfProcess:Processor activeProcess)
+ includes: obj.
+
+ "Created: / 30-04-2011 / 22:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Thread_isAlive: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'isAlive'>
+
+ "is it alive ?"
+
+ |jThread stProcess|
+
+ jThread := nativeContext receiver.
+ stProcess := JavaVM stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ 0 "FALSE"
+ ].
+ stProcess isDead ifTrue:[^ 0 "FALSE"].
+ ^ 1 "TRUE"
+
+ "Created: / 5.1.1998 / 02:03:51 / cg"
+ "Modified: / 6.2.1998 / 02:15:01 / cg"
+!
+
+_java_lang_Thread_isInterrupted: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'isInterrupted'>
+
+ "ask if a thread is interrupted (clear interruptState if arg is true)"
+
+ |jThread stProcess clearInterrupt rslt|
+
+ jThread := nativeContext receiver.
+ stProcess := self stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ self halt.
+ ^ 0
+ ].
+
+ clearInterrupt := nativeContext argAt:1.
+ rslt := "stProcess isInterrupted"false ifTrue:[1] ifFalse:[0].
+ "clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]."
+ ^ rslt
+
+ "Modified: / 02-01-1998 / 21:49:06 / cg"
+ "Created: / 07-01-1998 / 18:50:26 / cg"
+ "Modified: / 05-08-2011 / 22:21:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Thread_registerNatives: aJavaContext
+
+ <javanative: 'java/lang/Thread' name: 'registerNatives'>
+
+
+ "Nothing to do, native method are bound lazily"
+
+ "Created: / 20-10-2010 / 11:12:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Thread_setPriority0: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'setPriority0'>
+
+ |t p prio|
+
+ t := nativeContext receiver.
+ p := JavaVM stProcessForJavaThread:t.
+ prio := nativeContext argAt:1.
+
+ p isNil ifTrue:[
+ ThreadTrace == true ifTrue:[
+ 'JAVA [info]: no process yet (in setPriority)' infoPrintCR.
+ ].
+ ^ nil
+ ].
+
+ "Modified: / 01-05-2011 / 13:25:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Thread_sleep: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'sleep'>
+
+ "sleep for some milliseconds "
+
+ |millis|
+
+ millis := nativeContext argAt:1.
+ self waitFor:nil state:nil timeOut:(millis max:50)
+
+ "Modified: / 8.1.1999 / 16:42:52 / cg"
+!
+
+_java_lang_Thread_start0: nativeContext
+
+ <javanative: 'java/lang/Thread' name: 'start0'>
+
+
+ ^self threadStart: nativeContext
+
+ "Modified: / 24-12-1999 / 03:14:33 / cg"
+ "Created: / 22-11-2010 / 17:48:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-12-2010 / 21:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Throwable_fillInStackTrace: nativeContext
+
+ <javanative: 'java/lang/Throwable' name: 'fillInStackTrace'>
+
+ |exClass exceptionObject list con|
+
+ exClass := Java classNamed:'java.lang.Throwable'.
+
+ exceptionObject := nativeContext receiver.
+
+ "/
+ "/ debugging only
+ "/
+ (exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[
+ self halt
+ ].
+
+ con := thisContext sender.
+
+ "/
+ "/ we are not interrested in all intermediate Exception frames ...
+ "/
+ FullExceptionTrace ifFalse:[
+ "/ first, skip any JavaVM contexts
+ [con receiver == exceptionObject] whileFalse:[
+ con := con sender
+ ].
+ "/ then, all exception-init contexts
+ [con receiver == exceptionObject] whileTrue:[
+ con := con sender
+ ].
+ ].
+
+ list := OrderedCollection new.
+ [con notNil] whileTrue:[
+ (con isJavaContext) ifTrue:[
+ "/ add a copy, in case the context continues with some
+ "/ cleanup ...
+ list add:con shallowCopy
+ ].
+ con := con sender
+ ].
+
+ exceptionObject instVarNamed:'backtrace' put:(list asArray).
+
+ ^ nil.
+
+ "Created: / 4.1.1998 / 14:27:40 / cg"
+ "Modified: / 8.5.1998 / 21:29:53 / cg"
+!
+
+_java_lang_Throwable_getStackTraceDepth: nativeContext
+
+ <javanative: 'java/lang/Throwable' name: 'getStackTraceDepth'>
+
+
+ ^(nativeContext receiver instVarNamed: #backtrace) size
+
+ "Modified: / 01-05-2011 / 20:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_Throwable_getStackTraceElement: nativeContext
+
+ <javanative: 'java/lang/Throwable' name: 'getStackTraceElement'>
+
+ | throwable index ctx stackTraceElement |
+ throwable := nativeContext receiver.
+ index := nativeContext argAt: 1.
+ ctx := (throwable instVarNamed:#backtrace) at: index + 1.
+
+ stackTraceElement := (self classForName: 'java.lang.StackTraceElement') new.
+
+ stackTraceElement
+ instVarNamed: #declaringClass
+ put: (Java as_String:(ctx method javaClass javaName));
+
+ instVarNamed: #methodName
+ put: (Java as_String:(ctx method printStringForBrowserWithSelector:ctx method selector inClass: ctx method javaClass));
+
+ instVarNamed: #lineNumber
+ put: ctx lineNumber.
+
+ ctx method javaClass sourceFile notNil ifTrue:[
+ stackTraceElement
+ instVarNamed: #fileName
+ put: (Java as_String:(ctx method javaClass sourceFile))
+ ].
+ ^ stackTraceElement
+
+ "Modified: / 07-08-2011 / 13:30:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_UNIXProcess_forkAndExec: nativeContext
+
+ <javanative: 'java/lang/UNIXProcess' name: 'forkAndExec'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_lang_UNIXProcess_initIDs: nativeContext
+
+ <javanative: 'java/lang/UNIXProcess' name: 'initIDs'>
+
+ "Nothing to do"
+
+ "Modified: / 25-06-2011 / 10:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!JavaVM class methodsFor:'native - java.awt.image'!
+!JavaVM class methodsFor:'native - java.lang.reflect'!
+
+_java_lang_reflect_Array_getLength: nativeContext
+
+ <javanative: 'java/lang/reflect/Array' name: 'getLength(Ljava/lang/Object;)I'>
+
+ ^(nativeContext argAt: 1) size
+
+ "Modified: / 17-08-2011 / 09:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_lang_reflect_Array_newArray:aJavaContext
+ <javanative: 'java/lang/reflect/Array' name: 'newArray'>
+ |componentClass size|
+
+ componentClass := self reflection
+ classForJavaClassObject:(aJavaContext argAt:1).
+ size := aJavaContext argAt:2.
+ ^ componentClass javaArrayClass new:size
+
+ "Created: / 17-12-2010 / 14:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-12-2010 / 17:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:18:50 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 04-06-2011 / 17:06:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_java_lang_reflect_Array_set: nativeContext
+
+ <javanative: 'java/lang/reflect/Array' name: 'set'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_lang_reflect_Proxy_defineClass0: nativeContext
+
+ <javanative: 'java/lang/reflect/Proxy' name: 'defineClass0'>
+
+ "
+ private static native Class defineClass0(ClassLoader loader, String name,
+ byte[] b, int off, int len);
+ "
+ | loader name b off len bs cls |
+ loader := nativeContext argAt: 1.
+ name := nativeContext argAt: 2.
+ b := nativeContext argAt: 3.
+ off := nativeContext argAt: 4.
+ len := nativeContext argAt: 5.
+
+ bs := (off = 0 and: [len = b size])
+ ifTrue:[b readStream]
+ ifFalse:[(b copyFrom: off + 1 to: off + len) readStream].
+
+ cls := JavaClassReader readStream: bs.
+ cls classLoader: loader.
+
+ ^self reflection javaClassObjectForClass: cls.
+
+ "Created: / 06-02-2011 / 16:55:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'native - java.net'!
+
+_java_net_DatagramPacket_init: nativeContext
+
+ <javanative: 'java/net/DatagramPacket' name: 'init'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_net_InetAddressImplFactory_isIPv6Supported: nativeContext
+
+ <javanative: 'java/net/InetAddressImplFactory' name: 'isIPv6Supported'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_net_InetAddress_init: nativeContext
+
+ <javanative: 'java/net/InetAddress' name: 'init'>
+
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:16:40 / cg"
+
+
+!
+
+_java_net_NetworkInterface_init: nativeContext
+
+ <javanative: 'java/net/NetworkInterface' name: 'init'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_net_PlainDatagramSocketImpl_init: nativeContext
+
+ <javanative: 'java/net/PlainDatagramSocketImpl' name: 'init'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_net_PlainSocketImpl_initProto: nativeContext
+
+ <javanative: 'java/net/PlainSocketImpl' name: 'initProto'>
+
+
+ "Created: / 12.1.1998 / 12:56:52 / cg"
+! !
+
+!JavaVM class methodsFor:'native - java.security'!
+
+_java_security_AccessController_doPrivileged: aJavaContext
+
+ <javanative: 'java/security/AccessController' name: 'doPrivileged'>
+
+
+ "Don't care about permissions :-)"
+
+ ^(aJavaContext argAt:1) perform: #'run()Ljava/lang/Object;'
+
+ "Created: / 20-10-2010 / 12:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_security_AccessController_getStackAccessControlContext: nativeContext
+
+ <javanative: 'java/security/AccessController' name: 'getStackAccessControlContext'>
+
+ "/ introduced with jdk1.2
+
+ "/ supposed to do more here ...
+
+ ^ nil
+
+ "Created: / 27.1.1998 / 18:22:15 / cg"
+! !
+
+!JavaVM class methodsFor:'native - java.util'!
+
+_java_util_ResourceBundle_getClassContext: nativeContext
+
+ <javanative: 'java/util/ResourceBundle' name: 'getClassContext'>
+
+ "returns an array filled with the contextChain receivers classes.
+ What an ugly, messy interface."
+
+ |chain con cls jClass|
+
+ chain := OrderedCollection new.
+ con := thisContext sender.
+ [
+ con notNil
+ and:[con receiver isMethod not or:[con receiver isJavaMethod not]]
+ ] whileTrue:[con := con sender.].
+ con := con sender.
+ [con notNil] whileTrue:[
+ (true) "con isJavaContext" ifTrue:[
+ cls := con receiver class.
+ cls isMeta ifTrue:[
+ "/ t'was a static method
+ cls := cls soleInstance
+ ].
+ cls isJavaClass ifTrue:[
+ jClass := self reflection javaClassObjectForClass:cls.
+ chain add:jClass.
+ ]
+ ].
+ con := con sender.
+ ].
+ ^ chain asArray
+
+ "Created: / 05-01-1998 / 02:47:00 / cg"
+ "Modified: / 24-12-1998 / 00:34:57 / cg"
+ "Modified: / 28-01-2011 / 15:31:28 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-02-2011 / 21:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_TimeZone_getSystemTimeZoneID: nativeContext
+
+ <javanative: 'java/util/TimeZone' name: 'getSystemTimeZoneID'>
+
+ "JV@2011-06-25: TODO: finish, returning nil here means GMT"
+
+ ^ nil
+
+ "Modified: / 25-06-2011 / 08:26:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'native - java.util.concurrent.atomic'!
+
+_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8: nativeContext
+
+ <javanative: 'java/util/concurrent/atomic/AtomicLong' name: 'VMSupportsCS8'>
+
+ "Should be safe - say we don't support lockless updates"
+
+ ^ 0
+
+ "Modified: / 07-08-2011 / 20:53:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'native - java.util.jar'!
+
+_java_util_jar_JarFile_getMetaInfEntryNames: nativeContext
+
+ <javanative: 'java/util/jar/JarFile' name: 'getMetaInfEntryNames'>
+ "
+ private native String[] getMetaInfEntryNames();
+ "
+ | zipArchive entries jentries |
+
+ zipArchive := ZipCache at: (nativeContext receiver instVarNamed: #jzfile).
+ entries := zipArchive entries select:[:entry|entry size > 9 and:[entry startsWith: 'META-INF/']].
+ jentries := Java java_lang_String javaArrayClass new: entries size.
+ 1 to: entries size do:[:i|
+ jentries at: i put: (Java as_String: (entries at: i))
+ ].
+ ^jentries
+
+ "Modified: / 05-08-2011 / 20:18:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'native - java.util.zip'!
+
+_java_util_zip_Adler32_updateBytes: nativeContext
+
+ <javanative: 'java/util/zip/Adler32' name: 'updateBytes'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_util_zip_Deflater_initIDs: nativeContext
+
+ <javanative: 'java/util/zip/Deflater' name: 'initIDs'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_util_zip_Inflater_getBytesWritten: nativeContext
+
+ <javanative: 'java/util/zip/Inflater' name: 'getBytesWritten'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_java_util_zip_Inflater_inflateBytes: nativeContext
+
+ <javanative: 'java/util/zip/Inflater' name: 'inflateBytes'>
+ "
+ private native int inflateBytes(long addr, byte[] b, int off, int len)
+ "
+
+ | addr inputBuf outputBuf b off len inflater |
+ addr := nativeContext argAt: 1.
+ inflater := ZipInflaters at: addr.
+ inputBuf := nativeContext receiver instVarNamed: #buf.
+ inputBuf size == 0 ifTrue:[^0].
+
+ b := nativeContext argAt: 3.
+ off := nativeContext argAt: 4.
+ len := nativeContext argAt: 5.
+
+ outputBuf := ByteArray new: (b size + 1000"save").
+
+ ZipArchive basicNew inflate:inputBuf to:outputBuf.
+
+ b replaceFrom:off + 1 to: off + len with: outputBuf startingAt:1.
+
+ ^len
+
+ "Created: / 30-04-2011 / 23:02:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-08-2011 / 18:37:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_Inflater_init: nativeContext
+
+ <javanative: 'java/util/zip/Inflater' name: 'init'>
+
+
+ | index |
+ index := ZipInflaters indexOf: nativeContext receiver.
+ index == 0 ifTrue:
+ [ZipInflaters add: JavaInflater new.
+ index := ZipInflaters size].
+ ^index
+
+ "Created: / 01-02-1998 / 20:14:01 / cg"
+ "Modified: / 12-08-2011 / 18:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_Inflater_initIDs: aJavaContext
+
+ <javanative: 'java/util/zip/Inflater' name: 'initIDs'>
+
+
+ "Nothing to do, used only to register natives"
+
+ "Created: / 30-04-2011 / 21:55:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_Inflater_reset: nativeContext
+
+ <javanative: 'java/util/zip/Inflater' name: 'reset'>
+ "
+ private native static void reset(long addr);
+ "
+ | addr |
+ addr := nativeContext argAt: 1.
+ ZipInflaters at: addr put: nil.
+
+ "Created: / 01-02-1998 / 20:14:13 / cg"
+ "Modified: / 12-08-2011 / 18:21:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipEntry_initFields: aJavaContext
+
+ <javanative: 'java/util/zip/ZipEntry' name: 'initFields'>
+
+ | entry jzentry zmember |
+
+ entry := aJavaContext receiver.
+ jzentry := aJavaContext argAt: 1.
+ zmember := ZipEntryCache at: jzentry.
+
+ entry
+ instVarNamed: #time put: zmember lastModFileTime;
+ instVarNamed: #crc put: zmember crc32;
+ instVarNamed: #size put: zmember uncompressedSize;
+ instVarNamed: #csize put: zmember compressedSize;
+ instVarNamed: #method put: zmember compressionMethod;
+ instVarNamed: #extra put: zmember extraField;
+ instVarNamed: #comment put: (zmember fileComment ifNotNil:[Java as_String: zmember fileComment]).
+
+
+
+ "Created: / 01-04-2011 / 13:04:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 29-04-2011 / 20:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipEntry_initIDs: aJavaContext
+
+ <javanative: 'java/util/zip/ZipEntry' name: 'initIDs'>
+
+ "hopefully nothing to do"
+
+ "Created: / 01-04-2011 / 13:02:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_freeEntry: nativeContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'freeEntry'>
+
+ | zipArchiveIndex zipEntryIndex |
+
+
+ zipArchiveIndex := nativeContext at: 1.
+ zipEntryIndex := nativeContext at: 3.
+ zipEntryIndex = 0 ifFalse: [ ZipEntryCache at: zipEntryIndex put: nil ].
+
+ "Modified: / 01-05-2011 / 13:33:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_getCSize: aJavaContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'getCSize'>
+
+
+ | jzentry zmember |
+ jzentry := aJavaContext argAt: 1.
+ zmember := ZipEntryCache at: jzentry.
+
+ ^zmember compressedSize
+
+ "Created: / 30-04-2011 / 21:50:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_getEntry: nativeContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'getEntry'>
+
+ | zipArchive filename member |
+
+ zipArchive := ZipCache at: (nativeContext at: 1).
+ filename := Java as_ST_String: (nativeContext at: 3).
+ member := (zipArchive findMember: filename).
+ member isNil
+ ifTrue: [ ^ 0 ]
+ ifFalse: [ ^ ZipEntryCache indexOf: (ZipEntryCache add: member) ].
+
+ "Created: / 27-03-2011 / 16:59:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-04-2011 / 16:03:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-05-2011 / 15:12:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-08-2011 / 19:44:56 / jv"
+!
+
+_java_util_zip_ZipFile_getMethod: aJavaContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'getMethod'>
+
+
+ | jzentry zmember |
+ jzentry := aJavaContext argAt: 1.
+ zmember := ZipEntryCache at: jzentry.
+
+ ^zmember compressionMethod
+
+ "Created: / 30-04-2011 / 21:53:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_getSize: aJavaContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'getSize'>
+
+
+ | jzentry zmember |
+ jzentry := aJavaContext argAt: 1.
+ zmember := ZipEntryCache at: jzentry.
+
+ ^zmember uncompressedSize
+
+ "Created: / 30-04-2011 / 21:53:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_getTotal: nativeContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'getTotal'>
+
+ | zar |
+ zar := ZipCache at: (nativeContext at: 1).
+ ^ zar entries size.
+
+ "Modified: / 01-05-2011 / 13:31:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_initIDs: aJavaContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'initIDs'>
+
+
+ "Nothing to do"
+
+ "Created: / 23-03-2011 / 19:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_open: nativeContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'open'>
+
+ | path mode lastModTime result |
+
+ path := Java as_ST_String: (nativeContext at: 1).
+ mode := nativeContext at: 2.
+ lastModTime := nativeContext at: 3.
+ result := path asFilename.
+ result ifNil: [ JavaVM throwZipException ].
+ ^ ZipCache
+ indexOf: ( ZipCache add: (ZipArchive readingFrom: result readStream) ).
+
+ "Modified: / 01-04-2011 / 15:35:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 01-05-2011 / 13:29:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_java_util_zip_ZipFile_read: aJavaContext
+
+ <javanative: 'java/util/zip/ZipFile' name: 'read'>
+
+
+ | jzfile jzentry pos b off len zar zmember bytesToRead |
+ jzfile := aJavaContext argAt: 1.
+ jzentry := aJavaContext argAt: 3. "first arg is long!!!!!!"
+ pos := aJavaContext argAt: 5. "jzentry arg is long!!!!!!"
+ b := aJavaContext argAt: 7.
+ off := aJavaContext argAt: 8.
+ len := aJavaContext argAt: 9.
+
+ zar := ZipCache at: jzfile.
+ zmember := ZipEntryCache at: jzentry.
+
+ bytesToRead := len min: (zmember compressedSize - pos).
+
+ ^zar nextBytes: bytesToRead of: zmember startingAt: pos into: b startingAt: off + 1.
+
+ "Created: / 30-04-2011 / 22:15:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-05-2011 / 16:22:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM class methodsFor:'native - old-style'!
+
+_AccessController_beginPrivileged:nativeContext
+ "/ introduced with jdk1.2
+
+ "Created: / 27.1.1998 / 18:18:11 / cg"
+!
+
+_AccessController_endPrivileged:nativeContext
+ "/ introduced with jdk1.2
+
+ "Created: / 27.1.1998 / 18:18:32 / cg"
+!
+
+_AudioDevice_audioClose:nativeContext
+ |device fd stream|
+
+ device := nativeContext receiver.
+ device notNil ifTrue:[
+ fd := device instVarNamed:'dev'.
+ (fd notNil and:[fd > 0]) ifTrue:[
+ stream := self getOpenFileAt:fd.
+ stream notNil ifTrue:[
+ stream close.
+ device instVarNamed:'dev' put:0.
+ ]
+ ]
+ ]
+
+ "Created: / 10.1.1998 / 15:45:16 / cg"
+ "Modified: / 13.1.1998 / 18:08:20 / cg"
+!
+
+_AudioDevice_audioOpen:nativeContext
+ |f stream fileNo|
+
+ NoAudio ifTrue:[
+ Transcript showCR:'JAVA: audio disabled'.
+ ^ -1
+ ].
+
+ Stream streamErrorSignal handle:[:ex |
+ Stream streamErrorSignal handle:[:ex |
+ stream := nil.
+ ex return.
+ ] do:[
+ stream := SoundStream writing.
+ ].
+ ] do:[
+ stream := SoundStream writing.
+ stream notNil ifTrue:[
+ stream setSampleRate:8000.
+ ]
+ ].
+ stream isNil ifTrue:[
+"/ ^ -1.
+
+ f := '/dev/audio' asFilename.
+ f exists ifFalse:[
+ Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'.
+ ^ -1
+ ].
+ stream := f readWriteStream.
+ stream isNil ifTrue:[
+ Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'.
+ ^ -1
+ ].
+ fileNo := self addOpenFile:stream.
+ ].
+
+ fileNo := self addOpenFile:stream.
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR.
+ ].
+
+ ^ fileNo
+
+ "Created: / 10.1.1998 / 15:45:30 / cg"
+ "Modified: / 14.10.1998 / 15:20:52 / cg"
+!
+
+_AudioDevice_audioWrite:nativeContext
+ |device fd stream bytes count|
+
+ device := nativeContext receiver.
+ device notNil ifTrue:[
+ fd := device instVarNamed:'dev'.
+ (fd notNil and:[fd > 0]) ifTrue:[
+ stream := self getOpenFileAt:fd.
+ stream notNil ifTrue:[
+ bytes := nativeContext argAt:1.
+ count := nativeContext argAt:2.
+ stream nextPutBytes:count from:bytes startingAt:1
+ ]
+ ]
+ ]
+
+ "Created: / 10.1.1998 / 15:45:16 / cg"
+ "Modified: / 13.1.1998 / 18:07:20 / cg"
+!
+
+_BigInteger_plumbInit:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 19:23:00 / cg"
+!
+
+_CMM_cmmGetTagSize:nativeContext
+ "/ public static native synchronized int cmmGetTagSize (long arg1, int arg2, int[] arg3)
+ "/ new with jdk1.2 ...
+
+ UnimplementedNativeMethodSignal raiseRequest.
+ ^ -1.
+
+ "Created: / 27.1.1998 / 21:43:25 / cg"
+!
+
+_CMM_cmmInit:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 27.1.1998 / 21:43:25 / cg"
+!
+
+_CMM_cmmLoadProfile:nativeContext
+ "/ public static native synchronized int cmmLoadProfile (byte[] arg1, long[] arg2)
+ "/ new with jdk1.2 ...
+
+ UnimplementedNativeMethodSignal raiseRequest.
+ ^ -1.
+
+ "Created: / 27.1.1998 / 21:43:25 / cg"
+!
+
+_CRC32_update1:nativeContext
+ "/ void update1 (int)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+!
+
+_CRC32_update:nativeContext
+ "/ void update (byte[] int int)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:09:20 / cg"
+!
+
+_ClassLoader_createArrayClass:nativeContext
+ "java.lang.Class createArrayClass (java.lang.String java.lang.Class)"
+
+ "resolve a new class as previously created by defineClass0"
+
+ |jClassLoader name elCls|
+
+ jClassLoader := nativeContext receiver.
+ name := nativeContext argAt:1.
+ elCls := nativeContext argAt:2.
+ elCls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:36:01 / cg"
+ "Created: / 27.1.2000 / 02:56:37 / cg"
+!
+
+_ClassLoader_defineClass0:nativeContext
+ "create a new class from a given byteArray.
+ Here, construct a stream on it and pass the work to the
+ JavaClassReader."
+
+ |jClassLoader jName name data offset length inStream newClass
+ loaderStub jClass|
+
+ jClassLoader := nativeContext receiver.
+ jName := nativeContext argAt:1.
+
+ "/ className is now optional ...
+"/ jName isNil ifTrue:[
+"/ self internalError:'nil name in defineClass'.
+"/ ^ nil
+"/ ] ifFalse:[
+"/ name := Java as_ST_String:jName.
+"/ ].
+
+ data := nativeContext argAt:2.
+ offset := nativeContext argAt:3.
+ length := nativeContext argAt:4.
+
+ inStream := data readStream.
+ inStream position:offset + 1.
+ inStream readLimit:(offset + length).
+
+"/ loaderStub := Plug new.
+"/ loaderStub respondTo:#loadClass: with:[:clsName |
+"/ |jName|
+"/
+"/self halt.
+"/ jName := Java as_String:clsName.
+"/ "/ jClassLoader loadClass:jName
+"/ jClassLoader
+"/ perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
+"/ with:jName.
+"/ ].
+
+"/ ('JAVA [info]: defining class ...') infoPrintCR.
+
+"/ self internalError:'break'.
+
+ newClass := JavaClassReader
+ readStream:inStream
+ loader:jClassLoader "loaderStub"
+ loadUnresolved:false.
+
+ newClass isNil ifTrue:[
+ ('JAVA [info]: defineClass failed') infoPrintCR.
+ ^ nil.
+ ].
+"/ Transcript showCR:('defined class ' , newClass fullName , '.').
+ newClass classLoader:jClassLoader.
+
+"/ ('Java [info]: defined new class: ' , newClass fullName) infoPrintCR.
+
+ jClass := self javaClassObjectForClass:newClass.
+ ^ jClass
+
+ "Created: / 7.1.1998 / 12:35:10 / cg"
+ "Modified: / 24.1.1998 / 15:26:21 / cg"
+!
+
+_ClassLoader_findSystemClass0:nativeContext
+ |loader name class jClass|
+
+ loader := nativeContext receiver.
+ name := nativeContext argAt:1.
+ name := Java as_ST_String:name.
+
+ class := Java at:name.
+ class isNil ifTrue:[
+"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR.
+ loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[
+"/ Java classForName:name.
+"/ class := Java at:name.
+ class := JavaClassReader loadSystemClass:name.
+ ] ifFalse:[
+ "/ load using default (ST/X) loader
+ class := JavaClassReader loadSystemClass:name.
+"/ JavaClassReader classLoaderQuerySignal answer:nil do:[
+"/ Java classForName:name.
+"/ ]
+ ].
+ ].
+
+"/ JavaClassReader classLoaderQuerySignal answer:nil "loader"
+"/ do:[
+"/ class := Java classForName:name.
+"/ JavaClassReader postLoadActions:true.
+"/ ].
+
+ (class isNil
+ "or:[class classLoader notNil]") ifTrue:[
+"/ self halt:'class: ' , name , ' not found.'.
+"/ self internalError:'class: ' , name , ' not found.'.
+
+ self
+ throwExceptionClassName:'java.lang.ClassNotFoundException'
+ withMessage:('class: ' , name , ' not found.').
+ ^ nil
+ ].
+
+"/ 'JAVA: findSystemClass0 - loaded: ' infoPrint. class fullName infoPrintCR.
+ jClass := self javaClassObjectForClass:class.
+ ^ jClass
+
+ "Created: / 5.1.1998 / 02:53:04 / cg"
+ "Modified: / 20.10.1998 / 17:28:34 / cg"
+!
+
+_ClassLoader_findSystemClass:nativeContext
+ ^ self _ClassLoader_findSystemClass0:nativeContext
+
+ "Created: / 18.11.1998 / 00:00:14 / cg"
+!
+
+_ClassLoader_getSystemResource:nativeContext asStream0:returnAsStream
+ "common code for
+ getSystemResourceAsStream0
+ getSystemResourceAsName0"
+
+ |jString rString dir file text inStream url|
+
+ jString := nativeContext argAt:1.
+ rString := Java as_ST_String:jString.
+ Java effectiveClassPath keysAndValuesDo:[:classPathIndex :aPath |
+ |f zipFile zar data |
+
+ f := aPath asFilename.
+ ((zipFile := f withSuffix:'jar') exists
+ or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[
+ zar := ZipArchive oldFileNamed:zipFile.
+ (Array
+ with:rString
+ with:rString asLowercase
+ with:rString asUppercase)
+ do:[:tryName |
+ |entry|
+
+ entry := zar findMember:tryName.
+ entry notNil ifTrue:[
+ returnAsStream ifTrue:[
+ data := zar extract:tryName.
+ inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
+ inStream perform:#'<init>([B)V' with:data.
+ ^ inStream.
+ ].
+ url := 'systemResource:/ZIP' , (classPathIndex-1) printString , '/+/' , tryName.
+ ^ Java as_String:url.
+ ]
+ ]
+ ] ifFalse:[
+ f exists ifTrue:[
+ (file := f construct:rString) exists ifTrue:[
+ (Java isExcludedFromClassPath:file) ifFalse:[
+
+ "/ Copy data from returned buffer into Java byte array.
+
+"/ self halt.
+ returnAsStream ifTrue:[
+ text := file contents asString.
+ data := text asByteArray.
+
+ "/ Create input stream using byte array
+
+ inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
+ inStream perform:#'<init>([B)V' with:data.
+ ^ inStream.
+ ].
+ url := 'systemResource:/FILE/' , file pathName.
+self halt.
+ ^ Java as_String:url
+ ]
+ ]
+ ]
+ ]
+ ].
+ ^ nil
+
+ "Created: / 08-01-1998 / 16:06:56 / cg"
+ "Modified: / 26-12-1998 / 17:14:52 / cg"
+ "Modified: / 22-11-2010 / 13:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_ClassLoader_getSystemResourceAsName0:nativeContext
+ "/ java.lang.String getSystemResourceAsName0 (java.lang.String)
+
+ ^ self
+ _ClassLoader_getSystemResource:nativeContext
+ asStream0:false.
+!
+
+_ClassLoader_getSystemResourceAsStream0:nativeContext
+ "/ java.lang.InputStream getSystemResourceAsStream0 (java.lang.String)
+
+ ^ self
+ _ClassLoader_getSystemResource:nativeContext
+ asStream0:true.
+!
+
+_ClassLoader_init:nativeContext
+ ^ nil
+
+ "Created: / 5.1.1998 / 02:04:43 / cg"
+!
+
+_ClassLoader_initIDs:nativeContext
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:37:08 / cg"
+!
+
+_ClassLoader_resolveClass0:nativeContext
+ "resolve a new class as previously created by defineClass0"
+
+ |jClassLoader jCls cls loaderStub anyUnresolved|
+
+ jClassLoader := nativeContext receiver.
+ jCls := nativeContext argAt:1.
+ jCls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+ cls := self reflection javaClassObjectForClass:jCls.
+ cls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+ ('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR.
+ JavaClassReader classLoaderQuerySignal answer:jClassLoader
+ do:[
+ JavaClassReader resolveClass:cls.
+
+"/ JavaClassReader postLoadActions:true.
+
+ anyUnresolved := false.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ anyUnresolved := true.
+ ]
+ ]
+ ].
+ anyUnresolved ifTrue:[
+ jClassLoader notNil ifTrue:[
+ "/ any unresolved left -> try resolving with standard loader
+ JavaClassReader classLoaderQuerySignal answer:nil
+ do:[
+ JavaClassReader postLoadActions:true.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ ]
+ ]
+ ]
+ ].
+ ].
+
+ "Created: / 07-01-1998 / 13:12:27 / cg"
+ "Modified: / 20-10-1998 / 19:01:57 / cg"
+ "Modified: / 28-01-2011 / 15:28:18 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_ClassLoader_resolveClass:nativeContext
+ "void resolveClass (java.lang.Class)"
+
+ "resolve a new class as previously created by defineClass0"
+
+ |jClassLoader jCls cls loaderStub anyUnresolved|
+
+ jClassLoader := nativeContext receiver.
+ jCls := nativeContext argAt:1.
+ jCls isNil ifTrue:[
+ self halt.
+ ^ nil
+ ].
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:36:01 / cg"
+!
+
+_Class_forName:nativeContext
+ "get a java.lang.Class by name"
+
+ |jClassName className cls jClass s m c loader|
+
+ jClassName := nativeContext argAt:1.
+ className := Java as_ST_String:jClassName.
+
+ (s := nativeContext sender) notNil ifTrue:[
+ (s isJavaContext) ifTrue:[
+ c := s method javaClass.
+ loader := c classLoader.
+ loader isNil ifTrue:[
+"/ self halt.
+ ]
+ ]
+ ].
+
+ JavaClassReader classLoaderQuerySignal answer:loader
+ do:[
+ cls := Java classForName:className.
+ ].
+
+"/(className startsWith:'sun.awt') ifTrue:[self halt].
+"/('classForName: ' , className , ' -> ') print.
+"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR].
+
+ cls isNil ifTrue:[
+ ExceptionTrace ifTrue:[
+ ('throwing exception: no such class:' , className) infoPrintCR.
+ ].
+ ExceptionDebug ifTrue:[
+ self halt:'no such class:' , className.
+ ].
+ self throwClassNotFoundException:className.
+ "/ not proceedable
+ AbortSignal raise.
+ "/ not reached
+ ^ self
+ ].
+
+ ^ self javaClassObjectForClass:cls.
+
+ "Modified: / 30.12.1998 / 20:12:53 / cg"
+!
+
+_Class_getClassLoader:nativeContext
+ "get a classes loader"
+
+ |jClass cls loader|
+
+ jClass := nativeContext receiver.
+ cls := self reflection classForJavaClassObject:jClass.
+ loader := cls classLoader.
+ cls isNil ifTrue:[
+ loader := JavaClassReader classLoaderQuerySignal query.
+
+"/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR.
+ ].
+ ^ loader
+
+ "Created: / 05-01-1998 / 02:51:59 / cg"
+ "Modified: / 04-01-1999 / 17:50:15 / cg"
+ "Modified: / 28-01-2011 / 15:18:57 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_Class_getConstructor0:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:42 / cg"
+!
+
+_Class_getConstructors0:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:26 / cg"
+!
+
+_Class_getField0:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:37 / cg"
+!
+
+_Class_getFields0:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:18 / cg"
+!
+
+_Class_getMethod0:nativeContext
+ "get a method, given a name and type spec"
+
+ |jClass cls jmName mName mTypes whichAccess argSig sel|
+
+ jClass := nativeContext receiver.
+ cls := self reflection javaClassObjectForClass:jClass.
+ jmName := nativeContext argAt:1.
+ mName := Java as_ST_String:jmName.
+ mTypes := nativeContext argAt:2.
+ whichAccess := nativeContext argAt:3.
+ argSig := JavaMethod argSignatureFromArgTypeArray:mTypes.
+ cls methodDictionary
+ keysAndValuesDo:[:sel :mthd |
+ |i1 i2 jMethod retTypeClass argTypes|
+
+ JavaMethods notNil ifTrue:[
+ (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
+ ^ jMethod
+ ]
+ ].
+ mthd name printCR.
+ mName printCR.
+ mthd name = mName ifTrue:[
+ i1 := mthd signature indexOf:$(.
+ i2 := mthd signature indexOf:$) startingAt:(i1 + 1).
+ (mthd signature copyFrom:i1 + 1 to:i2 - 1) = argSig ifTrue:[
+ "/ found it - create a java.lang.reflect.Method for it.
+ jMethod := (Java at:'java.lang.reflect.Method') new.
+ jMethod instVarNamed:'clazz' put:jClass.
+ jMethod instVarNamed:'slot' put:sel.
+ jMethod instVarNamed:'name' put:jmName.
+ retTypeClass := mthd returnTypeClass.
+ retTypeClass isNil ifTrue:[
+ retTypeClass := #void
+ ].
+ argTypes := mthd argSignature.
+ argTypes := argTypes
+ collect:[:s |
+ |c|
+
+ c := Java at:s.
+ self javaClassObjectForClass:(c ? s asSymbol)
+ ].
+ jMethod instVarNamed:'returnType'
+ put:(self javaClassObjectForClass:retTypeClass).
+ jMethod instVarNamed:'parameterTypes' put:argTypes.
+ JavaMethods isNil ifTrue:[
+ JavaMethods := IdentityDictionary new
+ ].
+ JavaMethods at:jMethod put:mthd.
+ JavaMethods at:mthd put:jMethod.
+ ^ jMethod.
+ ].
+ ].
+ ].
+ self halt.
+ self throwExceptionClassName:'java.lang.NoSuchMethodException'
+ withMessage:'not yet implemented'.
+ ^ nil.
+
+ "Modified: / 22-10-1998 / 01:54:38 / cg"
+ "Modified: / 28-01-2011 / 14:36:26 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_Class_getMethods0:nativeContext
+ "get a method, given a name and type spec"
+
+ |jClass cls jmName mTypes whichAccess argSig sel methods|
+
+ jClass := nativeContext receiver.
+ cls := self reflection javaClassObjectForClass:jClass.
+
+ "/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here
+
+ whichAccess := nativeContext argAt:1.
+ methods := OrderedCollection new.
+ [cls isJavaClass] whileTrue:[
+ cls methodDictionary
+ keysAndValuesDo:[:sel :mthd |
+ |i1 i2 jMethod argTypes retTypeClass|
+
+ mthd name printCR.
+ i1 := mthd signature indexOf:$(.
+ i2 := mthd signature indexOf:$) startingAt:(i1 + 1).
+
+ "/ create a java.lang.reflect.Method for it.
+
+ jMethod := (Java at:'java.lang.reflect.Method') new.
+ jMethod instVarNamed:'clazz' put:jClass.
+ jMethod instVarNamed:'slot' put:sel.
+ jMethod instVarNamed:'name' put:(Java as_String:mthd name).
+ retTypeClass := mthd returnTypeClass.
+ retTypeClass isNil ifTrue:[
+ retTypeClass := #void
+ ].
+ argTypes := mthd argSignature.
+ argTypes := argTypes
+ collect:[:s |
+ |c|
+
+ c := Java at:s.
+ self javaClassObjectForClass:(c ? s asSymbol)
+ ].
+ jMethod instVarNamed:'returnType'
+ put:(self javaClassObjectForClass:retTypeClass).
+ jMethod instVarNamed:'parameterTypes' put:argTypes.
+
+"/ (mthd name includesString:'setName') ifTrue:[self halt].
+
+ JavaMethods isNil ifTrue:[
+ JavaMethods := IdentityDictionary new
+ ].
+ JavaMethods at:jMethod put:mthd.
+ JavaMethods at:mthd put:jMethod.
+ methods add:jMethod.
+ ].
+ whichAccess == 1 ifTrue:[
+ "/ local methods only
+ cls := nil
+ ] ifFalse:[
+ cls := cls superclass.
+ ]
+ ].
+ methods := methods asArray.
+ ^ methods.
+
+ "Modified: / 22-10-1998 / 01:53:58 / cg"
+ "Modified: / 28-01-2011 / 14:36:58 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_Class_getName:nativeContext
+ "get a classes name"
+
+ |jClass cls nm|
+
+ jClass := nativeContext receiver.
+ cls := self reflection javaClassObjectForClass:jClass.
+ cls isNil ifTrue:[
+ self halt.
+ ].
+ cls isJavaClass ifTrue:[
+ nm := (cls fullName copyReplaceAll:$/ with:$.)
+ ] ifFalse:[
+ cls isSymbol ifTrue:[
+ nm := cls
+ ] ifFalse:[
+ nm := cls name
+ ]
+ ].
+ ^ Java as_String:nm.
+
+ "Modified: / 30-12-1998 / 21:13:50 / cg"
+ "Modified: / 28-01-2011 / 15:30:34 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_Class_getSigners:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:01 / cg"
+!
+
+_Class_newInstance:nativeContext
+ "get an instance for a java.lang.Class"
+
+ |jClass cls newInst|
+
+ jClass := nativeContext receiver.
+ cls := self reflection javaClassObjectForClass:jClass.
+ cls classInit.
+ newInst := cls newCleared.
+ newInst perform:#'<init>()V'.
+ ^ newInst
+
+ "Created: / 02-01-1998 / 22:41:38 / cg"
+ "Modified: / 15-01-1998 / 00:57:37 / cg"
+ "Modified: / 28-01-2011 / 14:12:25 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_Class_setSigners:nativeContext
+ UnimplementedNativeMethodSignal raiseRequest
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:55:08 / cg"
+!
_ColorModel_deletepData:nativeContext
"/ void deletepData ()
UnimplementedNativeMethodSignal raiseRequest
"Created: / 12.11.1998 / 19:22:05 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.beans - ms'!
-
-_Introspector_getMethodDescriptor:nativeContext
- "java.lang.String getMethodDescriptor (java.lang.reflect.Method)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:47:43 / cg"
-!
-
-_Introspector_getMethodParameterCount:nativeContext
- "int getMethodParameterCount (java.lang.reflect.Method)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:49:15 / cg"
-!
-
-_Introspector_getPublicDeclaredMethods0:nativeContext
- "java.lang.reflect.Method[] getPublicDeclaredMethods0 (java.lang.Class)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:48:49 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.io'!
+!
+
+_ColorModel_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:19:23 / cg"
+!
+
+_Color_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:19:23 / cg"
+!
+
+_Constructor_getModifiers:nativeContext
+ "/ int getModifiers ()
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 02:54:38 / cg"
+!
+
+_Constructor_newInstance:nativeContext
+ "/ java.lang.Object newInstance (java.lang.Object[])
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+!
+
+_Double_doubleToLongBits:nativeContext
+ |f i|
+
+ f := nativeContext argAt:1.
+
+ UninterpretedBytes isBigEndian ifTrue:[
+ i := f basicAt:8.
+ i := i bitOr:((f basicAt:7) bitShift:8).
+ i := i bitOr:((f basicAt:6) bitShift:16).
+ i := i bitOr:((f basicAt:5) bitShift:24).
+ i := i bitOr:((f basicAt:4) bitShift:32).
+ i := i bitOr:((f basicAt:3) bitShift:40).
+ i := i bitOr:((f basicAt:2) bitShift:48).
+ i := i bitOr:((f basicAt:1) bitShift:56).
+ ] ifFalse:[
+ i := f basicAt:1.
+ i := i bitOr:((f basicAt:2) bitShift:8).
+ i := i bitOr:((f basicAt:3) bitShift:16).
+ i := i bitOr:((f basicAt:4) bitShift:24).
+ i := i bitOr:((f basicAt:5) bitShift:32).
+ i := i bitOr:((f basicAt:6) bitShift:40).
+ i := i bitOr:((f basicAt:7) bitShift:48).
+ i := i bitOr:((f basicAt:8) bitShift:56).
+ ].
+
+ ^ i.
+
+ "Created: / 4.1.1998 / 01:39:12 / cg"
+!
+
+_Double_valueOf0:nativeContext
+ |s d|
+
+ s := nativeContext argAt:1.
+ s notNil ifTrue:[
+ s := Java as_ST_String:s.
+ d := Float readFrom:s onError:nil.
+ ].
+ d isNil ifTrue:[
+ self throwNumberFormatException.
+ "/ not reached
+ ].
+
+ ^ d
+
+ "Modified: / 8.8.1997 / 12:03:55 / cg"
+ "Created: / 7.1.1998 / 11:09:43 / cg"
+!
+
+_Field_get:nativeContext
+ "/ java.lang.Object get (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:04:18 / cg"
+!
+
+_Field_getBoolean:nativeContext
+ "/ boolean getBoolean (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:05:16 / cg"
+!
+
+_Field_getByte:nativeContext
+ "/ byte getByte (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:05:30 / cg"
+!
+
+_Field_getChar:nativeContext
+ "/ char getChar (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:03:37 / cg"
+!
+
+_Field_getDouble:nativeContext
+ "/ double getDouble (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:07:49 / cg"
+!
+
+_Field_getFloat:nativeContext
+ "/ float getFloat (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:05:41 / cg"
+!
+
+_Field_getInt:nativeContext
+ "/ int getInt (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:04:47 / cg"
+!
+
+_Field_getLong:nativeContext
+ "/ long getLong (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:05:54 / cg"
+!
+
+_Field_getModifiers:nativeContext
+ "/ int getModifiers ()
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:07:03 / cg"
+!
+
+_Field_getShort:nativeContext
+ "/ unsigned short getShort (java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:07:35 / cg"
+!
+
+_Field_set:nativeContext
+ "/ void set (java.lang.Object java.lang.Object)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:04:33 / cg"
+!
+
+_Field_setBoolean:nativeContext
+ "/ void setBoolean (java.lang.Object boolean)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:06:06 / cg"
+!
+
+_Field_setByte:nativeContext
+ "/ void setByte (java.lang.Object byte)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:06:20 / cg"
+!
+
+_Field_setChar:nativeContext
+ "/ void setChar (java.lang.Object char)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:03:48 / cg"
+!
+
+_Field_setDouble:nativeContext
+ "/ void setDouble (java.lang.Object double)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:04:02 / cg"
+!
+
+_Field_setFloat:nativeContext
+ "/ void setFloat (java.lang.Object float)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:06:48 / cg"
+!
+
+_Field_setInt:nativeContext
+ "/ void setInt (java.lang.Object int)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:05:04 / cg"
+!
+
+_Field_setLong:nativeContext
+ "/ void setLong (java.lang.Object long)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:06:37 / cg"
+!
+
+_Field_setShort:nativeContext
+ "/ void setShort (java.lang.Object unsigned short)
+
+UnimplementedNativeMethodSignal raiseRequest.
+
+ "Modified: / 27.1.2000 / 02:53:55 / cg"
+ "Created: / 27.1.2000 / 03:03:23 / cg"
+!
_FileDescriptor_initSystemFD:nativeContext
|descriptor fileNo idx myStream|
@@ -3259,14 +7723,6 @@
"Modified: / 27.1.1998 / 18:15:28 / cg"
!
-_FileDescriptor_sync:nativeContext
- "/ void sync ()
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:57:39 / cg"
- "Created: / 12.11.1998 / 19:26:25 / cg"
-!
-
_FileDescriptor_valid:nativeContext
"/ boolean valid ()
|descriptor fileNo stream|
@@ -3282,32 +7738,6 @@
"Modified: / 11.12.1998 / 13:02:47 / cg"
!
-_FileInputStream_available:nativeContext
- |file|
-
- file := self validateFile:(nativeContext receiver).
- file isNil ifTrue:[
- self throwIOExceptionWithMessage:'invalid fileNo in available'.
- ^ self
- ].
- file == Stdin ifTrue:[
- file := StdinReplacementFileQuerySignal raiseRequest.
- file isNil ifTrue:[
- ^ 1
- ]
- ].
- file isFileStream ifTrue:[
- ^ file size - file position + 1
- ].
- file atEnd ifTrue:[
- ^ 0.
- ].
- self halt.
- ^ 1
-
- "Modified: / 14.1.1998 / 15:12:52 / cg"
-!
-
_FileInputStream_close:nativeContext
^ self anyStream_close:nativeContext
@@ -3315,60 +7745,6 @@
"Modified: / 4.2.1998 / 15:20:46 / cg"
!
-_FileInputStream_open:nativeContext
- |fs fd fn name stream fileNo|
-
- fs := nativeContext receiver.
- fd := fs instVarNamed:'fd'.
- (fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[
- fileNo ~~ -1 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
- ]
- ].
-
- name := nativeContext argAt:1.
- name := Java as_ST_String:name.
-
- name := self fixFilename:name.
-
- FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
- ].
-
- stream := self fileStreamForReading:name.
- stream isNil ifTrue:[
- FileOpenTrace ifTrue:[
- ('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR.
- ].
-
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading').
-
- ^ self.
- ].
- stream buffered:false.
-
-"/ FileOpenConfirmation ifTrue:[
-"/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs)
-"/ ifFalse:[
-"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading').
-"/ ^ self
-"/ ]
-"/ ].
-
- fileNo := self addOpenFile:stream.
-
- FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR.
- ].
-
- fd instVarNamed:'fd' put:fileNo.
-
- "Created: / 4.1.1998 / 16:47:12 / cg"
- "Modified: / 28.1.1999 / 17:24:07 / cg"
-!
-
_FileInputStream_read:nativeContext
|file byte|
@@ -3395,12 +7771,6 @@
"Modified: / 5.1.1998 / 02:17:25 / cg"
!
-_FileInputStream_readBytes:nativeContext
- ^ self anyStream_readBytes:nativeContext
-
- "Modified: / 4.2.1998 / 15:23:08 / cg"
-!
-
_FileInputStream_skip:nativeContext
"/ long skip (long)
|file nSkip nSkipped|
@@ -3432,51 +7802,6 @@
"Modified: / 4.2.1998 / 15:20:53 / cg"
!
-_FileOutputStream_open:nativeContext
- ^ self commonOpen:nativeContext forAppend:false
-
- "Modified: / 7.4.1998 / 19:14:31 / cg"
-!
-
-_FileOutputStream_openAppend:nativeContext
- ^ self commonOpen:nativeContext forAppend:true
-
- "Modified: / 7.4.1998 / 19:13:42 / cg"
-!
-
-_FileOutputStream_write:nativeContext
- |byte file|
-
- byte := nativeContext argAt:1.
-
- file := self validateFile:(nativeContext receiver).
-
- FileIOTrace ifTrue:[
- file isFileStream ifTrue:[
- ('JAVA: write 1 byte to ' , file pathName) infoPrintCR.
- ] ifFalse:[
- file ~~ Stdout ifTrue:[
- file ~~ Stderr ifTrue:[
- ('JAVA: write 1 byte to ' , file displayString) infoPrintCR.
- ]
- ]
- ]
- ].
-
- "/ should always be bytes
-
- file nextPutByte:byte
-
- "Created: / 13.1.1998 / 09:32:13 / cg"
- "Modified: / 13.1.1998 / 09:32:31 / cg"
-!
-
-_FileOutputStream_writeBytes:nativeContext
- ^ self anyStream_writeBytes:nativeContext
-
- "Modified: / 4.2.1998 / 15:24:20 / cg"
-!
-
_File_canRead0:nativeContext
|file path f|
@@ -3521,6 +7846,23 @@
"Modified: / 27.1.1999 / 18:57:52 / cg"
!
+_File_canonPath:nativeContext
+ "/ introduced with jdk1.2 ... (sigh)
+
+ |jPath path realPath|
+
+ jPath := nativeContext argAt:1.
+ jPath isNil ifTrue:[^ jPath].
+
+ path := Java as_ST_String:jPath.
+ realPath := path asFilename pathName.
+
+ ^ Java as_String:realPath
+
+ "Created: / 27.1.1998 / 18:35:58 / cg"
+ "Modified: / 27.1.1998 / 21:36:03 / cg"
+!
+
_File_delete0:nativeContext
"/ boolean delete0 ()
|oldFile oldPath oldF|
@@ -3573,6 +7915,12 @@
"Modified: / 27.1.1999 / 18:57:46 / cg"
!
+_File_initIDs:nativeContext
+ "/ introduced with jdk1.2 ... (sigh)
+
+ "Created: / 27.1.1998 / 18:25:19 / cg"
+!
+
_File_isAbsolute:nativeContext
|file path f|
@@ -3777,1167 +8125,6 @@
"Created: / 12.11.1998 / 19:03:52 / cg"
!
-_ObjectInputStream_allocateNewArray:nativeContext
- "/ java.lang.Object allocateNewArray (java.lang.Class int)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:02:52 / cg"
-!
-
-_ObjectInputStream_allocateNewObject:nativeContext
- "/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:02:40 / cg"
-!
-
-_ObjectInputStream_inputClassFields:nativeContext
- "/ void inputClassFields (java.lang.Object java.lang.Class int[])
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:02:22 / cg"
-!
-
-_ObjectInputStream_invokeObjectReader:nativeContext
- "/ boolean invokeObjectReader (java.lang.Object java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:03:06 / cg"
-!
-
-_ObjectInputStream_loadClass0:nativeContext
- "/ java.lang.Class loadClass0 (java.lang.Class java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:01:15 / cg"
- "Modified: / 12.11.1998 / 19:01:48 / cg"
-!
-
-_ObjectOutputStream_invokeObjectWriter:nativeContext
- "/ boolean invokeObjectWriter (java.lang.Object java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:00:36 / cg"
- "Modified: / 12.11.1998 / 19:01:45 / cg"
-!
-
-_ObjectOutputStream_outputClassFields:nativeContext
- "/ void outputClassFields (java.lang.Object java.lang.Class int[])
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:00:09 / cg"
- "Modified: / 12.11.1998 / 19:01:42 / cg"
-!
-
-_ObjectStreamClass_getClassAccess:nativeContext
- "/ int getClassAccess (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:04:19 / cg"
-!
-
-_ObjectStreamClass_getFieldAccess:nativeContext
- "/ int getFieldAccess (java.lang.Class java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:05:19 / cg"
-!
-
-_ObjectStreamClass_getFieldSignatures:nativeContext
- "/ java.lang.String[] getFieldSignatures (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:05:04 / cg"
-!
-
-_ObjectStreamClass_getFields0:nativeContext
- "/ java.io.ObjectStreamField[] getFields0 (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:05:32 / cg"
-!
-
-_ObjectStreamClass_getMethodAccess:nativeContext
- "/ int getMethodAccess (java.lang.Class java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:04:51 / cg"
-!
-
-_ObjectStreamClass_getMethodSignatures:nativeContext
- "/ java.lang.String[] getMethodSignatures (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:04:34 / cg"
-!
-
-_ObjectStreamClass_getSerialVersionUID:nativeContext
- "/ long getSerialVersionUID (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:05:43 / cg"
-!
-
-_ObjectStreamClass_hasWriteObject:nativeContext
- "/ boolean hasWriteObject (java.lang.Class)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 19:01:48 / cg"
- "Created: / 12.11.1998 / 19:05:53 / cg"
-!
-
-_RandomAccessFile_close:nativeContext
- ^ self anyStream_close:nativeContext
-
- "Created: / 4.2.1998 / 13:26:53 / cg"
- "Modified: / 4.2.1998 / 15:21:08 / cg"
-!
-
-_RandomAccessFile_length:nativeContext
- |file sz|
-
- file := self validateFile:(nativeContext receiver).
-
- FileIOTrace ifTrue:[
- ('JAVA: length of ' , file pathName) infoPrintCR.
- ].
-
- sz := file size.
- ^ sz.
-
- "Created: / 4.2.1998 / 13:27:58 / cg"
-!
-
-_RandomAccessFile_open:nativeContext
- |fs fd name dir stream fileNo answer readonly|
-
- readonly := false.
-
- fs := nativeContext receiver.
- fd := fs instVarNamed:'fd'.
- (fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
- ].
-
- name := nativeContext argAt:1.
- name := Java as_ST_String:name.
- name := self fixFilename:name.
-
- FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
- ].
-
- dir := name asFilename directory pathName.
-
- (PermittedDirectories notNil
- and:[PermittedDirectories includes:dir]) ifFalse:[
- FileOpenConfirmation ifTrue:[
- answer := Dialog
- confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
- labels:#('no' 'grant' 'readonly')
- values:#(false true #readonly)
- default:3.
- answer == false ifTrue:[
- self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
- ^ self
- ].
- readonly := (answer == #readonly).
-
- readonly ifFalse:[
- (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
- ifTrue:[
- PermittedDirectories isNil ifTrue:[
- PermittedDirectories := Set new
- ].
- PermittedDirectories add:dir.
- ]
- ]
- ]
- ].
-
- readonly ifTrue:[
- stream := name asFilename readStream.
- ] ifFalse:[
- stream := name asFilename readWriteStream.
- ].
- stream isNil ifTrue:[
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
- ].
-
- fileNo := self addOpenFile:stream.
-
- FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
- ].
-
- fd instVarNamed:'fd' put:fileNo.
-
- "Created: / 4.2.1998 / 00:14:48 / cg"
- "Modified: / 12.11.1998 / 21:29:46 / cg"
-!
-
-_RandomAccessFile_read:nativeContext
- |file byte|
-
- file := self validateFile:(nativeContext receiver).
-
- FileIOTrace ifTrue:[
- ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
- ].
-
- byte := file nextByte.
- byte isNil ifTrue:[
- ^ -1
- ].
- ^ byte
-
- "Modified: / 5.1.1998 / 02:17:25 / cg"
- "Created: / 27.1.1999 / 19:01:15 / cg"
-!
-
-_RandomAccessFile_readBytes:nativeContext
- ^ self anyStream_readBytes:nativeContext
-
- "Modified: / 4.2.1998 / 15:23:27 / cg"
-!
-
-_RandomAccessFile_seek:nativeContext
- |file pos|
-
- file := self validateFile:(nativeContext receiver).
-
- FileIOTrace ifTrue:[
- ('JAVA: seek on ' , file pathName) infoPrintCR.
- ].
-
- pos := nativeContext argAt:1.
- file position:pos+1 "/ ST/X position starts at 1
-
- "Created: / 4.2.1998 / 13:25:38 / cg"
- "Modified: / 4.2.1998 / 13:28:12 / cg"
-!
-
-_RandomAccessFile_writeBytes:nativeContext
- ^ self anyStream_writeBytes:nativeContext
-
- "Modified: / 4.2.1998 / 15:24:20 / cg"
- "Created: / 4.2.1998 / 15:24:35 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.io - jdk1.2'!
-
-_FileDescriptor_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:16:29 / cg"
-!
-
-_FileInputStream_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:15:51 / cg"
-!
-
-_FileOutputStream_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:16:40 / cg"
-!
-
-_File_canonPath:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- |jPath path realPath|
-
- jPath := nativeContext argAt:1.
- jPath isNil ifTrue:[^ jPath].
-
- path := Java as_ST_String:jPath.
- realPath := path asFilename pathName.
-
- ^ Java as_String:realPath
-
- "Created: / 27.1.1998 / 18:35:58 / cg"
- "Modified: / 27.1.1998 / 21:36:03 / cg"
-!
-
-_File_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:25:19 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.io - ms'!
-
-_ObjectInputStream_invokeDefaultReadObject:nativeContext
- "/ void invokeDefaultReadObject (java.lang.Object java.lang.Class)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 03:00:47 / cg"
-!
-
-_ObjectInputStream_invokeReadObject:nativeContext
- "/ void invokeReadObject (java.lang.Object java.lang.Class)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 03:01:02 / cg"
-!
-
-_ObjectOutputStream_invokeDefaultWriteObject:nativeContext
- "/ void invokeDefaultWriteObject (java.lang.Object java.lang.Class)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 03:01:36 / cg"
-!
-
-_ObjectOutputStream_invokeWriteObject:nativeContext
- "/ void invokeWriteObject (java.lang.Object java.lang.Class)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 03:01:52 / cg"
-!
-
-_ObjectStreamClass_doMismatchedRead:nativeContext
- "/ void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 02:50:55 / cg"
-!
-
-_ObjectStreamClass_findObjectMethod0:nativeContext
- "/ boolean findObjectMethod0 (java.lang.Class int)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 02:51:50 / cg"
-!
-
-_ObjectStreamClass_getClassDefinedUID:nativeContext
- "/ long getClassDefinedUID (java.lang.Class)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 02:51:33 / cg"
-!
-
-_PrintStream_isOutputStreamLocalised:nativeContext
- "/ boolean isOutputStreamLocalised (java.io.DataOutputStream)
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.2000 / 03:00:20 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.lang'!
-
-_ClassLoader_defineClass0:nativeContext
- "create a new class from a given byteArray.
- Here, construct a stream on it and pass the work to the
- JavaClassReader."
-
- |jClassLoader jName name data offset length inStream newClass
- loaderStub jClass|
-
- jClassLoader := nativeContext receiver.
- jName := nativeContext argAt:1.
-
- "/ className is now optional ...
-"/ jName isNil ifTrue:[
-"/ self internalError:'nil name in defineClass'.
-"/ ^ nil
-"/ ] ifFalse:[
-"/ name := Java as_ST_String:jName.
-"/ ].
-
- data := nativeContext argAt:2.
- offset := nativeContext argAt:3.
- length := nativeContext argAt:4.
-
- inStream := data readStream.
- inStream position:offset + 1.
- inStream readLimit:(offset + length).
-
-"/ loaderStub := Plug new.
-"/ loaderStub respondTo:#loadClass: with:[:clsName |
-"/ |jName|
-"/
-"/self halt.
-"/ jName := Java as_String:clsName.
-"/ "/ jClassLoader loadClass:jName
-"/ jClassLoader
-"/ perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
-"/ with:jName.
-"/ ].
-
-"/ ('JAVA [info]: defining class ...') infoPrintCR.
-
-"/ self internalError:'break'.
-
- newClass := JavaClassReader
- readStream:inStream
- loader:jClassLoader "loaderStub"
- loadUnresolved:false.
-
- newClass isNil ifTrue:[
- ('JAVA [info]: defineClass failed') infoPrintCR.
- ^ nil.
- ].
-"/ Transcript showCR:('defined class ' , newClass fullName , '.').
- newClass classLoader:jClassLoader.
-
-"/ ('Java [info]: defined new class: ' , newClass fullName) infoPrintCR.
-
- jClass := self javaClassObjectForClass:newClass.
- ^ jClass
-
- "Created: / 7.1.1998 / 12:35:10 / cg"
- "Modified: / 24.1.1998 / 15:26:21 / cg"
-!
-
-_ClassLoader_findSystemClass0:nativeContext
- |loader name class jClass|
-
- loader := nativeContext receiver.
- name := nativeContext argAt:1.
- name := Java as_ST_String:name.
-
- class := Java at:name.
- class isNil ifTrue:[
-"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR.
- loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[
-"/ Java classForName:name.
-"/ class := Java at:name.
- class := JavaClassReader loadSystemClass:name.
- ] ifFalse:[
- "/ load using default (ST/X) loader
- class := JavaClassReader loadSystemClass:name.
-"/ JavaClassReader classLoaderQuerySignal answer:nil do:[
-"/ Java classForName:name.
-"/ ]
- ].
- ].
-
-"/ JavaClassReader classLoaderQuerySignal answer:nil "loader"
-"/ do:[
-"/ class := Java classForName:name.
-"/ JavaClassReader postLoadActions:true.
-"/ ].
-
- (class isNil
- "or:[class classLoader notNil]") ifTrue:[
-"/ self halt:'class: ' , name , ' not found.'.
-"/ self internalError:'class: ' , name , ' not found.'.
-
- self
- throwExceptionClassName:'java.lang.ClassNotFoundException'
- withMessage:('class: ' , name , ' not found.').
- ^ nil
- ].
-
-"/ 'JAVA: findSystemClass0 - loaded: ' infoPrint. class fullName infoPrintCR.
- jClass := self javaClassObjectForClass:class.
- ^ jClass
-
- "Created: / 5.1.1998 / 02:53:04 / cg"
- "Modified: / 20.10.1998 / 17:28:34 / cg"
-!
-
-_ClassLoader_getSystemResource:nativeContext asStream0:returnAsStream
- "common code for
- getSystemResourceAsStream0
- getSystemResourceAsName0"
-
- |jString rString dir file text inStream url|
-
- jString := nativeContext argAt:1.
- rString := Java as_ST_String:jString.
- Java classPath keysAndValuesDo:[:classPathIndex :aPath |
- |f zipFile zar data |
-
- f := aPath asFilename.
- ((zipFile := f withSuffix:'jar') exists
- or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[
- zar := ZipArchive oldFileNamed:zipFile.
- (Array
- with:rString
- with:rString asLowercase
- with:rString asUppercase)
- do:[:tryName |
- |entry|
-
- entry := zar findMember:tryName.
- entry notNil ifTrue:[
- returnAsStream ifTrue:[
- data := zar extract:tryName.
- inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
- inStream perform:#'<init>([B)V' with:data.
- ^ inStream.
- ].
- url := 'systemResource:/ZIP' , (classPathIndex-1) printString , '/+/' , tryName.
- ^ Java as_String:url.
- ]
- ]
- ] ifFalse:[
- f exists ifTrue:[
- (file := f construct:rString) exists ifTrue:[
- (Java isExcludedFromClassPath:file) ifFalse:[
-
- "/ Copy data from returned buffer into Java byte array.
-
-"/ self halt.
- returnAsStream ifTrue:[
- text := file contents asString.
- data := text asByteArray.
-
- "/ Create input stream using byte array
-
- inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
- inStream perform:#'<init>([B)V' with:data.
- ^ inStream.
- ].
- url := 'systemResource:/FILE/' , file pathName.
-self halt.
- ^ Java as_String:url
- ]
- ]
- ]
- ]
- ].
- ^ nil
-
- "Created: / 8.1.1998 / 16:06:56 / cg"
- "Modified: / 26.12.1998 / 17:14:52 / cg"
-!
-
-_ClassLoader_getSystemResourceAsName0:nativeContext
- "/ java.lang.String getSystemResourceAsName0 (java.lang.String)
-
- ^ self
- _ClassLoader_getSystemResource:nativeContext
- asStream0:false.
-!
-
-_ClassLoader_getSystemResourceAsStream0:nativeContext
- "/ java.lang.InputStream getSystemResourceAsStream0 (java.lang.String)
-
- ^ self
- _ClassLoader_getSystemResource:nativeContext
- asStream0:true.
-!
-
-_ClassLoader_init:nativeContext
- ^ nil
-
- "Created: / 5.1.1998 / 02:04:43 / cg"
-!
-
-_ClassLoader_resolveClass0:nativeContext
- "resolve a new class as previously created by defineClass0"
-
- |jClassLoader jCls cls loaderStub anyUnresolved|
-
- jClassLoader := nativeContext receiver.
- jCls := nativeContext argAt:1.
- jCls isNil ifTrue:[
- self halt.
- ^ nil
- ].
- cls := JavaClasses at:jCls ifAbsent:nil.
- cls isNil ifTrue:[
- self halt.
- ^ nil
- ].
- ('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR.
-
- JavaClassReader classLoaderQuerySignal answer:jClassLoader
- do:[
- JavaClassReader resolveClass:cls.
-"/ JavaClassReader postLoadActions:true.
- anyUnresolved := false.
- cls constantPool do:[:entry |
- (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- self halt:'debugHalt'.
- entry preResolve.
- self halt:'debugHalt'.
- anyUnresolved := true.
- ]
- ]
- ].
-anyUnresolved ifTrue:[
- jClassLoader notNil ifTrue:[
- "/ any unresolved left -> try resolving with standard loader
- JavaClassReader classLoaderQuerySignal answer:nil
- do:[
- JavaClassReader postLoadActions:true.
- cls constantPool do:[:entry |
- (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- self halt:'debugHalt'.
- entry preResolve.
- self halt:'debugHalt'.
- ]
- ]
- ]
- ].
-].
-
- "Created: / 7.1.1998 / 13:12:27 / cg"
- "Modified: / 20.10.1998 / 19:01:57 / cg"
-!
-
-_Class_forName:nativeContext
- "get a java.lang.Class by name"
-
- |jClassName className cls jClass s m c loader|
-
- jClassName := nativeContext argAt:1.
- className := Java as_ST_String:jClassName.
-
- (s := nativeContext sender) notNil ifTrue:[
- (s isJavaContext) ifTrue:[
- c := s method javaClass.
- loader := c classLoader.
- loader isNil ifTrue:[
-"/ self halt.
- ]
- ]
- ].
-
- JavaClassReader classLoaderQuerySignal answer:loader
- do:[
- cls := Java classForName:className.
- ].
-
-"/(className startsWith:'sun.awt') ifTrue:[self halt].
-"/('classForName: ' , className , ' -> ') print.
-"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR].
-
- cls isNil ifTrue:[
- ExceptionTrace ifTrue:[
- ('throwing exception: no such class:' , className) infoPrintCR.
- ].
- ExceptionDebug ifTrue:[
- self halt:'no such class:' , className.
- ].
- self throwClassNotFoundException:className.
- "/ not proceedable
- AbortSignal raise.
- "/ not reached
- ^ self
- ].
-
- ^ self javaClassObjectForClass:cls.
-
- "Modified: / 30.12.1998 / 20:12:53 / cg"
-!
-
-_Class_getClassLoader:nativeContext
- "get a classes loader"
-
- |jClass cls loader|
-
- jClass := nativeContext receiver.
- cls := self classForJavaClassObject:jClass.
- loader := cls classLoader.
- cls isNil ifTrue:[
- loader := JavaClassReader classLoaderQuerySignal query.
-"/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR.
- ].
-
- ^ loader
-
- "Created: / 5.1.1998 / 02:51:59 / cg"
- "Modified: / 4.1.1999 / 17:50:15 / cg"
-!
-
-_Class_getComponentType:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:54:46 / cg"
-!
-
-_Class_getConstructor0:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:42 / cg"
-!
-
-_Class_getConstructors0:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:26 / cg"
-!
-
-_Class_getField0:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:37 / cg"
-!
-
-_Class_getFields0:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:18 / cg"
-!
-
-_Class_getInterfaces:nativeContext
- |jClass cls interfaces|
-
- jClass := nativeContext receiver.
- cls := self classForJavaClassObject:jClass.
-
- interfaces := cls interfaces collect:[:if | self javaClassObjectForClass:if].
- ^ interfaces asArray
-!
-
-_Class_getMethod0:nativeContext
- "get a method, given a name and type spec"
-
- |jClass cls jmName mName mTypes whichAccess argSig sel|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
-
- jmName := nativeContext argAt:1.
- mName := Java as_ST_String:jmName.
- mTypes := nativeContext argAt:2.
- whichAccess := nativeContext argAt:3.
-
- argSig := JavaMethod argSignatureFromArgTypeArray:mTypes.
- cls methodDictionary keysAndValuesDo:[:sel :mthd |
- |i1 i2 jMethod retTypeClass argTypes|
-
- JavaMethods notNil ifTrue:[
- (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
- ^ jMethod
- ]
- ].
-
- mthd name printCR.
- mName printCR.
-
- mthd name = mName ifTrue:[
- i1 := mthd signature indexOf:$(.
- i2 := mthd signature indexOf:$) startingAt:(i1+1).
-
- (mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[
- "/ found it - create a java.lang.reflect.Method for it.
- jMethod := (Java at:'java.lang.reflect.Method') new.
- jMethod instVarNamed:'clazz' put:jClass.
- jMethod instVarNamed:'slot' put:sel.
- jMethod instVarNamed:'name' put:jmName.
- retTypeClass := mthd returnTypeClass.
- retTypeClass isNil ifTrue:[
- retTypeClass := #void
- ].
- argTypes := mthd argSignature.
- argTypes := argTypes collect:[:s |
- |c|
-
- c := Java at:s.
- self javaClassObjectForClass:(c ? s asSymbol)
- ].
-
- jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
- jMethod instVarNamed:'parameterTypes' put:argTypes.
-
- JavaMethods isNil ifTrue:[
- JavaMethods := IdentityDictionary new
- ].
- JavaMethods at:jMethod put:mthd.
- JavaMethods at:mthd put:jMethod.
-
- ^ jMethod.
- ].
- ].
- ].
-
-self halt.
- self
- throwExceptionClassName:'java.lang.NoSuchMethodException'
- withMessage:'not yet implemented'.
-
- ^ nil.
-
- "Modified: / 22.10.1998 / 01:54:38 / cg"
-!
-
-_Class_getMethods0:nativeContext
- "get a method, given a name and type spec"
-
- |jClass cls jmName mTypes whichAccess argSig sel
- methods|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
-
- "/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here
- whichAccess := nativeContext argAt:1.
-
- methods := OrderedCollection new.
-
- [cls isJavaClass] whileTrue:[
- cls methodDictionary keysAndValuesDo:[:sel :mthd |
- |i1 i2 jMethod argTypes retTypeClass|
-
- mthd name printCR.
-
- i1 := mthd signature indexOf:$(.
- i2 := mthd signature indexOf:$) startingAt:(i1+1).
-
- "/ create a java.lang.reflect.Method for it.
- jMethod := (Java at:'java.lang.reflect.Method') new.
- jMethod instVarNamed:'clazz' put:jClass.
- jMethod instVarNamed:'slot' put:sel.
- jMethod instVarNamed:'name' put:(Java as_String:mthd name).
- retTypeClass := mthd returnTypeClass.
- retTypeClass isNil ifTrue:[
- retTypeClass := #void
- ].
- argTypes := mthd argSignature.
- argTypes := argTypes collect:[:s |
- |c|
-
- c := Java at:s.
- self javaClassObjectForClass:(c ? s asSymbol)
- ].
-
- jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
- jMethod instVarNamed:'parameterTypes' put:argTypes.
-
-"/ (mthd name includesString:'setName') ifTrue:[self halt].
- JavaMethods isNil ifTrue:[
- JavaMethods := IdentityDictionary new
- ].
- JavaMethods at:jMethod put:mthd.
- JavaMethods at:mthd put:jMethod.
-
- methods add:jMethod.
- ].
- whichAccess == 1 ifTrue:[
- "/ local methods only
- cls := nil
- ] ifFalse:[
- cls := cls superclass.
- ]
- ].
- methods := methods asArray.
- ^ methods.
-
- "Modified: / 22.10.1998 / 01:53:58 / cg"
-!
-
-_Class_getModifiers:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:54:53 / cg"
-!
-
-_Class_getName:nativeContext
- "get a classes name"
-
- |jClass cls nm|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass ifAbsent:nil.
- cls isNil ifTrue:[
-self halt.
- ].
- cls isJavaClass ifTrue:[
- nm := (cls fullName copyReplaceAll:$/ with:$.)
- ] ifFalse:[
- cls isSymbol ifTrue:[
- nm := cls "/ simulated dummy primitive class
- ] ifFalse:[
- nm := cls name
- ]
- ].
- ^ Java as_String:nm.
-
- "Modified: / 30.12.1998 / 21:13:50 / cg"
-!
-
-_Class_getPrimitiveClass:nativeContext
- "get a primitive class by name"
-
- |jClassName className cls|
-
- jClassName := nativeContext argAt:1.
- className := Java as_ST_String:jClassName.
-
- JavaClasses isNil ifTrue:[
- self initializePrimitiveClasses
- ].
- cls := JavaClasses at:className.
-
-"/ cls := Java classForName:className.
-"/ cls isNil ifTrue:[
-"/ cls := JavaClasses at:('JavaBase_' , className) asSymbol ifAbsent:nil.
-"/ #(
-"/ 'boolean' #Boolean
-"/ 'float' #ShortFloat
-"/ 'double' #Float
-"/ 'int' #Integer
-"/ 'long' #Integer
-"/ 'char' #Character
-"/ 'short' #Integer
-"/ 'byte' #Integer
-"/ 'void' #UndefinedObject
-"/ ) pairWiseDo:[:nm :sym |
-"/ className = nm ifTrue:[
-"/ cls := Smalltalk at:sym.
-"/ ]
-"/ ].
-"/
-"/ cls isNil ifTrue:[
-"/ self internalError:'class: ' , className , ' not found.'.
-"/ ].
-"/ ].
- ^ cls
-
- "Created: / 4.1.1998 / 00:46:03 / cg"
- "Modified: / 4.1.1998 / 01:12:27 / cg"
-!
-
-_Class_getSigners:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:01 / cg"
-!
-
-_Class_getSuperclass:nativeContext
- "return a classes superclass"
-
- |jClass cls superCls|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
- superCls := cls superclass.
- superCls == JavaObject ifTrue:[
- ^ nil.
- ].
- ^ self javaClassObjectForClass:superCls
-
- "Created: / 12.1.1998 / 12:38:36 / cg"
- "Modified: / 4.2.1998 / 14:51:22 / cg"
-!
-
-_Class_isArray:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:54:24 / cg"
-!
-
-_Class_isAssignableFrom:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:54:16 / cg"
-!
-
-_Class_isInstance:nativeContext
- "return true, if something is an instance of a class.
- (i.e. same as instanceOf - builtin bytecode)"
-
- |jClass cls obj|
-
- obj := nativeContext argAt:1.
- obj isNil ifTrue:[^ 0 "FALSE"].
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
-
- (obj isMemberOf:cls) ifTrue:[^ 1 "TRUE"].
- (obj isKindOf:cls) ifTrue:[^ 1 "TRUE"].
-
- cls isBehavior ifTrue:[
- cls isInterface ifTrue:[
- (obj class hasInterface:cls) ifTrue:[
- ^ 1 "TRUE"
- ]
- ].
- ^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
- ].
- (cls isMemberOf:JavaClassPointerRef) ifTrue:[
- "/ must be a pointer to an array of that class
-
- ^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
- ].
- (cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
- cls arrayClass == obj class ifTrue:[
- ^ 1 "TRUE"
- ].
- ].
-
- (obj isMemberOf:Array) ifTrue:[
- obj size == 0 ifTrue:[
- ^ 1 "TRUE"
- ].
- ^ (self _checkCast:(obj at:1) class:(cls deref))
- ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
- ].
- self halt.
- ^ 0 "FALSE".
-
- "Modified: / 9.2.1998 / 14:56:23 / cg"
-!
-
-_Class_isInterface:nativeContext
- "return true, if this class is an interface"
-
- |jClass cls|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
- cls isJavaClass ifFalse:[^ 0].
- cls isInterface ifTrue:[^ 1 "TRUE"].
- ^ 0 "FALSE"
-
- "Created: / 12.1.1998 / 12:37:02 / cg"
-!
-
-_Class_isPrimitive:nativeContext
- "return true, if this class is builtin primitive class
- (i.e. byteArray, array, string etc."
-
- |jClass cls|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
- ^ 0 "FALSE"
-
- "Created: / 9.2.1998 / 14:46:07 / cg"
-!
-
-_Class_newInstance:nativeContext
- "get an instance for a java.lang.Class"
-
- |jClass cls newInst|
-
- jClass := nativeContext receiver.
- cls := JavaClasses at:jClass.
- cls classInit.
- newInst := cls newCleared.
- newInst perform:#'<init>()V'.
-
- ^ newInst
-
- "Created: / 2.1.1998 / 22:41:38 / cg"
- "Modified: / 15.1.1998 / 00:57:37 / cg"
-!
-
-_Class_setSigners:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:55:08 / cg"
-!
-
-_Double_doubleToLongBits:nativeContext
- |f i|
-
- f := nativeContext argAt:1.
-
- UninterpretedBytes isBigEndian ifTrue:[
- i := f basicAt:8.
- i := i bitOr:((f basicAt:7) bitShift:8).
- i := i bitOr:((f basicAt:6) bitShift:16).
- i := i bitOr:((f basicAt:5) bitShift:24).
- i := i bitOr:((f basicAt:4) bitShift:32).
- i := i bitOr:((f basicAt:3) bitShift:40).
- i := i bitOr:((f basicAt:2) bitShift:48).
- i := i bitOr:((f basicAt:1) bitShift:56).
- ] ifFalse:[
- i := f basicAt:1.
- i := i bitOr:((f basicAt:2) bitShift:8).
- i := i bitOr:((f basicAt:3) bitShift:16).
- i := i bitOr:((f basicAt:4) bitShift:24).
- i := i bitOr:((f basicAt:5) bitShift:32).
- i := i bitOr:((f basicAt:6) bitShift:40).
- i := i bitOr:((f basicAt:7) bitShift:48).
- i := i bitOr:((f basicAt:8) bitShift:56).
- ].
-
- ^ i.
-
- "Created: / 4.1.1998 / 01:39:12 / cg"
-!
-
-_Double_longBitsToDouble:nativeContext
- |i aFloat|
-
- i := nativeContext argAt:1.
-
- aFloat := Float new.
- UninterpretedBytes isBigEndian ifTrue:[
- aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF).
- aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF).
- aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF).
- aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF).
- aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF).
- aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF).
- aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF).
- aFloat basicAt:8 put:(i bitAnd:16rFF).
- ] ifFalse:[
- aFloat basicAt:1 put:(i bitAnd:16rFF).
- aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF).
- aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF).
- aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF).
- aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF).
- aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF).
- aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF).
- aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF).
- ].
-
- ^ aFloat.
-
- "Created: / 4.1.1998 / 01:45:00 / cg"
-!
-
-_Double_valueOf0:nativeContext
- |s d|
-
- s := nativeContext argAt:1.
- s notNil ifTrue:[
- s := Java as_ST_String:s.
- d := Float readFrom:s onError:nil.
- ].
- d isNil ifTrue:[
- self throwNumberFormatException.
- "/ not reached
- ].
-
- ^ d
-
- "Modified: / 8.8.1997 / 12:03:55 / cg"
- "Created: / 7.1.1998 / 11:09:43 / cg"
-!
-
_Float_floatToIntBits:nativeContext
|f i|
@@ -4984,2857 +8171,17 @@
"Modified: / 13.1.1998 / 23:05:01 / cg"
!
-_Math_IEEEremainder:nativeContext
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 18:52:36 / cg"
-!
-
-_Math_acos:nativeContext
- "arc cosine"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal arcCos
-
- "Created: / 7.5.1998 / 00:34:50 / cg"
- "Modified: / 11.11.1998 / 15:08:20 / cg"
-!
-
-_Math_asin:nativeContext
- "arc sine"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal arcSin
-
- "Created: / 7.5.1998 / 00:34:26 / cg"
- "Modified: / 11.11.1998 / 15:08:15 / cg"
-!
-
-_Math_atan2:nativeContext
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 18:52:52 / cg"
-!
-
-_Math_atan:nativeContext
- "arc tangens"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal arcTan
-
- "Created: / 6.2.1998 / 01:24:12 / cg"
- "Modified: / 11.11.1998 / 15:08:11 / cg"
-!
-
-_Math_ceil:nativeContext
- "ceiling"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal ceilingAsFloat
-
- "Created: / 7.1.1998 / 15:43:00 / cg"
- "Modified: / 11.11.1998 / 15:08:04 / cg"
-!
-
-_Math_cos:nativeContext
- "cosine"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal cos
-
- "Created: / 7.1.1998 / 15:41:30 / cg"
- "Modified: / 11.11.1998 / 15:07:59 / cg"
-!
-
-_Math_exp:nativeContext
- "exponential"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal exp
-
- "Created: / 7.5.1998 / 00:36:19 / cg"
- "Modified: / 11.11.1998 / 15:07:50 / cg"
-!
-
-_Math_floor:nativeContext
- "floor"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal floorAsFloat
-
- "Created: / 7.1.1998 / 19:09:21 / cg"
- "Modified: / 11.11.1998 / 15:07:45 / cg"
-!
-
-_Math_log:nativeContext
- "natural logarithm"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal ln
-
- "Created: / 7.1.1998 / 15:42:19 / cg"
- "Modified: / 30.12.1998 / 17:41:42 / cg"
-!
-
-_Math_pow:nativeContext
- "power"
-
- |dVal1 dVal2|
-
- dVal1 := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal1 isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- dVal2 := nativeContext argAt:3.
-"/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal2 isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal1 raisedTo:dVal2
-
- "Created: / 7.1.1998 / 15:44:13 / cg"
- "Modified: / 11.11.1998 / 15:07:33 / cg"
-!
-
-_Math_rint:nativeContext
- |dVal|
-
- dVal := nativeContext argAt:1.
- ^ dVal rounded asFloat.
-!
-
-_Math_sin:nativeContext
- "sine"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal sin
-
- "Created: / 7.1.1998 / 15:41:40 / cg"
- "Modified: / 11.11.1998 / 15:07:09 / cg"
-!
-
-_Math_sqrt:nativeContext
- "square root"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
-
- "/ how about domain errors ?
- dVal < 0 ifTrue:[
- ^ 0.0
- ].
- ^ dVal sqrt
-
- "Created: / 7.1.1998 / 15:42:40 / cg"
- "Modified: / 29.12.1998 / 13:22:36 / cg"
-!
-
-_Math_tan:nativeContext
- "tangent"
-
- |dVal|
-
- dVal := nativeContext argAt:1.
-"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
-"/ dVal isReal ifTrue:[
-"/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR.
-"/ ] ifFalse:[
-"/ self halt:'expected double arg'
-"/ ]
-"/ ].
- ^ dVal tan
-
- "Created: / 7.5.1998 / 00:34:03 / cg"
- "Modified: / 11.11.1998 / 15:07:14 / cg"
-!
-
-_Method_getModifiers:nativeContext
- |jMethod mthd retVal|
-
- jMethod := nativeContext receiver.
-
- mthd := JavaMethods at:jMethod ifAbsent:nil.
- mthd isNil ifTrue:[
- self halt.
- ^ 0
- ].
- ^ mthd accessFlags
-
- "Modified: / 9.4.1998 / 17:50:01 / cg"
-!
-
-_Method_invoke:nativeContext
- "invoke a javaMethod"
-
- |jMethod mthd rec args retVal|
-
- jMethod := nativeContext receiver.
- rec := nativeContext argAt:1.
- args := nativeContext argAt:2.
-
- mthd := JavaMethods at:jMethod ifAbsent:nil.
- mthd isNil ifTrue:[
- self halt.
- ].
-
- "/ check for arguments to match the expected types ...
-
- mthd argSignature keysAndValuesDo:[:index :argSig |
- |cls arg|
-
- cls := Java at:argSig.
- arg := args at:index.
- (arg isKindOf:cls) ifFalse:[
- self halt.
- ]
- ].
-
- mthd isStatic ifTrue:[
- retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector.
- ^ retVal
- ] ifFalse:[
- self halt.
- ].
-
- self halt.
-
- "Created: / 13.2.1998 / 15:15:28 / cg"
- "Modified: / 13.2.1998 / 15:35:54 / cg"
-!
-
-_Object_clone:nativeContext
- "clone an object"
-
- |o rslt|
-
- o := nativeContext receiver.
- rslt := o shallowCopy.
- ^ rslt
-
- "Created: / 4.1.1998 / 19:39:26 / cg"
-!
-
-_Object_getClass:nativeContext
- "return an objects class"
-
- |o cls jClass|
-
- o := nativeContext receiver.
- cls := o class.
-
- jClass := self javaClassObjectForClass:cls.
- ^ jClass
-
- "Created: / 6.1.1998 / 18:28:27 / cg"
- "Modified: / 23.1.1998 / 17:48:22 / cg"
-!
-
-_Object_hashCode:nativeContext
- "identityHash"
-
- |o rslt|
-
- o := nativeContext receiver.
- rslt := o identityHash.
- ^ rslt
-
- "Created: / 4.1.1998 / 19:40:26 / cg"
-!
-
-_Object_notify:nativeContext
- "wakeup"
-
- self wakeup:(nativeContext receiver).
-
- "Created: / 6.1.1998 / 21:09:26 / cg"
-!
-
-_Object_notifyAll:nativeContext
- self wakeupAll:(nativeContext receiver).
-
- "Created: / 3.1.1998 / 03:06:56 / cg"
-!
-
-_Object_wait:nativeMethodContext
- "wait"
-
- |tmo handle sema|
-
- handle := nativeMethodContext receiver.
- tmo := nativeMethodContext argAt:1.
-
- sema := JavaVM semaphoreFor:handle.
-
- [
- self waitFor:sema state:#javaWait timeOut:tmo.
- ] valueOnUnwindDo:[
- JavaVM releaseSemaphoreFor:handle.
- ].
-
- ThreadTrace ifTrue:[
- '====> thread continues ...' printCR.
- ]
-
- "Modified: / 30.12.1998 / 19:20:43 / cg"
-!
-
-_Runtime_buildLibName:nativeContext
- |jPath jFileName path fileName libName|
-
- jPath := nativeContext argAt:1.
- jFileName := nativeContext argAt:2.
-
- path := Java as_ST_String:jPath.
- fileName := Java as_ST_String:jFileName.
-
- path = '__builtIn__' ifTrue:[
- libName := path , '/' , fileName
- ] ifFalse:[
- libName := path , '/lib' , fileName , '.so'.
- ].
- ^ Java as_String:libName.
-
- "Modified: / 8.8.1997 / 12:05:05 / cg"
- "Created: / 4.1.1998 / 19:07:14 / cg"
-!
-
-_Runtime_execInternal:nativeContext
- "Run a unix-command; return a process object."
-
- |cmdAndArgArray envArray cmd jProcessClass jProcess|
-
- cmdAndArgArray := nativeContext argAt:1.
- envArray := nativeContext argAt:2.
-
- cmd := cmdAndArgArray at:1.
-
- OperatingSystem isUNIXlike ifTrue:[
- jProcessClass := Java classForName:'java.lang.UNIXProcess'.
- ] ifFalse:[
- jProcessClass := Java classForName:'java.lang.Win32Process'.
- ].
-"/
- jProcessClass notNil ifTrue:[
-self halt.
- jProcess := jProcessClass newCleared.
- jProcess
- perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V'
- with:cmdAndArgArray
- with:envArray.
- ^ jProcess
- ].
-self halt.
- self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'.
- ^ nil
-
- "Created: / 15.1.1998 / 01:50:31 / cg"
- "Modified: / 11.12.1998 / 13:09:36 / cg"
-!
-
-_Runtime_exitInternal:nativeContext
- "exit - here, we only shut down java threads"
-
- |enteredMonitors|
-
- ExitDebug == true ifTrue:[
- self halt:'Java code called exit'.
- ].
-
- self syncMonitorCache.
- (enteredMonitors := self enteredMonitors) size > 0 ifTrue:[
- enteredMonitors do:[:handle |
- | mon |
-
- mon := LockTable at:handle ifAbsent:nil.
- mon isNil ifTrue:[
- self halt:'no monitor in exitInternal'.
- ] ifFalse:[
- mon exit.
-('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- ].
- ].
-
- "/ TODO: shut down all threads created by this one ...
-
- AbortSignal raise.
- self halt.
-
- "Created: / 7.1.1998 / 22:48:51 / cg"
- "Modified: / 8.1.1999 / 14:09:36 / cg"
-!
-
-_Runtime_freeMemory:nativeContext
- "free memory - Returns the number of free bytes"
-
- ^ ObjectMemory freeListSpace + ObjectMemory freeSpace
-
- "Created: / 12.1.1998 / 12:59:53 / cg"
-!
-
-_Runtime_gc:nativeContext
- "Runs the garbage collector.
- Ignored, since the ST-gc runs all the time."
-
- ^ self
-
- "Modified: / 12.1.1998 / 12:58:32 / cg"
-!
-
-_Runtime_initializeLinkerInternal:nativeContext
- "init sharedLib linker, return searchPath as javaString"
-
- |path|
-
- "/ mhmh - what is done here ?
-
- path := ''.
- LibPath do:[:comp | path size == 0 ifTrue:[
- path := path , comp
- ] ifFalse:[
- path := path , ':' , comp
- ]
- ].
-
- ^ Java as_String:path
-
- "Modified: / 7.8.1997 / 21:17:03 / cg"
- "Created: / 4.1.1998 / 17:53:15 / cg"
-!
-
-_Runtime_loadFileInternal:nativeContext
- "load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok"
-
- |ret|
-
- ret := self _Runtime_loadFileInternalI:nativeContext.
- ret < 0 ifTrue:[ ret := 0 ].
- ^ ret
-
- "Created: / 4.1.1998 / 19:10:20 / cg"
- "Modified: / 4.1.1998 / 19:11:04 / cg"
-!
-
-_Runtime_loadFileInternalI:nativeContext
- "1.1b3 change; load a sharedLib like 'loadFileInternal',
- but return integer:
- -1 outOfMemory error
- 0 failed to load
- 1 loaded or already loaded (i.e. ok)"
-
- |jLibName libName libHandle|
-
- jLibName := nativeContext argAt:1.
- libName := Java as_ST_String:jLibName.
-
- (SimulatedLibs includes:libName) ifTrue:[
-"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL.
- ^ 1
- ].
- (LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[
-"/ ('JAVA: already loaded: ' , libName) printNL.
- ^ 1
- ].
-
- libName asFilename exists ifFalse:[
- ('JAVA: no file to load: ' , libName) printNL.
- ^ 0
- ].
-
- (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
- ^ 0
- ].
-
- libHandle := ObjectFileLoader loadLibrary:libName.
- libHandle isNil ifTrue:[
- ('JAVA: failed to load: ' , libName) printNL.
- ^ 0
- ].
-
- LoadedLibs isNil ifTrue:[
- LoadedLibs := Dictionary new.
- ].
-
- LoadedLibs at:libName put:libHandle.
- ^ 1
-
- "Created: / 4.1.1998 / 19:10:54 / cg"
- "Modified: / 6.2.1998 / 03:11:59 / cg"
-!
-
-_Runtime_runFinalization:nativeContext
- "/ void runFinalization ()
-"/ UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:59:01 / cg"
-!
-
-_Runtime_runFinalizersOnExit0:nativeContext
- ""
-
- |onOff|
-
- onOff := nativeContext argAt:1.
- ^ 1
-
- "Modified: / 6.2.1998 / 03:11:59 / cg"
- "Created: / 15.10.1998 / 23:34:55 / cg"
-!
-
-_Runtime_totalMemory:nativeContext
- "free memory - Returns the total number of bytes"
-
- ^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize
-
- "Created: / 12.1.1998 / 12:59:23 / cg"
-!
-
-_Runtime_traceInstructions:nativeContext
- "/ void traceInstructions (boolean)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:59:18 / cg"
-!
-
-_Runtime_traceMethodCalls:nativeContext
- "/ void traceMethodCalls (boolean)
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:59:37 / cg"
-!
-
-_SecurityManager_classDepth:nativeContext
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:56:27 / cg"
-!
-
-_SecurityManager_classLoaderDepth:nativeContext
- |con depth|
-
- con := thisContext sender.
- depth := 1.
- [con notNil] whileTrue:[
- con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[
- con selector == #handle:do: ifTrue:[
- depth := depth + 1
- ]
- ].
- con := con sender.
- ].
-'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR.
- ^ depth.
-
- "Created: / 13.1.1998 / 09:21:46 / cg"
- "Modified: / 13.1.1998 / 09:33:43 / cg"
-!
-
-_SecurityManager_currentClassLoader:nativeContext
- |loader|
-
- loader := JavaClassReader classLoaderQuerySignal query.
-"/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR.
- ^ loader.
-
- "Created: / 13.1.1998 / 09:23:28 / cg"
- "Modified: / 11.12.1998 / 12:39:59 / cg"
-!
-
-_SecurityManager_currentLoadedClass0:nativeContext
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:56:41 / cg"
-!
-
-_SecurityManager_getClassContext:nativeContext
- UnimplementedNativeMethodSignal raise
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:56:06 / cg"
-!
-
-_String_intern:nativeContext
- |jString|
-
- jString := nativeContext receiver.
- ^ Java intern:jString
-!
-
-_System_arraycopy:nativeContext
- |srcArray srcIdx dstArray dstIdx count dstEndIdx|
-
- srcArray := nativeContext argAt:1.
- srcArray isNil ifTrue:[
- ^ self throwNullPointerException
- ].
- srcIdx := nativeContext argAt:2.
- dstArray := nativeContext argAt:3.
- dstArray isNil ifTrue:[
- ^ self throwNullPointerException
- ].
- dstIdx := nativeContext argAt:4.
- count := nativeContext argAt:5.
-
- ((srcIdx < 0) or:[srcIdx + count > srcArray size]) ifTrue:[
- srcArray size == 0 ifTrue:[
- srcArray isVariable ifFalse:[
- ^ self throwArrayStoreException:srcArray
- ]
- ].
- ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
- ].
- ((dstIdx < 0) or:[dstIdx + count > dstArray size]) ifTrue:[
- dstArray size == 0 ifTrue:[
- dstArray isVariable ifFalse:[
- ^ self throwArrayStoreException:dstArray
- ]
- ].
- ^ self throwArrayIndexOutOfBoundsException:(dstIdx + count - 1)
- ].
-
- dstEndIdx := dstIdx + count.
- dstIdx := dstIdx + 1. "/ ST uses 1-based indexing
- srcIdx := srcIdx + 1. "/ ST uses 1-based indexing
-
- (srcArray class isBytes and:[dstArray class isBytes]) ifTrue:[
- dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
- ] ifFalse:[
- dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
- ].
- ^ nil.
-!
-
-_System_currentTimeMillis:nativeContext
- "return the milliseconds since 1.jan.1970"
-
- |delta|
-
- "/ workaround win32 bug (use 01:01:01 as base)
- delta := Timestamp now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1).
- delta := delta - 3600 - 60 - 1.
-"/ "/ make certain, it fits 64 signed bits
-"/ delta := delta bitAnd:16r7FFFFFFFFFFFFFFF.
-"/ ^ delta max:0
- ^ delta
-
- "
- JavaVM _System_currentTimeMillis:nil
- "
-
- "Modified: / 23.12.1998 / 21:54:50 / cg"
-!
-
-_System_identityHashCode:nativeContext
- |obj|
-
- obj := nativeContext argAt:1.
- ^ obj identityHash
-
- "Modified: / 12.11.1998 / 18:52:07 / cg"
- "Created: / 12.11.1998 / 18:54:00 / cg"
-!
-
-_System_initProperties:nativeContext
- |props stProps|
-
- props := nativeContext argAt:1.
- stProps := self systemProperties.
-
- "/ recursively invoke myself on the Java HashTable.
- "/ calling 'put' to stuff in the values ...
-
- stProps keysAndValuesDo:[:key :value |
- |keyObj valueObj|
-
- keyObj := Java as_String:key.
- valueObj := Java as_String:value.
-
- props
- perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;'
- with:keyObj
- with:valueObj.
- ].
- ^ props
-
- "Created: / 3.1.1998 / 14:25:22 / cg"
- "Modified: / 4.1.1998 / 14:23:18 / cg"
-!
-
-_System_setErr0:nativeContext
- |stream|
-
- stream := nativeContext argAt:1.
-
- self setOpenFile:(self javaConsoleStream ? Stderr) at:2.
-
- nativeContext receiver instVarNamed:'err' put:stream.
-
- "Created: / 18.3.1997 / 15:02:05 / cg"
- "Modified: / 4.1.1998 / 16:21:15 / cg"
-!
-
-_System_setIn0:nativeContext
- |stream|
-
- stream := nativeContext argAt:1.
-
- self setOpenFile:Stdin at:0.
-
- nativeContext receiver instVarNamed:'in' put:stream.
-
- "Created: / 4.1.1998 / 16:16:38 / cg"
- "Modified: / 4.1.1998 / 16:20:44 / cg"
-!
-
-_System_setOut0:nativeContext
- |stream|
-
- stream := nativeContext argAt:1.
-
- self setOpenFile:(self javaConsoleStream ? Stdout) at:1.
-
- nativeContext receiver instVarNamed:'out' put:stream.
-
- "Created: / 4.1.1998 / 16:18:26 / cg"
- "Modified: / 4.1.1998 / 16:20:23 / cg"
-!
-
-_Thread_countStackFrames:nativeContext
- "/ int countStackFrames ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:06:21 / cg"
-!
-
-_Thread_currentThread:nativeMethodContext
- |t p prio|
-
- p := Processor activeProcess.
- t := self javaThreadForSTProcess:p.
- t notNil ifTrue:[
- ^ t
- ].
- t := self newThread:'main'.
- Java threads at:t put:p.
- ^ t
-
- "Created: / 3.1.1998 / 01:42:28 / cg"
- "Modified: / 4.1.1998 / 14:59:13 / cg"
-!
-
-_Thread_interrupt0:nativeContext
- "ask if a thread is interrupted (clear interruptState if arg is true)"
-
- |jThread stProcess|
-
- jThread := nativeContext receiver.
- stProcess := self stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- self halt.
- ^ 0
- ].
-
- stProcess markInterrupted
-
- "Modified: / 2.1.1998 / 21:49:06 / cg"
- "Created: / 10.4.1998 / 15:21:43 / cg"
-!
-
-_Thread_isAlive:nativeContext
- "is it alive ?"
-
- |jThread stProcess|
-
- jThread := nativeContext receiver.
- stProcess := JavaVM stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ 0 "FALSE"
- ].
- stProcess isDead ifTrue:[^ 0 "FALSE"].
- ^ 1 "TRUE"
-
- "Created: / 5.1.1998 / 02:03:51 / cg"
- "Modified: / 6.2.1998 / 02:15:01 / cg"
-!
-
-_Thread_isInterrupted:nativeContext
- "ask if a thread is interrupted (clear interruptState if arg is true)"
-
- |jThread stProcess clearInterrupt rslt|
-
- jThread := nativeContext receiver.
- stProcess := self stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- self halt.
- ^ 0
- ].
-
- clearInterrupt := nativeContext argAt:1.
- rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0].
- clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions].
- ^ rslt
-
- "Modified: / 2.1.1998 / 21:49:06 / cg"
- "Created: / 7.1.1998 / 18:50:26 / cg"
-!
-
-_Thread_resume0:nativeContext
- "yield"
-
- |jThread stProcess|
-
- jThread := nativeContext receiver.
- stProcess := JavaVM stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
- ].
- stProcess resume
-
- "Created: / 8.1.1998 / 01:06:27 / cg"
- "Modified: / 6.2.1998 / 02:15:08 / cg"
-!
-
-_Thread_setPriority0:nativeMethodContext
- |t p prio|
-
- t := nativeMethodContext receiver.
- p := JavaVM stProcessForJavaThread:t.
- prio := nativeMethodContext argAt:1.
-
- p isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- 'JAVA [info]: no process yet (in setPriority)' infoPrintCR.
- ].
- ^ nil
- ].
-
- ThreadTrace ifTrue:[
- 'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL.
- ].
- ^ nil
-
- "Created: / 2.1.1998 / 19:05:55 / cg"
- "Modified: / 6.2.1998 / 02:28:18 / cg"
-!
-
-_Thread_sleep:nativeContext
- "sleep for some milliseconds "
-
- |millis|
-
- millis := nativeContext argAt:1.
- self waitFor:nil state:nil timeOut:(millis max:50)
-
- "Modified: / 8.1.1999 / 16:42:52 / cg"
-!
-
-_Thread_start:nativeContext
- "start the thread"
-
- |jThread jName name stProcess|
-
- jThread := nativeContext receiver.
- (jThread instVarNamed:'priority') < 1 ifTrue:[
- self halt.
- jThread instVarNamed:'priority' put:1.
- ].
-
- stProcess := JavaProcess
- for:[
- |procName|
-
- Object abortSignal handle:[:ex |
- procName := stProcess name.
- (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
- ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
- ex restart.
- ] ifFalse:[
- (stProcess == JavaScreenUpdaterThread
- or:[stProcess == JavaEventQueueThread]) ifTrue:[
- ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
- ex restart
- ] ifFalse:[
- ('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR.
- ]
- ].
- ] do:[
- [
- JavaVM javaExceptionSignal handle:[:ex |
- |exClass|
-
- procName := stProcess name.
- exClass := ex parameter class.
-
- exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
- ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
- ] ifFalse:[
- Transcript
- showCR:('JAVA: thread '''
- , procName
- , ''' terminated with exception: '
- , exClass name).
- ].
- ex return.
- ] do:[
- Object messageNotUnderstoodSignal handle:[:ex |
- "/ remap doesNotUnderstand with nil-receiver to
- "/ a nullPointerException ...
- |con m|
-
- con := ex suspendedContext.
- con receiver isNil ifTrue:[
- ((m := con sender method) notNil
- and:[m isJavaMethod]) ifTrue:[
- self throwNullPointerException.
- AbortSignal raise. "/ ex proceed.
- ]
- ].
- ex reject.
- ] do:[
-"/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
- jThread perform:#'run()V'.
- ThreadTrace == true ifTrue:[
- ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR.
- ].
- jThread perform:#'exit()V'.
- ThreadTrace == true ifTrue:[
- ('JAVA: after exit of thread ' , stProcess name) infoPrintCR.
- ]
- ]
- ]
- ] ensure:[
- |monitors|
-
- monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil.
- monitors notNil ifTrue:[
- monitors do:[:obj |
- | mon |
-
- mon := self monitorFor:obj.
- mon notNil ifTrue:[
- mon owningProcess == stProcess ifTrue:[
- ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR.
- mon exit
- ].
- ].
- ].
- EnteredMonitorsPerProcess removeKey:stProcess.
-
- stProcess == JavaScreenUpdaterThread ifTrue:[
- JavaScreenUpdaterThread := nil.
- ].
- stProcess == JavaEventQueueThread ifTrue:[
- JavaEventQueueThread := nil.
- ].
-"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.
-"/ screenUpdaterClass notNil ifTrue:[
-"/ screenUpdaterClass instVarNamed:'updater' put:nil.
-"/ ].
- ].
- Java threads removeKey:jThread ifAbsent:[].
- ]
- ]
- ]
- priority:(Processor activePriority).
-
- jName := jThread instVarNamed:'name'.
- jName isString ifFalse:[
- name := Java as_ST_String:jName.
- ] ifTrue:[
- name := jName
- ].
-
- "/ kludge - remember the ScreenUpdater ...
- name = 'Screen Updater' ifTrue:[
- JavaScreenUpdaterThread := stProcess.
- ] ifFalse:[
- name = 'AWT-Windows' ifTrue:[
- JavaEventThread := stProcess.
- ] ifFalse:[
- (name startsWith:'AWT-EventQueue') ifTrue:[
- JavaEventQueueThread := stProcess.
- ].
- ]
- ].
-
-"/name = 'UserDialogShowThread' ifTrue:[
-"/self halt
-"/].
- "/ when that process terminates, wakup any waiters
- stProcess addExitAction:[self wakeup:jThread].
-
- stProcess name:'JAVA-' , name.
- stProcess restartable:true.
- stProcess resume.
-
- Java threads at:jThread put:stProcess.
-
- ^ nil
-
- "Created: / 3.1.1998 / 02:05:52 / cg"
- "Modified: / 24.12.1999 / 03:14:33 / cg"
-!
-
-_Thread_stop0:nativeContext
- "terminate a thread"
-
- |jThread stProcess death|
-
- jThread := nativeContext receiver.
-
- stProcess := JavaVM stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
- ].
-stProcess == JavaScreenUpdaterThread ifTrue:[self halt].
-stProcess == JavaEventQueueThread ifTrue:[self halt].
-
- death := nativeContext argAt:1.
- stProcess
- interruptWith:[
- JavaVM javaExceptionSignal handle:[:ex |
-Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt].
-Processor activeProcess == JavaEventQueueThread ifTrue:[self halt].
- Processor activeProcess terminate
- ] do:[
- ThreadTrace == true ifTrue:[
- ('JAVA: thread exit: ' , jThread displayString) infoPrintNL.
- ].
- jThread perform:#'exit()V'.
- self throwException:death.
- ]
- ].
- stProcess resume.
-
- [stProcess isDead] whileFalse:[
- stProcess resume.
- 'JavaVM: wait for death' infoPrintCR.
- Delay waitForSeconds:0.1
- ].
- stProcess terminate
-
- "Created: / 8.1.1998 / 13:11:17 / cg"
- "Modified: / 24.12.1999 / 02:32:45 / cg"
-!
-
-_Thread_suspend0:nativeContext
- "yield"
-
- |jThread stProcess|
-
- jThread := nativeContext receiver.
- stProcess := JavaVM stProcessForJavaThread:jThread.
- stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
- ].
- stProcess suspend
-
- "Created: / 8.1.1998 / 01:05:49 / cg"
- "Modified: / 6.2.1998 / 02:15:23 / cg"
-!
-
-_Thread_yield:nativeContext
- "yield"
-
- |jThread stProcess|
-
- Processor yield.
-"/ jThread := nativeContext receiver.
-"/ stProcess := JavaVM stProcessForJavaThread:jThread.
-"/ stProcess isNil ifTrue:[
-"/ ThreadTrace == true ifTrue:[
-"/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
-"/ ].
-"/ ^ nil "void"
-"/ ].
-"/ stProcess == Processor activeProcess ifTrue:[
-"/ Processor yield.
-"/ ] ifFalse:[
-"/ self halt.
-"/ ].
-
- "Created: / 5.1.1998 / 02:03:51 / cg"
- "Modified: / 23.12.1998 / 19:19:17 / cg"
-!
-
-_Throwable_fillInStackTrace:nativeContext
- |exClass exceptionObject list con|
-
- exClass := Java classNamed:'java.lang.Throwable'.
-
- exceptionObject := nativeContext receiver.
-
- "/
- "/ debugging only
- "/
- (exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[
- self halt
- ].
-
- con := thisContext sender.
-
- "/
- "/ we are not interrested in all intermediate Exception frames ...
- "/
- FullExceptionTrace ifFalse:[
- "/ first, skip any JavaVM contexts
- [con receiver == exceptionObject] whileFalse:[
- con := con sender
- ].
- "/ then, all exception-init contexts
- [con receiver == exceptionObject] whileTrue:[
- con := con sender
- ].
- ].
-
- list := OrderedCollection new.
- [con notNil] whileTrue:[
- (con isJavaContext) ifTrue:[
- "/ add a copy, in case the context continues with some
- "/ cleanup ...
- list add:con shallowCopy
- ].
- con := con sender
- ].
-
- exceptionObject instVarNamed:'backtrace' put:(list asArray).
-
- ^ nil.
-
- "Created: / 4.1.1998 / 14:27:40 / cg"
- "Modified: / 8.5.1998 / 21:29:53 / cg"
-!
-
-_Throwable_printStackTrace0:nativeContext
- |out outStream exceptionObject contextList|
-
- outStream := nativeContext argAt:1.
- exceptionObject := nativeContext receiver.
-
- contextList := exceptionObject instVarNamed:'backtrace'.
-
- out := self javaConsoleStream.
- out cr.
- out nextPutLine:'JAVA: stackTrace:'.
-
- contextList do:[:con |
- out
- nextPutAll:' ';
- nextPutAll:(con method javaClass fullName);
- nextPutAll:'.';
- nextPutAll:(con method selector);
- nextPutAll:' [';
- nextPutAll:(con method javaClass sourceFile);
- nextPutAll:' ';
- nextPutAll:(con quickLineNumber displayString);
- nextPutAll:']'.
- out cr
- ].
- out nextPutLine:'----------------------------------------------------'
-
- "Created: / 4.1.1998 / 14:27:40 / cg"
- "Modified: / 10.11.1998 / 14:19:32 / cg"
-!
-
-_Win32Process_create:nativeContext
- "really create a win32 process"
-
- |env cmd jProcess p inPipe outPipe errorPipe|
-
- jProcess := nativeContext receiver.
- cmd := nativeContext argAt:1.
- cmd := Java as_ST_String:cmd.
-
- env := nativeContext argAt:2.
- env notNil ifTrue:[
- self halt
- ].
-self halt.
-
- p := Win32Process new.
- p command:cmd.
- p environment:env.
- p inStream:inPipe.
- p outStream:outPipe.
- p errorStream:errorPipe.
- p directory:nil.
- p startProcess.
-self halt.
-
- jProcess instVarNamed:'handle' put:p.
-
- "Created: / 10.11.1998 / 19:50:31 / cg"
- "Modified: / 10.11.1998 / 21:34:18 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.lang - jdk1.2'!
-
-_AccessController_beginPrivileged:nativeContext
- "/ introduced with jdk1.2
-
- "Created: / 27.1.1998 / 18:18:11 / cg"
-!
-
-_AccessController_endPrivileged:nativeContext
- "/ introduced with jdk1.2
-
- "Created: / 27.1.1998 / 18:18:32 / cg"
-!
-
-_AccessController_getStackAccessControlContext:nativeContext
- "/ introduced with jdk1.2
-
- "/ supposed to do more here ...
-
- ^ nil
-
- "Created: / 27.1.1998 / 18:22:15 / cg"
-!
-
-_ClassLoader$NativeLibrary_load:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- |nativeLoader jLibName libName libHandle index|
-
- nativeLoader := nativeContext receiver.
- jLibName := nativeContext argAt:1.
- libName := Java as_ST_String:jLibName.
-
- (index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[
-"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL.
- nativeLoader instVarNamed:'handle' put:index.
- ^ self "/ void
- ].
- (LoadedNativeLibs notNil
- and:[LoadedNativeLibs includesKey:libName]) ifTrue:[
-"/ ('JAVA: native library already loaded: ' , libName) printNL.
- nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
- ^ self "/ void
- ].
-
- (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
- ^ self
- ].
-self halt.
-
- libName asFilename exists ifFalse:[
- ('JAVA: no file to load nativeLib: ' , libName) printNL.
- ^ self "/ void
- ].
-
- libHandle := ObjectFileLoader loadLibrary:libName.
- libHandle isNil ifTrue:[
- ('JAVA: failed to load nativeLib: ' , libName) printNL.
- ^ self "/ void
- ].
-
- LoadedNativeLibs isNil ifTrue:[
- LoadedNativeLibs := Dictionary new.
- ].
-
- LoadedNativeLibs at:libName put:libHandle.
- nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
- ^ self "/ void
-
- "Created: / 27.1.1998 / 18:38:37 / cg"
- "Modified: / 6.2.1998 / 03:12:17 / cg"
-!
-
-_ClassLoader_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:37:08 / cg"
-!
-
-_Component_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 19:53:29 / cg"
-!
-
-_System_getCallerClass:nativeContext
- "/ introduced with jdk1.2
-
- |senderContext cls|
-
- senderContext := nativeContext sender.
- [senderContext receiver == (Java at:'java.lang.System')] whileTrue:[
- senderContext := senderContext sender.
- ].
-
- senderContext method isStatic ifTrue:[
- cls := senderContext receiver
- ] ifFalse:[
- cls := senderContext receiver class
- ].
- cls isJavaClass ifTrue:[
- ^ self javaClassObjectForClass:cls
- ].
- (cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[
- ^ Java at:'java.lang.Class'
- ].
- self halt.
- ^ nil
-
- "Modified: / 27.1.1998 / 18:33:13 / cg"
-!
-
-_Toolkit_initIDs:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 19:53:50 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.lang - ms'!
-
-_ClassLoader_createArrayClass:nativeContext
- "java.lang.Class createArrayClass (java.lang.String java.lang.Class)"
-
- "resolve a new class as previously created by defineClass0"
-
- |jClassLoader name elCls|
-
- jClassLoader := nativeContext receiver.
- name := nativeContext argAt:1.
- elCls := nativeContext argAt:2.
- elCls isNil ifTrue:[
- self halt.
- ^ nil
- ].
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:36:01 / cg"
- "Created: / 27.1.2000 / 02:56:37 / cg"
-!
-
-_ClassLoader_resolveClass:nativeContext
- "void resolveClass (java.lang.Class)"
-
- "resolve a new class as previously created by defineClass0"
-
- |jClassLoader jCls cls loaderStub anyUnresolved|
-
- jClassLoader := nativeContext receiver.
- jCls := nativeContext argAt:1.
- jCls isNil ifTrue:[
- self halt.
- ^ nil
- ].
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:36:01 / cg"
-!
-
-_Runtime_isInputStreamLocalised:nativeContext
- "/ boolean isInputStreamLocalised (java.io.DataInputStream)
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 03:03:01 / cg"
-!
-
-_Runtime_isOutputStreamLocalised:nativeContext
- "/ boolean isOutputStreamLocalised (java.io.DataOutputStream)
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 03:02:49 / cg"
-!
-
-_Runtime_setInputStreamLocalised:nativeContext
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:02:27 / cg"
-!
-
-_Runtime_setOutputStreamLocalised:nativeContext
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:02:32 / cg"
-!
-
-_String_compareTo:nativeContext
- "int compareTo (java.lang.String)"
-
- |jString1 jString2|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:28:59 / cg"
-!
-
-_String_equals:nativeContext
- |jString1 jString2|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- ^ (jString1 instVarAt:1) = (jString2 instVarAt:1)
-
- "Created: / 18.11.1998 / 00:52:03 / cg"
- "Modified: / 18.11.1998 / 00:53:01 / cg"
-!
-
-_String_equalsIgnoreCase:nativeContext
- "boolean equalsIgnoreCase (java.lang.String)"
-
- |jString1 jString2|
-
-self halt:'untested'.
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- ^ (jString1 instVarAt:1) sameAs: (jString2 instVarAt:1)
-
- "Modified: / 18.11.1998 / 00:53:01 / cg"
- "Created: / 27.1.2000 / 02:27:46 / cg"
-!
-
-_String_indexOf:nativeContext
- "int indexOf (java.lang.String int)"
-
- |jString1 jString2 idx|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- idx := nativeContext argAt:2.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:30:22 / cg"
-!
-
-_String_lastIndexOf:nativeContext
- "int lastIndexOf (java.lang.String int)"
-
- |jString1 jString2 idx|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- idx := nativeContext argAt:2.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:33:59 / cg"
-!
-
-_String_length:nativeContext
- |jString|
-
- jString := nativeContext receiver.
- ^ (jString instVarAt:3)
-
- "Created: / 18.11.1998 / 00:53:50 / cg"
- "Modified: / 18.11.1998 / 00:54:18 / cg"
-!
-
-_String_regionMatches2:nativeContext
- "boolean regionMatches (boolean int java.lang.String int int)"
-
- |jString1 bool jString2 idx1 idx2|
-
- jString1 := nativeContext receiver.
- bool := nativeContext argAt:1.
- jString2 := nativeContext argAt:2.
- idx1 := nativeContext argAt:3.
- idx2 := nativeContext argAt:4.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:33:40 / cg"
-!
-
-_String_regionMatches:nativeContext
- "boolean regionMatches (int java.lang.String int int)"
-
- |jString1 jString2 idx1 idx2|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- idx1 := nativeContext argAt:2.
- idx2 := nativeContext argAt:3.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:32:29 / cg"
-!
-
-_String_startsWith:nativeContext
- "boolean startsWith (java.lang.String int)"
-
- |jString1 jString2 idx|
-
- jString1 := nativeContext receiver.
- jString2 := nativeContext argAt:1.
- idx := nativeContext argAt:2.
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:31:40 / cg"
-!
-
-_System_validateSecurityManager:nativeContext
- "void validateSecurityManager (java.lang.SecurityManager)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:43:25 / cg"
-!
-
-_ThreadGroup_initMainThreadGroup0:nativeContext
- "void initMainThreadGroup0 (java.lang.ThreadGroup)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:45:52 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.lang.reflect - ms'!
-
-_Constructor_getModifiers:nativeContext
- "/ int getModifiers ()
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 02:54:38 / cg"
-!
-
-_Constructor_newInstance:nativeContext
- "/ java.lang.Object newInstance (java.lang.Object[])
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
-!
-
-_Field_get:nativeContext
- "/ java.lang.Object get (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:04:18 / cg"
-!
-
-_Field_getBoolean:nativeContext
- "/ boolean getBoolean (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:05:16 / cg"
-!
-
-_Field_getByte:nativeContext
- "/ byte getByte (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:05:30 / cg"
-!
-
-_Field_getChar:nativeContext
- "/ char getChar (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:03:37 / cg"
-!
-
-_Field_getDouble:nativeContext
- "/ double getDouble (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:07:49 / cg"
-!
-
-_Field_getFloat:nativeContext
- "/ float getFloat (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:05:41 / cg"
-!
-
-_Field_getInt:nativeContext
- "/ int getInt (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:04:47 / cg"
-!
-
-_Field_getLong:nativeContext
- "/ long getLong (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:05:54 / cg"
-!
-
-_Field_getModifiers:nativeContext
- "/ int getModifiers ()
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:07:03 / cg"
-!
-
-_Field_getShort:nativeContext
- "/ unsigned short getShort (java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:07:35 / cg"
-!
-
-_Field_set:nativeContext
- "/ void set (java.lang.Object java.lang.Object)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:04:33 / cg"
-!
-
-_Field_setBoolean:nativeContext
- "/ void setBoolean (java.lang.Object boolean)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:06:06 / cg"
-!
-
-_Field_setByte:nativeContext
- "/ void setByte (java.lang.Object byte)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:06:20 / cg"
-!
-
-_Field_setChar:nativeContext
- "/ void setChar (java.lang.Object char)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:03:48 / cg"
-!
-
-_Field_setDouble:nativeContext
- "/ void setDouble (java.lang.Object double)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:04:02 / cg"
-!
-
-_Field_setFloat:nativeContext
- "/ void setFloat (java.lang.Object float)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:06:48 / cg"
-!
-
-_Field_setInt:nativeContext
- "/ void setInt (java.lang.Object int)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:05:04 / cg"
-!
-
-_Field_setLong:nativeContext
- "/ void setLong (java.lang.Object long)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:06:37 / cg"
-!
-
-_Field_setShort:nativeContext
- "/ void setShort (java.lang.Object unsigned short)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 02:53:55 / cg"
- "Created: / 27.1.2000 / 03:03:23 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.math'!
-
-_BigInteger_plumbInit:nativeContext
- UnimplementedNativeMethodSignal raiseRequest
-
- "Modified: / 12.11.1998 / 19:23:00 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.net'!
-
-_InetAddressImpl_getHostByAddr:nativeContext
- "/ java.lang.String getHostByAddr (int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:08:04 / cg"
-!
-
-_InetAddressImpl_getInetFamily:nativeContext
- "/ self unimplementedNativeMethod.
- ^ 0
-
- "Modified: / 15.8.1997 / 17:04:43 / cg"
- "Created: / 5.1.1998 / 02:05:48 / cg"
-!
-
-_InetAddressImpl_getLocalHostName:nativeContext
- ""
-
- |hostName|
-
- hostName := OperatingSystem getHostName.
-
- ^ (Java as_String:hostName).
-
- "Modified: / 7.8.1997 / 21:16:55 / cg"
- "Created: / 5.1.1998 / 02:07:03 / cg"
-!
-
-_InetAddressImpl_lookupAllHostAddr:nativeContext
- ""
-
- |jAddrImpl jHostName hostName addrBytes|
-
- jAddrImpl := nativeContext receiver.
- jHostName := nativeContext argAt:1.
-
- hostName := Java as_ST_String:jHostName.
- addrBytes := Socket ipAddressOfHost:hostName.
- addrBytes isNil ifTrue:[
- addrBytes := #[0 0 0 0] copy
- ].
- ^ Array with:addrBytes
-
- "Modified: / 8.8.1997 / 12:04:25 / cg"
- "Created: / 7.1.1998 / 18:51:31 / cg"
-!
-
-_InetAddressImpl_makeAnyLocalAddress:nativeContext
- ""
-
- |jAddrImpl jAddr hostName addrBytes address|
-
- jAddrImpl := nativeContext receiver.
- jAddr := nativeContext argAt:1.
-
- hostName := OperatingSystem getHostName.
- addrBytes := Socket ipAddressOfHost:hostName.
- addrBytes isNil ifTrue:[
- addrBytes := #[127 0 0 0].
- ].
- "/ MSB first into an integer.
- address := (addrBytes at:1).
- address := (address bitShift:8) bitOr:(addrBytes at:2).
- address := (address bitShift:8) bitOr:(addrBytes at:3).
- address := (address bitShift:8) bitOr:(addrBytes at:4).
-
- jAddr instVarNamed:'hostName' put:(Java as_String:hostName).
- jAddr instVarNamed:'address' put:address.
- jAddr instVarNamed:'family' put:0.
-
- ^ nil
-
- "Created: / 5.1.1998 / 02:06:27 / cg"
- "Modified: / 21.10.1998 / 03:30:29 / cg"
-!
-
-_PlainDatagramSocketImpl_bind:nativeContext
- |jsock jaddr port sock hostName ok err|
-
- jsock := nativeContext receiver.
- port := nativeContext argAt:1.
- jaddr := nativeContext argAt:2.
-
- hostName := jaddr instVarNamed:'hostName'.
- hostName isNil ifTrue:[
- self halt.
- ] ifFalse:[
- hostName := Java as_ST_String:hostName
- ].
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
- ].
-
- ok := sock bindTo:port address:nil "hostName".
- ok ifFalse:[
- err := OperatingSystem lastErrorString.
- Transcript showCR:'sock err: ' , err printString.
- self throwIOExceptionWithMessage:'bind failed'.
- ]
- ].
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainDatagramSocketImpl_datagramSocketClose:nativeContext
- |jsock sock|
-
- jsock := nativeContext receiver.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- 'JAVA: datagram close socket' infoPrintCR
- ].
- sock close.
- ].
-
- "Modified: / 21.8.1997 / 17:09:40 / cg"
- "Created: / 25.1.1998 / 20:04:24 / cg"
-!
-
-_PlainDatagramSocketImpl_datagramSocketCreate:nativeContext
- |jsock fd sock fileNo|
-
- jsock := nativeContext receiver.
-
- fd := jsock instVarNamed:'fd'.
- (fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'file already open in socketCreate'.
- ^ self.
- ].
-
- FileOpenTrace ifTrue:[
- ('JAVA: create datagram socket') infoPrintCR.
- ].
-
- sock := Socket newUDP.
- sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketCreate failed'.
- ].
-
- fileNo := self addOpenFile:sock.
- fd instVarNamed:'fd' put:fileNo.
-
- "Created: / 25.1.1998 / 19:59:25 / cg"
- "Modified: / 30.12.1998 / 20:10:38 / cg"
-!
-
-_PlainDatagramSocketImpl_join:nativeContext
- "/ native void join (InetAddress arg1)
-
- |jsock addr sock ok err|
-
- jsock := nativeContext receiver.
- addr := nativeContext argAt:1.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket join ' , addr printString) infoPrintCR
- ].
- self throwIOExceptionWithMessage:'unimplemented: join'.
-self halt.
- ^ nil. "/ void
- ].
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainDatagramSocketImpl_receive:nativeContext
- |jsock jdatagramPacket sock ok|
-
- jsock := nativeContext receiver.
- jdatagramPacket := nativeContext argAt:1.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket receive') infoPrintCR
- ].
- ^ -1.
- ].
- ^ -1
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainDatagramSocketImpl_send:nativeContext
- |jsock jdatagramPacket sock ok|
-
- jsock := nativeContext receiver.
- jdatagramPacket := nativeContext argAt:1.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket send') infoPrintCR
- ].
- ^ -1.
- ].
- ^ -1
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainDatagramSocketImpl_socketGetOption:nativeContext
- |jsock opt port sock hostName ok err|
-
- jsock := nativeContext receiver.
- opt := nativeContext argAt:1.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket getOption ' , opt printString) infoPrintCR
- ].
- self throwIOExceptionWithMessage:'unimplemented: getOption'.
-self halt.
- ^ -1.
- ].
- ^ -1.
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainDatagramSocketImpl_socketSetOption:nativeContext
- "/ native void socketSetOption (int arg1, java.lang.Object arg2)
-
- |jsock opt optVal sock ok err jSocketOptions|
-
- jsock := nativeContext receiver.
- opt := nativeContext argAt:1.
- optVal := nativeContext argAt:2.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket setOption ' , opt printString) infoPrintCR
- ].
-
- jSocketOptions := Java at:'java.net.SocketOptions'.
- (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[
- ] ifFalse:[
- self throwIOExceptionWithMessage:'bad arg to setOption'.
- ]
- ]
- ]
- ]
- ]
- ].
- self throwIOExceptionWithMessage:'unimplemented: setOption'.
-self halt.
- ^ nil. "/ void
- ].
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainSocketImpl_initProto:nativeContext
-
- "Created: / 12.1.1998 / 12:56:52 / cg"
-!
-
-_PlainSocketImpl_socketAccept:nativeContext
- |jsock fd newJSock sock newSock fileNo|
-
- jsock := nativeContext receiver.
-
- sock := self validateFile:jsock.
- sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'nil socket in accept'.
- ^ self.
- ].
-
- newJSock := nativeContext argAt:1.
- fd := newJSock instVarNamed:'fd'.
- (fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'socket already open in socketAccept'.
- ^ self.
- ].
- FileIOTrace ifTrue:[
- 'JAVA: socket accept' infoPrintCR
- ].
- newSock := sock accept.
- newSock isNil ifTrue:[
- self throwIOExceptionWithMessage:'accept failed'.
- ].
- fileNo := self addOpenFile:newSock.
- fd instVarNamed:'fd' put:fileNo.
-
- "Created: / 4.2.1998 / 15:26:49 / cg"
- "Modified: / 30.12.1998 / 20:10:01 / cg"
-!
-
-_PlainSocketImpl_socketAvailable:nativeContext
- |jSock sock n|
-
- jSock := nativeContext receiver.
-
- sock := self validateFile:jSock.
- sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
- ^ self.
- ].
-
- n := sock numAvailable.
- ^ n
-
- "Created: / 4.2.1998 / 16:58:49 / cg"
- "Modified: / 30.12.1998 / 20:10:08 / cg"
-!
-
-_PlainSocketImpl_socketBind:nativeContext
- |jsock jaddr port sock hostName ok err|
-
- jsock := nativeContext receiver.
- jaddr := nativeContext argAt:1.
- port := nativeContext argAt:2.
-
- hostName := jaddr instVarNamed:'hostName'.
- hostName isNil ifTrue:[
- self halt.
- ] ifFalse:[
- hostName := Java as_ST_String:hostName
- ].
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
- ].
-
- ok := sock bindTo:port address:nil "hostName".
- ok ifFalse:[
- err := OperatingSystem lastErrorString.
- Transcript showCR:'sock err: ' , err printString.
- self throwIOExceptionWithMessage:'bind failed'.
- ]
- ].
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
-!
-
-_PlainSocketImpl_socketClose:nativeContext
- |jsock sock|
-
- jsock := nativeContext receiver.
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- 'JAVA: close socket' infoPrintCR
- ].
- sock close.
- ].
-
- "Modified: / 21.8.1997 / 17:09:40 / cg"
- "Created: / 25.1.1998 / 20:04:24 / cg"
-!
-
-_PlainSocketImpl_socketConnect:nativeContext
- |jsock jaddr port sock addr hostName ok|
-
- jsock := nativeContext receiver.
- jaddr := nativeContext argAt:1.
- port := nativeContext argAt:2.
-
- hostName := jaddr instVarNamed:'hostName'.
- hostName notNil ifTrue:[
- hostName := Java as_ST_String:hostName
- ] ifFalse:[
- addr := jaddr instVarNamed:'address'.
- addr notNil ifTrue:[
- hostName := ByteArray new:4.
- hostName at:4 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:3 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:2 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:1 put:(addr bitAnd:16rFF).
- ].
- ].
- hostName isNil ifTrue:[
- self halt.
- ].
-
- sock := self validateFile:jsock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR
- ].
- SocketConnectConfirmation ifTrue:[
- (PermittedHostConnects isNil
- or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[
- (self confirm:'connect to host: ' , hostName printString , ' - ok ?')
- ifFalse:[
- self throwIOExceptionWithMessage:'connect permission denied'.
- ].
-
- (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs)
- ifTrue:[
- PermittedHostConnects isNil ifTrue:[
- PermittedHostConnects := Set new
- ].
- PermittedHostConnects add:hostName.
- ]
- ]
- ].
-
- ok := sock connectTo:hostName port:port.
- ok ifFalse:[
- self throwIOExceptionWithMessage:'connect failed'.
- ]
- ].
-
- "Created: / 25.1.1998 / 20:02:27 / cg"
- "Modified: / 30.12.1998 / 20:10:28 / cg"
-!
-
-_PlainSocketImpl_socketCreate:nativeContext
- |jsock isStream fd sock fileNo|
-
- jsock := nativeContext receiver.
- isStream := (nativeContext argAt:1) == 1.
-
- fd := jsock instVarNamed:'fd'.
- (fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'file already open in socketCreate'.
- ^ self.
- ].
-
- FileOpenTrace ifTrue:[
- ('JAVA: create socket') infoPrintCR.
- ].
-
- isStream ifTrue:[
- sock := Socket newTCP
- ] ifFalse:[
- sock := Socket newUDP
- ].
- sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketCreate failed'.
- ].
-
- fileNo := self addOpenFile:sock.
- fd instVarNamed:'fd' put:fileNo.
-
- "Created: / 25.1.1998 / 19:59:25 / cg"
- "Modified: / 30.12.1998 / 20:10:38 / cg"
-!
-
-_PlainSocketImpl_socketListen:nativeContext
- |jSock time sock ok|
-
- jSock := nativeContext receiver.
- time := nativeContext argAt:1.
-
- sock := self validateFile:jSock.
- sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket listen with timeout ' , time printString) infoPrintCR.
- ].
- ok := sock listenWithBacklog:5.
- ok ifFalse:[
- self throwIOExceptionWithMessage:'listen failed'.
- ^ self.
- ].
- time ~~ 0 ifTrue:[
- sock readWaitWithTimeoutMs:time
- ]
- ].
-
- "Created: / 4.2.1998 / 15:17:48 / cg"
- "Modified: / 30.12.1998 / 20:10:46 / cg"
-!
-
-_SocketInputStream_socketRead:nativeContext
- ^ self anyStream_readBytes:nativeContext
-
- "Created: / 25.1.1998 / 20:56:53 / cg"
- "Modified: / 4.2.1998 / 15:52:31 / cg"
-!
-
-_SocketOutputStream_socketWrite:nativeContext
- ^ self anyStream_writeBytes:nativeContext
-
- "Created: / 25.1.1998 / 21:06:55 / cg"
- "Modified: / 4.2.1998 / 15:52:40 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.net - jdk1.2'!
-
-_InetAddress_init:nativeContext
- "/ introduced with jdk1.2 ... (sigh)
-
- "Created: / 27.1.1998 / 18:16:40 / cg"
-
-
-! !
-
-!JavaVM class methodsFor:'native - java.net - ms'!
-
-_ClassLoader_findSystemClass:nativeContext
- ^ self _ClassLoader_findSystemClass0:nativeContext
-
- "Created: / 18.11.1998 / 00:00:14 / cg"
-!
-
-_InetAddress_getInetFamily:nativeContext
- "/ self unimplementedNativeMethod.
- ^ 0
-
- "Modified: / 15.8.1997 / 17:04:43 / cg"
- "Created: / 17.11.1998 / 23:54:38 / cg"
-!
-
-_InetAddress_getLocalHostName:nativeContext
- ""
-
- |hostName|
-
- hostName := OperatingSystem getHostName.
-
- ^ Java as_String:hostName.
-
- "Modified: / 7.8.1997 / 21:16:55 / cg"
- "Created: / 17.11.1998 / 23:54:54 / cg"
-!
-
-_InetAddress_lookupAllHostAddr:nativeContext
- ""
-
- |jAddrImpl jHostName hostName addrBytes|
-
- jAddrImpl := nativeContext receiver.
- jHostName := nativeContext argAt:1.
-
- hostName := Java as_ST_String:jHostName.
- addrBytes := Socket ipAddressOfHost:hostName.
- addrBytes isNil ifTrue:[
- addrBytes := #[0 0 0 0] copy
- ].
- ^ Array with:addrBytes
-
- "Modified: / 8.8.1997 / 12:04:25 / cg"
- "Created: / 17.11.1998 / 23:56:10 / cg"
-!
-
-_InetAddress_lookupHostByAddr:nativeContext
- "java.lang.Object[] lookupHostByAddr (int)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 02:59:22 / cg"
-!
-
-_InetAddress_lookupHostByName:nativeContext
- "java.lang.Object[] lookupHostByName (java.lang.String)"
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 02:58:53 / cg"
-!
-
-_InetAddress_makeAnyLocalAddress:nativeContext
- ""
-
- |jAddrImpl jAddr hostName addrBytes address|
-
- jAddrImpl := nativeContext receiver.
- jAddr := nativeContext argAt:1.
-
- hostName := OperatingSystem getHostName.
- addrBytes := Socket ipAddressOfHost:hostName.
- addrBytes isNil ifTrue:[
- addrBytes := #[127 0 0 0].
- ].
- "/ MSB first into an integer.
- address := (addrBytes at:1).
- address := (address bitShift:8) bitOr:(addrBytes at:2).
- address := (address bitShift:8) bitOr:(addrBytes at:3).
- address := (address bitShift:8) bitOr:(addrBytes at:4).
-
- jAddr instVarNamed:'hostName' put:(Java as_String:hostName).
- jAddr instVarNamed:'address' put:address.
- jAddr instVarNamed:'family' put:0.
-
- ^ nil
-
- "Modified: / 21.10.1998 / 03:30:29 / cg"
- "Created: / 17.11.1998 / 23:54:00 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.util.zip - ms'!
-
-_CRC32_update1:nativeContext
- "/ void update1 (int)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
-!
-
-_CRC32_update:nativeContext
- "/ void update (byte[] int int)
-
-UnimplementedNativeMethodSignal raiseRequest.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:09:20 / cg"
-!
-
-_Inflater_end0:nativeContext
- "/ void end0 ()
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:11:21 / cg"
-!
-
-_Inflater_getAdler0:nativeContext
- "/ int getAdler0 ()
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:12:15 / cg"
-!
-
-_Inflater_getTotalIn0:nativeContext
- "/ int getTotalIn0 ()
-
-UnimplementedNativeMethodSignal raise.
-
- "Created: / 27.1.2000 / 03:10:50 / cg"
- "Modified: / 27.1.2000 / 03:11:08 / cg"
-!
-
-_Inflater_getTotalOut0:nativeContext
- "/ int getTotalOut0 ()
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:12:01 / cg"
-!
-
-_Inflater_inflate0:nativeContext
- "/ int inflate0 (byte[] int int)
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:11:39 / cg"
-!
-
-_Inflater_reset0:nativeContext
- "/ void reset0 ()
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:11:02 / cg"
-!
-
-_Inflater_setDictionary0:nativeContext
- "/ void setDictionary0 (byte[] int int)
-
-UnimplementedNativeMethodSignal raise.
-
- "Modified: / 27.1.2000 / 03:08:47 / cg"
- "Created: / 27.1.2000 / 03:10:33 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.utils'!
-
-_ResourceBundle_getClassContext:nativeContext
- "returns an array filled with the contextChain receivers classes.
- What an ugly, messy interface."
-
- |chain con cls jClass|
-
- chain := OrderedCollection new.
- con := thisContext sender.
- [con notNil
- and:[con receiver isMethod not
- or:[con receiver isJavaMethod not]]] whileTrue:[
- con := con sender.
- ].
- con := con sender.
-
- [con notNil] whileTrue:[
- (true "con isJavaContext") ifTrue:[
- cls := con receiver class.
- cls isMeta ifTrue:[
- "/ t'was a static method
- cls := cls soleInstance
- ].
- cls isJavaClass ifTrue:[
- jClass := JavaClasses at:cls ifAbsent:nil.
- jClass isNil ifTrue:[
- JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new).
- JavaClasses at:jClass put:cls.
- ].
- chain add:jClass.
- ]
- ].
- con := con sender.
- ].
- ^ chain asArray
-
- "Created: / 5.1.1998 / 02:47:00 / cg"
- "Modified: / 24.12.1998 / 00:34:57 / cg"
-! !
-
-!JavaVM class methodsFor:'native - java.utils.zip'!
-
-_Inflater_inflate:nativeContext
- "public native synchronized int inflate (byte[] arg1, int arg2, int arg3)"
-
- |inBytes in outBytes len offs|
-
- inBytes := nativeContext argAt:1.
- offs := nativeContext argAt:2.
- len := nativeContext argAt:3.
-
- outBytes := ByteArray new:16*1024.
- in := inBytes copyFrom:offs+1 to:offs+len.
-
- UnimplementedNativeMethodSignal raise
-
- "Created: / 27.1.1999 / 20:57:37 / cg"
- "Modified: / 27.1.1999 / 21:10:13 / cg"
-!
-
-_Inflater_init:nativeContext
-
- "Created: / 1.2.1998 / 20:14:01 / cg"
-!
-
-_Inflater_reset:nativeContext
-
- "Created: / 1.2.1998 / 20:14:13 / cg"
-! !
-
-!JavaVM class methodsFor:'native - kaffe.lang'!
-
-_MemoryAdvice_register0:nativeContext
- "private native void register0()"
-
- "/ UnimplementedNativeMethodSignal raise
-! !
-
-!JavaVM class methodsFor:'native - netscape'!
-
-_MozillaAppletContext_pMochaOnLoad:nativeContext
- |id|
-
- id := nativeContext argAt:1.
-"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL.
- ^ nil
-
- "Created: / 6.1.1998 / 20:37:13 / cg"
- "Modified: / 6.2.1998 / 02:13:09 / cg"
-!
-
-_MozillaAppletContext_pShowDocument:nativeContext
- |jAppletContext s1 s2 s3 js|
-
- jAppletContext := nativeContext receiver.
- js := nativeContext argAt:1.
- s1 := Java as_ST_String:js.
- js := nativeContext argAt:2.
- s2 := Java as_ST_String:js.
- js := nativeContext argAt:3.
- s2 := Java as_ST_String:js.
-
- "/ somehow pass it to the html browser ....
-Transcript show:'pShowDocument: '; show:s1; show:' / ';
- show:s2; show:' / '; showCR:s3.
-
- ^ nil
-
- "Created: / 29.3.1998 / 15:53:17 / cg"
- "Modified: / 29.12.1998 / 13:32:41 / cg"
-!
-
-_MozillaAppletContext_pShowStatus:nativeContext
- |s js|
-
- js := nativeContext argAt:1.
- js isNil ifTrue:[
- s := ''
- ] ifFalse:[
- s := Java as_ST_String:js.
- ].
-
- self activityNotification:s.
-"/ Transcript showCR:s.
- ^ nil
-
- "Created: / 6.1.1998 / 18:31:34 / cg"
- "Modified: / 22.10.1998 / 01:17:46 / cg"
-!
-
-_MozillaAppletContext_setConsoleState0:nativeContext
- "/ void setConsoleState0 (int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:23:22 / cg"
-!
-
-_URLConnection_close:nativeContext
- "/ void close ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:26:03 / cg"
-!
-
-_URLConnection_finalize:nativeContext
- "/ void finalize ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:22 / cg"
-!
-
-_URLConnection_getContentLength0:nativeContext
- "/ int getContentLength0 ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:34 / cg"
-!
-
-_URLConnection_getContentType0:nativeContext
- "/ java.lang.String getContentType0 ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:42 / cg"
-!
-
-_URLConnection_getHeaderField0:nativeContext
- "/ java.lang.String getHeaderField0 (java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:53 / cg"
-!
-
-_URLConnection_pCreate:nativeContext
- "/ void pCreate (java.lang.String java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:14 / cg"
-!
-
-_URLInputStream_available:nativeContext
- "/ int available ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:26 / cg"
-!
-
-_URLInputStream_open:nativeContext
- "/ void open ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:01 / cg"
-!
-
-_URLInputStream_read:nativeContext
- "/ int read (byte[] int int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:12 / cg"
-!
-
-_URLOutputStream_open:nativeContext
- "/ void open ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:38 / cg"
-!
-
-_URLOutputStream_pClose:nativeContext
- "/ void pClose ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:25:02 / cg"
-!
-
-_URLOutputStream_write:nativeContext
- "/ void write (int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:45 / cg"
-!
-
-_URLOutputStream_writeBytes:nativeContext
- "/ void writeBytes (byte[] int int)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:24:55 / cg"
-!
-
-_URLStreamHandlerFactory_pInit:nativeContext
- "/ self unimplementedNativeMethod.
-
- "Created: / 10.1.1998 / 15:47:24 / cg"
-!
-
-_URLStreamHandlerFactory_pSupportsProtocol:nativeContext
- "/ boolean pSupportsProtocol (java.lang.String)
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:23:43 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.audio'!
-
-_AudioDevice_audioClose:nativeContext
- |device fd stream|
-
- device := nativeContext receiver.
- device notNil ifTrue:[
- fd := device instVarNamed:'dev'.
- (fd notNil and:[fd > 0]) ifTrue:[
- stream := self getOpenFileAt:fd.
- stream notNil ifTrue:[
- stream close.
- device instVarNamed:'dev' put:0.
- ]
- ]
- ]
-
- "Created: / 10.1.1998 / 15:45:16 / cg"
- "Modified: / 13.1.1998 / 18:08:20 / cg"
-!
-
-_AudioDevice_audioOpen:nativeContext
- |f stream fileNo|
-
- NoAudio ifTrue:[
- Transcript showCR:'JAVA: audio disabled'.
- ^ -1
- ].
-
- Stream streamErrorSignal handle:[:ex |
- Stream streamErrorSignal handle:[:ex |
- stream := nil.
- ex return.
- ] do:[
- stream := SoundStream writing.
- ].
- ] do:[
- stream := SoundStream writing.
- stream notNil ifTrue:[
- stream setSampleRate:8000.
- ]
- ].
- stream isNil ifTrue:[
-"/ ^ -1.
-
- f := '/dev/audio' asFilename.
- f exists ifFalse:[
- Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'.
- ^ -1
- ].
- stream := f readWriteStream.
- stream isNil ifTrue:[
- Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'.
- ^ -1
- ].
- fileNo := self addOpenFile:stream.
- ].
-
- fileNo := self addOpenFile:stream.
-
- FileOpenTrace ifTrue:[
- ('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR.
- ].
-
- ^ fileNo
-
- "Created: / 10.1.1998 / 15:45:30 / cg"
- "Modified: / 14.10.1998 / 15:20:52 / cg"
-!
-
-_AudioDevice_audioWrite:nativeContext
- |device fd stream bytes count|
-
- device := nativeContext receiver.
- device notNil ifTrue:[
- fd := device instVarNamed:'dev'.
- (fd notNil and:[fd > 0]) ifTrue:[
- stream := self getOpenFileAt:fd.
- stream notNil ifTrue:[
- bytes := nativeContext argAt:1.
- count := nativeContext argAt:2.
- stream nextPutBytes:count from:bytes startingAt:1
- ]
- ]
- ]
-
- "Created: / 10.1.1998 / 15:45:16 / cg"
- "Modified: / 13.1.1998 / 18:07:20 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.awt'!
+_FontDescriptor_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:30:52 / cg"
+!
+
+_Font_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 27.1.1998 / 21:43:25 / cg"
+!
_GifImageDecoder_parseImage:nativeContext
|decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel
@@ -8250,6 +8597,261 @@
"Modified: / 21.10.1998 / 00:35:37 / cg"
!
+_InetAddressImpl_getHostByAddr:nativeContext
+ "/ java.lang.String getHostByAddr (int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:08:04 / cg"
+!
+
+_InetAddressImpl_getInetFamily:nativeContext
+ "/ self unimplementedNativeMethod.
+ ^ 0
+
+ "Modified: / 15.8.1997 / 17:04:43 / cg"
+ "Created: / 5.1.1998 / 02:05:48 / cg"
+!
+
+_InetAddressImpl_getLocalHostName:nativeContext
+ ""
+
+ |hostName|
+
+ hostName := OperatingSystem getHostName.
+
+ ^ (Java as_String:hostName).
+
+ "Modified: / 7.8.1997 / 21:16:55 / cg"
+ "Created: / 5.1.1998 / 02:07:03 / cg"
+!
+
+_InetAddressImpl_lookupAllHostAddr:nativeContext
+ ""
+
+ |jAddrImpl jHostName hostName addrBytes|
+
+ jAddrImpl := nativeContext receiver.
+ jHostName := nativeContext argAt:1.
+
+ hostName := Java as_ST_String:jHostName.
+ addrBytes := Socket ipAddressOfHost:hostName.
+ addrBytes isNil ifTrue:[
+ addrBytes := #[0 0 0 0] copy
+ ].
+ ^ Array with:addrBytes
+
+ "Modified: / 8.8.1997 / 12:04:25 / cg"
+ "Created: / 7.1.1998 / 18:51:31 / cg"
+!
+
+_InetAddressImpl_makeAnyLocalAddress:nativeContext
+ ""
+
+ |jAddrImpl jAddr hostName addrBytes address|
+
+ jAddrImpl := nativeContext receiver.
+ jAddr := nativeContext argAt:1.
+
+ hostName := OperatingSystem getHostName.
+ addrBytes := Socket ipAddressOfHost:hostName.
+ addrBytes isNil ifTrue:[
+ addrBytes := #[127 0 0 0].
+ ].
+ "/ MSB first into an integer.
+ address := (addrBytes at:1).
+ address := (address bitShift:8) bitOr:(addrBytes at:2).
+ address := (address bitShift:8) bitOr:(addrBytes at:3).
+ address := (address bitShift:8) bitOr:(addrBytes at:4).
+
+ jAddr instVarNamed:'hostName' put:(Java as_String:hostName).
+ jAddr instVarNamed:'address' put:address.
+ jAddr instVarNamed:'family' put:0.
+
+ ^ nil
+
+ "Created: / 5.1.1998 / 02:06:27 / cg"
+ "Modified: / 21.10.1998 / 03:30:29 / cg"
+!
+
+_InetAddress_getInetFamily:nativeContext
+ "/ self unimplementedNativeMethod.
+ ^ 0
+
+ "Modified: / 15.8.1997 / 17:04:43 / cg"
+ "Created: / 17.11.1998 / 23:54:38 / cg"
+!
+
+_InetAddress_getLocalHostName:nativeContext
+ ""
+
+ |hostName|
+
+ hostName := OperatingSystem getHostName.
+
+ ^ Java as_String:hostName.
+
+ "Modified: / 7.8.1997 / 21:16:55 / cg"
+ "Created: / 17.11.1998 / 23:54:54 / cg"
+!
+
+_InetAddress_lookupAllHostAddr:nativeContext
+ ""
+
+ |jAddrImpl jHostName hostName addrBytes|
+
+ jAddrImpl := nativeContext receiver.
+ jHostName := nativeContext argAt:1.
+
+ hostName := Java as_ST_String:jHostName.
+ addrBytes := Socket ipAddressOfHost:hostName.
+ addrBytes isNil ifTrue:[
+ addrBytes := #[0 0 0 0] copy
+ ].
+ ^ Array with:addrBytes
+
+ "Modified: / 8.8.1997 / 12:04:25 / cg"
+ "Created: / 17.11.1998 / 23:56:10 / cg"
+!
+
+_InetAddress_lookupHostByAddr:nativeContext
+ "java.lang.Object[] lookupHostByAddr (int)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:59:22 / cg"
+!
+
+_InetAddress_lookupHostByName:nativeContext
+ "java.lang.Object[] lookupHostByName (java.lang.String)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 02:58:53 / cg"
+!
+
+_InetAddress_makeAnyLocalAddress:nativeContext
+ ""
+
+ |jAddrImpl jAddr hostName addrBytes address|
+
+ jAddrImpl := nativeContext receiver.
+ jAddr := nativeContext argAt:1.
+
+ hostName := OperatingSystem getHostName.
+ addrBytes := Socket ipAddressOfHost:hostName.
+ addrBytes isNil ifTrue:[
+ addrBytes := #[127 0 0 0].
+ ].
+ "/ MSB first into an integer.
+ address := (addrBytes at:1).
+ address := (address bitShift:8) bitOr:(addrBytes at:2).
+ address := (address bitShift:8) bitOr:(addrBytes at:3).
+ address := (address bitShift:8) bitOr:(addrBytes at:4).
+
+ jAddr instVarNamed:'hostName' put:(Java as_String:hostName).
+ jAddr instVarNamed:'address' put:address.
+ jAddr instVarNamed:'family' put:0.
+
+ ^ nil
+
+ "Modified: / 21.10.1998 / 03:30:29 / cg"
+ "Created: / 17.11.1998 / 23:54:00 / cg"
+!
+
+_Inflater_end0:nativeContext
+ "/ void end0 ()
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:11:21 / cg"
+!
+
+_Inflater_getAdler0:nativeContext
+ "/ int getAdler0 ()
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:12:15 / cg"
+!
+
+_Inflater_getTotalIn0:nativeContext
+ "/ int getTotalIn0 ()
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 03:10:50 / cg"
+ "Modified: / 27.1.2000 / 03:11:08 / cg"
+!
+
+_Inflater_getTotalOut0:nativeContext
+ "/ int getTotalOut0 ()
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:12:01 / cg"
+!
+
+_Inflater_inflate0:nativeContext
+ "/ int inflate0 (byte[] int int)
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:11:39 / cg"
+!
+
+_Inflater_reset0:nativeContext
+ "/ void reset0 ()
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:11:02 / cg"
+!
+
+_Inflater_setDictionary0:nativeContext
+ "/ void setDictionary0 (byte[] int int)
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:08:47 / cg"
+ "Created: / 27.1.2000 / 03:10:33 / cg"
+!
+
+_InputThread_run:nativeContext
+ self _WToolkit_eventLoop:nativeContext.
+
+ "Created: / 28.1.1998 / 22:34:47 / cg"
+ "Modified: / 28.1.1998 / 22:35:16 / cg"
+!
+
+_Introspector_getMethodDescriptor:nativeContext
+ "java.lang.String getMethodDescriptor (java.lang.reflect.Method)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:47:43 / cg"
+!
+
+_Introspector_getMethodParameterCount:nativeContext
+ "int getMethodParameterCount (java.lang.reflect.Method)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:49:15 / cg"
+!
+
+_Introspector_getPublicDeclaredMethods0:nativeContext
+ "java.lang.reflect.Method[] getPublicDeclaredMethods0 (java.lang.Class)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:48:49 / cg"
+!
+
_JPEGImageDecoder_readImage:nativeContext
UnimplementedNativeMethodSignal raise
@@ -8257,130 +8859,42 @@
"Modified: / 12.11.1998 / 18:53:40 / cg"
!
-_OffScreenImageSource_sendPixels:nativeContext
- "/ self halt.
- "/ UnimplementedNativeMethodSignal raise
-
- "Modified: / 16.1.1998 / 18:22:23 / cg"
- "Created: / 17.1.1998 / 12:36:25 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.awt - jdk1.2'!
-
-_CMM_cmmGetTagSize:nativeContext
- "/ public static native synchronized int cmmGetTagSize (long arg1, int arg2, int[] arg3)
- "/ new with jdk1.2 ...
-
- UnimplementedNativeMethodSignal raiseRequest.
- ^ -1.
-
- "Created: / 27.1.1998 / 21:43:25 / cg"
-!
-
-_CMM_cmmInit:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 27.1.1998 / 21:43:25 / cg"
-!
-
-_CMM_cmmLoadProfile:nativeContext
- "/ public static native synchronized int cmmLoadProfile (byte[] arg1, long[] arg2)
- "/ new with jdk1.2 ...
-
- UnimplementedNativeMethodSignal raiseRequest.
- ^ -1.
-
- "Created: / 27.1.1998 / 21:43:25 / cg"
-!
-
-_ColorModel_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:19:23 / cg"
-!
-
-_Color_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:19:23 / cg"
-!
-
-_FontDescriptor_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:30:52 / cg"
-!
-
-_Font_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 27.1.1998 / 21:43:25 / cg"
-!
-
-_PackedColorModel_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:19:35 / cg"
-!
-
-_PlatformFont_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:30:41 / cg"
-!
-
-_ScrollPane_initIDs:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 22:19:23 / cg"
-!
-
-_X11GraphicsDevice_getConfigType:nativeContext
- "/ new with jdk1.2 ...
-
- |configNr cls|
-
- "/ for now, only one config.
- configNr := nativeContext argAt:1.
-
- cls := Java classNamed:'java.awt.GraphicsDevice'.
- ^ cls instVarNamed:'TYPE_RASTER_SCREEN'.
-
- "Created: / 28.1.1998 / 22:19:05 / cg"
-!
-
-_X11GraphicsDevice_getNumConfigs:nativeContext
- "/ new with jdk1.2 ...
-
- ^ 1
-
- "Created: / 28.1.1998 / 22:13:26 / cg"
- "Modified: / 28.1.1998 / 22:14:33 / cg"
-!
-
-_X11GraphicsEnvironment_getNumScreens:nativeContext
- "/ new with jdk1.2 ...
-
- "/ could return the actual number of screens ...
-
- ^ 1
-
- "Created: / 28.1.1998 / 01:50:22 / cg"
- "Modified: / 28.1.1998 / 22:12:32 / cg"
-!
-
-_X11GraphicsEnvironment_initDisplay:nativeContext
- "/ new with jdk1.2 ...
-
- "Created: / 28.1.1998 / 01:50:22 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.awt.motif'!
-
_MButtonPeer_create:nativeContext
^ self _WButtonPeer_create:nativeContext
!
+_MCanvasPeer_create:nativeContext
+ |jCanvasPeer jFrame frame subView|
+
+ jCanvasPeer := nativeContext receiver.
+
+ jFrame := nativeContext argAt:1.
+ jFrame isNil ifTrue:[
+ self halt:'no frame in canvasPeer create'.
+ self internalError:'no frame in canvasPeer create'.
+ ^ self.
+ ].
+ frame := jFrame instVarNamed:'pData'.
+
+ subView := JavaView in:frame.
+ subView delegate:self.
+ subView javaPeer:jCanvasPeer.
+
+ self createdWindowsView:subView for:jCanvasPeer.
+
+ WindowCreationTrace == true ifTrue:[
+ 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
+ ].
+
+ "Modified: / 16.1.1998 / 13:40:00 / cg"
+ "Created: / 18.11.1998 / 00:14:44 / cg"
+!
+
+_MComponentPeer_cacheInit:nativeContext
+
+ "Created: / 28.1.1998 / 22:22:30 / cg"
+!
+
_MComponentPeer_handleEvent:nativeContext
^ self _WComponentPeer_handleEvent:nativeContext
@@ -8391,6 +8905,23 @@
^ self _WComponentPeer_nativeHandleEvent:nativeContext
!
+_MComponentPeer_pHide:nativeContext
+ ^ self _WComponentPeer_hide:nativeContext
+
+ "Created: / 18.11.1998 / 00:15:18 / cg"
+!
+
+_MComponentPeer_pInitialize:nativeContext
+
+ "Created: / 28.1.1998 / 22:27:25 / cg"
+!
+
+_MComponentPeer_pReshape:nativeContext
+ self commonReshapeComponent:nativeContext
+
+ "Created: / 18.11.1998 / 00:18:17 / cg"
+!
+
_MComponentPeer_pSetBackground:nativeContext
|view jClr rgb clr|
@@ -8468,99 +8999,26 @@
"Created: / 18.11.1998 / 00:21:51 / cg"
!
-_MToolkit_loadSystemColors:nativeContext
- ^ self _WToolkit_loadSystemColors:nativeContext
-!
-
-_X11FontMetrics_getMFCharSegmentWidth:nativeContext
- "get multi-font string-segment width.
- Not yet supported - use standard strings width"
-
- |jMetrics jFont jFontDescr stFont w
- bool1 cp offs lenght bp int1|
-
- jMetrics := nativeContext receiver.
- jFont := nativeContext argAt:1.
- jFontDescr := nativeContext argAt:2.
- cp := nativeContext argAt:3.
- lenght := nativeContext argAt:4.
-
- stFont := jFont instVarNamed:'pData'.
- (stFont isNil or:[stFont == 0]) ifTrue:[
- self halt
- ].
-
- stFont device isNil ifTrue:[
- stFont := stFont on:Display.
- jFont instVarNamed:'pData' put:stFont.
- ].
- w := stFont widthOf:cp from:1 to:lenght.
- ^ w.
-!
-
-_X11FontMetrics_init:nativeContext
- ^ self _WFontMetrics_init:nativeContext
-!
-
-_X11Graphics_changeClip:nativeContext
- ^ self _WGraphics_changeClip:nativeContext
-!
-
-_X11Graphics_createFromComponent:nativeContext
- ^ self _WGraphics_createFromComponent:nativeContext
-!
-
-_X11Graphics_disposeImpl:nativeContext
- ^ self _WGraphics_dispose:nativeContext
-!
-
-_X11Graphics_drawMFCharsSegment:nativeContext
- ^ self _WGraphics_drawMFCharsSegment:nativeContext
-!
-
-_X11Graphics_drawRect:nativeContext
- ^ self _WGraphics_drawRect:nativeContext
-!
-
-_X11Graphics_fillOval:nativeContext
- ^ self _WGraphics_fillOval:nativeContext
-!
-
-_X11Graphics_fillRect:nativeContext
- ^ self _WGraphics_fillRect:nativeContext
-!
-
-_X11Graphics_pSetFont:nativeContext
- ^ self _WGraphics_pSetFont:nativeContext
-!
-
-_X11Graphics_pSetForeground:nativeContext
- ^ self _WGraphics_pSetForeground:nativeContext
-! !
-
-!JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'!
-
-_InputThread_run:nativeContext
- self _WToolkit_eventLoop:nativeContext.
-
- "Created: / 28.1.1998 / 22:34:47 / cg"
- "Modified: / 28.1.1998 / 22:35:16 / cg"
-!
-
-_MComponentPeer_cacheInit:nativeContext
-
- "Created: / 28.1.1998 / 22:22:30 / cg"
-!
-
-_MComponentPeer_pHide:nativeContext
- ^ self _WComponentPeer_hide:nativeContext
-
- "Created: / 18.11.1998 / 00:15:18 / cg"
-!
-
-_MComponentPeer_pInitialize:nativeContext
-
- "Created: / 28.1.1998 / 22:27:25 / cg"
+_MComponentPeer_setBackground:nativeContext
+ |jClr rgb clr view|
+
+ view := self viewForWPeer:nativeContext.
+
+ jClr := nativeContext argAt:1.
+ rgb := jClr instVarNamed:'value'.
+"/ self halt.
+ clr := Color rgbValue:rgb.
+
+
+ clr := clr on:(view device).
+
+ (view isKindOf:ScrollableView) ifTrue:[
+ view := view scrolledView
+ ].
+ view viewBackground:clr.
+ view backgroundPaint:clr.
+
+ "Created: / 17.11.1998 / 23:49:41 / cg"
!
_MComponentPeer_setCursor:nativeContext
@@ -8568,12 +9026,46 @@
"Created: / 28.1.1998 / 22:27:35 / cg"
!
+_MComponentPeer_setFont:nativeContext
+ |view|
+
+ view := self viewForWPeer:nativeContext.
+"/ self halt.
+
+ "Modified: / 25.1.1998 / 01:22:19 / cg"
+ "Created: / 17.11.1998 / 23:43:48 / cg"
+!
+
+_MComponentPeer_setForeground:nativeContext
+ |jClr rgb clr view|
+
+ view := self viewForWPeer:nativeContext.
+
+ jClr := nativeContext argAt:1.
+ rgb := jClr instVarNamed:'value'.
+"/ self halt.
+ clr := Color rgbValue:rgb.
+
+ clr := clr on:(view device).
+
+ view paint:clr.
+
+ "Created: / 17.11.1998 / 23:50:31 / cg"
+ "Modified: / 17.11.1998 / 23:57:29 / cg"
+!
+
_MFramePeer_create:nativeContext
^ self _WFramePeer_create:nativeContext
"Created: / 28.1.1998 / 22:25:44 / cg"
!
+_MFramePeer_getWindowBackgroundColor:nativeContext
+ ^ View defaultViewBackgroundColor rgbValue.
+
+ "Created: / 17.11.1998 / 23:55:42 / cg"
+!
+
_MFramePeer_pHide:nativeContext
^ self _WComponentPeer_hide:nativeContext
@@ -8593,17 +9085,2182 @@
"Created: / 28.1.1998 / 22:30:23 / cg"
!
+_MFramePeer_pShow:nativeContext
+ |view|
+
+ view := self viewForWPeer:nativeContext.
+
+ "/ frame views are under my browsers own control
+ (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+ view beVisible.
+ view realize.
+ ].
+
+"/ view windowGroup notNil ifTrue:[
+"/ windowServer addGroup:(view windowGroup)
+"/ ].
+
+ ^ nil
+
+"/ self halt.
+
+ "Modified: / 25.1.1998 / 09:54:07 / cg"
+ "Created: / 18.11.1998 / 00:19:59 / cg"
+!
+
+_MFramePeer_setInsets:nativeContext
+
+ "Created: / 17.11.1998 / 23:55:32 / cg"
+!
+
+_MFramePeer_setResizable:nativeContext
+ |view onOff|
+
+ view := self viewForWPeer:nativeContext.
+
+ onOff := (nativeContext argAt:1) == 1.
+ view isTopView ifTrue:[
+ onOff ifTrue:[
+ view minExtent:10@10.
+ view maxExtent:(Screen current extent).
+ ] ifFalse:[
+ view minExtent:view extent.
+ view maxExtent:view extent.
+ ]
+ ] ifFalse:[
+ (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+ self halt.
+ ]
+ ].
+
+"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
+
+ ^ nil
+
+ "Modified: / 16.1.1998 / 18:08:00 / cg"
+ "Created: / 17.11.1998 / 23:51:45 / cg"
+!
+
+_MToolkit_callbackLoop:nativeContext
+ |toolKit|
+
+ toolKit := nativeContext receiver.
+^ self.
+self halt.
+ self wakeup:toolKit.
+self halt.
+
+ (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
+ 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
+ ].
+
+ JavaEventThread := Processor activeProcess.
+ [
+ [true] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self doWindowsEventThread.
+ ]
+ ].
+ ] valueNowOrOnUnwindDo:[
+ JavaEventThread := nil.
+ ].
+
+ "Created: / 17.11.1998 / 23:58:33 / cg"
+ "Modified: / 8.1.1999 / 17:08:35 / cg"
+!
+
+_MToolkit_eventLoop:nativeContext
+ |toolKit|
+
+ (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
+ 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
+ ].
+
+ toolKit := nativeContext receiver.
+
+ self wakeup:toolKit.
+self halt.
+
+ JavaEventThread := Processor activeProcess.
+ [
+ [true] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self doWindowsEventThread.
+ ]
+ ].
+ ] valueNowOrOnUnwindDo:[
+ JavaEventThread := nil.
+ ].
+
+ "Created: / 17.11.1998 / 23:04:29 / cg"
+ "Modified: / 8.1.1999 / 17:08:21 / cg"
+!
+
_MToolkit_init:nativeContext
"Created: / 28.1.1998 / 22:21:54 / cg"
!
+_MToolkit_loadSystemColors:nativeContext
+ ^ self _WToolkit_loadSystemColors:nativeContext
+!
+
_MToolkit_run:nativeContext
"Created: / 28.1.1998 / 22:22:10 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.awt.windows'!
+!
+
+_Math_IEEEremainder:nativeContext
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 18:52:36 / cg"
+!
+
+_Math_acos:nativeContext
+ "arc cosine"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal arcCos
+
+ "Created: / 7.5.1998 / 00:34:50 / cg"
+ "Modified: / 11.11.1998 / 15:08:20 / cg"
+!
+
+_Math_asin:nativeContext
+ "arc sine"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal arcSin
+
+ "Created: / 7.5.1998 / 00:34:26 / cg"
+ "Modified: / 11.11.1998 / 15:08:15 / cg"
+!
+
+_Math_atan2:nativeContext
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 18:52:52 / cg"
+!
+
+_Math_atan:nativeContext
+ "arc tangens"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal arcTan
+
+ "Created: / 6.2.1998 / 01:24:12 / cg"
+ "Modified: / 11.11.1998 / 15:08:11 / cg"
+!
+
+_Math_ceil:nativeContext
+ "ceiling"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal ceilingAsFloat
+
+ "Created: / 7.1.1998 / 15:43:00 / cg"
+ "Modified: / 11.11.1998 / 15:08:04 / cg"
+!
+
+_Math_cos:nativeContext
+ "cosine"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal cos
+
+ "Created: / 7.1.1998 / 15:41:30 / cg"
+ "Modified: / 11.11.1998 / 15:07:59 / cg"
+!
+
+_Math_exp:nativeContext
+ "exponential"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal exp
+
+ "Created: / 7.5.1998 / 00:36:19 / cg"
+ "Modified: / 11.11.1998 / 15:07:50 / cg"
+!
+
+_Math_floor:nativeContext
+ "floor"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal floorAsFloat
+
+ "Created: / 7.1.1998 / 19:09:21 / cg"
+ "Modified: / 11.11.1998 / 15:07:45 / cg"
+!
+
+_Math_log:nativeContext
+ "natural logarithm"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal ln
+
+ "Created: / 7.1.1998 / 15:42:19 / cg"
+ "Modified: / 30.12.1998 / 17:41:42 / cg"
+!
+
+_Math_pow:nativeContext
+ "power"
+
+ |dVal1 dVal2|
+
+ dVal1 := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal1 isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ dVal2 := nativeContext argAt:3.
+"/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal2 isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal1 raisedTo:dVal2
+
+ "Created: / 7.1.1998 / 15:44:13 / cg"
+ "Modified: / 11.11.1998 / 15:07:33 / cg"
+!
+
+_Math_rint:nativeContext
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+ ^ dVal rounded asFloat.
+!
+
+_Math_sin:nativeContext
+ "sine"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal sin
+
+ "Created: / 7.1.1998 / 15:41:40 / cg"
+ "Modified: / 11.11.1998 / 15:07:09 / cg"
+!
+
+_Math_sqrt:nativeContext
+ "square root"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+
+ "/ how about domain errors ?
+ dVal < 0 ifTrue:[
+ ^ 0.0
+ ].
+ ^ dVal sqrt
+
+ "Created: / 7.1.1998 / 15:42:40 / cg"
+ "Modified: / 29.12.1998 / 13:22:36 / cg"
+!
+
+_Math_tan:nativeContext
+ "tangent"
+
+ |dVal|
+
+ dVal := nativeContext argAt:1.
+"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
+"/ dVal isReal ifTrue:[
+"/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR.
+"/ ] ifFalse:[
+"/ self halt:'expected double arg'
+"/ ]
+"/ ].
+ ^ dVal tan
+
+ "Created: / 7.5.1998 / 00:34:03 / cg"
+ "Modified: / 11.11.1998 / 15:07:14 / cg"
+!
+
+_MemoryAdvice_register0:nativeContext
+ "private native void register0()"
+
+ "/ UnimplementedNativeMethodSignal raise
+!
+
+_Method_getModifiers:nativeContext
+ |jMethod mthd retVal|
+
+ jMethod := nativeContext receiver.
+
+ mthd := JavaMethods at:jMethod ifAbsent:nil.
+ mthd isNil ifTrue:[
+ self halt.
+ ^ 0
+ ].
+ ^ mthd accessFlags
+
+ "Modified: / 9.4.1998 / 17:50:01 / cg"
+!
+
+_Method_invoke:nativeContext
+ "invoke a javaMethod"
+
+ |jMethod mthd rec args retVal|
+
+ jMethod := nativeContext receiver.
+ rec := nativeContext argAt:1.
+ args := nativeContext argAt:2.
+
+ mthd := JavaMethods at:jMethod ifAbsent:nil.
+ mthd isNil ifTrue:[
+ self halt.
+ ].
+
+ "/ check for arguments to match the expected types ...
+
+ mthd argSignature keysAndValuesDo:[:index :argSig |
+ |cls arg|
+
+ cls := Java at:argSig.
+ arg := args at:index.
+ (arg isKindOf:cls) ifFalse:[
+ self halt.
+ ]
+ ].
+
+ mthd isStatic ifTrue:[
+ retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector.
+ ^ retVal
+ ] ifFalse:[
+ self halt.
+ ].
+
+ self halt.
+
+ "Created: / 13.2.1998 / 15:15:28 / cg"
+ "Modified: / 13.2.1998 / 15:35:54 / cg"
+!
+
+_MozillaAppletContext_pMochaOnLoad:nativeContext
+ |id|
+
+ id := nativeContext argAt:1.
+"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL.
+ ^ nil
+
+ "Created: / 6.1.1998 / 20:37:13 / cg"
+ "Modified: / 6.2.1998 / 02:13:09 / cg"
+!
+
+_MozillaAppletContext_pShowDocument:nativeContext
+ |jAppletContext s1 s2 s3 js|
+
+ jAppletContext := nativeContext receiver.
+ js := nativeContext argAt:1.
+ s1 := Java as_ST_String:js.
+ js := nativeContext argAt:2.
+ s2 := Java as_ST_String:js.
+ js := nativeContext argAt:3.
+ s2 := Java as_ST_String:js.
+
+ "/ somehow pass it to the html browser ....
+Transcript show:'pShowDocument: '; show:s1; show:' / ';
+ show:s2; show:' / '; showCR:s3.
+
+ ^ nil
+
+ "Created: / 29.3.1998 / 15:53:17 / cg"
+ "Modified: / 29.12.1998 / 13:32:41 / cg"
+!
+
+_MozillaAppletContext_pShowStatus:nativeContext
+ |s js|
+
+ js := nativeContext argAt:1.
+ js isNil ifTrue:[
+ s := ''
+ ] ifFalse:[
+ s := Java as_ST_String:js.
+ ].
+
+ self activityNotification:s.
+"/ Transcript showCR:s.
+ ^ nil
+
+ "Created: / 6.1.1998 / 18:31:34 / cg"
+ "Modified: / 22.10.1998 / 01:17:46 / cg"
+!
+
+_MozillaAppletContext_setConsoleState0:nativeContext
+ "/ void setConsoleState0 (int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:23:22 / cg"
+!
+
+_ObjectInputStream_allocateNewArray:nativeContext
+ "/ java.lang.Object allocateNewArray (java.lang.Class int)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:02:52 / cg"
+!
+
+_ObjectInputStream_allocateNewObject:nativeContext
+ "/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:02:40 / cg"
+!
+
+_ObjectInputStream_inputClassFields:nativeContext
+ "/ void inputClassFields (java.lang.Object java.lang.Class int[])
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:02:22 / cg"
+!
+
+_ObjectInputStream_invokeDefaultReadObject:nativeContext
+ "/ void invokeDefaultReadObject (java.lang.Object java.lang.Class)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 03:00:47 / cg"
+!
+
+_ObjectInputStream_invokeObjectReader:nativeContext
+ "/ boolean invokeObjectReader (java.lang.Object java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:03:06 / cg"
+!
+
+_ObjectInputStream_invokeReadObject:nativeContext
+ "/ void invokeReadObject (java.lang.Object java.lang.Class)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 03:01:02 / cg"
+!
+
+_ObjectInputStream_loadClass0:nativeContext
+ "/ java.lang.Class loadClass0 (java.lang.Class java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:01:15 / cg"
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+!
+
+_ObjectOutputStream_invokeDefaultWriteObject:nativeContext
+ "/ void invokeDefaultWriteObject (java.lang.Object java.lang.Class)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 03:01:36 / cg"
+!
+
+_ObjectOutputStream_invokeObjectWriter:nativeContext
+ "/ boolean invokeObjectWriter (java.lang.Object java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:00:36 / cg"
+ "Modified: / 12.11.1998 / 19:01:45 / cg"
+!
+
+_ObjectOutputStream_invokeWriteObject:nativeContext
+ "/ void invokeWriteObject (java.lang.Object java.lang.Class)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 03:01:52 / cg"
+!
+
+_ObjectOutputStream_outputClassFields:nativeContext
+ "/ void outputClassFields (java.lang.Object java.lang.Class int[])
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:00:09 / cg"
+ "Modified: / 12.11.1998 / 19:01:42 / cg"
+!
+
+_ObjectStreamClass_doMismatchedRead:nativeContext
+ "/ void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 02:50:55 / cg"
+!
+
+_ObjectStreamClass_findObjectMethod0:nativeContext
+ "/ boolean findObjectMethod0 (java.lang.Class int)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 02:51:50 / cg"
+!
+
+_ObjectStreamClass_getClassAccess:nativeContext
+ "/ int getClassAccess (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:04:19 / cg"
+!
+
+_ObjectStreamClass_getClassDefinedUID:nativeContext
+ "/ long getClassDefinedUID (java.lang.Class)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 02:51:33 / cg"
+!
+
+_ObjectStreamClass_getFieldAccess:nativeContext
+ "/ int getFieldAccess (java.lang.Class java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:05:19 / cg"
+!
+
+_ObjectStreamClass_getFieldSignatures:nativeContext
+ "/ java.lang.String[] getFieldSignatures (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:05:04 / cg"
+!
+
+_ObjectStreamClass_getFields0:nativeContext
+ "/ java.io.ObjectStreamField[] getFields0 (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:05:32 / cg"
+!
+
+_ObjectStreamClass_getMethodAccess:nativeContext
+ "/ int getMethodAccess (java.lang.Class java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:04:51 / cg"
+!
+
+_ObjectStreamClass_getMethodSignatures:nativeContext
+ "/ java.lang.String[] getMethodSignatures (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:04:34 / cg"
+!
+
+_ObjectStreamClass_getSerialVersionUID:nativeContext
+ "/ long getSerialVersionUID (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:05:43 / cg"
+!
+
+_ObjectStreamClass_hasWriteObject:nativeContext
+ "/ boolean hasWriteObject (java.lang.Class)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 19:01:48 / cg"
+ "Created: / 12.11.1998 / 19:05:53 / cg"
+!
+
+_OffScreenImageSource_sendPixels:nativeContext
+ "/ self halt.
+ "/ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 16.1.1998 / 18:22:23 / cg"
+ "Created: / 17.1.1998 / 12:36:25 / cg"
+!
+
+_PackedColorModel_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:19:35 / cg"
+!
+
+_PlainDatagramSocketImpl_bind:nativeContext
+ |jsock jaddr port sock hostName ok err|
+
+ jsock := nativeContext receiver.
+ port := nativeContext argAt:1.
+ jaddr := nativeContext argAt:2.
+
+ hostName := jaddr instVarNamed:'hostName'.
+ hostName isNil ifTrue:[
+ self halt.
+ ] ifFalse:[
+ hostName := Java as_ST_String:hostName
+ ].
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
+ ].
+
+ ok := sock bindTo:port address:nil "hostName".
+ ok ifFalse:[
+ err := OperatingSystem lastErrorString.
+ Transcript showCR:'sock err: ' , err printString.
+ self throwIOExceptionWithMessage:'bind failed'.
+ ]
+ ].
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainDatagramSocketImpl_datagramSocketClose:nativeContext
+ |jsock sock|
+
+ jsock := nativeContext receiver.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ 'JAVA: datagram close socket' infoPrintCR
+ ].
+ sock close.
+ ].
+
+ "Modified: / 21.8.1997 / 17:09:40 / cg"
+ "Created: / 25.1.1998 / 20:04:24 / cg"
+!
+
+_PlainDatagramSocketImpl_datagramSocketCreate:nativeContext
+ |jsock fd sock fileNo|
+
+ jsock := nativeContext receiver.
+
+ fd := jsock instVarNamed:'fd'.
+ (fd instVarNamed:'fd') ~~ 0 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'file already open in socketCreate'.
+ ^ self.
+ ].
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: create datagram socket') infoPrintCR.
+ ].
+
+ sock := Socket newUDP.
+ sock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'socketCreate failed'.
+ ].
+
+ fileNo := self addOpenFile:sock.
+ fd instVarNamed:'fd' put:fileNo.
+
+ "Created: / 25.1.1998 / 19:59:25 / cg"
+ "Modified: / 30.12.1998 / 20:10:38 / cg"
+!
+
+_PlainDatagramSocketImpl_join:nativeContext
+ "/ native void join (InetAddress arg1)
+
+ |jsock addr sock ok err|
+
+ jsock := nativeContext receiver.
+ addr := nativeContext argAt:1.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket join ' , addr printString) infoPrintCR
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: join'.
+self halt.
+ ^ nil. "/ void
+ ].
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainDatagramSocketImpl_receive:nativeContext
+ |jsock jdatagramPacket sock ok|
+
+ jsock := nativeContext receiver.
+ jdatagramPacket := nativeContext argAt:1.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket receive') infoPrintCR
+ ].
+ ^ -1.
+ ].
+ ^ -1
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainDatagramSocketImpl_send:nativeContext
+ |jsock jdatagramPacket sock ok|
+
+ jsock := nativeContext receiver.
+ jdatagramPacket := nativeContext argAt:1.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket send') infoPrintCR
+ ].
+ ^ -1.
+ ].
+ ^ -1
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainDatagramSocketImpl_socketGetOption:nativeContext
+ |jsock opt port sock hostName ok err|
+
+ jsock := nativeContext receiver.
+ opt := nativeContext argAt:1.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket getOption ' , opt printString) infoPrintCR
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: getOption'.
+self halt.
+ ^ -1.
+ ].
+ ^ -1.
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainDatagramSocketImpl_socketSetOption:nativeContext
+ "/ native void socketSetOption (int arg1, java.lang.Object arg2)
+
+ |jsock opt optVal sock ok err jSocketOptions|
+
+ jsock := nativeContext receiver.
+ opt := nativeContext argAt:1.
+ optVal := nativeContext argAt:2.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket setOption ' , opt printString) infoPrintCR
+ ].
+
+ jSocketOptions := Java at:'java.net.SocketOptions'.
+ (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[
+ ] ifFalse:[
+ self throwIOExceptionWithMessage:'bad arg to setOption'.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: setOption'.
+self halt.
+ ^ nil. "/ void
+ ].
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainSocketImpl_socketAccept:nativeContext
+ |jsock fd newJSock sock newSock fileNo|
+
+ jsock := nativeContext receiver.
+
+ sock := self validateFile:jsock.
+ sock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'nil socket in accept'.
+ ^ self.
+ ].
+
+ newJSock := nativeContext argAt:1.
+ fd := newJSock instVarNamed:'fd'.
+ (fd instVarNamed:'fd') ~~ 0 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'socket already open in socketAccept'.
+ ^ self.
+ ].
+ FileIOTrace ifTrue:[
+ 'JAVA: socket accept' infoPrintCR
+ ].
+ newSock := sock accept.
+ newSock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'accept failed'.
+ ].
+ fileNo := self addOpenFile:newSock.
+ fd instVarNamed:'fd' put:fileNo.
+
+ "Created: / 4.2.1998 / 15:26:49 / cg"
+ "Modified: / 30.12.1998 / 20:10:01 / cg"
+!
+
+_PlainSocketImpl_socketAvailable:nativeContext
+ |jSock sock n|
+
+ jSock := nativeContext receiver.
+
+ sock := self validateFile:jSock.
+ sock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
+ ^ self.
+ ].
+
+ n := sock numAvailable.
+ ^ n
+
+ "Created: / 4.2.1998 / 16:58:49 / cg"
+ "Modified: / 30.12.1998 / 20:10:08 / cg"
+!
+
+_PlainSocketImpl_socketBind:nativeContext
+ |jsock jaddr port sock hostName ok err|
+
+ jsock := nativeContext receiver.
+ jaddr := nativeContext argAt:1.
+ port := nativeContext argAt:2.
+
+ hostName := jaddr instVarNamed:'hostName'.
+ hostName isNil ifTrue:[
+ self halt.
+ ] ifFalse:[
+ hostName := Java as_ST_String:hostName
+ ].
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
+ ].
+
+ ok := sock bindTo:port address:nil "hostName".
+ ok ifFalse:[
+ err := OperatingSystem lastErrorString.
+ Transcript showCR:'sock err: ' , err printString.
+ self throwIOExceptionWithMessage:'bind failed'.
+ ]
+ ].
+
+ "Created: / 4.2.1998 / 15:06:20 / cg"
+ "Modified: / 30.12.1998 / 20:10:16 / cg"
+!
+
+_PlainSocketImpl_socketClose:nativeContext
+ |jsock sock|
+
+ jsock := nativeContext receiver.
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ 'JAVA: close socket' infoPrintCR
+ ].
+ sock close.
+ ].
+
+ "Modified: / 21.8.1997 / 17:09:40 / cg"
+ "Created: / 25.1.1998 / 20:04:24 / cg"
+!
+
+_PlainSocketImpl_socketConnect:nativeContext
+ |jsock jaddr port sock addr hostName ok|
+
+ jsock := nativeContext receiver.
+ jaddr := nativeContext argAt:1.
+ port := nativeContext argAt:2.
+
+ hostName := jaddr instVarNamed:'hostName'.
+ hostName notNil ifTrue:[
+ hostName := Java as_ST_String:hostName
+ ] ifFalse:[
+ addr := jaddr instVarNamed:'address'.
+ addr notNil ifTrue:[
+ hostName := ByteArray new:4.
+ hostName at:4 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:3 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:2 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:1 put:(addr bitAnd:16rFF).
+ ].
+ ].
+ hostName isNil ifTrue:[
+ self halt.
+ ].
+
+ sock := self validateFile:jsock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR
+ ].
+ SocketConnectConfirmation ifTrue:[
+ (PermittedHostConnects isNil
+ or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[
+ (self confirm:'connect to host: ' , hostName printString , ' - ok ?')
+ ifFalse:[
+ self throwIOExceptionWithMessage:'connect permission denied'.
+ ].
+
+ (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs)
+ ifTrue:[
+ PermittedHostConnects isNil ifTrue:[
+ PermittedHostConnects := Set new
+ ].
+ PermittedHostConnects add:hostName.
+ ]
+ ]
+ ].
+
+ ok := sock connectTo:hostName port:port.
+ ok ifFalse:[
+ self throwIOExceptionWithMessage:'connect failed'.
+ ]
+ ].
+
+ "Created: / 25.1.1998 / 20:02:27 / cg"
+ "Modified: / 30.12.1998 / 20:10:28 / cg"
+!
+
+_PlainSocketImpl_socketCreate:nativeContext
+ |jsock isStream fd sock fileNo|
+
+ jsock := nativeContext receiver.
+ isStream := (nativeContext argAt:1) == 1.
+
+ fd := jsock instVarNamed:'fd'.
+ (fd instVarNamed:'fd') ~~ 0 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'file already open in socketCreate'.
+ ^ self.
+ ].
+
+ FileOpenTrace ifTrue:[
+ ('JAVA: create socket') infoPrintCR.
+ ].
+
+ isStream ifTrue:[
+ sock := Socket newTCP
+ ] ifFalse:[
+ sock := Socket newUDP
+ ].
+ sock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'socketCreate failed'.
+ ].
+
+ fileNo := self addOpenFile:sock.
+ fd instVarNamed:'fd' put:fileNo.
+
+ "Created: / 25.1.1998 / 19:59:25 / cg"
+ "Modified: / 30.12.1998 / 20:10:38 / cg"
+!
+
+_PlainSocketImpl_socketListen:nativeContext
+ |jSock time sock ok|
+
+ jSock := nativeContext receiver.
+ time := nativeContext argAt:1.
+
+ sock := self validateFile:jSock.
+ sock notNil ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: socket listen with timeout ' , time printString) infoPrintCR.
+ ].
+ ok := sock listenWithBacklog:5.
+ ok ifFalse:[
+ self throwIOExceptionWithMessage:'listen failed'.
+ ^ self.
+ ].
+ time ~~ 0 ifTrue:[
+ sock readWaitWithTimeoutMs:time
+ ]
+ ].
+
+ "Created: / 4.2.1998 / 15:17:48 / cg"
+ "Modified: / 30.12.1998 / 20:10:46 / cg"
+!
+
+_PlatformFont_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:30:41 / cg"
+!
+
+_PrintStream_isOutputStreamLocalised:nativeContext
+ "/ boolean isOutputStreamLocalised (java.io.DataOutputStream)
+
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 03:00:20 / cg"
+!
+
+_RandomAccessFile_close:nativeContext
+ ^ self anyStream_close:nativeContext
+
+ "Created: / 4.2.1998 / 13:26:53 / cg"
+ "Modified: / 4.2.1998 / 15:21:08 / cg"
+!
+
+_RandomAccessFile_length:nativeContext
+ |file sz|
+
+ file := self validateFile:(nativeContext receiver).
+
+ FileIOTrace ifTrue:[
+ ('JAVA: length of ' , file pathName) infoPrintCR.
+ ].
+
+ sz := file size.
+ ^ sz.
+
+ "Created: / 4.2.1998 / 13:27:58 / cg"
+!
+
+_RandomAccessFile_read:nativeContext
+ |file byte|
+
+ file := self validateFile:(nativeContext receiver).
+
+ FileIOTrace ifTrue:[
+ ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
+ ].
+
+ byte := file nextByte.
+ byte isNil ifTrue:[
+ ^ -1
+ ].
+ ^ byte
+
+ "Modified: / 5.1.1998 / 02:17:25 / cg"
+ "Created: / 27.1.1999 / 19:01:15 / cg"
+!
+
+_RandomAccessFile_readBytes:nativeContext
+ ^ self anyStream_readBytes:nativeContext
+
+ "Modified: / 4.2.1998 / 15:23:27 / cg"
+!
+
+_RandomAccessFile_seek:nativeContext
+ |file pos|
+
+ file := self validateFile:(nativeContext receiver).
+
+ FileIOTrace ifTrue:[
+ ('JAVA: seek on ' , file pathName) infoPrintCR.
+ ].
+
+ pos := nativeContext argAt:1.
+ file position:pos+1 "/ ST/X position starts at 1
+
+ "Created: / 4.2.1998 / 13:25:38 / cg"
+ "Modified: / 4.2.1998 / 13:28:12 / cg"
+!
+
+_RandomAccessFile_writeBytes:nativeContext
+ ^ self anyStream_writeBytes:nativeContext
+
+ "Modified: / 4.2.1998 / 15:24:20 / cg"
+ "Created: / 4.2.1998 / 15:24:35 / cg"
+!
+
+_Runtime_buildLibName:nativeContext
+ |jPath jFileName path fileName libName|
+
+ jPath := nativeContext argAt:1.
+ jFileName := nativeContext argAt:2.
+
+ path := Java as_ST_String:jPath.
+ fileName := Java as_ST_String:jFileName.
+
+ path = '__builtIn__' ifTrue:[
+ libName := path , '/' , fileName
+ ] ifFalse:[
+ libName := path , '/lib' , fileName , '.so'.
+ ].
+ ^ Java as_String:libName.
+
+ "Modified: / 8.8.1997 / 12:05:05 / cg"
+ "Created: / 4.1.1998 / 19:07:14 / cg"
+!
+
+_Runtime_execInternal:nativeContext
+ "Run a unix-command; return a process object."
+
+ |cmdAndArgArray envArray cmd jProcessClass jProcess|
+
+ cmdAndArgArray := nativeContext argAt:1.
+ envArray := nativeContext argAt:2.
+
+ cmd := cmdAndArgArray at:1.
+
+ OperatingSystem isUNIXlike ifTrue:[
+ jProcessClass := Java classForName:'java.lang.UNIXProcess'.
+ ] ifFalse:[
+ jProcessClass := Java classForName:'java.lang.Win32Process'.
+ ].
+"/
+ jProcessClass notNil ifTrue:[
+self halt.
+ jProcess := jProcessClass newCleared.
+ jProcess
+ perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V'
+ with:cmdAndArgArray
+ with:envArray.
+ ^ jProcess
+ ].
+self halt.
+ self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'.
+ ^ nil
+
+ "Created: / 15.1.1998 / 01:50:31 / cg"
+ "Modified: / 11.12.1998 / 13:09:36 / cg"
+!
+
+_Runtime_exitInternal:nativeContext
+ "exit - here, we only shut down java threads"
+
+ |enteredMonitors|
+
+ ExitDebug == true ifTrue:[
+ self halt:'Java code called exit'.
+ ].
+
+ self syncMonitorCache.
+ (enteredMonitors := self enteredMonitors) size > 0 ifTrue:[
+ enteredMonitors do:[:handle |
+ | mon |
+
+ mon := LockTable at:handle ifAbsent:nil.
+ mon isNil ifTrue:[
+ self halt:'no monitor in exitInternal'.
+ ] ifFalse:[
+ mon exit.
+('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
+ ].
+ ].
+ ].
+
+ "/ TODO: shut down all threads created by this one ...
+
+ AbortSignal raise.
+ self halt.
+
+ "Created: / 7.1.1998 / 22:48:51 / cg"
+ "Modified: / 8.1.1999 / 14:09:36 / cg"
+!
+
+_Runtime_freeMemory:nativeContext
+ "free memory - Returns the number of free bytes"
+
+ ^ ObjectMemory freeListSpace + ObjectMemory freeSpace
+
+ "Created: / 12.1.1998 / 12:59:53 / cg"
+!
+
+_Runtime_initializeLinkerInternal:nativeContext
+ "init sharedLib linker, return searchPath as javaString"
+
+ |path|
+
+ "/ mhmh - what is done here ?
+
+ path := ''.
+ LibPath do:[:comp | path size == 0 ifTrue:[
+ path := path , comp
+ ] ifFalse:[
+ path := path , ':' , comp
+ ]
+ ].
+
+ ^ Java as_String:path
+
+ "Modified: / 7.8.1997 / 21:17:03 / cg"
+ "Created: / 4.1.1998 / 17:53:15 / cg"
+!
+
+_Runtime_isInputStreamLocalised:nativeContext
+ "/ boolean isInputStreamLocalised (java.io.DataInputStream)
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 03:03:01 / cg"
+!
+
+_Runtime_isOutputStreamLocalised:nativeContext
+ "/ boolean isOutputStreamLocalised (java.io.DataOutputStream)
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 03:02:49 / cg"
+!
+
+_Runtime_loadFileInternal:nativeContext
+ "load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok"
+
+ |ret|
+
+ ret := self _Runtime_loadFileInternalI:nativeContext.
+ ret < 0 ifTrue:[ ret := 0 ].
+ ^ ret
+
+ "Created: / 4.1.1998 / 19:10:20 / cg"
+ "Modified: / 4.1.1998 / 19:11:04 / cg"
+!
+
+_Runtime_loadFileInternalI:nativeContext
+ "1.1b3 change; load a sharedLib like 'loadFileInternal',
+ but return integer:
+ -1 outOfMemory error
+ 0 failed to load
+ 1 loaded or already loaded (i.e. ok)"
+
+ |jLibName libName libHandle|
+
+ jLibName := nativeContext argAt:1.
+ libName := Java as_ST_String:jLibName.
+
+ (SimulatedLibs includes:libName) ifTrue:[
+"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL.
+ ^ 1
+ ].
+ (LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[
+"/ ('JAVA: already loaded: ' , libName) printNL.
+ ^ 1
+ ].
+
+ libName asFilename exists ifFalse:[
+ ('JAVA: no file to load: ' , libName) printNL.
+ ^ 0
+ ].
+
+ (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
+ ^ 0
+ ].
+
+ libHandle := ObjectFileLoader loadLibrary:libName.
+ libHandle isNil ifTrue:[
+ ('JAVA: failed to load: ' , libName) printNL.
+ ^ 0
+ ].
+
+ LoadedLibs isNil ifTrue:[
+ LoadedLibs := Dictionary new.
+ ].
+
+ LoadedLibs at:libName put:libHandle.
+ ^ 1
+
+ "Created: / 4.1.1998 / 19:10:54 / cg"
+ "Modified: / 6.2.1998 / 03:11:59 / cg"
+!
+
+_Runtime_runFinalization:nativeContext
+ "/ void runFinalization ()
+"/ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:59:01 / cg"
+!
+
+_Runtime_runFinalizersOnExit0:nativeContext
+ ""
+
+ |onOff|
+
+ onOff := nativeContext argAt:1.
+ ^ 1
+
+ "Modified: / 6.2.1998 / 03:11:59 / cg"
+ "Created: / 15.10.1998 / 23:34:55 / cg"
+!
+
+_Runtime_setInputStreamLocalised:nativeContext
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:02:27 / cg"
+!
+
+_Runtime_setOutputStreamLocalised:nativeContext
+
+UnimplementedNativeMethodSignal raise.
+
+ "Modified: / 27.1.2000 / 03:02:32 / cg"
+!
+
+_Runtime_totalMemory:nativeContext
+ "free memory - Returns the total number of bytes"
+
+ ^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize
+
+ "Created: / 12.1.1998 / 12:59:23 / cg"
+!
+
+_Runtime_traceInstructions:nativeContext
+ "/ void traceInstructions (boolean)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:59:18 / cg"
+!
+
+_Runtime_traceMethodCalls:nativeContext
+ "/ void traceMethodCalls (boolean)
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:59:37 / cg"
+!
+
+_ScrollPane_initIDs:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 22:19:23 / cg"
+!
+
+_SecurityManager_classDepth:nativeContext
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:56:27 / cg"
+!
+
+_SecurityManager_classLoaderDepth:nativeContext
+ |con depth|
+
+ con := thisContext sender.
+ depth := 1.
+ [con notNil] whileTrue:[
+ con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[
+ con selector == #handle:do: ifTrue:[
+ depth := depth + 1
+ ]
+ ].
+ con := con sender.
+ ].
+'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR.
+ ^ depth.
+
+ "Created: / 13.1.1998 / 09:21:46 / cg"
+ "Modified: / 13.1.1998 / 09:33:43 / cg"
+!
+
+_SecurityManager_currentClassLoader:nativeContext
+ |loader|
+
+ loader := JavaClassReader classLoaderQuerySignal query.
+"/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR.
+ ^ loader.
+
+ "Created: / 13.1.1998 / 09:23:28 / cg"
+ "Modified: / 11.12.1998 / 12:39:59 / cg"
+!
+
+_SecurityManager_currentLoadedClass0:nativeContext
+ UnimplementedNativeMethodSignal raise
+
+ "Modified: / 12.11.1998 / 18:52:07 / cg"
+ "Created: / 12.11.1998 / 18:56:41 / cg"
+!
+
+_SocketInputStream_socketRead:nativeContext
+ ^ self anyStream_readBytes:nativeContext
+
+ "Created: / 25.1.1998 / 20:56:53 / cg"
+ "Modified: / 4.2.1998 / 15:52:31 / cg"
+!
+
+_SocketOutputStream_socketWrite:nativeContext
+ ^ self anyStream_writeBytes:nativeContext
+
+ "Created: / 25.1.1998 / 21:06:55 / cg"
+ "Modified: / 4.2.1998 / 15:52:40 / cg"
+!
+
+_String_compareTo:nativeContext
+ "int compareTo (java.lang.String)"
+
+ |jString1 jString2|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:28:59 / cg"
+!
+
+_String_equals:nativeContext
+ |jString1 jString2|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ ^ (jString1 instVarAt:1) = (jString2 instVarAt:1)
+
+ "Created: / 18.11.1998 / 00:52:03 / cg"
+ "Modified: / 18.11.1998 / 00:53:01 / cg"
+!
+
+_String_equalsIgnoreCase:nativeContext
+ "boolean equalsIgnoreCase (java.lang.String)"
+
+ |jString1 jString2|
+
+self halt:'untested'.
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ ^ (jString1 instVarAt:1) sameAs: (jString2 instVarAt:1)
+
+ "Modified: / 18.11.1998 / 00:53:01 / cg"
+ "Created: / 27.1.2000 / 02:27:46 / cg"
+!
+
+_String_indexOf:nativeContext
+ "int indexOf (java.lang.String int)"
+
+ |jString1 jString2 idx|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ idx := nativeContext argAt:2.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:30:22 / cg"
+!
+
+_String_lastIndexOf:nativeContext
+ "int lastIndexOf (java.lang.String int)"
+
+ |jString1 jString2 idx|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ idx := nativeContext argAt:2.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:33:59 / cg"
+!
+
+_String_length:nativeContext
+ |jString|
+
+ jString := nativeContext receiver.
+ ^ (jString instVarAt:3)
+
+ "Created: / 18.11.1998 / 00:53:50 / cg"
+ "Modified: / 18.11.1998 / 00:54:18 / cg"
+!
+
+_String_regionMatches2:nativeContext
+ "boolean regionMatches (boolean int java.lang.String int int)"
+
+ |jString1 bool jString2 idx1 idx2|
+
+ jString1 := nativeContext receiver.
+ bool := nativeContext argAt:1.
+ jString2 := nativeContext argAt:2.
+ idx1 := nativeContext argAt:3.
+ idx2 := nativeContext argAt:4.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:33:40 / cg"
+!
+
+_String_regionMatches:nativeContext
+ "boolean regionMatches (int java.lang.String int int)"
+
+ |jString1 jString2 idx1 idx2|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ idx1 := nativeContext argAt:2.
+ idx2 := nativeContext argAt:3.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:32:29 / cg"
+!
+
+_String_startsWith:nativeContext
+ "boolean startsWith (java.lang.String int)"
+
+ |jString1 jString2 idx|
+
+ jString1 := nativeContext receiver.
+ jString2 := nativeContext argAt:1.
+ idx := nativeContext argAt:2.
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:31:40 / cg"
+!
+
+_SystemColor_GetSysColor:nativeContext
+ "/ int GetSysColor (int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 27.1.2000 / 02:44:41 / cg"
+!
+
+_SystemResourceManager_getEntryFromKey:nativeContext
+ "get a resource by name"
+
+ |key s|
+
+ key := nativeContext argAt:1.
+
+ s := Java effectiveClassPath at:(key+1) ifAbsent:nil.
+ s isNil ifTrue:[^ nil].
+ ^ Java as_String:s
+
+ "Modified: / 22-11-2010 / 13:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_SystemResourceManager_validateSystemResource:nativeContext
+ "check a resource"
+
+ |bool str1 str2|
+
+ bool := nativeContext argAt:1.
+ str1 := nativeContext argAt:2.
+ str2 := nativeContext argAt:3.
+ ^ 1 "/ true
+!
+
+_System_getCallerClass:nativeContext
+ "/ introduced with jdk1.2
+
+ |senderContext cls|
+
+ senderContext := nativeContext sender.
+ [senderContext receiver == (Java at:'java.lang.System')] whileTrue:[
+ senderContext := senderContext sender.
+ ].
+
+ senderContext method isStatic ifTrue:[
+ cls := senderContext receiver
+ ] ifFalse:[
+ cls := senderContext receiver class
+ ].
+ cls isJavaClass ifTrue:[
+ ^ self javaClassObjectForClass:cls
+ ].
+ (cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[
+ ^ Java at:'java.lang.Class'
+ ].
+ self halt.
+ ^ nil
+
+ "Modified: / 27.1.1998 / 18:33:13 / cg"
+!
+
+_System_validateSecurityManager:nativeContext
+ "void validateSecurityManager (java.lang.SecurityManager)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:43:25 / cg"
+!
+
+_ThreadGroup_initMainThreadGroup0:nativeContext
+ "void initMainThreadGroup0 (java.lang.ThreadGroup)"
+
+UnimplementedNativeMethodSignal raise.
+
+ "Created: / 27.1.2000 / 02:45:52 / cg"
+!
+
+_Thread_countStackFrames:nativeContext
+ "/ int countStackFrames ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:06:21 / cg"
+!
+
+_Thread_interrupt0:nativeContext
+ "ask if a thread is interrupted (clear interruptState if arg is true)"
+
+ |jThread stProcess|
+
+ jThread := nativeContext receiver.
+ stProcess := self stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ self halt.
+ ^ 0
+ ].
+
+ stProcess markInterrupted
+
+ "Modified: / 2.1.1998 / 21:49:06 / cg"
+ "Created: / 10.4.1998 / 15:21:43 / cg"
+!
+
+_Thread_resume0:nativeContext
+ "yield"
+
+ |jThread stProcess|
+
+ jThread := nativeContext receiver.
+ stProcess := JavaVM stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
+ ].
+ stProcess resume
+
+ "Created: / 8.1.1998 / 01:06:27 / cg"
+ "Modified: / 6.2.1998 / 02:15:08 / cg"
+!
+
+_Thread_start:nativeContext
+ "start the thread"
+
+ |jThread jName name stProcess|
+
+ jThread := nativeContext receiver.
+ (jThread instVarNamed:'priority') < 1 ifTrue:[
+ self halt.
+ jThread instVarNamed:'priority' put:1.
+ ].
+
+ stProcess := JavaProcess
+ for:[
+ |procName|
+
+ Object abortSignal handle:[:ex |
+ procName := stProcess name.
+ (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
+ ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
+ ex restart.
+ ] ifFalse:[
+ (stProcess == JavaScreenUpdaterThread
+ or:[stProcess == JavaEventQueueThread]) ifTrue:[
+ ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
+ ex restart
+ ] ifFalse:[
+ ('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR.
+ ]
+ ].
+ ] do:[
+ [
+ JavaVM javaExceptionSignal handle:[:ex |
+ |exClass|
+
+ procName := stProcess name.
+ exClass := ex parameter class.
+
+ exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
+ ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
+ ] ifFalse:[
+ Transcript
+ showCR:('JAVA: thread '''
+ , procName
+ , ''' terminated with exception: '
+ , exClass name).
+ ].
+ ex return.
+ ] do:[
+ Object messageNotUnderstoodSignal handle:[:ex |
+ "/ remap doesNotUnderstand with nil-receiver to
+ "/ a nullPointerException ...
+ |con m|
+
+ con := ex suspendedContext.
+ con receiver isNil ifTrue:[
+ ((m := con sender method) notNil
+ and:[m isJavaMethod]) ifTrue:[
+ self throwNullPointerException.
+ AbortSignal raise. "/ ex proceed.
+ ]
+ ].
+ ex reject.
+ ] do:[
+"/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
+ jThread perform:#'run()V'.
+ ThreadTrace == true ifTrue:[
+ ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR.
+ ].
+ jThread perform:#'exit()V'.
+ ThreadTrace == true ifTrue:[
+ ('JAVA: after exit of thread ' , stProcess name) infoPrintCR.
+ ]
+ ]
+ ]
+ ] ensure:[
+ |monitors|
+
+ monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil.
+ monitors notNil ifTrue:[
+ monitors do:[:obj |
+ | mon |
+
+ mon := self monitorFor:obj.
+ mon notNil ifTrue:[
+ mon owningProcess == stProcess ifTrue:[
+ ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR.
+ mon exit
+ ].
+ ].
+ ].
+ EnteredMonitorsPerProcess removeKey:stProcess.
+
+ stProcess == JavaScreenUpdaterThread ifTrue:[
+ JavaScreenUpdaterThread := nil.
+ ].
+ stProcess == JavaEventQueueThread ifTrue:[
+ JavaEventQueueThread := nil.
+ ].
+"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.
+"/ screenUpdaterClass notNil ifTrue:[
+"/ screenUpdaterClass instVarNamed:'updater' put:nil.
+"/ ].
+ ].
+ Java threads removeKey:jThread ifAbsent:[].
+ ]
+ ]
+ ]
+ priority:(Processor activePriority).
+
+ jName := jThread instVarNamed:'name'.
+ jName isString ifFalse:[
+ name := Java as_ST_String:jName.
+ ] ifTrue:[
+ name := jName
+ ].
+
+ "/ kludge - remember the ScreenUpdater ...
+ name = 'Screen Updater' ifTrue:[
+ JavaScreenUpdaterThread := stProcess.
+ ] ifFalse:[
+ name = 'AWT-Windows' ifTrue:[
+ JavaEventThread := stProcess.
+ ] ifFalse:[
+ (name startsWith:'AWT-EventQueue') ifTrue:[
+ JavaEventQueueThread := stProcess.
+ ].
+ ]
+ ].
+
+"/name = 'UserDialogShowThread' ifTrue:[
+"/self halt
+"/].
+ "/ when that process terminates, wakup any waiters
+ stProcess addExitAction:[self wakeup:jThread].
+
+ stProcess name:'JAVA-' , name.
+ stProcess restartable:true.
+ stProcess resume.
+
+ Java threads at:jThread put:stProcess.
+
+ ^ nil
+
+ "Created: / 3.1.1998 / 02:05:52 / cg"
+ "Modified: / 24.12.1999 / 03:14:33 / cg"
+!
+
+_Thread_stop0:nativeContext
+ "terminate a thread"
+
+ |jThread stProcess death|
+
+ jThread := nativeContext receiver.
+
+ stProcess := JavaVM stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
+ ].
+stProcess == JavaScreenUpdaterThread ifTrue:[self halt].
+stProcess == JavaEventQueueThread ifTrue:[self halt].
+
+ death := nativeContext argAt:1.
+ stProcess
+ interruptWith:[
+ JavaVM javaExceptionSignal handle:[:ex |
+Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt].
+Processor activeProcess == JavaEventQueueThread ifTrue:[self halt].
+ Processor activeProcess terminate
+ ] do:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: thread exit: ' , jThread displayString) infoPrintNL.
+ ].
+ jThread perform:#'exit()V'.
+ self throwException:death.
+ ]
+ ].
+ stProcess resume.
+
+ [stProcess isDead] whileFalse:[
+ stProcess resume.
+ 'JavaVM: wait for death' infoPrintCR.
+ Delay waitForSeconds:0.1
+ ].
+ stProcess terminate
+
+ "Created: / 8.1.1998 / 13:11:17 / cg"
+ "Modified: / 24.12.1999 / 02:32:45 / cg"
+!
+
+_Thread_suspend0:nativeContext
+ "yield"
+
+ |jThread stProcess|
+
+ jThread := nativeContext receiver.
+ stProcess := JavaVM stProcessForJavaThread:jThread.
+ stProcess isNil ifTrue:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
+ ].
+ stProcess suspend
+
+ "Created: / 8.1.1998 / 01:05:49 / cg"
+ "Modified: / 6.2.1998 / 02:15:23 / cg"
+!
+
+_Thread_yield:nativeContext
+ "yield"
+
+ |jThread stProcess|
+
+ Processor yield.
+"/ jThread := nativeContext receiver.
+"/ stProcess := JavaVM stProcessForJavaThread:jThread.
+"/ stProcess isNil ifTrue:[
+"/ ThreadTrace == true ifTrue:[
+"/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+"/ ].
+"/ ^ nil "void"
+"/ ].
+"/ stProcess == Processor activeProcess ifTrue:[
+"/ Processor yield.
+"/ ] ifFalse:[
+"/ self halt.
+"/ ].
+
+ "Created: / 5.1.1998 / 02:03:51 / cg"
+ "Modified: / 23.12.1998 / 19:19:17 / cg"
+!
+
+_Throwable_printStackTrace0:nativeContext
+ |out outStream exceptionObject contextList|
+
+ outStream := nativeContext argAt:1.
+ exceptionObject := nativeContext receiver.
+
+ contextList := exceptionObject instVarNamed:'backtrace'.
+
+ out := self javaConsoleStream.
+ out cr.
+ out nextPutLine:'JAVA: stackTrace:'.
+
+ contextList do:[:con |
+ out
+ nextPutAll:' ';
+ nextPutAll:(con method javaClass fullName);
+ nextPutAll:'.';
+ nextPutAll:(con method selector);
+ nextPutAll:' [';
+ nextPutAll:(con method javaClass sourceFile);
+ nextPutAll:' ';
+ nextPutAll:(con quickLineNumber displayString);
+ nextPutAll:']'.
+ out cr
+ ].
+ out nextPutLine:'----------------------------------------------------'
+
+ "Created: / 4.1.1998 / 14:27:40 / cg"
+ "Modified: / 10.11.1998 / 14:19:32 / cg"
+!
+
+_URLConnection_close:nativeContext
+ "/ void close ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:26:03 / cg"
+!
+
+_URLConnection_finalize:nativeContext
+ "/ void finalize ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:22 / cg"
+!
+
+_URLConnection_getContentLength0:nativeContext
+ "/ int getContentLength0 ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:34 / cg"
+!
+
+_URLConnection_getContentType0:nativeContext
+ "/ java.lang.String getContentType0 ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:42 / cg"
+!
+
+_URLConnection_getHeaderField0:nativeContext
+ "/ java.lang.String getHeaderField0 (java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:53 / cg"
+!
+
+_URLConnection_pCreate:nativeContext
+ "/ void pCreate (java.lang.String java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:14 / cg"
+!
+
+_URLInputStream_available:nativeContext
+ "/ int available ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:26 / cg"
+!
+
+_URLInputStream_open:nativeContext
+ "/ void open ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:01 / cg"
+!
+
+_URLInputStream_read:nativeContext
+ "/ int read (byte[] int int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:12 / cg"
+!
+
+_URLOutputStream_open:nativeContext
+ "/ void open ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:38 / cg"
+!
+
+_URLOutputStream_pClose:nativeContext
+ "/ void pClose ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:25:02 / cg"
+!
+
+_URLOutputStream_write:nativeContext
+ "/ void write (int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:45 / cg"
+!
+
+_URLOutputStream_writeBytes:nativeContext
+ "/ void writeBytes (byte[] int int)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:24:55 / cg"
+!
+
+_URLStreamHandlerFactory_pInit:nativeContext
+ "/ self unimplementedNativeMethod.
+
+ "Created: / 10.1.1998 / 15:47:24 / cg"
+!
+
+_URLStreamHandlerFactory_pSupportsProtocol:nativeContext
+ "/ boolean pSupportsProtocol (java.lang.String)
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:23:43 / cg"
+!
+
+_VM_getState:nativeContext
+ "/ int getState ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:06:44 / cg"
+!
+
+_VM_resetJavaMonitor:nativeContext
+ "/ void resetJavaMonitor ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 14.11.1998 / 10:43:23 / cg"
+!
+
+_VM_resumeJavaMonitor:nativeContext
+ "/ void resumeJavaMonitor ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 14.11.1998 / 10:42:49 / cg"
+!
+
+_VM_suspendJavaMonitor:nativeContext
+ "/ void suspendJavaMonitor ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 14.11.1998 / 10:43:07 / cg"
+!
+
+_VM_threadsSuspended:nativeContext
+ "/ boolean threadsSuspended ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:07:10 / cg"
+!
+
+_VM_unsuspendSomeThreads:nativeContext
+ "/ void unsuspendSomeThreads ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:07:29 / cg"
+!
+
+_VM_unsuspendThreads:nativeContext
+ "/ void unsuspendThreads ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 12.11.1998 / 19:07:20 / cg"
+!
+
+_VM_writeJavaMonitorReport:nativeContext
+ "/ void writeJavaMonitorReport ()
+ UnimplementedNativeMethodSignal raise
+
+ "Created: / 14.11.1998 / 10:43:37 / cg"
+!
_WButtonPeer_create:nativeContext
|jButtonPeer jButton jFrame frame button
@@ -9133,6 +11790,39 @@
"Created: / 4.1.1998 / 18:01:11 / cg"
!
+_WComponentPeer_setBackground:nativeContext
+ |jClr rgb clr view|
+
+ view := self viewForWPeer:nativeContext.
+
+ jClr := nativeContext argAt:1.
+ rgb := jClr instVarNamed:'value'.
+"/ self halt.
+ clr := Color rgbValue:rgb.
+
+
+ clr := clr on:(view device).
+
+"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[
+"/ view viewBackground:(view superView viewBackground).
+"/ view backgroundPaint:(view superView viewBackground).
+"/ ] ifFalse:[
+"/ (view isMemberOf:JavaView) ifTrue:[
+"/ view viewBackground:clr.
+"/ view backgroundPaint:clr.
+"/ ]
+"/ ].
+
+ (view isKindOf:ScrollableView) ifTrue:[
+ view := view scrolledView
+ ].
+ view viewBackground:clr.
+ view backgroundPaint:clr.
+
+ "Created: / 16.10.1998 / 02:16:31 / cg"
+ "Modified: / 16.10.1998 / 02:26:29 / cg"
+!
+
_WComponentPeer_setCursor:nativeContext
|view|
@@ -9153,6 +11843,28 @@
"Modified: / 25.1.1998 / 01:22:19 / cg"
!
+_WComponentPeer_setForeground:nativeContext
+ |jClr rgb clr view|
+
+ view := self viewForWPeer:nativeContext.
+
+ jClr := nativeContext argAt:1.
+ rgb := jClr instVarNamed:'value'.
+"/ self halt.
+ clr := Color rgbValue:rgb.
+
+
+ clr := clr on:(view device).
+
+ (view isKindOf:ScrollableView) ifTrue:[
+ view := view scrolledView
+ ].
+ view paint:clr.
+
+ "Created: / 16.10.1998 / 02:18:58 / cg"
+ "Modified: / 16.10.1998 / 02:26:37 / cg"
+!
+
_WComponentPeer_setZOrderPosition:nativeContext
|view|
@@ -9195,6 +11907,12 @@
"Created: / 5.1.1998 / 00:58:40 / cg"
!
+_WContainerPeer_calculateInsets:nativeContext
+ "/ new with ns4.0 ...
+
+ "Created: / 16.10.1998 / 02:12:59 / cg"
+!
+
_WDefaultFontCharset_canConvert:nativeContext
^ 1
@@ -9583,6 +12301,51 @@
"Modified: / 8.1.1998 / 17:35:04 / cg"
!
+_WFramePeer_setResizable:nativeContext
+ |view onOff|
+
+ view := self viewForWPeer:nativeContext.
+
+ onOff := (nativeContext argAt:1) == 1.
+ view isTopView ifTrue:[
+ onOff ifTrue:[
+ view minExtent:10@10.
+ view maxExtent:(Screen current extent).
+ ] ifFalse:[
+ view minExtent:view extent.
+ view maxExtent:view extent.
+ ]
+ ] ifFalse:[
+ (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+ self halt.
+ ]
+ ].
+
+"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
+
+ ^ nil
+
+ "Modified: / 16.1.1998 / 18:08:00 / cg"
+ "Created: / 16.10.1998 / 02:21:34 / cg"
+!
+
+_WFramePeer_setTitle:nativeContext
+ |view jString string|
+
+ view := self viewForWPeer:nativeContext.
+
+ jString := nativeContext argAt:1.
+ string := Java as_ST_String:jString.
+
+"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL.
+
+ view label:string.
+ ^ nil
+
+ "Modified: / 8.1.1998 / 17:37:41 / cg"
+ "Created: / 27.1.1998 / 21:42:57 / cg"
+!
+
_WGraphics__dispose:nativeContext
"/ void _dispose()
UnimplementedNativeMethodSignal raise
@@ -10606,6 +13369,12 @@
"Modified: / 10.12.1998 / 21:12:29 / cg"
!
+_WPanelPeer_calculateInsets:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 27.1.1998 / 21:40:00 / cg"
+!
+
_WPopupMenuPeer__show:nativeContext
"/ void _show (java.awt.Event)
UnimplementedNativeMethodSignal raise
@@ -11162,411 +13931,740 @@
"Modified: / 18.3.1997 / 18:43:18 / cg"
"Created: / 4.1.1998 / 18:09:04 / cg"
-! !
-
-!JavaVM class methodsFor:'native - sun.awt.windows - jdk1.2'!
-
-_WFramePeer_setTitle:nativeContext
- |view jString string|
-
- view := self viewForWPeer:nativeContext.
-
- jString := nativeContext argAt:1.
- string := Java as_ST_String:jString.
-
-"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL.
-
- view label:string.
- ^ nil
-
- "Modified: / 8.1.1998 / 17:37:41 / cg"
- "Created: / 27.1.1998 / 21:42:57 / cg"
-!
-
-_WPanelPeer_calculateInsets:nativeContext
+!
+
+_Win32Process_create:nativeContext
+ "really create a win32 process"
+
+ |env cmd jProcess p inPipe outPipe errorPipe|
+
+ jProcess := nativeContext receiver.
+ cmd := nativeContext argAt:1.
+ cmd := Java as_ST_String:cmd.
+
+ env := nativeContext argAt:2.
+ env notNil ifTrue:[
+ self halt
+ ].
+self halt.
+
+ p := Win32Process new.
+ p command:cmd.
+ p environment:env.
+ p inStream:inPipe.
+ p outStream:outPipe.
+ p errorStream:errorPipe.
+ p directory:nil.
+ p startProcess.
+self halt.
+
+ jProcess instVarNamed:'handle' put:p.
+
+ "Created: / 10.11.1998 / 19:50:31 / cg"
+ "Modified: / 10.11.1998 / 21:34:18 / cg"
+!
+
+_X11FontMetrics_getMFCharSegmentWidth:nativeContext
+ "get multi-font string-segment width.
+ Not yet supported - use standard strings width"
+
+ |jMetrics jFont jFontDescr stFont w
+ bool1 cp offs lenght bp int1|
+
+ jMetrics := nativeContext receiver.
+ jFont := nativeContext argAt:1.
+ jFontDescr := nativeContext argAt:2.
+ cp := nativeContext argAt:3.
+ lenght := nativeContext argAt:4.
+
+ stFont := jFont instVarNamed:'pData'.
+ (stFont isNil or:[stFont == 0]) ifTrue:[
+ self halt
+ ].
+
+ stFont device isNil ifTrue:[
+ stFont := stFont on:Display.
+ jFont instVarNamed:'pData' put:stFont.
+ ].
+ w := stFont widthOf:cp from:1 to:lenght.
+ ^ w.
+!
+
+_X11FontMetrics_init:nativeContext
+ ^ self _WFontMetrics_init:nativeContext
+!
+
+_X11GraphicsDevice_getConfigType:nativeContext
"/ new with jdk1.2 ...
- "Created: / 27.1.1998 / 21:40:00 / cg"
+ |configNr cls|
+
+ "/ for now, only one config.
+ configNr := nativeContext argAt:1.
+
+ cls := Java classNamed:'java.awt.GraphicsDevice'.
+ ^ cls instVarNamed:'TYPE_RASTER_SCREEN'.
+
+ "Created: / 28.1.1998 / 22:19:05 / cg"
+!
+
+_X11GraphicsDevice_getNumConfigs:nativeContext
+ "/ new with jdk1.2 ...
+
+ ^ 1
+
+ "Created: / 28.1.1998 / 22:13:26 / cg"
+ "Modified: / 28.1.1998 / 22:14:33 / cg"
+!
+
+_X11GraphicsEnvironment_getNumScreens:nativeContext
+ "/ new with jdk1.2 ...
+
+ "/ could return the actual number of screens ...
+
+ ^ 1
+
+ "Created: / 28.1.1998 / 01:50:22 / cg"
+ "Modified: / 28.1.1998 / 22:12:32 / cg"
+!
+
+_X11GraphicsEnvironment_initDisplay:nativeContext
+ "/ new with jdk1.2 ...
+
+ "Created: / 28.1.1998 / 01:50:22 / cg"
+!
+
+_X11Graphics_changeClip:nativeContext
+ ^ self _WGraphics_changeClip:nativeContext
+!
+
+_X11Graphics_createFromComponent:nativeContext
+ ^ self _WGraphics_createFromComponent:nativeContext
+!
+
+_X11Graphics_disposeImpl:nativeContext
+ ^ self _WGraphics_dispose:nativeContext
+!
+
+_X11Graphics_drawMFCharsSegment:nativeContext
+ ^ self _WGraphics_drawMFCharsSegment:nativeContext
+!
+
+_X11Graphics_drawRect:nativeContext
+ ^ self _WGraphics_drawRect:nativeContext
+!
+
+_X11Graphics_fillOval:nativeContext
+ ^ self _WGraphics_fillOval:nativeContext
+!
+
+_X11Graphics_fillRect:nativeContext
+ ^ self _WGraphics_fillRect:nativeContext
+!
+
+_X11Graphics_pSetFont:nativeContext
+ ^ self _WGraphics_pSetFont:nativeContext
+!
+
+_X11Graphics_pSetForeground:nativeContext
+ ^ self _WGraphics_pSetForeground:nativeContext
! !
-!JavaVM class methodsFor:'native - sun.awt.windows - ms'!
-
-_MCanvasPeer_create:nativeContext
- |jCanvasPeer jFrame frame subView|
-
- jCanvasPeer := nativeContext receiver.
-
- jFrame := nativeContext argAt:1.
- jFrame isNil ifTrue:[
- self halt:'no frame in canvasPeer create'.
- self internalError:'no frame in canvasPeer create'.
- ^ self.
- ].
- frame := jFrame instVarNamed:'pData'.
-
- subView := JavaView in:frame.
- subView delegate:self.
- subView javaPeer:jCanvasPeer.
-
- self createdWindowsView:subView for:jCanvasPeer.
-
- WindowCreationTrace == true ifTrue:[
- 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
- ].
-
- "Modified: / 16.1.1998 / 13:40:00 / cg"
- "Created: / 18.11.1998 / 00:14:44 / cg"
-!
-
-_MComponentPeer_pReshape:nativeContext
- self commonReshapeComponent:nativeContext
-
- "Created: / 18.11.1998 / 00:18:17 / cg"
-!
-
-_MComponentPeer_setBackground:nativeContext
- |jClr rgb clr view|
-
- view := self viewForWPeer:nativeContext.
-
- jClr := nativeContext argAt:1.
- rgb := jClr instVarNamed:'value'.
-"/ self halt.
- clr := Color rgbValue:rgb.
-
-
- clr := clr on:(view device).
-
- (view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
- ].
- view viewBackground:clr.
- view backgroundPaint:clr.
-
- "Created: / 17.11.1998 / 23:49:41 / cg"
-!
-
-_MComponentPeer_setFont:nativeContext
- |view|
-
- view := self viewForWPeer:nativeContext.
-"/ self halt.
-
- "Modified: / 25.1.1998 / 01:22:19 / cg"
- "Created: / 17.11.1998 / 23:43:48 / cg"
-!
-
-_MComponentPeer_setForeground:nativeContext
- |jClr rgb clr view|
-
- view := self viewForWPeer:nativeContext.
-
- jClr := nativeContext argAt:1.
- rgb := jClr instVarNamed:'value'.
-"/ self halt.
- clr := Color rgbValue:rgb.
-
- clr := clr on:(view device).
-
- view paint:clr.
-
- "Created: / 17.11.1998 / 23:50:31 / cg"
- "Modified: / 17.11.1998 / 23:57:29 / cg"
-!
-
-_MFramePeer_getWindowBackgroundColor:nativeContext
- ^ View defaultViewBackgroundColor rgbValue.
-
- "Created: / 17.11.1998 / 23:55:42 / cg"
-!
-
-_MFramePeer_pShow:nativeContext
- |view|
-
- view := self viewForWPeer:nativeContext.
-
- "/ frame views are under my browsers own control
- (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- view beVisible.
- view realize.
- ].
-
-"/ view windowGroup notNil ifTrue:[
-"/ windowServer addGroup:(view windowGroup)
-"/ ].
-
- ^ nil
-
-"/ self halt.
-
- "Modified: / 25.1.1998 / 09:54:07 / cg"
- "Created: / 18.11.1998 / 00:19:59 / cg"
-!
-
-_MFramePeer_setInsets:nativeContext
-
- "Created: / 17.11.1998 / 23:55:32 / cg"
-!
-
-_MFramePeer_setResizable:nativeContext
- |view onOff|
-
- view := self viewForWPeer:nativeContext.
-
- onOff := (nativeContext argAt:1) == 1.
- view isTopView ifTrue:[
- onOff ifTrue:[
- view minExtent:10@10.
- view maxExtent:(Screen current extent).
- ] ifFalse:[
- view minExtent:view extent.
- view maxExtent:view extent.
- ]
- ] ifFalse:[
- (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- self halt.
- ]
- ].
-
-"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
-
- ^ nil
-
- "Modified: / 16.1.1998 / 18:08:00 / cg"
- "Created: / 17.11.1998 / 23:51:45 / cg"
-!
-
-_MToolkit_callbackLoop:nativeContext
- |toolKit|
-
- toolKit := nativeContext receiver.
-^ self.
-self halt.
- self wakeup:toolKit.
-self halt.
-
- (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
- 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
- ].
-
- JavaEventThread := Processor activeProcess.
- [
- [true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self doWindowsEventThread.
- ]
- ].
- ] valueNowOrOnUnwindDo:[
- JavaEventThread := nil.
- ].
-
- "Created: / 17.11.1998 / 23:58:33 / cg"
- "Modified: / 8.1.1999 / 17:08:35 / cg"
-!
-
-_MToolkit_eventLoop:nativeContext
- |toolKit|
-
- (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
- 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
- ].
-
- toolKit := nativeContext receiver.
-
- self wakeup:toolKit.
-self halt.
-
- JavaEventThread := Processor activeProcess.
- [
- [true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self doWindowsEventThread.
- ]
- ].
- ] valueNowOrOnUnwindDo:[
- JavaEventThread := nil.
- ].
-
- "Created: / 17.11.1998 / 23:04:29 / cg"
- "Modified: / 8.1.1999 / 17:08:21 / cg"
+!JavaVM class methodsFor:'native - sun.io'!
+
+_sun_io_Win32ErrorMode_setErrorMode: nativeContext
+
+ <javanative: 'sun/io/Win32ErrorMode' name: 'setErrorMode(J)J'>
+
+ "FIXME: Ignored for now"
+
+ ^0
! !
-!JavaVM class methodsFor:'native - sun.awt.windows - ns4.0'!
-
-_WComponentPeer_setBackground:nativeContext
- |jClr rgb clr view|
-
- view := self viewForWPeer:nativeContext.
-
- jClr := nativeContext argAt:1.
- rgb := jClr instVarNamed:'value'.
-"/ self halt.
- clr := Color rgbValue:rgb.
-
-
- clr := clr on:(view device).
-
-"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[
-"/ view viewBackground:(view superView viewBackground).
-"/ view backgroundPaint:(view superView viewBackground).
-"/ ] ifFalse:[
-"/ (view isMemberOf:JavaView) ifTrue:[
-"/ view viewBackground:clr.
-"/ view backgroundPaint:clr.
-"/ ]
-"/ ].
-
- (view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
- ].
- view viewBackground:clr.
- view backgroundPaint:clr.
-
- "Created: / 16.10.1998 / 02:16:31 / cg"
- "Modified: / 16.10.1998 / 02:26:29 / cg"
-!
-
-_WComponentPeer_setForeground:nativeContext
- |jClr rgb clr view|
-
- view := self viewForWPeer:nativeContext.
-
- jClr := nativeContext argAt:1.
- rgb := jClr instVarNamed:'value'.
-"/ self halt.
- clr := Color rgbValue:rgb.
-
-
- clr := clr on:(view device).
-
- (view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
- ].
- view paint:clr.
-
- "Created: / 16.10.1998 / 02:18:58 / cg"
- "Modified: / 16.10.1998 / 02:26:37 / cg"
-!
-
-_WContainerPeer_calculateInsets:nativeContext
- "/ new with ns4.0 ...
-
- "Created: / 16.10.1998 / 02:12:59 / cg"
-!
-
-_WFramePeer_setResizable:nativeContext
- |view onOff|
-
- view := self viewForWPeer:nativeContext.
-
- onOff := (nativeContext argAt:1) == 1.
- view isTopView ifTrue:[
- onOff ifTrue:[
- view minExtent:10@10.
- view maxExtent:(Screen current extent).
- ] ifFalse:[
- view minExtent:view extent.
- view maxExtent:view extent.
- ]
- ] ifFalse:[
- (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- self halt.
- ]
- ].
-
-"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
-
- ^ nil
-
- "Modified: / 16.1.1998 / 18:08:00 / cg"
- "Created: / 16.10.1998 / 02:21:34 / cg"
+!JavaVM class methodsFor:'native - sun.management'!
+
+_sun_management_VMManagementImpl_getVersion0: nativeContext
+
+ <javanative: 'sun/management/VMManagementImpl' name: 'getVersion0'>
+
+ ^ UnimplementedNativeMethodSignal raise
! !
!JavaVM class methodsFor:'native - sun.misc'!
-_VM_getState:nativeContext
- "/ int getState ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:06:44 / cg"
-!
-
-_VM_resetJavaMonitor:nativeContext
- "/ void resetJavaMonitor ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 14.11.1998 / 10:43:23 / cg"
-!
-
-_VM_resumeJavaMonitor:nativeContext
- "/ void resumeJavaMonitor ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 14.11.1998 / 10:42:49 / cg"
-!
-
-_VM_suspendJavaMonitor:nativeContext
- "/ void suspendJavaMonitor ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 14.11.1998 / 10:43:07 / cg"
-!
-
-_VM_threadsSuspended:nativeContext
- "/ boolean threadsSuspended ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:07:10 / cg"
-!
-
-_VM_unsuspendSomeThreads:nativeContext
- "/ void unsuspendSomeThreads ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:07:29 / cg"
-!
-
-_VM_unsuspendThreads:nativeContext
- "/ void unsuspendThreads ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 12.11.1998 / 19:07:20 / cg"
-!
-
-_VM_writeJavaMonitorReport:nativeContext
- "/ void writeJavaMonitorReport ()
- UnimplementedNativeMethodSignal raise
-
- "Created: / 14.11.1998 / 10:43:37 / cg"
+_sun_misc_Signal_findSignal: aJavaContext
+
+ <javanative: 'sun/misc/Signal' name: 'findSignal'>
+
+ | input signame |
+
+ input := Java as_ST_String: (aJavaContext argAt: 1).
+ OperatingSystem isUNIXlike ifTrue:[
+ signame := 'SIG', (input asUppercase).
+ ^UnixOperatingSystem signalNamed: signame asSymbol.
+ ].
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ signame := 'sig', (input asUppercase).
+ ^Win32OperatingSystem perform: signame asSymbol.
+ ].
+ self error: 'Unsupported OS'
+
+ "Created: / 11-12-2010 / 15:22:07 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_sun_misc_Signal_handle0: aJavaContext
+
+ <javanative: 'sun/misc/Signal' name: 'handle0'>
+
+ self breakPoint: #libjava.
+ ^ 0.
+
+ "Created: / 11-12-2010 / 16:33:38 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_sun_misc_Unsafe_allocateInstance: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'allocateInstance'>
+
+ "
+ /** Allocate an instance but do not run any constructor.
+ Initializes the class if it has not yet been. */
+ public native Object allocateInstance(Class cls)
+ throws InstantiationException;
+ "
+ | cls |
+ cls := self reflection classForJavaClassObject: (nativeContext argAt:1).
+ cls classInit.
+ ^cls newCleared
+
+ "Created: / 05-02-2011 / 23:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_allocateMemory: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'allocateMemory'>
+
+
+ | size |
+ size := aJavaContext argAt: 1.
+ ^SimulatedNativeMemory malloc: size.
+
+ "Created: / 07-12-2010 / 21:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-12-2010 / 23:46:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_arrayBaseOffset: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'arrayBaseOffset'>
+ "
+ /**
+ * Report the offset of the first element in the storage allocation of a
+ * given array class. If {@link #arrayIndexScale} returns a non-zero value
+ * for the same class, you may use that scale factor, together with this
+ * base offset, to form new offsets to access elements of arrays of the
+ * given class.
+ *
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayBaseOffset(Class arrayClass);
+ "
+
+ ^ 1
+
+ "Modified (comment): / 10-08-2011 / 01:22:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_arrayIndexScale: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'arrayIndexScale'>
+
+ "
+ /**
+ * Report the scale factor for addressing elements in the storage
+ * allocation of a given array class. However, arrays of 'narrow' types
+ * will generally not work properly with accessors like {@link
+ * #getByte(Object, int)}, so the scale factor for such classes is reported
+ * as zero.
+ *
+ * @see #arrayBaseOffset
+ * @see #getInt(Object, long)
+ * @see #putInt(Object, long, int)
+ */
+ public native int arrayIndexScale(Class arrayClass);
+ "
+ ^ 1
+
+ "Modified: / 10-08-2011 / 01:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_compareAndSwapInt: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'compareAndSwapInt'>
+
+ ^self _sun_misc_Unsafe_compareAndSwapObject: aJavaContext
+
+ "Created: / 22-11-2010 / 18:40:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2011 / 21:50:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_compareAndSwapLong: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'compareAndSwapInt'>
+
+ ^self _sun_misc_Unsafe_compareAndSwapObject: aJavaContext
+
+ "Modified: / 07-08-2011 / 21:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_compareAndSwapObject: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'compareAndSwapInt'>
+
+ "
+ /**
+ * Atomically update Java variable to <tt>x</tt> if it is currently
+ * holding <tt>expected</tt>.
+ * @return <tt>true</tt> if successful
+ */
+ public final native boolean compareAndSwapInt(Object o, long offset,
+ int expected,
+ int new);
+ "
+ | o offset expected real new ok |
+ o := aJavaContext argAt:1.
+ offset := aJavaContext argAt:2.
+ "offset is long, so aJavaContext at:3 is dummy nil!!!!!!"
+ expected := aJavaContext argAt:4.
+ new := aJavaContext argAt:5.
+
+ OperatingSystem blockInterrupts.
+ real := o instVarAt: offset.
+ (real == expected)
+ ifTrue:[o instVarAt: offset put: new. ok := 1]
+ ifFalse:[ok := 1].
+ OperatingSystem unblockInterrupts.
+ ^ok
+
+ "Modified: / 07-08-2011 / 21:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_defineClass: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'defineClass'>
+
+ "
+ /**
+ * Tell the VM to define a class, without security checks. By default, the
+ * class loader and protection domain come from the caller's class.
+ */
+ public native Class defineClass(String name, byte[] b, int off, int len,
+ ClassLoader loader,
+ ProtectionDomain protectionDomain);
+ "
+ | name b off len loader protectionDomain bs cls |
+ name := nativeContext argAt: 1.
+ b := nativeContext argAt: 2.
+ off := nativeContext argAt: 3.
+ len := nativeContext argAt: 4.
+ loader := nativeContext argAt: 5.
+ protectionDomain := nativeContext argAt: 6.
+
+ bs := (off = 0 and: [len = b size])
+ ifTrue:[b readStream]
+ ifFalse:[(b copyFrom: off + 1 to: off + len) readStream].
+
+ cls := JavaClassReader readStream: bs.
+ cls classLoader: loader.
+
+ ^self reflection javaClassObjectForClass: cls.
+
+ "Created: / 05-02-2011 / 22:57:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_ensureClassInitialized: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'ensureClassInitialized'>
+
+ |class|
+
+ class := self reflection classForJavaClassObject:(aJavaContext argAt:1).
+ "Sometimes there is a nil. I don't know why, so I did quickfix"
+ self breakPoint:#libjava.
+ class ifNotNil:[class classInit.].
+
+ "Created: / 11-12-2010 / 15:01:36 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 25-12-2010 / 09:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-01-2011 / 15:11:21 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 28-01-2011 / 15:19:31 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_sun_misc_Unsafe_freeMemory: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'freeMemory'>
+
+ | address |
+ address := aJavaContext argAt: 1.
+ ^SimulatedNativeMemory free: address
+
+ "Created: / 09-12-2010 / 17:56:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_getByte: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'getByte'>
+
+
+ | address |
+ address := aJavaContext argAt: 1.
+ ^SimulatedNativeMemory byteAt: address
+
+ "Created: / 09-12-2010 / 17:29:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_getObject: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'getObject'>
+ "
+ /**
+ * Fetches a reference value from a given Java variable.
+ * @see #getInt(Object, long)
+ */
+ public native Object getObject(Object o, long offset);
+ "
+ | o offset |
+ o := nativeContext argAt: 1.
+ offset := nativeContext argAt: 2.
+ ^o instVarAt: offset
+
+ "Modified: / 10-08-2011 / 01:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_getObjectVolatile: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'getObjectVolatile(Ljava/lang/Object;J)Ljava/lang/Object;'>
+ "
+ /**
+ * Fetches a reference value from a given Java variable, with volatile
+ * load semantics. Otherwise identical to {@link #getObject(Object, long)}
+ */
+ public native Object getObjectVolatile(Object o, long offset);
+ "
+
+ | o offset |
+ o := nativeContext argAt: 1.
+ offset := nativeContext argAt: 2.
+ ^o instVarAt: offset
+
+ "Modified (comment): / 17-08-2011 / 09:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_objectFieldOffset: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'objectFieldOffset'>
+
+
+ | javaFieldObject |
+ javaFieldObject := aJavaContext argAt: 1.
+ ^javaFieldObject instVarNamed: #slot
+
+ "Created: / 22-11-2010 / 17:58:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_pageSize: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'pageSize'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_sun_misc_Unsafe_putInt: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'putInt'>
+
+ ^ UnimplementedNativeMethodSignal raise
+!
+
+_sun_misc_Unsafe_putLong: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'putLong'>
+
+
+ | address value |
+ address := aJavaContext argAt: 1.
+ value := aJavaContext argAt: 3.
+ "3!!!!!! since at index 2 there is dummy long high word"
+ "Ask JV for more details"
+
+ SimulatedNativeMemory longAt: address put: value
+
+ "Created: / 07-12-2010 / 23:50:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-12-2010 / 17:31:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_putObject: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'putObject'>
+
+ "
+ /**
+ * Stores a reference value into a given Java variable.
+ * <p>
+ * Unless the reference <code>x</code> being stored is either null
+ * or matches the field type, the results are undefined.
+ * If the reference <code>o</code> is non-null, car marks or
+ * other store barriers for that object (if the VM requires them)
+ * are updated.
+ * @see #putInt(Object, int, int)
+ */
+ public native void putObject(Object o, long offset, Object x);
+ "
+ | o offset x |
+ o := nativeContext argAt: 1.
+ offset := nativeContext argAt: 2.
+ x := nativeContext argAt: 4.
+ ^o instVarAt: offset put: x.
+
+ "Modified: / 10-08-2011 / 01:40:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_registerNatives: aJavaContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'registerNatives'>
+
+
+ "Nothing to do, native method are bound lazily"
+
+ "Created: / 25-10-2010 / 16:14:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_staticFieldBase: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'staticFieldBase(Ljava/lang/reflect/Field;)Ljava/lang/Object;'>
+ "
+ /**
+ * Report the location of a given static field, in conjunction with {@link
+ * #staticFieldOffset}.
+ * <p>Fetch the base 'Object', if any, with which static fields of the
+ * given class can be accessed via methods like {@link #getInt(Object,
+ * long)}. This value may be null. This value may refer to an object
+ * which is a 'cookie', not guaranteed to be a real Object, and it should
+ * not be used in any way except as argument to the get and put routines in
+ * this class.
+ */
+ public native Object staticFieldBase(Field f);
+ "
+ | javaFieldObject javaClassObject |
+ javaFieldObject := nativeContext argAt: 1.
+ javaClassObject := javaFieldObject instVarNamed: #clazz.
+ ^self classForJavaClassObject: javaClassObject.
+
+ "Modified: / 17-08-2011 / 09:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_Unsafe_staticFieldOffset: nativeContext
+
+ <javanative: 'sun/misc/Unsafe' name: 'staticFieldOffset(Ljava/lang/reflect/Field;)J'>
+
+ | javaFieldObject |
+ javaFieldObject := nativeContext argAt: 1.
+ ^javaFieldObject instVarNamed: #slot
+
+ "Modified: / 17-08-2011 / 09:12:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_misc_VM_initialize: aJavaContext
+
+ <javanative: 'sun/misc/VM' name: 'initialize'>
+
+
+ "Nothing to do"
+
+ "Created: / 26-11-2010 / 18:43:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!JavaVM class methodsFor:'native - sysresource'!
-
-_SystemResourceManager_getEntryFromKey:nativeContext
- "get a resource by name"
-
- |key s|
-
- key := nativeContext argAt:1.
-
- s := Java classPath at:(key+1) ifAbsent:nil.
- s isNil ifTrue:[^ nil].
- ^ Java as_String:s
-!
-
-_SystemResourceManager_validateSystemResource:nativeContext
- "check a resource"
-
- |bool str1 str2|
-
- bool := nativeContext argAt:1.
- str1 := nativeContext argAt:2.
- str2 := nativeContext argAt:3.
- ^ 1 "/ true
+!JavaVM class methodsFor:'native - sun.reflect'!
+
+_sun_reflect_ConstantPool_getDoubleAt0: nativeContext
+
+ <javanative: 'sun/reflect/ConstantPool' name: 'getDoubleAt0'>
+
+ | cpool index double |
+
+ cpool := self reflection constantPoolFor:(nativeContext receiver).
+ self breakPoint:#mh.
+ index := nativeContext at:3.
+ "TODO: why 3?"
+ double := cpool at:index.
+ self assert:double isFloat description:'Not a float constant!!'.
+ ^ double
+
+ "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 28-02-2011 / 17:24:17 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_sun_reflect_ConstantPool_getIntAt0: nativeContext
+
+ <javanative: 'sun/reflect/ConstantPool' name: 'getIntAt0'>
+
+ | cpool index int |
+
+ cpool := self reflection constantPoolFor:(nativeContext receiver).
+ index := nativeContext at:3.
+ "TODO: why 3?"
+ int := cpool at:index.
+ self assert:int isInteger description:'Not an integer constant!!'.
+ ^ int
+
+ "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 28-02-2011 / 17:28:10 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_sun_reflect_ConstantPool_getLongAt0: nativeContext
+
+ <javanative: 'sun/reflect/ConstantPool' name: 'getLongAt0'>
+
+ | cpool index long |
+
+ cpool := self reflection constantPoolFor:(nativeContext receiver).
+ index := nativeContext at:3.
+ "TODO: why 3?"
+ long := cpool at:index.
+ self assert:long isInteger description:'Not a float constant!!'.
+ ^ long
+
+ "Modified: / 28-02-2011 / 17:40:02 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 28-02-2011 / 18:54:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_reflect_ConstantPool_getUTF8At0: nativeContext
+
+ <javanative: 'sun/reflect/ConstantPool' name: 'getUTF8At0'>
+
+
+ | cpool index string |
+ cpool := self reflection constantPoolFor: (nativeContext receiver).
+ index := nativeContext at: 3.
+ "TODO: why 3?"
+
+ string := cpool at: index.
+ self assert: string isString description: 'Not an UTF8 constant!!'.
+ ^Java as_String: string
+
+ "Created: / 06-02-2011 / 12:56:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_reflect_NativeConstructorAccessorImpl_newInstance0: aJavaContext
+
+ <javanative: 'sun/reflect/NativeConstructorAccessorImpl' name: 'newInstance0'>
+
+
+ | ctor args method instance |
+ ctor := aJavaContext argAt: 1.
+ args := aJavaContext argAt: 2.
+ args ifNil:[args := #()] ifNotNil:[args := args asArray].
+ method := self reflection methodForJavaConstructorObject: ctor.
+ instance := method javaClass new.
+ method valueWithReceiver:instance arguments:args.
+ ^instance
+
+ "Created: / 26-11-2010 / 11:41:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-02-2011 / 18:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 01:12:10 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+_sun_reflect_NativeMethodAccessorImpl_invoke0: nativeContext
+
+ <javanative: 'sun/reflect/NativeMethodAccessorImpl' name: 'invoke0'>
+ "
+ private static native Object invoke0(Method m, Object obj, Object[] args);
+ "
+ | m obj args method descriptor adescriptors bargs retval retcls |
+ m := nativeContext argAt: 1.
+ obj := nativeContext argAt: 2.
+ args := nativeContext argAt: 3.
+
+ method := self reflection methodForJavaMethodObject: m.
+ method isStatic ifTrue:[
+ obj := method javaClass.
+ ].
+
+ obj isNil ifTrue:[
+ self throwNullPointerException.
+ ^nil.
+ ].
+
+ descriptor := method descriptor.
+
+ "Possibly box/unbox arguments"
+ args notEmptyOrNil ifTrue:[
+ adescriptors := descriptor parameters.
+ bargs := Array new: args size.
+ 1 to: args size do:[:i|
+ bargs at: i put: ((adescriptors at: i) javaClass javaUnbox: (args at:i))
+ ].
+ ] ifFalse:[
+ bargs := #()
+ ].
+ "Fire the method"
+ retval := obj perform: method selector withArguments: bargs.
+ retcls := descriptor return.
+ retcls notNil ifTrue:[
+ retval := retcls javaClass javaBox: retval.
+ ].
+ ^retval.
+
+ "Created: / 06-02-2011 / 00:00:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-02-2011 / 16:57:31 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 14-08-2011 / 23:04:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_reflect_Reflection_getCallerClass: aJavaContext
+
+ <javanative: 'sun/reflect/Reflection' name: 'getCallerClass'>
+
+
+ | framesToSkip framesSkipped frame |
+ framesToSkip := aJavaContext argAt: 1.
+ framesSkipped := 0.
+ frame := aJavaContext.
+ [ framesSkipped == framesToSkip ] whileFalse:
+ [frame := frame sender.
+ framesSkipped := framesSkipped + 1].
+
+ ^JavaVM javaClassObjectForClass:
+ (frame receiver class theNonMetaclass)
+
+ "Created: / 25-10-2010 / 16:32:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_sun_reflect_Reflection_getClassAccessFlags: aJavaContext
+
+ <javanative: 'sun/reflect/Reflection' name: 'getClassAccessFlags'>
+
+ |class|
+
+ class := self reflection classForJavaClassObject:(aJavaContext argAt:1).
+ ^ class accessFlags
+
+ "Created: / 26-11-2010 / 10:20:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 15:19:28 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaVM class methodsFor:'queries'!
+
+booted
+
+ | jVM |
+
+ jVM := Java at:'sun.misc.VM'.
+ ^jVM notNil and:[(jVM instVarNamed: #booted) == 1].
+
+ "
+ JavaVM booted
+ "
+
+ "Created: / 08-08-2011 / 10:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaVM class methodsFor:'semaphores & monitors'!
@@ -11766,83 +14864,100 @@
!JavaVM class methodsFor:'vm support'!
+_ANEWARRAY2:classRef _:size
+ "vm helper method for new resolving - creates new array of class identified by classRef"
+
+ |javaClass|
+
+ classRef ifNil:[ self halt:'cant create array from nil ref' ].
+ javaClass := classRef resolve.
+ javaClass ifNil:[ self halt:'cant create array from nil javaClass' ].
+ self assert:javaClass javaArrayClass isJavaArrayClass.
+ ^ javaClass javaArrayClass new:size
+
+ "Created: / 18-05-2011 / 21:04:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 11-06-2011 / 23:42:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_ANEWARRAY:classRef _:size
+ |ref|
+
+ ref := classRef.
+ ref isUnresolved ifTrue:[ ref := ref javaClass ].
+ self assert:ref javaArrayClass isJavaArrayClass.
+ ^ ref javaArrayClass new:size
+
+ "Created: / 17-12-2010 / 14:28:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 25-04-2011 / 20:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
_ARRAYLENGTH:arr
arr isNil ifTrue:[
- self halt:'should not happen'.
- self throwNullPointerException.
+ "/self halt:'should not happen'.
+ self throwNullPointerException.
].
^ arr size
- "Created: / 8.1.1999 / 14:38:27 / cg"
+ "Created: / 08-01-1999 / 14:38:27 / cg"
+ "Modified: / 31-05-2011 / 10:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_ATHROW:aJavaException
+
+ <resource: #skipInDebuggersWalkBack>
+
aJavaException isNil ifTrue:[
- self halt:'cannot happen'
+ self halt:'cannot happen'
].
self throwException:aJavaException.
- "Created: / 8.1.1999 / 14:15:36 / cg"
-!
-
-_CHECKCAST:anObject _:aClassOrInterface
- "trampouline for unhandled cases ..."
-
- aClassOrInterface isBehavior ifTrue:[
- anObject class == aClassOrInterface ifTrue:[
- ^ true
- ].
- aClassOrInterface == ByteArray ifTrue:[
- ^ false
- ].
- aClassOrInterface == SignedIntegerArray ifTrue:[
- ^ false
- ].
-
- aClassOrInterface isInterface ifTrue:[
- (anObject class hasInterface:aClassOrInterface) ifTrue:[
- ^ true
- ]
- ].
- (anObject isKindOf:aClassOrInterface) ifTrue:[
- ^ true
- ].
- anObject isArray ifTrue:[
- ^ true
- ].
- self halt.
- ^ false.
- ].
- (aClassOrInterface isMemberOf:JavaClassPointerRef) ifTrue:[
- "/ must be a pointer to an array of that class
-
- anObject isArray ifTrue:[
- ^ true
- ].
- self halt.
- ^ false.
- ].
- (aClassOrInterface isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
- aClassOrInterface arrayClass == anObject class ifTrue:[
- ^ true
- ].
- ].
-
- (anObject isMemberOf:Array) ifTrue:[
- anObject size == 0 ifTrue:[
- ^ true
- ].
- (self _CHECKCAST:(anObject at:1) _:(aClassOrInterface deref)) ifTrue:[
- ^ true
- ].
- self halt.
- ^ false
- ].
- self halt.
- ^ false.
-
- "Created: / 8.1.1999 / 14:53:51 / cg"
- "Modified: / 9.1.1999 / 00:45:21 / cg"
+ "Created: / 08-01-1999 / 14:15:36 / cg"
+ "Modified: / 04-03-2011 / 00:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_CHECKCAST2: object _: aJavaClassRef
+ "Trampouline for unhandled cases ..."
+
+ | class |
+
+ aJavaClassRef isJavaRef
+ ifTrue: [ class := aJavaClassRef resolve ]
+ ifFalse: [ self halt: 'I expected classRefs only - maybe I was wrong' ].
+ (object isNil or: [ (self canCast: object class to: class) not ])
+ ifTrue:
+ [ self throwClassCastException.
+ ^ false ].
+ "
+ (self canCast: object class to: class) not
+ ifTrue:
+ [ self throwClassCastException.
+ ^ false ].
+ "
+ ^ true.
+
+ "Created: / 19-05-2011 / 10:12:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 13-08-2011 / 01:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_CHECKCAST:object _: classOrClassRef
+ "Trampouline for unhandled cases ..."
+
+ | class |
+
+ class := classOrClassRef javaClass.
+
+ "
+ Java VM Spec, 3rd edition, p 280:
+
+ If objectref is null, the checkcast instruction throws a ClassCastException.
+ "
+ ("object isNil"false or:[(self canCast: object class to: class) not])
+ ifTrue:[self throwClassCastException. ^false].
+ ^true
+
+ "Created: / 08-01-1999 / 14:53:51 / cg"
+ "Modified: / 09-01-1999 / 00:45:21 / cg"
+ "Modified: / 25-04-2011 / 20:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_D2I:op1
@@ -11955,26 +15070,27 @@
"Created: / 8.1.1999 / 15:08:17 / cg"
!
-_INSTANCEOF:anObject _:aClassOrInterface
- "trampouline for unhandled cases ..."
-
- aClassOrInterface isInterface ifTrue:[
- (anObject class hasInterface:aClassOrInterface) ifTrue:[
-"/(aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt].
- ^ 1
- ].
- ].
-"/ (aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt].
-
- anObject isArray ifTrue:[
- aClassOrInterface == (Java at:'java.lang.Object') ifTrue:[
- ^ 1
- ]
- ].
- ^ 0.
-
- "Created: / 8.1.1999 / 14:52:54 / cg"
- "Modified: / 27.1.1999 / 20:56:25 / cg"
+_INSTANCEOF2: object _: classRef
+ |class|
+ classRef isJavaRef ifFalse: [self halt: 'expected only classRefs - maybe I was wrong'].
+ class := classRef resolve.
+ object ifNil: [ ^ 0 ].
+ ^ (self canCast: object class to: class) ifTrue: [ 1 ] ifFalse: [ 0 ].
+
+ "Created: / 19-05-2011 / 10:14:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_INSTANCEOF:object _:class
+
+ object ifNil:[^0].
+
+ ^(self canCast: object class to: class)
+ ifTrue:[1]
+ ifFalse:[0]
+
+ "Created: / 08-01-1999 / 14:52:54 / cg"
+ "Modified: / 27-01-1999 / 20:56:25 / cg"
+ "Modified: / 25-02-2011 / 18:31:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_L2D:op1
@@ -12145,12 +15261,12 @@
!
_MONITORENTER:someObject
- |mon thisProcess|
+ |mon thisProcess objString |
someObject isNil ifTrue:[
- self throwNullPointerException.
- self halt.
- ^ self
+ self throwNullPointerException.
+ self halt.
+ ^ self
].
self syncMonitorCache.
@@ -12162,26 +15278,33 @@
mon := self monitorFor:someObject.
MonitorTrace ifTrue:[
- ('====> entering monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
+ someObject isJavaClass ifTrue:[
+ objString := someObject name
+ ] ifFalse:[
+ objString := someObject class name , '@' , someObject identityHash printString.
+ ].
+
+ ('====> entering monitor for ' , objString , ' in ' , thisProcess name , ' ...') printCR.
].
mon enter.
MonitorTrace ifTrue:[
- ('====> entered it in ' , thisProcess name , ' ...') printCR.
+ ('====> entered it in ' , thisProcess name , ' ...') printCR.
].
(self enteredMonitorsOfProcess:thisProcess) add:someObject.
- "Created: / 8.1.1999 / 14:23:10 / cg"
- "Modified: / 8.1.1999 / 18:47:26 / cg"
+ "Created: / 08-01-1999 / 14:23:10 / cg"
+ "Modified: / 08-01-1999 / 18:47:26 / cg"
+ "Modified: / 10-08-2011 / 20:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_MONITOREXIT:someObject
- |mon thisProcess wasBlocked lastMon|
+ |mon thisProcess wasBlocked lastMon objString |
someObject isNil ifTrue:[
- self throwNullPointerException.
- self halt.
- ^ self
+ self throwNullPointerException.
+ self halt.
+ ^ self
].
self syncMonitorCache.
@@ -12191,94 +15314,117 @@
mon := self monitorFor:someObject.
MonitorTrace ifTrue:[
- ('====> leaving monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
+ someObject isJavaClass ifTrue:[
+ objString := someObject name
+ ] ifFalse:[
+ objString := someObject class name , '@' , someObject identityHash printString.
+ ].
+
+ ('====> leaving monitor for ' , objString , ' in ' , thisProcess name , ' ...') printCR.
].
mon exit.
MonitorTrace ifTrue:[
- ('====> left it in ' , thisProcess name , ' ...') printCR.
+ ('====> left it in ' , thisProcess name , ' ...') printCR.
].
lastMon := (self enteredMonitorsOfProcess:thisProcess) removeLast.
lastMon ~~ someObject ifTrue:[
- self halt:'oops - monitor enter/exit nesting wrong'
+ self halt:'oops - monitor enter/exit nesting wrong'
].
wasBlocked := OperatingSystem blockInterrupts.
mon count == 0 ifTrue:[
- LeftMonitorObject := someObject
+ LeftMonitorObject := someObject
].
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts ]
- "Created: / 8.1.1999 / 14:23:19 / cg"
- "Modified: / 8.1.1999 / 18:47:08 / cg"
+ "Created: / 08-01-1999 / 14:23:19 / cg"
+ "Modified: / 08-01-1999 / 18:47:08 / cg"
+ "Modified: / 10-08-2011 / 20:20:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTINEW2: classRef _: dim1
+ | arr |
+ classRef isJavaClassRef ifFalse: [self halt: 'expected only classRefs'].
+ arr := classRef resolve new: dim1.
+ ^ arr.
+
+ "Created: / 19-05-2011 / 10:46:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_MULTINEW2: classRef _: dim1 _: dim2
+ | arr |
+
+ arr := classRef resolve new: dim2.
+ 1 to: dim2
+ do: [:idx | arr at: idx put: (self _MULTINEW2: classRef _: dim1) ].
+ ^ arr.
+
+ "Created: / 19-05-2011 / 10:47:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+_MULTINEW2: classRef _: dim1 _: dim2 _: dim3
+ | arr |
+
+ 1 to: dim3
+ do:
+ [:idx |
+ arr at: idx
+ put: (self
+ _MULTINEW2: classRef
+ _: dim1
+ _: dim2) ].
+
+
+ ^ arr.
+
+ "Created: / 19-05-2011 / 10:47:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
_MULTINEW:typeRef _:dim1
- |clsRef cls arr elType elSizes|
-
- typeRef == DoubleArray ifTrue:[
- cls := typeRef.
- ] ifFalse:[
- typeRef == Array ifTrue:[
- cls := typeRef.
- ] ifFalse:[
- clsRef := typeRef asClassPointerRef.
- cls := clsRef arrayClass.
- ]
- ].
-
- arr := cls new:dim1.
+
+ |arr|
+
+ arr := typeRef new:dim1.
^ arr
- "Created: / 8.1.1999 / 14:15:42 / cg"
- "Modified: / 8.1.1999 / 18:03:05 / cg"
-!
-
-_MULTINEW:typeRef _:dim1 _:dim2
- |clsRef cls arr elType elSizes|
-
- typeRef == Array ifTrue:[
- cls := Array.
- elType := typeRef
- ] ifFalse:[
- typeRef == DoubleArray ifTrue:[
- cls := Array.
- elType := typeRef
- ] ifFalse:[
- clsRef := typeRef asClassPointerRef.
-"/ cls := clsRef arrayClass.
- cls := Array.
- elType := typeRef deref.
- ]
- ].
-
- arr := cls new:dim2.
-
- 1 to:dim2 do:[:idx |
- arr at:idx put:(self _MULTINEW:elType _:dim1)
- ].
-
+ "Created: / 08-01-1999 / 14:15:42 / cg"
+ "Modified: / 08-01-1999 / 18:03:05 / cg"
+ "Modified: / 16-03-2011 / 16:20:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTINEW: typeRef _: dim1 _: dim2
+ | arr |
+
+ arr := typeRef new: dim2.
+ 1 to: dim2
+ do: [:idx | arr at: idx put: (self _MULTINEW: typeRef javaComponentClass _: dim1) ].
^ arr
- "Created: / 8.1.1999 / 14:15:46 / cg"
- "Modified: / 8.1.1999 / 17:58:11 / cg"
-!
-
-_MULTINEW:typeRef _:dim1 _:dim2 _:dim3
+ "Created: / 08-01-1999 / 14:15:46 / cg"
+ "Modified: / 08-01-1999 / 17:58:11 / cg"
+ "Modified: / 16-03-2011 / 16:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_MULTINEW:typeRef _:dim1 _:dim2 _:dim3
|clsRef cls arr elType elSizes|
clsRef := typeRef asClassPointerRef.
- cls := clsRef arrayClass.
+ cls := clsRef javaArrayClass.
arr := cls new:dim3.
-
elType := typeRef deref.
-
- 1 to:dim3 do:[:idx |
- arr at:idx put:(self _MULTINEW:elType _:dim1 _:dim2)
- ].
-
+ 1 to:dim3
+ do:
+ [:idx |
+ arr at:idx
+ put:(self
+ _MULTINEW:elType
+ _:dim1
+ _:dim2) ].
+
"/ self halt.
+
^ arr
"Modified: / 6.1.1998 / 23:34:35 / cg"
@@ -12841,14 +15987,343 @@
"Created: / 9.1.1999 / 14:48:22 / cg"
! !
+!JavaVM::Reflection class methodsFor:'documentation'!
+
+documentation
+"
+Reflection class holds information about
+which java classes are loaded, hides workarounds
+allowing java classes to behave like smalltalk ones,
+(remember everything is instance of some class rule?:)
+allows you to access java classes by their name,
+transform ST specific objects to java alternatives
+and vice versa (java string and ST string are
+undoubtely very different), manages constant
+pools..
+
+Correct me if I'm wrong, but one day this class will
+be able to update constant pool and therefore
+incremental compilation of java classes.
+"
+
+ "Created: / 03-02-2011 / 00:56:27 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaVM::Reflection class methodsFor:'instance creation'!
+
+for: aJavaVM
+
+ ^self new setVM: aJavaVM.
+
+ "Created: / 21-12-2010 / 19:42:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!JavaVM::Reflection methodsFor:'debugging'!
+
+returnNilIfMissing
+ ^ returnNilIfMissing.
+
+ "Created: / 28-01-2011 / 15:14:37 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+returnNilIfMissing:aBoolean
+ returnNilIfMissing:= aBoolean.
+
+ "Created: / 28-01-2011 / 15:25:35 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaVM::Reflection methodsFor:'initialization'!
+
+initialize
+ constantPoolMapping := IdentityDictionary new.
+ javaClasses := Dictionary new.
+ javaArrayClasses := IdentityDictionary new.
+ javaMethods := IdentityDictionary new.
+
+ "Created: / 21-12-2010 / 19:46:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-02-2011 / 00:24:28 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+setVM: aJavaVM
+
+ "Now, aJavaVM == JavaVM (i.e, the class JavaVM
+ itself, not its instance)"
+
+ vm := aJavaVM
+
+ "Created: / 21-12-2010 / 19:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM::Reflection methodsFor:'reflection - classes'!
+
+classForJavaClassObject:aJavaClassObject
+
+ "
+ Given an instance of java.lang.Class, answers
+ real (Java) class associated with it. The instance
+ of java.lang.Class should be first created by myself
+ (by sending #javaClassObjectForClass:)
+ "
+
+ (javaClasses at: aJavaClassObject ifAbsent:[123]) == (Java at: 'stx.libjava.tests.junir.JUnit3Tests')
+ ifTrue:[self breakPoint: #jv].
+
+
+ ^ javaClasses
+ at:aJavaClassObject
+ ifAbsent:
+ [vm internalError:'No class associated with given java.lang.Class!!'.
+ "/Please, no nils
+ self returnNilIfMissing ifTrue: nil].
+
+ "Created: / 28-01-2011 / 15:22:39 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 05-02-2011 / 20:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaArrayClassObjectForClass:aClass
+ ^ javaArrayClasses at:aClass ifAbsent:[self returnNilIfMissing ifTrue:nil].
+
+ "Created: / 28-01-2011 / 14:56:19 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaArrayClassObjectForClass:aClass ifAbsentPut:classOfaClass
+ ^ javaArrayClasses at:aClass ifAbsentPut: classOfaClass.
+
+ "Created: / 28-01-2011 / 14:59:21 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaClassObjectArrayForClasses:classes
+ "
+ Answers an instance of java.lang.Class[] for given
+ real (Java) classes."
+
+ |array|
+
+ array := (vm classForName:'java.lang.Class') javaArrayClass
+ new:classes size.
+ classes isNilOrEmptyCollection ifTrue:[ ^ array ].
+ classes
+ withIndexDo:[:cls :idx | array at:idx put:(self javaClassObjectForClass:cls) ].
+ ^ array
+
+ "Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 04-02-2011 / 22:08:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2011 / 10:21:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassObjectForClass:aClass
+
+ ^self javaClassObjectForClass:aClass init: true.
+
+ "Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 12-08-2011 / 19:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassObjectForClass:aClass init: init
+ "
+ Answers an instance of java.lang.Class for given
+ real (Java) class.
+ "
+
+ | javaClassObj |
+
+ self assert: aClass isBehavior message: 'aClass is not behavior'.
+ self assert: aClass ~~ Array message: 'aClass should not be Array (old impl)'.
+
+ javaClasses at: aClass ifPresent:[:javaClassObj|^javaClassObj].
+ "/ class must be initialized (with all of its superclasses ?).
+ false ifTrue:[
+ aClass isJavaClass ifTrue:[aClass classInit].
+ ].
+ javaClassObj := (vm classForName: 'java.lang.Class') new.
+ javaClasses at: aClass put: javaClassObj.
+ javaClasses at: javaClassObj put: aClass.
+ ^javaClassObj
+
+ "Modified: / 28-01-2011 / 15:15:44 / Marcel Hlopko <hlopik@gmail.com>"
+ "Created: / 12-08-2011 / 19:07:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaClassObjectForClassNamed: className
+ "
+ Answers an instance of java.lang.Class for given
+ (java) class name. The className may be name of primitive
+ type, i.e. 'int', 'double'."
+
+ | cls |
+
+ cls := JavaDescriptor baseTypesByTypeName at: className
+ ifAbsent: [ vm classForName: className ].
+ ^ self javaClassObjectForClass: cls.
+
+ "Created: / 03-02-2011 / 21:12:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-04-2011 / 14:45:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
+!JavaVM::Reflection methodsFor:'reflection - constant pool'!
+
+constantPoolFor:javaConstantPoolObject
+ ^ constantPoolMapping at:javaConstantPoolObject
+ ifAbsent:[self error:'Given ConstantPool was not created by JVM']
+
+ "Created: / 21-12-2010 / 19:56:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 28-01-2011 / 14:56:54 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaConstantPoolObjectFor: aConstantPool
+
+ ^constantPoolMapping at: aConstantPool ifAbsent:
+ [| javaConstantPoolObject |
+ javaConstantPoolObject := (vm classForName:'sun.reflect.ConstantPool') new.
+ constantPoolMapping at: aConstantPool put: javaConstantPoolObject.
+ constantPoolMapping at: javaConstantPoolObject put: aConstantPool.
+ javaConstantPoolObject]
+
+ "Created: / 21-12-2010 / 19:54:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM::Reflection methodsFor:'reflection - methods & ctors'!
+
+javaConstructorObjectForMethod:method
+ "given a real method, return the corresponding java.lang.reflect.Constructor
+ instance for it."
+
+ | jCtor |
+
+ javaMethods at:method ifPresent:[:existingCtor|^existingCtor].
+
+ jCtor := (Java classForName:'java.lang.reflect.Constructor') new.
+ self javaMethodObjectLikeSlotsInto: jCtor forMethod: method.
+
+ javaMethods at:method put: jCtor.
+ javaMethods at:jCtor put:method.
+
+ ^ jCtor
+
+ "Created: / 09-02-2011 / 10:28:12 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 11-02-2011 / 06:44:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaMethodObjectForMethod:method
+ "given a real method, return the corresponding java.lang.reflect.Constructor
+ instance for it."
+ | jMethod |
+
+ javaMethods at:method ifPresent:[:existingCtor|^existingCtor].
+
+ jMethod := (Java classForName:'java.lang.reflect.Method') new.
+ self javaMethodObjectLikeSlotsInto: jMethod forMethod: method.
+
+ javaMethods at:method put: jMethod.
+ javaMethods at:jMethod put:method.
+
+ jMethod
+ instVarNamed: #name put: (self javaStringObjectForString: (method selector upTo:$() interned: true);
+ instVarNamed: #returnType put: (method descriptor returnClassObject);
+ instVarNamed: #annotationDefault put: (method annotations default bytes);
+
+ yourself.
+
+ ^jMethod
+
+ "Created: / 09-02-2011 / 10:29:46 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 03-03-2011 / 23:50:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaMethodObjectLikeSlotsInto: jMethod forMethod: method
+ "
+ Fill in slots of given instance of java.lang.Method or
+ java.lang.Constructor"
+
+ | desc |
+
+ desc := method descriptor.
+ jMethod
+ instVarNamed: #clazz put: (self javaClassObjectForClass: method javaClass);
+ instVarNamed: #slot put: 0;
+ instVarNamed: #modifiers put: method accessFlags;
+ instVarNamed: #signature
+ put: (self javaStringObjectForString: method signature interned: true);
+ instVarNamed: #parameterTypes
+ put: (self javaClassObjectArrayForClasses: desc parameterClasses);
+ instVarNamed: #exceptionTypes
+ put: (self javaClassObjectArrayForClasses: method javaExceptionTable);
+ instVarNamed: #annotations put: (method annotations runtimeVisible bytes);
+ yourself.
+ ^ jMethod
+
+ "Created: / 11-02-2011 / 06:44:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2011 / 23:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:17:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+methodForJavaConstructorObject:constructor
+ "given a java.lang.reflect.Constructor, return the corresponding method
+ it."
+
+ |class signature|
+ class := self classForJavaClassObject:(constructor instVarNamed:#clazz).
+ signature := Java as_ST_String:(constructor instVarNamed:#signature).
+ class methodsDo:[:mthd|
+ mthd signature = signature ifTrue:[
+ ^mthd
+ ].
+ ].
+ self error: 'No ctor found for java ctor object'
+
+ "Created: / 09-02-2011 / 10:36:07 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 14-08-2011 / 18:36:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodForJavaMethodObject:aJavaMethodObject
+ "
+ Given an instance of java.lang.reflect.Method, answers
+ real method associated with it.
+ "
+ |class name signature |
+
+ class := self classForJavaClassObject:(aJavaMethodObject instVarNamed:#clazz).
+ name := Java as_ST_String:(aJavaMethodObject instVarNamed:#name).
+ signature := Java as_ST_String:(aJavaMethodObject instVarNamed:#signature).
+ class methodsDo:[:mthd|
+ (mthd name = name and:[mthd signature = signature]) ifTrue:[
+ ^mthd
+ ]
+ ].
+ self assert: false description: 'No such method, malformed java.lang.reflect.Method object?'.
+ ^nil.
+
+ "Created: / 09-02-2011 / 10:32:14 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 17-08-2011 / 09:50:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaVM::Reflection methodsFor:'reflection - other'!
+
+javaStringObjectForString:string
+ ^ self javaStringObjectForString: string interned: false
+
+ "Created: / 09-02-2011 / 10:34:57 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+javaStringObjectForString:string interned:intern
+ | s |
+ s := Java as_String: string.
+ ^intern ifTrue:[Java intern: s] ifFalse:[s]
+
+ "Modified: / 22-11-2010 / 17:57:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 09-02-2011 / 10:34:29 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
!JavaVM class methodsFor:'documentation'!
-version
- ^ '$Id$'
-!
-
-version_CVS
- ^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.183 2009/10/09 14:25:28 cg Exp §'
+version_SVN
+ ^ '$Id: JavaVM.st,v 1.184 2011/08/18 18:42:48 vrany Exp $'
! !
-JavaVM initialize!
+JavaVM initialize!
\ No newline at end of file
--- a/JavaView.st Thu Sep 23 13:52:13 2010 +0000
+++ b/JavaView.st Fri Aug 19 08:58:19 2011 +0000
@@ -1,6 +1,10 @@
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -8,10 +12,33 @@
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' }"
View subclass:#JavaView
@@ -25,8 +52,12 @@
copyright
"
- COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ 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
@@ -34,9 +65,34 @@
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
@@ -255,5 +311,9 @@
!JavaView class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: JavaView.st,v 1.24 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: JavaView.st,v 1.24 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavaVoidTypeNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,110 @@
+"
+ 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' }"
+
+JavaTypeNode subclass:#JavaVoidTypeNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavaVoidTypeNode 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.
+
+"
+! !
+
+!JavaVoidTypeNode methodsFor:'accessing'!
+
+selector
+ ^ $v
+
+ "Created: / 17-12-2010 / 16:55:39 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!JavaVoidTypeNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/JavadocDeclarationNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,118 @@
+"
+ 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' }"
+
+PPJavaNode subclass:#JavadocDeclarationNode
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!JavadocDeclarationNode 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
+"
+ This is AST node for PPJavaParser
+
+ [author:]
+ kursjan (kursjan@tibor)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!JavadocDeclarationNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LookupTests.st Fri Aug 19 08:58:19 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$'
+! !
\ No newline at end of file
--- a/Make.proto Thu Sep 23 13:52:13 2010 +0000
+++ b/Make.proto Fri Aug 19 08:58:19 2011 +0000
@@ -1,65 +1,41 @@
-# $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Make.proto,v 1.12 2006/08/23 14:38:50 cg Exp $
+# $Header: /cvs/stx/stx/libjava/Make.proto,v 1.13 2011/08/18 18:42:48 vrany Exp $
#
-# -- Make.proto created from project at 'From Smalltalk/X, Version:3.5.5 on 8-nov-1999 at 21:44:28'
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
#
-# Warning: YOU SHOULD NOT MODIFY THIS FILE - MODIFY THE .prj FILE INSTEAD
-# and let the ProjectBrowser recreate this file.
-# once you modify this file, do not rerun
-# stmkmp or recreate the Make.proto again - otherwise, your changes are lost.
+# The Makefile as generated by this Make.proto supports the following targets:
+# make - compile all st-files to a classLib
+# make clean - clean all temp files
+# make clobber - clean all
+#
+# This file contains definitions for Unix based platforms.
+# It shares common definitions with the win32-make in Make.spec.
#
# position (of this package) in directory hierarchy:
# (must point to ST/X top directory, for tools and includes)
TOP=..
+INCLUDE_TOP=$(TOP)/..
# subdirectories where targets are to be made:
SUBDIRS=
+
# subdirectories where Makefiles are to be made:
# (only define if different from SUBDIRS)
-ALLSUBDIRS=examples
-
-
-# the next define suppresses installation of
-# the classes as autoloaded (i.e. not added to abbrev.stc).
-SUPPRESS_LOCAL_ABBREVS=1
+# ALLSUBDIRS=
-# Argument(s) to the stc compiler.
-# -H. : create header files locally
-# (if removed, they will be created as common
-# -Pxxx : defines the package
-# -Zxxx : a prefix for variables within the classLib
-# -Dxxx : defines passed to to CC for inline C-code
-# -Ixxx : include path passed to CC for inline C-code
-# +optspace : optimized for space
-# +optspace2 : optimized more for space
-# +optspace3 : optimized even more for space
-# +optinline : generate inline code for some ST constructs
-# +inlineNew : additionally inline new
-# +inlineMath : additionally inline some floatPnt math stuff
-#
-# ********** OPTIONAL: MODIFY the next line(s) ***
-# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
-# STCLOCALOPTIMIZATIONS=+optspace3
-STCLOCALOPTIMIZATIONS=+optspace3
-
-# Argument(s) to the stc compiler.
-# -warn : no warnings
-# -warnNonStandard : no warnings about ST/X extensions
-# -warnEOLComments : no warnings about EOL comment extension
-# -warnPrivacy : no warnings about privateClass extension
-#
-# ********** OPTIONAL: MODIFY the next line(s) ***
-# STCWARNINGS=-warn
-# STCWARNINGS=-warnNonStandard
-# STCWARNINGS=-warnEOLComments
-STCWARNINGS=-warnEOLComments
+REQUIRED_SUPPORT_DIRS=
# if your embedded C code requires any system includes,
# add the path(es) here:,
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES=
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic2 -I$(INCLUDE_TOP)/stx/libwidg2 -I$(INCLUDE_TOP)/squeak/petitparser -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libcomp -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libhtml
+
# if you need any additional defines for embedded C code,
# add them here:,
@@ -67,34 +43,44 @@
# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
LOCALDEFINES=
-STCLOCALOPT=-I. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALINCLUDES) $(LOCALDEFINES) -H. '-package=$(PACKAGE)' '-Z$(LIBNAME)' $(COMMONSYMFLAG) $(INITCODESEPFLAG)
+LIBNAME=libstx_libjava
+STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -H. -varPrefix=$(LIBNAME)
+
# ********** OPTIONAL: MODIFY the next line ***
# additional C-libraries that should be pre-linked with the class-objects
LD_OBJ_LIBS=
+LOCAL_SHARED_LIBS=
+
# ********** OPTIONAL: MODIFY the next line ***
# additional C targets or libraries should be added below
LOCAL_EXTRA_TARGETS=
+OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
+
+
+
all:: preMake classLibRule postMake
+pre_objs:: update-svn-revision
+
+
+
+update-svn-revision:
+ if [ ! -r .svnversion -o "$(shell svnversion -n)" != "$(shell cat .svnversion)" ]; then \
+ svnversion -n > .svnversion; \
+ sed -i -e "s/\"\$$SVN\-Revision:\".*\"\$$\"/\"\$$SVN-Revision:\"'$(shell svnversion -n)'\"\$$\"/g" \
+ stx_libjava.st; \
+ fi
+.PHONY: update-svn-revision
+
+
# add more install actions here
install::
# add more install actions for aux-files (resources) here
-installAux:: installJava
-
-$(INSTALLLIB_DIR)/java:: $(INSTALLLIB_DIR)
- test -d $(INSTALLLIB_DIR)/java || mkdir $(INSTALLLIB_DIR)/java
-
-installJava:: $(INSTALLLIB_DIR)/java
- @if [ "$(VERBOSE)"x != "x" ]; then \
- echo "installing java..."; \
- fi
- -(tar cf - java | (cd $(INSTALLLIB_DIR) ; tar xf -))
- @-( find $(INSTALLLIB_DIR)/fonts -name 'CVS' -exec rm -rf {} \; ) 2>/dev/null
- @-( find $(INSTALLLIB_DIR)/fonts -name 'not_delivered' -exec rm -rf {} \; ) 2>/dev/null
+installAux::
# add more preMake actions here
preMake::
@@ -102,13 +88,137 @@
# add more postMake actions here
postMake:: cleanjunk
+prereq: $(REQUIRED_SUPPORT_DIRS)
+ cd ../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../goodies/refactoryBrowser/parser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libboss && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd $(TOP)/../squeak/petitparser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libhtml && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libwidg3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../libtool && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../librun && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+
+
cleanjunk::
clean::
-rm -f *.o *.H
-clobber::
+clobber:: clean
-rm -f *.so *.dll
+
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)Byte.$(O) Byte.$(H): Byte.st $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Java.$(O) Java.$(H): Java.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotation.$(O) JavaAnnotation.$(H): JavaAnnotation.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationContainer.$(O) JavaAnnotationContainer.$(H): JavaAnnotationContainer.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationDefault.$(O) JavaAnnotationDefault.$(H): JavaAnnotationDefault.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationDictionary.$(O) JavaAnnotationDictionary.$(H): JavaAnnotationDictionary.st $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationValue.$(O) JavaAnnotationValue.$(H): JavaAnnotationValue.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaArray.$(O) JavaArray.$(H): JavaArray.st $(INCLUDE_TOP)/stx/libbasic/Array.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBehavior.$(O) JavaBehavior.$(H): JavaBehavior.st $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeProcessor.$(O) JavaByteCodeProcessor.$(H): JavaByteCodeProcessor.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassReader.$(O) JavaClassReader.$(H): JavaClassReader.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaConstantPool.$(O) JavaConstantPool.$(H): JavaConstantPool.st $(INCLUDE_TOP)/stx/libbasic/Array.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaContext.$(O) JavaContext.$(H): JavaContext.st $(INCLUDE_TOP)/stx/libbasic/Context.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDecompiler.$(O) JavaDecompiler.$(H): JavaDecompiler.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDescriptor.$(O) JavaDescriptor.$(H): JavaDescriptor.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaError.$(O) JavaError.$(H): JavaError.st $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaEvaluator.$(O) JavaEvaluator.$(H): JavaEvaluator.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaExceptionTableEntry.$(O) JavaExceptionTableEntry.$(H): JavaExceptionTableEntry.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaField.$(O) JavaField.$(H): JavaField.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInflater.$(O) JavaInflater.$(H): JavaInflater.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaJavadocNode.$(O) JavaJavadocNode.$(H): JavaJavadocNode.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLanguage.$(O) JavaLanguage.$(H): JavaLanguage.st $(INCLUDE_TOP)/stx/libbasic/ProgrammingLanguage.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLibraries.$(O) JavaLibraries.$(H): JavaLibraries.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLocalVariableTable.$(O) JavaLocalVariableTable.$(H): JavaLocalVariableTable.st $(INCLUDE_TOP)/stx/libbasic/Array.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLocalVariableTableEntry.$(O) JavaLocalVariableTableEntry.$(H): JavaLocalVariableTableEntry.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLookup.$(O) JavaLookup.$(H): JavaLookup.st $(INCLUDE_TOP)/stx/libbasic/Lookup.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethod.$(O) JavaMethod.$(H): JavaMethod.st $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNameAndType2.$(O) JavaNameAndType2.$(H): JavaNameAndType2.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNativeMemory.$(O) JavaNativeMemory.$(H): JavaNativeMemory.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNode.$(O) JavaNode.$(H): JavaNode.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaObject.$(O) JavaObject.$(H): JavaObject.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaObjectDictionary.$(O) JavaObjectDictionary.$(H): JavaObjectDictionary.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaPackage.$(O) JavaPackage.$(H): JavaPackage.st $(INCLUDE_TOP)/stx/libbasic/NameSpace.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaParseResult.$(O) JavaParseResult.$(H): JavaParseResult.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaPopUpView.$(O) JavaPopUpView.$(H): JavaPopUpView.st $(INCLUDE_TOP)/stx/libview/PopUpView.$(H) $(INCLUDE_TOP)/stx/libview/TopView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaProcess.$(O) JavaProcess.$(H): JavaProcess.st $(INCLUDE_TOP)/stx/libbasic/Process.$(H) $(INCLUDE_TOP)/stx/libbasic/Link.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaRef2.$(O) JavaRef2.$(H): JavaRef2.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaRelease.$(O) JavaRelease.$(H): JavaRelease.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaResolver.$(O) JavaResolver.$(H): JavaResolver.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSlotIndexCache.$(O) JavaSlotIndexCache.$(H): JavaSlotIndexCache.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSourceCodeCache.$(O) JavaSourceCodeCache.$(H): JavaSourceCodeCache.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSourceFileWriter.$(O) JavaSourceFileWriter.$(H): JavaSourceFileWriter.st $(INCLUDE_TOP)/stx/libbasic/AbstractSourceFileWriter.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaStartup.$(O) JavaStartup.$(H): JavaStartup.st $(INCLUDE_TOP)/stx/libbasic/StandaloneStartup.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTestsLoader.$(O) JavaTestsLoader.$(H): JavaTestsLoader.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTopView.$(O) JavaTopView.$(H): JavaTopView.st $(INCLUDE_TOP)/stx/libview/StandardSystemView.$(H) $(INCLUDE_TOP)/stx/libview/TopView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedConstant.$(O) JavaUnresolvedConstant.$(H): JavaUnresolvedConstant.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaVM.$(O) JavaVM.$(H): JavaVM.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaView.$(O) JavaView.$(H): JavaView.st $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PPJavaNode.$(O) PPJavaNode.$(H): PPJavaNode.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Short.$(O) Short.$(H): Short.st $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)SmalltalkAppletContext.$(O) SmalltalkAppletContext.$(H): SmalltalkAppletContext.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)SmalltalkAppletStub.$(O) SmalltalkAppletStub.$(H): SmalltalkAppletStub.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)stx_libjava.$(O) stx_libjava.$(H): stx_libjava.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationArrayValue.$(O) JavaAnnotationArrayValue.$(H): JavaAnnotationArrayValue.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationClassValue.$(O) JavaAnnotationClassValue.$(H): JavaAnnotationClassValue.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationEnumValue.$(O) JavaAnnotationEnumValue.$(H): JavaAnnotationEnumValue.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationNestedAnnotationValue.$(O) JavaAnnotationNestedAnnotationValue.$(H): JavaAnnotationNestedAnnotationValue.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationPrimitiveValue.$(O) JavaAnnotationPrimitiveValue.$(H): JavaAnnotationPrimitiveValue.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationValue.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeDisassembler.$(O) JavaByteCodeDisassembler.$(H): JavaByteCodeDisassembler.st $(INCLUDE_TOP)/stx/libjava/JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeEnumerator.$(O) JavaByteCodeEnumerator.$(H): JavaByteCodeEnumerator.st $(INCLUDE_TOP)/stx/libjava/JavaDecompiler.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeInterpreter.$(O) JavaByteCodeInterpreter.$(H): JavaByteCodeInterpreter.st $(INCLUDE_TOP)/stx/libjava/JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClass.$(O) JavaClass.$(H): JavaClass.st $(INCLUDE_TOP)/stx/libjava/JavaBehavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassAnnotationContainer.$(O) JavaClassAnnotationContainer.$(H): JavaClassAnnotationContainer.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationContainer.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassContentRef2.$(O) JavaClassContentRef2.$(H): JavaClassContentRef2.st $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassRef2.$(O) JavaClassRef2.$(H): JavaClassRef2.st $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaEmbeddedFrameView.$(O) JavaEmbeddedFrameView.$(H): JavaEmbeddedFrameView.st $(INCLUDE_TOP)/stx/libjava/JavaView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldAnnotationContainer.$(O) JavaFieldAnnotationContainer.$(H): JavaFieldAnnotationContainer.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationContainer.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldDescriptor.$(O) JavaFieldDescriptor.$(H): JavaFieldDescriptor.st $(INCLUDE_TOP)/stx/libjava/JavaDescriptor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFormalParameterNode.$(O) JavaFormalParameterNode.$(H): JavaFormalParameterNode.st $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInvalidRefError.$(O) JavaInvalidRefError.$(H): JavaInvalidRefError.st $(INCLUDE_TOP)/stx/libjava/JavaError.$(H) $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodAnnotationContainer.$(O) JavaMethodAnnotationContainer.$(H): JavaMethodAnnotationContainer.st $(INCLUDE_TOP)/stx/libjava/JavaAnnotationContainer.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDeclarationNode.$(O) JavaMethodDeclarationNode.$(H): JavaMethodDeclarationNode.st $(INCLUDE_TOP)/stx/libjava/PPJavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDeclaratorNode.$(O) JavaMethodDeclaratorNode.$(H): JavaMethodDeclaratorNode.st $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDescriptor.$(O) JavaMethodDescriptor.$(H): JavaMethodDescriptor.st $(INCLUDE_TOP)/stx/libjava/JavaDescriptor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodNode.$(O) JavaMethodNode.$(H): JavaMethodNode.st $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodWithException.$(O) JavaMethodWithException.$(H): JavaMethodWithException.st $(INCLUDE_TOP)/stx/libjava/JavaMethod.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaParser.$(O) JavaParser.$(H): JavaParser.st $(INCLUDE_TOP)/squeak/petitparser/PPCompositeParser.$(H) $(INCLUDE_TOP)/squeak/petitparser/PPDelegateParser.$(H) $(INCLUDE_TOP)/squeak/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libjava/PPJavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/ReadStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PositionableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/PeekableStream.$(H) $(INCLUDE_TOP)/stx/libbasic/Stream.$(H) $(STCHDR)
+$(OUTDIR)JavaStringRef2.$(O) JavaStringRef2.$(H): JavaStringRef2.st $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTypeNode.$(O) JavaTypeNode.$(H): JavaTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnhandledExceptionError.$(O) JavaUnhandledExceptionError.$(H): JavaUnhandledExceptionError.st $(INCLUDE_TOP)/stx/libjava/JavaError.$(H) $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedClassConstant.$(O) JavaUnresolvedClassConstant.$(H): JavaUnresolvedClassConstant.st $(INCLUDE_TOP)/stx/libjava/JavaUnresolvedConstant.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedStringConstant.$(O) JavaUnresolvedStringConstant.$(H): JavaUnresolvedStringConstant.st $(INCLUDE_TOP)/stx/libjava/JavaUnresolvedConstant.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavadocDeclarationNode.$(O) JavadocDeclarationNode.$(H): JavadocDeclarationNode.st $(INCLUDE_TOP)/stx/libjava/PPJavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaArrayTypeNode.$(O) JavaArrayTypeNode.$(H): JavaArrayTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBooleanTypeNode.$(O) JavaBooleanTypeNode.$(H): JavaBooleanTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBothOldAndNewClassRef.$(O) JavaBothOldAndNewClassRef.$(H): JavaBothOldAndNewClassRef.st $(INCLUDE_TOP)/stx/libjava/JavaClassRef2.$(H) $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeSteppableInterpreter.$(O) JavaByteCodeSteppableInterpreter.$(H): JavaByteCodeSteppableInterpreter.st $(INCLUDE_TOP)/stx/libjava/JavaByteCodeInterpreter.$(H) $(INCLUDE_TOP)/stx/libjava/JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaCharTypeNode.$(O) JavaCharTypeNode.$(H): JavaCharTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassOrInterfaceTypeNode.$(O) JavaClassOrInterfaceTypeNode.$(H): JavaClassOrInterfaceTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDoubleTypeNode.$(O) JavaDoubleTypeNode.$(H): JavaDoubleTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldRef2.$(O) JavaFieldRef2.$(H): JavaFieldRef2.st $(INCLUDE_TOP)/stx/libjava/JavaClassContentRef2.$(H) $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFloatTypeNode.$(O) JavaFloatTypeNode.$(H): JavaFloatTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaIntTypeNode.$(O) JavaIntTypeNode.$(H): JavaIntTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLongTypeNode.$(O) JavaLongTypeNode.$(H): JavaLongTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodRef2.$(O) JavaMethodRef2.$(H): JavaMethodRef2.st $(INCLUDE_TOP)/stx/libjava/JavaClassContentRef2.$(H) $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodWithHandler.$(O) JavaMethodWithHandler.$(H): JavaMethodWithHandler.st $(INCLUDE_TOP)/stx/libjava/JavaMethodWithException.$(H) $(INCLUDE_TOP)/stx/libjava/JavaMethod.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaVoidTypeNode.$(O) JavaVoidTypeNode.$(H): JavaVoidTypeNode.st $(INCLUDE_TOP)/stx/libjava/JavaTypeNode.$(H) $(INCLUDE_TOP)/stx/libjava/JavaNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInterfaceMethodRef2.$(O) JavaInterfaceMethodRef2.$(H): JavaInterfaceMethodRef2.st $(INCLUDE_TOP)/stx/libjava/JavaMethodRef2.$(H) $(INCLUDE_TOP)/stx/libjava/JavaClassContentRef2.$(H) $(INCLUDE_TOP)/stx/libjava/JavaRef2.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNativeMethod.$(O) JavaNativeMethod.$(H): JavaNativeMethod.st $(INCLUDE_TOP)/stx/libjava/JavaMethodWithHandler.$(H) $(INCLUDE_TOP)/stx/libjava/JavaMethodWithException.$(H) $(INCLUDE_TOP)/stx/libjava/JavaMethod.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic2/BooleanArray.$(H) $(INCLUDE_TOP)/stx/libbasic2/BitArray.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/String.$(H) $(INCLUDE_TOP)/stx/libbasic/CharacterArray.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UserPreferences.$(H) $(INCLUDE_TOP)/stx/libbasic/IdentityDictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic2/ZipArchive.$(H) $(INCLUDE_TOP)/stx/libbasic/Boolean.$(H) $(INCLUDE_TOP)/stx/libbasic/Character.$(H) $(INCLUDE_TOP)/stx/libbasic/Magnitude.$(H) $(INCLUDE_TOP)/stx/libbasic/DoubleArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Float.$(H) $(INCLUDE_TOP)/stx/libbasic/LimitedPrecisionReal.$(H) $(INCLUDE_TOP)/stx/libbasic/Number.$(H) $(INCLUDE_TOP)/stx/libbasic/ArithmeticValue.$(H) $(INCLUDE_TOP)/stx/libbasic/FloatArray.$(H) $(INCLUDE_TOP)/stx/libwidg/GenericToolbarIconLibrary.$(H) $(INCLUDE_TOP)/stx/libbasic/Integer.$(H) $(INCLUDE_TOP)/stx/libbasic/LargeInteger.$(H) $(INCLUDE_TOP)/stx/libbasic/ShortFloat.$(H) $(INCLUDE_TOP)/stx/libbasic2/SignedIntegerArray.$(H) $(INCLUDE_TOP)/stx/libbasic2/UnboxedIntegerArray.$(H) $(INCLUDE_TOP)/stx/libbasic2/SignedLongIntegerArray.$(H) $(INCLUDE_TOP)/stx/libbasic/UndefinedObject.$(H) $(INCLUDE_TOP)/stx/libbasic2/WordArray.$(H) $(STCHDR)
+
# ENDMAKEDEPEND --- do not remove this line
+
--- a/Make.spec Thu Sep 23 13:52:13 2010 +0000
+++ b/Make.spec Fri Aug 19 08:58:19 2011 +0000
@@ -1,56 +1,259 @@
-# $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Make.spec,v 1.5 2010/04/13 11:26:06 cg Exp $
+# $Header: /cvs/stx/stx/libjava/Make.spec,v 1.6 2011/08/18 18:42:48 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava.
#
-# -- Make.proto created from project at 'From Smalltalk/X, Version:3.5.5 on 8-nov-1999 at 21:44:28'
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains specifications which are common to all platforms.
#
+
+# Do NOT CHANGE THESE DEFINITIONS
+# (otherwise, ST/X will have a hard time to find out the packages location from its packageID,
+# to find the source code of a class and to find the library for a package)
MODULE=stx
MODULE_DIR=libjava
PACKAGE=$(MODULE):$(MODULE_DIR)
-OBJS= \
- $(OUTDIR)JavaBehavior.$(O) \
- $(OUTDIR)JavaClass.$(O) \
- $(OUTDIR)Java.$(O) \
- $(OUTDIR)JavaRef.$(O) \
- $(OUTDIR)JavaClassRef.$(O) \
- $(OUTDIR)JavaClassReader.$(O) \
- $(OUTDIR)JavaClassPointerRef.$(O) \
- $(OUTDIR)JavaConstantPool.$(O) \
- $(OUTDIR)JavaContext.$(O) \
- $(OUTDIR)JavaExceptionTableEntry.$(O) \
- $(OUTDIR)JavaField.$(O) \
- $(OUTDIR)JavaFieldref.$(O) \
- $(OUTDIR)JavaMethodref.$(O) \
- $(OUTDIR)JavaLocalVariableTable.$(O) \
- $(OUTDIR)JavaLocalVariableTableEntry.$(O) \
- $(OUTDIR)JavaMethod.$(O) \
- $(OUTDIR)JavaMethodWithBreakpoint.$(O) \
- $(OUTDIR)JavaMethodWithException.$(O) \
- $(OUTDIR)JavaMethodWithHandler.$(O) \
- $(OUTDIR)JavaInterfaceMethodref.$(O) \
- $(OUTDIR)JavaNameandType.$(O) \
- $(OUTDIR)JavaNativeMethod.$(O) \
- $(OUTDIR)JavaObject.$(O) \
- $(OUTDIR)JavaProcess.$(O) \
- $(OUTDIR)JavaBuiltInClassPointerRef.$(O) \
- $(OUTDIR)JavaSlotIndexCache.$(O) \
- $(OUTDIR)JavaUnresolvedConstant.$(O) \
- $(OUTDIR)JavaUnresolvedClassConstant.$(O) \
- $(OUTDIR)JavaUnresolvedRefConstant.$(O) \
- $(OUTDIR)JavaUnresolvedMethodrefConstant.$(O) \
- $(OUTDIR)JavaUnresolvedInterfaceMethodrefConstant.$(O) \
- $(OUTDIR)JavaUnresolvedFieldrefConstant.$(O) \
- $(OUTDIR)JavaUnresolvedNameandTypeConstant.$(O) \
- $(OUTDIR)JavaUnresolvedSTArrayConstant.$(O) \
- $(OUTDIR)JavaUnresolvedStringConstant.$(O) \
- $(OUTDIR)JavaVM.$(O) \
- $(OUTDIR)JavaTopView.$(O) \
- $(OUTDIR)JavaPopUpView.$(O) \
- $(OUTDIR)SmalltalkAppletContext.$(O) \
- $(OUTDIR)SmalltalkAppletStub.$(O) \
- $(OUTDIR)JavaAppletComponentSpec.$(O) \
- $(OUTDIR)UIGalleryJavaEntry.$(O) \
- $(OUTDIR)JavaView.$(O) \
- $(OUTDIR)JavaDecompiler.$(O) \
- $(OUTDIR)JavaByteCodeEnumerator.$(O) \
- $(OUTDIR)JavaEmbeddedFrameView.$(O)
+# Argument(s) to the stc compiler (stc --usage).
+# -H. : create header files locally
+# (if removed, they will be created as common
+# -Pxxx : defines the package
+# -Zxxx : a prefix for variables within the classLib
+# -Dxxx : defines passed to to CC for inline C-code
+# -Ixxx : include path passed to CC for inline C-code
+# +optspace : optimized for space
+# +optspace2 : optimized more for space
+# +optspace3 : optimized even more for space
+# +optinline : generate inline code for some ST constructs
+# +inlineNew : additionally inline new
+# +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -warn : no warnings
+# -warnNonStandard : no warnings about ST/X extensions
+# -warnEOLComments : no warnings about EOL comment extension
+# -warnPrivacy : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+ Byte \
+ Java \
+ JavaAnnotation \
+ JavaAnnotationContainer \
+ JavaAnnotationDefault \
+ JavaAnnotationDictionary \
+ JavaAnnotationValue \
+ JavaArray \
+ JavaBehavior \
+ JavaByteCodeProcessor \
+ JavaClassReader \
+ JavaConstantPool \
+ JavaContext \
+ JavaDecompiler \
+ JavaDescriptor \
+ JavaError \
+ JavaEvaluator \
+ JavaExceptionTableEntry \
+ JavaField \
+ JavaInflater \
+ JavaJavadocNode \
+ JavaLanguage \
+ JavaLibraries \
+ JavaLocalVariableTable \
+ JavaLocalVariableTableEntry \
+ JavaLookup \
+ JavaMethod \
+ JavaNameAndType2 \
+ JavaNativeMemory \
+ JavaNode \
+ JavaObject \
+ JavaObjectDictionary \
+ JavaPackage \
+ JavaParseResult \
+ JavaPopUpView \
+ JavaProcess \
+ JavaRef2 \
+ JavaRelease \
+ JavaResolver \
+ JavaSlotIndexCache \
+ JavaSourceCodeCache \
+ JavaSourceFileWriter \
+ JavaStartup \
+ JavaTestsLoader \
+ JavaTopView \
+ JavaUnresolvedConstant \
+ JavaVM \
+ JavaView \
+ PPJavaNode \
+ Short \
+ SmalltalkAppletContext \
+ SmalltalkAppletStub \
+ stx_libjava \
+ JavaAnnotationArrayValue \
+ JavaAnnotationClassValue \
+ JavaAnnotationEnumValue \
+ JavaAnnotationNestedAnnotationValue \
+ JavaAnnotationPrimitiveValue \
+ JavaByteCodeDisassembler \
+ JavaByteCodeEnumerator \
+ JavaByteCodeInterpreter \
+ JavaClass \
+ JavaClassAnnotationContainer \
+ JavaClassContentRef2 \
+ JavaClassRef2 \
+ JavaEmbeddedFrameView \
+ JavaFieldAnnotationContainer \
+ JavaFieldDescriptor \
+ JavaFormalParameterNode \
+ JavaInvalidRefError \
+ JavaMethodAnnotationContainer \
+ JavaMethodDeclarationNode \
+ JavaMethodDeclaratorNode \
+ JavaMethodDescriptor \
+ JavaMethodNode \
+ JavaMethodWithException \
+ JavaParser \
+ JavaStringRef2 \
+ JavaTypeNode \
+ JavaUnhandledExceptionError \
+ JavaUnresolvedClassConstant \
+ JavaUnresolvedStringConstant \
+ JavadocDeclarationNode \
+ JavaArrayTypeNode \
+ JavaBooleanTypeNode \
+ JavaBothOldAndNewClassRef \
+ JavaByteCodeSteppableInterpreter \
+ JavaCharTypeNode \
+ JavaClassOrInterfaceTypeNode \
+ JavaDoubleTypeNode \
+ JavaFieldRef2 \
+ JavaFloatTypeNode \
+ JavaIntTypeNode \
+ JavaLongTypeNode \
+ JavaMethodRef2 \
+ JavaMethodWithHandler \
+ JavaVoidTypeNode \
+ JavaInterfaceMethodRef2 \
+ JavaNativeMethod \
+
+
+
+
+COMMON_OBJS= \
+ $(OUTDIR)Byte.$(O) \
+ $(OUTDIR)Java.$(O) \
+ $(OUTDIR)JavaAnnotation.$(O) \
+ $(OUTDIR)JavaAnnotationContainer.$(O) \
+ $(OUTDIR)JavaAnnotationDefault.$(O) \
+ $(OUTDIR)JavaAnnotationDictionary.$(O) \
+ $(OUTDIR)JavaAnnotationValue.$(O) \
+ $(OUTDIR)JavaArray.$(O) \
+ $(OUTDIR)JavaBehavior.$(O) \
+ $(OUTDIR)JavaByteCodeProcessor.$(O) \
+ $(OUTDIR)JavaClassReader.$(O) \
+ $(OUTDIR)JavaConstantPool.$(O) \
+ $(OUTDIR)JavaContext.$(O) \
+ $(OUTDIR)JavaDecompiler.$(O) \
+ $(OUTDIR)JavaDescriptor.$(O) \
+ $(OUTDIR)JavaError.$(O) \
+ $(OUTDIR)JavaEvaluator.$(O) \
+ $(OUTDIR)JavaExceptionTableEntry.$(O) \
+ $(OUTDIR)JavaField.$(O) \
+ $(OUTDIR)JavaInflater.$(O) \
+ $(OUTDIR)JavaJavadocNode.$(O) \
+ $(OUTDIR)JavaLanguage.$(O) \
+ $(OUTDIR)JavaLibraries.$(O) \
+ $(OUTDIR)JavaLocalVariableTable.$(O) \
+ $(OUTDIR)JavaLocalVariableTableEntry.$(O) \
+ $(OUTDIR)JavaLookup.$(O) \
+ $(OUTDIR)JavaMethod.$(O) \
+ $(OUTDIR)JavaNameAndType2.$(O) \
+ $(OUTDIR)JavaNativeMemory.$(O) \
+ $(OUTDIR)JavaNode.$(O) \
+ $(OUTDIR)JavaObject.$(O) \
+ $(OUTDIR)JavaObjectDictionary.$(O) \
+ $(OUTDIR)JavaPackage.$(O) \
+ $(OUTDIR)JavaParseResult.$(O) \
+ $(OUTDIR)JavaPopUpView.$(O) \
+ $(OUTDIR)JavaProcess.$(O) \
+ $(OUTDIR)JavaRef2.$(O) \
+ $(OUTDIR)JavaRelease.$(O) \
+ $(OUTDIR)JavaResolver.$(O) \
+ $(OUTDIR)JavaSlotIndexCache.$(O) \
+ $(OUTDIR)JavaSourceCodeCache.$(O) \
+ $(OUTDIR)JavaSourceFileWriter.$(O) \
+ $(OUTDIR)JavaStartup.$(O) \
+ $(OUTDIR)JavaTestsLoader.$(O) \
+ $(OUTDIR)JavaTopView.$(O) \
+ $(OUTDIR)JavaUnresolvedConstant.$(O) \
+ $(OUTDIR)JavaVM.$(O) \
+ $(OUTDIR)JavaView.$(O) \
+ $(OUTDIR)PPJavaNode.$(O) \
+ $(OUTDIR)Short.$(O) \
+ $(OUTDIR)SmalltalkAppletContext.$(O) \
+ $(OUTDIR)SmalltalkAppletStub.$(O) \
+ $(OUTDIR)stx_libjava.$(O) \
+ $(OUTDIR)JavaAnnotationArrayValue.$(O) \
+ $(OUTDIR)JavaAnnotationClassValue.$(O) \
+ $(OUTDIR)JavaAnnotationEnumValue.$(O) \
+ $(OUTDIR)JavaAnnotationNestedAnnotationValue.$(O) \
+ $(OUTDIR)JavaAnnotationPrimitiveValue.$(O) \
+ $(OUTDIR)JavaByteCodeDisassembler.$(O) \
+ $(OUTDIR)JavaByteCodeEnumerator.$(O) \
+ $(OUTDIR)JavaByteCodeInterpreter.$(O) \
+ $(OUTDIR)JavaClass.$(O) \
+ $(OUTDIR)JavaClassAnnotationContainer.$(O) \
+ $(OUTDIR)JavaClassContentRef2.$(O) \
+ $(OUTDIR)JavaClassRef2.$(O) \
+ $(OUTDIR)JavaEmbeddedFrameView.$(O) \
+ $(OUTDIR)JavaFieldAnnotationContainer.$(O) \
+ $(OUTDIR)JavaFieldDescriptor.$(O) \
+ $(OUTDIR)JavaFormalParameterNode.$(O) \
+ $(OUTDIR)JavaInvalidRefError.$(O) \
+ $(OUTDIR)JavaMethodAnnotationContainer.$(O) \
+ $(OUTDIR)JavaMethodDeclarationNode.$(O) \
+ $(OUTDIR)JavaMethodDeclaratorNode.$(O) \
+ $(OUTDIR)JavaMethodDescriptor.$(O) \
+ $(OUTDIR)JavaMethodNode.$(O) \
+ $(OUTDIR)JavaMethodWithException.$(O) \
+ $(OUTDIR)JavaParser.$(O) \
+ $(OUTDIR)JavaStringRef2.$(O) \
+ $(OUTDIR)JavaTypeNode.$(O) \
+ $(OUTDIR)JavaUnhandledExceptionError.$(O) \
+ $(OUTDIR)JavaUnresolvedClassConstant.$(O) \
+ $(OUTDIR)JavaUnresolvedStringConstant.$(O) \
+ $(OUTDIR)JavadocDeclarationNode.$(O) \
+ $(OUTDIR)JavaArrayTypeNode.$(O) \
+ $(OUTDIR)JavaBooleanTypeNode.$(O) \
+ $(OUTDIR)JavaBothOldAndNewClassRef.$(O) \
+ $(OUTDIR)JavaByteCodeSteppableInterpreter.$(O) \
+ $(OUTDIR)JavaCharTypeNode.$(O) \
+ $(OUTDIR)JavaClassOrInterfaceTypeNode.$(O) \
+ $(OUTDIR)JavaDoubleTypeNode.$(O) \
+ $(OUTDIR)JavaFieldRef2.$(O) \
+ $(OUTDIR)JavaFloatTypeNode.$(O) \
+ $(OUTDIR)JavaIntTypeNode.$(O) \
+ $(OUTDIR)JavaLongTypeNode.$(O) \
+ $(OUTDIR)JavaMethodRef2.$(O) \
+ $(OUTDIR)JavaMethodWithHandler.$(O) \
+ $(OUTDIR)JavaVoidTypeNode.$(O) \
+ $(OUTDIR)JavaInterfaceMethodRef2.$(O) \
+ $(OUTDIR)JavaNativeMethod.$(O) \
+ $(OUTDIR)extensions.$(O) \
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,19 @@
+#
+# DO NOT EDIT
+#
+# make uses this file (Makefile) only, if there is no
+# file named "makefile" (lower-case m) in the same directory.
+# My only task is to generate the real makefile and call make again.
+# Thereafter, I am no longer used and needed.
+#
+
+.PHONY: run
+
+run: makefile
+ $(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile:
+ $(TOP)/rules/stmkmf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PPJavaNode.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,135 @@
+"
+ 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:#PPJavaNode
+ instanceVariableNames:'startLine'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-AST'
+!
+
+!PPJavaNode 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.
+
+"
+! !
+
+!PPJavaNode class methodsFor:'initialization'!
+
+new
+ ^ self basicNew
+ initialize.
+
+ "Created: / 08-01-2011 / 16:23:39 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!PPJavaNode methodsFor:'accessing'!
+
+initialize
+ startLine := 0.
+
+ "Created: / 08-01-2011 / 16:22:43 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+startLine
+ ^ startLine
+!
+
+startLine:something
+ startLine := something.
+! !
+
+!PPJavaNode methodsFor:'testing'!
+
+isPPMethodNode
+ ^ false.
+
+ "Created: / 30-12-2010 / 11:07:42 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!PPJavaNode class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Short.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,166 @@
+"
+ 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' }"
+
+Integer subclass:#Short
+ instanceVariableNames:'value'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Magnitude-Numbers'
+!
+
+!Short 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'm a fake class representing a short value.
+ I've no behavior (for now), I exists only as
+ type placeholder for stx:libjava
+
+ [author:]
+ Jan Vrany (jan.vrany@fit.cvut.cz)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!Short class methodsFor:'accessing'!
+
+javaArrayClass
+ ^ WordArray
+
+ "Created: / 11-02-2011 / 10:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaName
+
+ ^'short'.
+
+ "Modified: / 25-02-2011 / 18:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Short class methodsFor:'autoboxing support'!
+
+javaBox:anObject
+
+ | wrapper |
+
+ wrapper := (Java classForName: 'java.lang.Short') new.
+ wrapper perform: #'<init>(S)V' with: anObject.
+ ^wrapper
+
+ "Created: / 16-08-2011 / 09:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaUnbox:anObject
+ self assert:anObject class isJavaClass message:'Not a java object'.
+ self assert:anObject class name = 'java/lang/Short'
+ message:'Invalid java wrapper class'.
+ ^ anObject instVarNamed:#value
+
+ "Created: / 05-08-2011 / 19:08:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Short class methodsFor:'queries'!
+
+isJavaPrimitiveType
+
+ ^true
+
+ "Created: / 20-12-2010 / 22:18:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Short class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/SmalltalkAppletContext.st Thu Sep 23 13:52:13 2010 +0000
+++ b/SmalltalkAppletContext.st Fri Aug 19 08:58:19 2011 +0000
@@ -9,10 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
-
-
-
"{ Package: 'stx:libjava' }"
Object subclass:#SmalltalkAppletContext
@@ -112,5 +108,9 @@
!SmalltalkAppletContext class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: SmalltalkAppletContext.st,v 1.10 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: SmalltalkAppletContext.st,v 1.10 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- a/SmalltalkAppletStub.st Thu Sep 23 13:52:13 2010 +0000
+++ b/SmalltalkAppletStub.st Fri Aug 19 08:58:19 2011 +0000
@@ -9,10 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
-
-
-
"{ Package: 'stx:libjava' }"
Object subclass:#SmalltalkAppletStub
@@ -186,5 +182,9 @@
!SmalltalkAppletStub class methodsFor:'documentation'!
version
- ^ '$Id$'
-! !
+ ^ '$Id: SmalltalkAppletStub.st,v 1.10 2011/08/18 18:42:48 vrany Exp $'
+!
+
+version_SVN
+ ^ '$Id: SmalltalkAppletStub.st,v 1.10 2011/08/18 18:42:48 vrany Exp $'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TestletTestCaseProxy.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,294 @@
+"
+ 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' }"
+
+JavaTestCaseProxy subclass:#TestletTestCaseProxy
+ instanceVariableNames:'harness'
+ classVariableNames:'TestCases'
+ poolDictionaries:''
+ category:'Languages-Java-Tests-Proxies'
+!
+
+!TestletTestCaseProxy 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.
+
+"
+! !
+
+!TestletTestCaseProxy class methodsFor:'accessing'!
+
+lookupHierarchyRoot
+ ^ TestletTestCaseProxy
+
+ "Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-04-2011 / 10:25:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+selector: aSymbol
+
+ ^super selector: aSymbol
+
+ "Created: / 01-03-2011 / 11:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy class methodsFor:'private'!
+
+testSelectors
+ "testlet always has only one test method, but maybe for the future.."
+
+ ^ #( #'test(Lgnu/testlet/TestHarness;)V' ).
+
+ "Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 29-05-2011 / 22:54:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-08-2011 / 16:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy class methodsFor:'queries'!
+
+isTestlet
+ ^ true
+
+! !
+
+!TestletTestCaseProxy class methodsFor:'subclass creation'!
+
+for: javaClass
+ "Answers a new (anonymous) testcase proxy for
+ given javaClass"
+
+ self assert: javaClass isJavaClass description: 'Not a java class'.
+ self assert: javaClass isTestletLike
+ description: 'Not a testcase-like class'.
+ ^self forClassNamed: javaClass name
+
+ "Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 21-06-2011 / 17:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy methodsFor:'accessing'!
+
+nameForHDTestReport
+
+ ^(self class javaClassName copyReplaceAll:$/ with: $.) copyTo: (self class javaClassName lastIndexOf: $/) - 1.
+
+ "Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+!
+
+selectorForHDTestReport
+
+ ^self class javaClassName copyFrom:
+ (self class javaClassName lastIndexOf: $/) + 1
+
+
+
+! !
+
+!TestletTestCaseProxy methodsFor:'error handling'!
+
+doesNotUnderstand: msg
+
+ "Here, we have to emulate stx.libjava.tests.TestHarness.Proxy interface..."
+ | sel |
+
+ sel := msg selector.
+ (sel includes:$() ifTrue:[
+ sel == #'check(Z)V' ifTrue:[
+ ^self assert: msg arg1 == 1 description: ('Assertion failed (checkpoint: %1)' bindWith: self checkPointName).
+ ].
+ sel == #'message(Ljava/lang/String;I)V' ifTrue:[
+ | text type |
+ text := Java as_ST_String: msg arg1.
+ type := msg arguments at: 2.
+ ^self message: text type: type.
+ ].
+ sel == #'directory(I)Ljava/lang/String;' ifTrue:[
+ ^Java as_String: (self directory: msg arg1) asString.
+ ].
+ ].
+ ^super doesNotUnderstand: msg
+
+ "Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy methodsFor:'private'!
+
+checkPointName
+
+ | jstring |
+ jstring := harness instVarNamed: #checkPoint.
+ ^jstring notNil ifTrue:[
+ Java as_ST_String: jstring
+ ] ifFalse:[
+ '<no checkpoint set>'
+ ]
+
+ "Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 09-08-2011 / 12:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+createHarness
+
+ harness := (Java classForName: 'stx.libjava.tests.TestHarness') new.
+ harness instVarNamed: #proxy put: self.
+
+ "Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Created: / 09-08-2011 / 11:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+performTest
+ | handlerBlock |
+
+ handlerBlock := [:ex | TestResult failure sunitSignalWith: ex description].
+
+ self createHarness.
+
+ [ JavaVM unimplementedNativeMethodSignal
+ handle:
+ handlerBlock
+ do: [
+ self javaClass new
+ perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol
+ with: harness
+ ].
+ ] on: JavaError do: [:ex |
+ TestResult failure sunitSignalWith: ex description
+ ].
+
+ "/((harness instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ].
+
+ "Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-05-2011 / 23:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 09-08-2011 / 12:13:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy methodsFor:'private - Proxy interface'!
+
+directory: type
+ "
+ public static final int DIR_TMP = 1;
+ public static final int DIR_SRC = 2;
+ public static final int DIR_RES = 3;
+ public static final int DIR_BLD = 4;
+ "
+
+ type == 1 ifTrue:[
+ ^Filename newTemporaryDirectory.
+ ] ifFalse:[type == 2 ifTrue:[
+ ^JavaTestsResource classpathForMauve anyOne asFilename directory / 'src'
+ ] ifFalse:[type == 3 ifTrue:[
+ ^self error:'DIR_RES not yet implemented'
+ ] ifFalse:[type == 4 ifTrue:[
+ ^JavaTestsResource classpathForMauve anyOne asFilename
+ ] ifFalse:[
+ ^self error:'Unknown type code'
+ ]]]].
+
+ "Created: / 10-08-2011 / 15:03:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+message:msg type: type
+ "
+ public static final int MSG_DBG = 1;
+ public static final int MSG_INF = 2;
+ public static final int MSG_ERR = 3;
+ "
+ type == 1 ifTrue:[Transcript showCR:' Testlet [DBG]: '] ifFalse:[
+ type == 2 ifTrue:[Transcript showCR:' Testlet [INF]: '] ifFalse:[
+ type == 3 ifTrue:[Transcript showCR:' Testlet [ERR]: '] ifFalse:[
+ Transcript showCR:' Testlet [???]: ']]].
+ Transcript showCR: msg.
+ type == 3 ifTrue:[self error: msg].
+
+ "Created: / 10-08-2011 / 15:06:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TestletTestCaseProxy class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- a/abbrev.stc Thu Sep 23 13:52:13 2010 +0000
+++ b/abbrev.stc Fri Aug 19 08:58:19 2011 +0000
@@ -1,46 +1,127 @@
+AbstractJavaTestCase AbstractJavaTestCase stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+Byte Byte stx:libjava 'Magnitude-Numbers' 0
+JUnitTestCaseProxy JUnitTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 6
Java Java stx:libjava 'Languages-Java-Support' 0
-JavaAppletComponentSpec JavaAppletComponentSpec stx:libjava 'Languages-Java-Views-Support' 0
+JavaAnnotation JavaAnnotation stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAnnotationContainer JavaAnnotationContainer stx:libjava 'Languages-Java-Annotations' 1
+JavaAnnotationDefault JavaAnnotationDefault stx:libjava 'Languages-Java-Annotations' 1
+JavaAnnotationDictionary JavaAnnotationDictionary stx:libjava 'Languages-Java-Annotations' 1
+JavaAnnotationValue JavaAnnotationValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAntProjectResource JavaAntProjectResource stx:libjava 'Languages-Java-Tests' 2
+JavaArray JavaArray stx:libjava 'Languages-Java-Classes' 1
JavaBehavior JavaBehavior stx:libjava 'Languages-Java-Classes' 0
-JavaBuiltInClassPointerRef JavaBuiltInClassPointerRef stx:libjava 'Languages-Java-Reader-Support' 0
-JavaByteCodeEnumerator JavaByteCodeEnumerator stx:libjava 'Languages-Java-Support-Decompiling' 0
-JavaClass JavaClass stx:libjava 'Languages-Java-Classes' 0
-JavaClassPointerRef JavaClassPointerRef stx:libjava 'Languages-Java-Reader-Support' 0
+JavaByteCodeDisassemblerTests JavaByteCodeDisassemblerTests stx:libjava 'Languages-Java-Tests' 4
+JavaByteCodeInterpreterTests JavaByteCodeInterpreterTests stx:libjava 'Languages-Java-Tests' 4
+JavaByteCodeProcessor JavaByteCodeProcessor stx:libjava 'Languages-Java-Bytecode' 0
+JavaByteCodeProcessorTests JavaByteCodeProcessorTests stx:libjava 'Languages-Java-Tests' 4
JavaClassReader JavaClassReader stx:libjava 'Languages-Java-Support' 0
-JavaClassRef JavaClassRef stx:libjava 'Languages-Java-Reader-Support' 0
+JavaClassReader2Tests JavaClassReader2Tests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+JavaClassReaderTests JavaClassReaderTests stx:libjava 'Languages-Java-Tests' 4
+JavaClassRefTests JavaClassRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
JavaConstantPool JavaConstantPool stx:libjava 'Languages-Java-Reader-Support' 0
JavaContext JavaContext stx:libjava 'Languages-Java-Support' 0
JavaDecompiler JavaDecompiler stx:libjava 'Languages-Java-Support-Decompiling' 0
-JavaEmbeddedFrameView JavaEmbeddedFrameView stx:libjava 'Languages-Java-Views-Support' 0
+JavaDescriptor JavaDescriptor stx:libjava 'Languages-Java-Support' 0
+JavaError JavaError stx:libjava 'Languages-Java-Support' 1
+JavaEvaluator JavaEvaluator stx:libjava 'Languages-Java-Support' 0
JavaExceptionTableEntry JavaExceptionTableEntry stx:libjava 'Languages-Java-Support' 0
+JavaExceptionThrowerMock JavaExceptionThrowerMock stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 0
JavaField JavaField stx:libjava 'Languages-Java-Reader-Support' 0
-JavaFieldref JavaFieldref stx:libjava 'Languages-Java-Reader-Support' 0
-JavaInterfaceMethodref JavaInterfaceMethodref stx:libjava 'Languages-Java-Reader-Support' 0
+JavaFieldRefTests JavaFieldRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+JavaInflater JavaInflater stx:libjava 'Languages-Java-Support' 0
+JavaInitializedResource JavaInitializedResource stx:libjava 'Languages-Java-Tests' 2
+JavaInterfaceMethodRefTests JavaInterfaceMethodRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+JavaJUnitTests JavaJUnitTests stx:libjava 'Languages-Java-Tests' 4
+JavaJavadocNode JavaJavadocNode stx:libjava 'Languages-Java-AST' 0
+JavaLanguage JavaLanguage stx:libjava 'Languages-Java-Support' 1
+JavaLibraries JavaLibraries stx:libjava 'Languages-Java-Support' 0
+JavaLibrariesResource JavaLibrariesResource stx:libjava 'Languages-Java-Tests' 1
JavaLocalVariableTable JavaLocalVariableTable stx:libjava 'Languages-Java-Support' 0
JavaLocalVariableTableEntry JavaLocalVariableTableEntry stx:libjava 'Languages-Java-Support' 0
+JavaLookup JavaLookup stx:libjava 'Languages-Java-Lookup' 0
+JavaLookupTestsResource JavaLookupTestsResource stx:libjava 'Languages-Java-Lookup-Tests' 3
JavaMethod JavaMethod stx:libjava 'Languages-Java-Classes' 0
-JavaMethodWithBreakpoint JavaMethodWithBreakpoint stx:libjava 'Languages-Java-Classes' 0
-JavaMethodWithException JavaMethodWithException stx:libjava 'Languages-Java-Classes' 0
-JavaMethodWithHandler JavaMethodWithHandler stx:libjava 'Languages-Java-Classes' 0
-JavaMethodref JavaMethodref stx:libjava 'Languages-Java-Reader-Support' 0
-JavaNameandType JavaNameandType stx:libjava 'Languages-Java-Reader-Support' 0
-JavaNativeMethod JavaNativeMethod stx:libjava 'Languages-Java-Classes' 0
+JavaMethodRefTests JavaMethodRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+JavaNameAndType2 JavaNameAndType2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaNativeMemory JavaNativeMemory stx:libjava 'Languages-Java-Support' 0
+JavaNode JavaNode stx:libjava 'Languages-Java-AST' 0
JavaObject JavaObject stx:libjava 'Languages-Java-Classes' 0
-JavaPopUpView JavaPopUpView stx:libjava 'Languages-Java-Views-Support' 0
+JavaObjectDictionary JavaObjectDictionary stx:libjava 'Languages-Java-Support' 0
+JavaPackage JavaPackage stx:libjava 'Languages-Java-Classes' 0
+JavaParseResult JavaParseResult stx:libjava 'Languages-Java-Parser' 0
+JavaParserNavigationTests JavaParserNavigationTests stx:libjava 'Languages-Java-Tests' 4
+JavaParserTestCase JavaParserTestCase stx:libjava 'Languages-Java-Tests' 4
+JavaParserTests JavaParserTests stx:libjava 'Languages-Java-Tests' 4
+JavaPopUpView JavaPopUpView stx:libjava 'Languages-Java-Views-Support' 2
JavaProcess JavaProcess stx:libjava 'Languages-Java-Classes' 0
-JavaRef JavaRef stx:libjava 'Languages-Java-Reader-Support' 0
+JavaRef2 JavaRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaRefMock JavaRefMock stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 0
+JavaRefTests JavaRefTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
+JavaRelease JavaRelease stx:libjava 'Languages-Java-Support' 0
+JavaResolver JavaResolver stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaRuntimeConstantPoolTests JavaRuntimeConstantPoolTests stx:libjava 'Languages-Java-Tests-RuntimeConstantPool' 4
JavaSlotIndexCache JavaSlotIndexCache stx:libjava 'Languages-Java-Support' 0
-JavaTopView JavaTopView stx:libjava 'Languages-Java-Views-Support' 0
-JavaUnresolvedClassConstant JavaUnresolvedClassConstant stx:libjava 'Languages-Java-Reader-Support' 0
+JavaSourceCodeCache JavaSourceCodeCache stx:libjava 'Languages-Java-Support' 1
+JavaSourceFileWriter JavaSourceFileWriter stx:libjava 'Languages-Java-Support' 0
+JavaStartup JavaStartup stx:libjava 'Languages-Java-Support' 1
+JavaTestCaseProxy JavaTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 6
+JavaTestsLoader JavaTestsLoader stx:libjava 'Languages-Java-Tests' 0
+JavaTestsResource JavaTestsResource stx:libjava 'Languages-Java-Tests' 2
+JavaTopView JavaTopView stx:libjava 'Languages-Java-Views-Support' 2
+JavaUTF8Tests JavaUTF8Tests stx:libjava 'Languages-Java-Tests' 4
JavaUnresolvedConstant JavaUnresolvedConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedFieldrefConstant JavaUnresolvedFieldrefConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedInterfaceMethodrefConstant JavaUnresolvedInterfaceMethodrefConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedMethodrefConstant JavaUnresolvedMethodrefConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedNameandTypeConstant JavaUnresolvedNameandTypeConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedRefConstant JavaUnresolvedRefConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedSTArrayConstant JavaUnresolvedSTArrayConstant stx:libjava 'Languages-Java-Reader-Support' 0
-JavaUnresolvedStringConstant JavaUnresolvedStringConstant stx:libjava 'Languages-Java-Reader-Support' 0
JavaVM JavaVM stx:libjava 'Languages-Java-Support' 0
-JavaView JavaView stx:libjava 'Languages-Java-Views-Support' 0
+JavaView JavaView stx:libjava 'Languages-Java-Views-Support' 2
+LookupTests LookupTests stx:libjava 'Languages-Java-Lookup-Tests' 4
+PPJavaNode PPJavaNode stx:libjava 'Languages-Java-AST' 0
+Short Short stx:libjava 'Magnitude-Numbers' 0
SmalltalkAppletContext SmalltalkAppletContext stx:libjava 'Languages-Java-Views-Support' 0
SmalltalkAppletStub SmalltalkAppletStub stx:libjava 'Languages-Java-Views-Support' 0
-UIGalleryJavaEntry UIGalleryJavaEntry stx:libjava 'Java-Views-Support' 0
+TestletTestCaseProxy TestletTestCaseProxy stx:libjava 'Languages-Java-Tests-Proxies' 6
+stx_libjava stx_libjava stx:libjava '* Projects & Packages *' 3
+JavaAnnotationArrayValue JavaAnnotationArrayValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAnnotationClassValue JavaAnnotationClassValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAnnotationEnumValue JavaAnnotationEnumValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAnnotationNestedAnnotationValue JavaAnnotationNestedAnnotationValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaAnnotationPrimitiveValue JavaAnnotationPrimitiveValue stx:libjava 'Languages-Java-Reader-Support' 0
+JavaByteCodeDisassembler JavaByteCodeDisassembler stx:libjava 'Languages-Java-Bytecode' 0
+JavaByteCodeEnumerator JavaByteCodeEnumerator stx:libjava 'Languages-Java-Support-Decompiling' 0
+JavaByteCodeInterpreter JavaByteCodeInterpreter stx:libjava 'Languages-Java-Bytecode' 0
+JavaClass JavaClass stx:libjava 'Languages-Java-Classes' 0
+JavaClassAnnotationContainer JavaClassAnnotationContainer stx:libjava 'Languages-Java-Annotations' 1
+JavaClassContentRef2 JavaClassContentRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaClassRef2 JavaClassRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaEmbeddedFrameView JavaEmbeddedFrameView stx:libjava 'Languages-Java-Views-Support' 2
+JavaFieldAnnotationContainer JavaFieldAnnotationContainer stx:libjava 'Languages-Java-Annotations' 1
+JavaFieldDescriptor JavaFieldDescriptor stx:libjava 'Languages-Java-Support' 0
+JavaFormalParameterNode JavaFormalParameterNode stx:libjava 'Languages-Java-AST' 0
+JavaInvalidRefError JavaInvalidRefError stx:libjava 'Languages-Java-Support' 1
+JavaMethodAnnotationContainer JavaMethodAnnotationContainer stx:libjava 'Languages-Java-Annotations' 1
+JavaMethodDeclarationNode JavaMethodDeclarationNode stx:libjava 'Languages-Java-AST' 0
+JavaMethodDeclaratorNode JavaMethodDeclaratorNode stx:libjava 'Languages-Java-AST' 0
+JavaMethodDescriptor JavaMethodDescriptor stx:libjava 'Languages-Java-Support' 0
+JavaMethodNode JavaMethodNode stx:libjava 'Languages-Java-AST' 0
+JavaMethodWithException JavaMethodWithException stx:libjava 'Languages-Java-Classes' 0
+JavaParser JavaParser stx:libjava 'Languages-Java-Parser' 0
+JavaStringRef2 JavaStringRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaTypeNode JavaTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaUnhandledExceptionError JavaUnhandledExceptionError stx:libjava 'Languages-Java-Support' 1
+JavaUnresolvedClassConstant JavaUnresolvedClassConstant stx:libjava 'Languages-Java-Reader-Support' 0
+JavaUnresolvedStringConstant JavaUnresolvedStringConstant stx:libjava 'Languages-Java-Reader-Support' 0
+JavadocDeclarationNode JavadocDeclarationNode stx:libjava 'Languages-Java-AST' 0
+JavaArrayTypeNode JavaArrayTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaBooleanTypeNode JavaBooleanTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaBothOldAndNewClassRef JavaBothOldAndNewClassRef stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaByteCodeSteppableInterpreter JavaByteCodeSteppableInterpreter stx:libjava 'Languages-Java-Bytecode' 0
+JavaCharTypeNode JavaCharTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaClassOrInterfaceTypeNode JavaClassOrInterfaceTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaDoubleTypeNode JavaDoubleTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaFieldRef2 JavaFieldRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaFloatTypeNode JavaFloatTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaIntTypeNode JavaIntTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaLongTypeNode JavaLongTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaMethodRef2 JavaMethodRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaMethodWithHandler JavaMethodWithHandler stx:libjava 'Languages-Java-Classes' 0
+JavaVoidTypeNode JavaVoidTypeNode stx:libjava 'Languages-Java-AST' 0
+JavaInterfaceMethodRef2 JavaInterfaceMethodRef2 stx:libjava 'Languages-Java-Reader-Support-new' 0
+JavaNativeMethod JavaNativeMethod stx:libjava 'Languages-Java-Classes' 0
--- a/bc.mak Thu Sep 23 13:52:13 2010 +0000
+++ b/bc.mak Fri Aug 19 08:58:19 2011 +0000
@@ -1,156 +1,170 @@
-# $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/bc.mak,v 1.15 2010/04/13 11:26:06 cg Exp $
+# $Header: /cvs/stx/stx/libjava/bc.mak,v 1.16 2011/08/18 18:42:48 vrany Exp $
#
-# -- nt.mak created from project at 'From Smalltalk/X, Version:3.5.5 on 8-nov-1999 at 21:44:36'
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
#
-# Warning: YOU SHOULD NOT MODIFY THIS FILE - MODIFY THE .prj FILE INSTEAD
-# and let the ProjectBrowser recreate this file.
-# once you modify this file, do not recreate nt.mak again
-# - otherwise, your changes are lost.
+# This file contains make rules for the win32 platform (using borland-bcc).
+# It shares common definitions with the unix-make in Make.spec.
+# The nt.mak supports the following targets:
+# bmake - compile all st-files to a classLib (dll)
+# bmake clean - clean all temp files
+# bmake clobber - clean all
+#
+#
+TOP=..
+INCLUDE_TOP=$(TOP)\..
-# default installation directory:
-# (overwrite with 'make INSTALLTOP_DIR=... install')
-# the INSTALLBASE is imported from configurations... and usually
-# defaults to something like /opt/smalltalk.
-# (overwrite with 'make INSTALLBASE=... install')
-INSTALLTOP_DIR=$(INSTALLBASE)/packages/$(MODULE)/$(MODULE_DIR)
-INSTALLLIB_DIR=$(INSTALLTOP_DIR)
-INSTALLBIN_DIR=$(INSTALLTOP_DIR)
+
-#
-# position (of this package) in directory hierarchy:
-# (must point to ST/X top directory, for tools and includes)
-TOP=..
+!INCLUDE $(TOP)\rules\stdHeader_bc
-RESFILES=$(LIBNAME).res
-#
!INCLUDE Make.spec
-!INCLUDE "$(TOP)\rules\stdHeader_bc"
LIBNAME=libstx_libjava
RESFILES=libjava.res
-# subdirectories where targets are to be made:
-SUBDIRS=
-# subdirectories where Makefiles are to be made:
-# (only define if different from SUBDIRS)
-# ALLSUBDIRS=
-
-LIB_BASE_LD_ARG=$(LIBJAVA_BASE_LD_ARG)
-
-# the next define suppresses installation of
-# the classes as autoloaded (i.e. not added to abbrev.stc).
-SUPPRESS_LOCAL_ABBREVS=1
-# Argument(s) to the stc compiler.
-# -H. : create header files locally
-# (if removed, they will be created as common
-# -Pxxx : defines the package
-# -Zxxx : a prefix for variables within the classLib
-# -Dxxx : defines passed to to CC for inline C-code
-# -Ixxx : include path passed to CC for inline C-code
-# +optspace : optimized for space
-# +optspace2 : optimized more for space
-# +optspace3 : optimized even more for space
-# +optinline : generate inline code for some ST constructs
-# +inlineNew : additionally inline new
-# +inlineMath : additionally inline some floatPnt math stuff
-#
-# ********** OPTIONAL: MODIFY the next line(s) ***
-# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
-# STCLOCALOPTIMIZATIONS=+optspace3
-STCLOCALOPTIMIZATIONS=+optspace3
-
-# Argument(s) to the stc compiler.
-# -warn : no warnings
-# -warnNonStandard : no warnings about ST/X extensions
-# -warnEOLComments : no warnings about EOL comment extension
-# -warnPrivacy : no warnings about privateClass extension
-#
-# ********** OPTIONAL: MODIFY the next line(s) ***
-# STCWARNINGS=-warn
-# STCWARNINGS=-warnNonStandard
-# STCWARNINGS=-warnEOLComments
-STCWARNINGS=-warnEOLComments
-
-# if your embedded C code requires any system includes,
-# add the path(es) here:,
-# ********** OPTIONAL: MODIFY the next lines ***
-# LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES=-I..\libbasic -I..\libview -I..\libui
-
-# if you need any additional defines for embedded C code,
-# add them here:,
-# ********** OPTIONAL: MODIFY the next lines ***
-# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic2 -I$(INCLUDE_TOP)\stx\libwidg2 -I$(INCLUDE_TOP)\squeak\petitparser -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libcomp -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libhtml
LOCALDEFINES=
-STCLOCALOPT=-I. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALINCLUDES) $(LOCALDEFINES) -H. -package=$(PACKAGE) -varPrefix=$(LIBNAME) $(INITCODESEPFLAG)
-
-# ********** OPTIONAL: MODIFY the next line ***
-# additional C-libraries that should be pre-linked with the class-objects
-LD_OBJ_LIBS=
-
-# ********** OPTIONAL: MODIFY the next line ***
-# additional C targets or libraries should be added below
-LOCAL_EXTRA_TARGETS=
-
-#ALL:: preMake $(LIBDIR)\$(LIBNAME).lib $(OUTDIR)$(LIBNAME).dll postMake
-ALL:: $(OUTDIR) $(LIBDIR)\$(LIBNAME).lib $(OUTDIR)$(LIBNAME).dll
+STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -H. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
+LOCALLIBS=
-# add more preMake actions here
-preMake:
-
-# add more postMake actions here
-postMake: cleanjunk
+OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
-#clean::
-# -del $(OUTDIR)*.obj
-# -del *.sc
+ALL:: classLibRule
-#clobber::
-# -del $(OUTDIR)*.obj
-# -del *.sc
-# -del *.dll
-# -del *.lib
-
+classLibRule: $(OUTDIR) $(OUTDIR)$(LIBNAME).dll
!INCLUDE $(TOP)\rules\stdRules_bc
+# build all prerequisite packages for this package
+prereq:
+ pushd ..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libboss & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\squeak\petitparser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libwidg3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\librun & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+
+
+
+
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
-$(OUTDIR)JavaClass.$(O): JavaClass.st $(STCHDR)
-$(OUTDIR)Java.$(O): Java.st $(STCHDR)
-$(OUTDIR)JavaRef.$(O): JavaRef.st $(STCHDR)
-$(OUTDIR)JavaClassRef.$(O): JavaClassRef.st $(STCHDR)
-$(OUTDIR)JavaClassReader.$(O): JavaClassReader.st $(STCHDR)
-$(OUTDIR)JavaClassPointerRef.$(O): JavaClassPointerRef.st $(STCHDR)
-$(OUTDIR)JavaConstantPool.$(O): JavaConstantPool.st $(STCHDR)
-$(OUTDIR)JavaContext.$(O): JavaContext.st $(STCHDR)
-$(OUTDIR)JavaExceptionTableEntry.$(O): JavaExceptionTableEntry.st $(STCHDR)
-$(OUTDIR)JavaField.$(O): JavaField.st $(STCHDR)
-$(OUTDIR)JavaFieldref.$(O): JavaFieldref.st $(STCHDR)
-$(OUTDIR)JavaMethodref.$(O): JavaMethodref.st $(STCHDR)
-$(OUTDIR)JavaLocalVariableTable.$(O): JavaLocalVariableTable.st $(STCHDR)
-$(OUTDIR)JavaLocalVariableTableEntry.$(O): JavaLocalVariableTableEntry.st $(STCHDR)
-$(OUTDIR)JavaMethod.$(O): JavaMethod.st $(STCHDR)
-$(OUTDIR)JavaMethodWithBreakpoint.$(O): JavaMethodWithBreakpoint.st $(STCHDR)
-$(OUTDIR)JavaMethodWithException.$(O): JavaMethodWithException.st $(STCHDR)
-$(OUTDIR)JavaMethodWithHandler.$(O): JavaMethodWithHandler.st $(STCHDR)
-$(OUTDIR)JavaInterfaceMethodref.$(O): JavaInterfaceMethodref.st $(STCHDR)
-$(OUTDIR)JavaNameandType.$(O): JavaNameandType.st $(STCHDR)
-$(OUTDIR)JavaNativeMethod.$(O): JavaNativeMethod.st $(STCHDR)
-$(OUTDIR)JavaObject.$(O): JavaObject.st $(STCHDR)
-$(OUTDIR)JavaProcess.$(O): JavaProcess.st $(STCHDR)
-$(OUTDIR)JavaBuiltInClassPointerRef.$(O): JavaBuiltInClassPointerRef.st $(STCHDR)
-$(OUTDIR)JavaSlotIndexCache.$(O): JavaSlotIndexCache.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedConstant.$(O): JavaUnresolvedConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedClassConstant.$(O): JavaUnresolvedClassConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedRefConstant.$(O): JavaUnresolvedRefConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedMethodrefConstant.$(O): JavaUnresolvedMethodrefConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedInterfaceMethodrefConstant.$(O): JavaUnresolvedInterfaceMethodrefConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedFieldrefConstant.$(O): JavaUnresolvedFieldrefConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedNameandTypeConstant.$(O): JavaUnresolvedNameandTypeConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedSTArrayConstant.$(O): JavaUnresolvedSTArrayConstant.st $(STCHDR)
-$(OUTDIR)JavaUnresolvedStringConstant.$(O): JavaUnresolvedStringConstant.st $(STCHDR)
-$(OUTDIR)JavaVM.$(O): JavaVM.st $(STCHDR)
+$(OUTDIR)Byte.$(O) Byte.$(H): Byte.st $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Java.$(O) Java.$(H): Java.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotation.$(O) JavaAnnotation.$(H): JavaAnnotation.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationContainer.$(O) JavaAnnotationContainer.$(H): JavaAnnotationContainer.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationDefault.$(O) JavaAnnotationDefault.$(H): JavaAnnotationDefault.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationDictionary.$(O) JavaAnnotationDictionary.$(H): JavaAnnotationDictionary.st $(INCLUDE_TOP)\stx\libbasic\Dictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\Set.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationValue.$(O) JavaAnnotationValue.$(H): JavaAnnotationValue.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaArray.$(O) JavaArray.$(H): JavaArray.st $(INCLUDE_TOP)\stx\libbasic\Array.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBehavior.$(O) JavaBehavior.$(H): JavaBehavior.st $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeProcessor.$(O) JavaByteCodeProcessor.$(H): JavaByteCodeProcessor.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassReader.$(O) JavaClassReader.$(H): JavaClassReader.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaConstantPool.$(O) JavaConstantPool.$(H): JavaConstantPool.st $(INCLUDE_TOP)\stx\libbasic\Array.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaContext.$(O) JavaContext.$(H): JavaContext.st $(INCLUDE_TOP)\stx\libbasic\Context.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDecompiler.$(O) JavaDecompiler.$(H): JavaDecompiler.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDescriptor.$(O) JavaDescriptor.$(H): JavaDescriptor.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaError.$(O) JavaError.$(H): JavaError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaEvaluator.$(O) JavaEvaluator.$(H): JavaEvaluator.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaExceptionTableEntry.$(O) JavaExceptionTableEntry.$(H): JavaExceptionTableEntry.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaField.$(O) JavaField.$(H): JavaField.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInflater.$(O) JavaInflater.$(H): JavaInflater.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaJavadocNode.$(O) JavaJavadocNode.$(H): JavaJavadocNode.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLanguage.$(O) JavaLanguage.$(H): JavaLanguage.st $(INCLUDE_TOP)\stx\libbasic\ProgrammingLanguage.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLibraries.$(O) JavaLibraries.$(H): JavaLibraries.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLocalVariableTable.$(O) JavaLocalVariableTable.$(H): JavaLocalVariableTable.st $(INCLUDE_TOP)\stx\libbasic\Array.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLocalVariableTableEntry.$(O) JavaLocalVariableTableEntry.$(H): JavaLocalVariableTableEntry.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLookup.$(O) JavaLookup.$(H): JavaLookup.st $(INCLUDE_TOP)\stx\libbasic\Lookup.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethod.$(O) JavaMethod.$(H): JavaMethod.st $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNameAndType2.$(O) JavaNameAndType2.$(H): JavaNameAndType2.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNativeMemory.$(O) JavaNativeMemory.$(H): JavaNativeMemory.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNode.$(O) JavaNode.$(H): JavaNode.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaObject.$(O) JavaObject.$(H): JavaObject.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaObjectDictionary.$(O) JavaObjectDictionary.$(H): JavaObjectDictionary.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaPackage.$(O) JavaPackage.$(H): JavaPackage.st $(INCLUDE_TOP)\stx\libbasic\NameSpace.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaParseResult.$(O) JavaParseResult.$(H): JavaParseResult.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaPopUpView.$(O) JavaPopUpView.$(H): JavaPopUpView.st $(INCLUDE_TOP)\stx\libview\PopUpView.$(H) $(INCLUDE_TOP)\stx\libview\TopView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaProcess.$(O) JavaProcess.$(H): JavaProcess.st $(INCLUDE_TOP)\stx\libbasic\Process.$(H) $(INCLUDE_TOP)\stx\libbasic\Link.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaRef2.$(O) JavaRef2.$(H): JavaRef2.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaRelease.$(O) JavaRelease.$(H): JavaRelease.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaResolver.$(O) JavaResolver.$(H): JavaResolver.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSlotIndexCache.$(O) JavaSlotIndexCache.$(H): JavaSlotIndexCache.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSourceCodeCache.$(O) JavaSourceCodeCache.$(H): JavaSourceCodeCache.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaSourceFileWriter.$(O) JavaSourceFileWriter.$(H): JavaSourceFileWriter.st $(INCLUDE_TOP)\stx\libbasic\AbstractSourceFileWriter.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaStartup.$(O) JavaStartup.$(H): JavaStartup.st $(INCLUDE_TOP)\stx\libbasic\StandaloneStartup.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTestsLoader.$(O) JavaTestsLoader.$(H): JavaTestsLoader.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTopView.$(O) JavaTopView.$(H): JavaTopView.st $(INCLUDE_TOP)\stx\libview\StandardSystemView.$(H) $(INCLUDE_TOP)\stx\libview\TopView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedConstant.$(O) JavaUnresolvedConstant.$(H): JavaUnresolvedConstant.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaVM.$(O) JavaVM.$(H): JavaVM.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaView.$(O) JavaView.$(H): JavaView.st $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)PPJavaNode.$(O) PPJavaNode.$(H): PPJavaNode.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Short.$(O) Short.$(H): Short.st $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)SmalltalkAppletContext.$(O) SmalltalkAppletContext.$(H): SmalltalkAppletContext.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)SmalltalkAppletStub.$(O) SmalltalkAppletStub.$(H): SmalltalkAppletStub.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)stx_libjava.$(O) stx_libjava.$(H): stx_libjava.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationArrayValue.$(O) JavaAnnotationArrayValue.$(H): JavaAnnotationArrayValue.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationClassValue.$(O) JavaAnnotationClassValue.$(H): JavaAnnotationClassValue.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationEnumValue.$(O) JavaAnnotationEnumValue.$(H): JavaAnnotationEnumValue.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationNestedAnnotationValue.$(O) JavaAnnotationNestedAnnotationValue.$(H): JavaAnnotationNestedAnnotationValue.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaAnnotationPrimitiveValue.$(O) JavaAnnotationPrimitiveValue.$(H): JavaAnnotationPrimitiveValue.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationValue.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeDisassembler.$(O) JavaByteCodeDisassembler.$(H): JavaByteCodeDisassembler.st $(INCLUDE_TOP)\stx\libjava\JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeEnumerator.$(O) JavaByteCodeEnumerator.$(H): JavaByteCodeEnumerator.st $(INCLUDE_TOP)\stx\libjava\JavaDecompiler.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeInterpreter.$(O) JavaByteCodeInterpreter.$(H): JavaByteCodeInterpreter.st $(INCLUDE_TOP)\stx\libjava\JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClass.$(O) JavaClass.$(H): JavaClass.st $(INCLUDE_TOP)\stx\libjava\JavaBehavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassAnnotationContainer.$(O) JavaClassAnnotationContainer.$(H): JavaClassAnnotationContainer.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationContainer.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassContentRef2.$(O) JavaClassContentRef2.$(H): JavaClassContentRef2.st $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassRef2.$(O) JavaClassRef2.$(H): JavaClassRef2.st $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaEmbeddedFrameView.$(O) JavaEmbeddedFrameView.$(H): JavaEmbeddedFrameView.st $(INCLUDE_TOP)\stx\libjava\JavaView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldAnnotationContainer.$(O) JavaFieldAnnotationContainer.$(H): JavaFieldAnnotationContainer.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationContainer.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldDescriptor.$(O) JavaFieldDescriptor.$(H): JavaFieldDescriptor.st $(INCLUDE_TOP)\stx\libjava\JavaDescriptor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFormalParameterNode.$(O) JavaFormalParameterNode.$(H): JavaFormalParameterNode.st $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInvalidRefError.$(O) JavaInvalidRefError.$(H): JavaInvalidRefError.st $(INCLUDE_TOP)\stx\libjava\JavaError.$(H) $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodAnnotationContainer.$(O) JavaMethodAnnotationContainer.$(H): JavaMethodAnnotationContainer.st $(INCLUDE_TOP)\stx\libjava\JavaAnnotationContainer.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDeclarationNode.$(O) JavaMethodDeclarationNode.$(H): JavaMethodDeclarationNode.st $(INCLUDE_TOP)\stx\libjava\PPJavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDeclaratorNode.$(O) JavaMethodDeclaratorNode.$(H): JavaMethodDeclaratorNode.st $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodDescriptor.$(O) JavaMethodDescriptor.$(H): JavaMethodDescriptor.st $(INCLUDE_TOP)\stx\libjava\JavaDescriptor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodNode.$(O) JavaMethodNode.$(H): JavaMethodNode.st $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodWithException.$(O) JavaMethodWithException.$(H): JavaMethodWithException.st $(INCLUDE_TOP)\stx\libjava\JavaMethod.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaParser.$(O) JavaParser.$(H): JavaParser.st $(INCLUDE_TOP)\squeak\petitparser\PPCompositeParser.$(H) $(INCLUDE_TOP)\squeak\petitparser\PPDelegateParser.$(H) $(INCLUDE_TOP)\squeak\petitparser\PPParser.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libjava\PPJavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\ReadStream.$(H) $(INCLUDE_TOP)\stx\libbasic\PositionableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\PeekableStream.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(STCHDR)
+$(OUTDIR)JavaStringRef2.$(O) JavaStringRef2.$(H): JavaStringRef2.st $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaTypeNode.$(O) JavaTypeNode.$(H): JavaTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnhandledExceptionError.$(O) JavaUnhandledExceptionError.$(H): JavaUnhandledExceptionError.st $(INCLUDE_TOP)\stx\libjava\JavaError.$(H) $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedClassConstant.$(O) JavaUnresolvedClassConstant.$(H): JavaUnresolvedClassConstant.st $(INCLUDE_TOP)\stx\libjava\JavaUnresolvedConstant.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaUnresolvedStringConstant.$(O) JavaUnresolvedStringConstant.$(H): JavaUnresolvedStringConstant.st $(INCLUDE_TOP)\stx\libjava\JavaUnresolvedConstant.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavadocDeclarationNode.$(O) JavadocDeclarationNode.$(H): JavadocDeclarationNode.st $(INCLUDE_TOP)\stx\libjava\PPJavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaArrayTypeNode.$(O) JavaArrayTypeNode.$(H): JavaArrayTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBooleanTypeNode.$(O) JavaBooleanTypeNode.$(H): JavaBooleanTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaBothOldAndNewClassRef.$(O) JavaBothOldAndNewClassRef.$(H): JavaBothOldAndNewClassRef.st $(INCLUDE_TOP)\stx\libjava\JavaClassRef2.$(H) $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaByteCodeSteppableInterpreter.$(O) JavaByteCodeSteppableInterpreter.$(H): JavaByteCodeSteppableInterpreter.st $(INCLUDE_TOP)\stx\libjava\JavaByteCodeInterpreter.$(H) $(INCLUDE_TOP)\stx\libjava\JavaByteCodeProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaCharTypeNode.$(O) JavaCharTypeNode.$(H): JavaCharTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaClassOrInterfaceTypeNode.$(O) JavaClassOrInterfaceTypeNode.$(H): JavaClassOrInterfaceTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaDoubleTypeNode.$(O) JavaDoubleTypeNode.$(H): JavaDoubleTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFieldRef2.$(O) JavaFieldRef2.$(H): JavaFieldRef2.st $(INCLUDE_TOP)\stx\libjava\JavaClassContentRef2.$(H) $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaFloatTypeNode.$(O) JavaFloatTypeNode.$(H): JavaFloatTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaIntTypeNode.$(O) JavaIntTypeNode.$(H): JavaIntTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaLongTypeNode.$(O) JavaLongTypeNode.$(H): JavaLongTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodRef2.$(O) JavaMethodRef2.$(H): JavaMethodRef2.st $(INCLUDE_TOP)\stx\libjava\JavaClassContentRef2.$(H) $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaMethodWithHandler.$(O) JavaMethodWithHandler.$(H): JavaMethodWithHandler.st $(INCLUDE_TOP)\stx\libjava\JavaMethodWithException.$(H) $(INCLUDE_TOP)\stx\libjava\JavaMethod.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaVoidTypeNode.$(O) JavaVoidTypeNode.$(H): JavaVoidTypeNode.st $(INCLUDE_TOP)\stx\libjava\JavaTypeNode.$(H) $(INCLUDE_TOP)\stx\libjava\JavaNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaInterfaceMethodRef2.$(O) JavaInterfaceMethodRef2.$(H): JavaInterfaceMethodRef2.st $(INCLUDE_TOP)\stx\libjava\JavaMethodRef2.$(H) $(INCLUDE_TOP)\stx\libjava\JavaClassContentRef2.$(H) $(INCLUDE_TOP)\stx\libjava\JavaRef2.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)JavaNativeMethod.$(O) JavaNativeMethod.$(H): JavaNativeMethod.st $(INCLUDE_TOP)\stx\libjava\JavaMethodWithHandler.$(H) $(INCLUDE_TOP)\stx\libjava\JavaMethodWithException.$(H) $(INCLUDE_TOP)\stx\libjava\JavaMethod.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic2\BooleanArray.$(H) $(INCLUDE_TOP)\stx\libbasic2\BitArray.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\String.$(H) $(INCLUDE_TOP)\stx\libbasic\CharacterArray.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UserPreferences.$(H) $(INCLUDE_TOP)\stx\libbasic\IdentityDictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\Dictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\Set.$(H) $(INCLUDE_TOP)\stx\libbasic2\ZipArchive.$(H) $(INCLUDE_TOP)\stx\libbasic\Boolean.$(H) $(INCLUDE_TOP)\stx\libbasic\Character.$(H) $(INCLUDE_TOP)\stx\libbasic\Magnitude.$(H) $(INCLUDE_TOP)\stx\libbasic\DoubleArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Float.$(H) $(INCLUDE_TOP)\stx\libbasic\LimitedPrecisionReal.$(H) $(INCLUDE_TOP)\stx\libbasic\Number.$(H) $(INCLUDE_TOP)\stx\libbasic\ArithmeticValue.$(H) $(INCLUDE_TOP)\stx\libbasic\FloatArray.$(H) $(INCLUDE_TOP)\stx\libwidg\GenericToolbarIconLibrary.$(H) $(INCLUDE_TOP)\stx\libbasic\Integer.$(H) $(INCLUDE_TOP)\stx\libbasic\LargeInteger.$(H) $(INCLUDE_TOP)\stx\libbasic\ShortFloat.$(H) $(INCLUDE_TOP)\stx\libbasic2\SignedIntegerArray.$(H) $(INCLUDE_TOP)\stx\libbasic2\UnboxedIntegerArray.$(H) $(INCLUDE_TOP)\stx\libbasic2\SignedLongIntegerArray.$(H) $(INCLUDE_TOP)\stx\libbasic\UndefinedObject.$(H) $(INCLUDE_TOP)\stx\libbasic2\WordArray.$(H) $(STCHDR)
+
# ENDMAKEDEPEND --- do not remove this line
--- a/bmake.bat Thu Sep 23 13:52:13 2010 +0000
+++ b/bmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -1,2 +1,8 @@
-if not exist object\nul mkdir objbc
-make.exe -N -f bc.mak %1 %
+@REM -------
+@REM make using borland bcc
+@REM type bmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/.cvsignore Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,2 @@
+makefile
+.listOfSTfiles
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/CodingExamples_GUI__JavaAppletDemo1.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,104 @@
+"{ NameSpace: CodingExamples_GUI }"
+
+ApplicationModel subclass:#JavaAppletDemo1
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'examples-Java-Applets'
+!
+
+!JavaAppletDemo1 class methodsFor:'documentation'!
+
+documentation
+"
+ Simple app using a java applet
+
+ [author:]
+ Claus Gittinger (cg@betti)
+"
+!
+
+examples
+"
+ examples to be added.
+ [exBegin]
+ JavaAppletDemo1 open
+ [exEnd]
+"
+! !
+
+!JavaAppletDemo1 class methodsFor:'interface specs'!
+
+windowSpec
+ "this window spec was automatically generated by the ST/X UIPainter"
+
+ "do not manually edit this - the painter/builder may not be able to
+ handle the specification if its corrupted."
+
+ "
+ UIPainter new openOnClass:CodingExamples_GUI::JavaAppletDemo1 andSelector:#windowSpec
+ CodingExamples_GUI::JavaAppletDemo1 new openInterface:#windowSpec
+ "
+ "CodingExamples_GUI::JavaAppletDemo1 open"
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #'window:'
+ #(#WindowSpec
+ #'name:' 'standardSystemView'
+ #'layout:' #(#LayoutFrame 216 0 173 0 572 0 657 0)
+ #'label:' 'unnamed canvas'
+ #'min:' #(#Point 10 10)
+ #'max:' #(#Point 1280 1024)
+ #'bounds:' #(#Rectangle 216 173 573 658)
+ #'usePreferredExtent:' false
+ )
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#LabelSpec
+ #'name:' 'label1'
+ #'layout:' #(#LayoutFrame 0 0.0 7 0 0 1.0 48 0)
+ #'label:' 'Java applet example'
+ #'style:' #(#FontDescription #times #bold #roman 18)
+ )
+ #(#ActionButtonSpec
+ #'name:' 'actionButton1'
+ #'layout:' #(#AlignmentOrigin 179 0 -14 1 0.5 1)
+ #'label:' 'dismiss'
+ #'model:' #closeRequest
+ )
+ #(#ViewSpec
+ #'name:' 'view1'
+ #'layout:' #(#LayoutFrame 4 0.0 60 0.0 -4 1.0 -60 1.0)
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#JavaAppletComponentSpec
+ #'name:' 'javaAppletComponent2'
+ #'layout:' #(#LayoutFrame 1 0.0 1 0.0 -1 1.0 -1 1.0)
+ #'codeURL:' 'ArcTest.class'
+ #'codeBaseURL:' 'file:examples/ArcTest'
+ #'level:' -1
+ )
+ )
+ )
+ #'level:' -1
+ )
+ )
+ )
+ )
+
+ "Modified: / 30.1.1998 / 05:03:29 / cg"
+! !
+
+!JavaAppletDemo1 class methodsFor:'documentation'!
+
+version
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/CodingExamples_GUI__JavaAppletDemo2.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,127 @@
+"{ NameSpace: CodingExamples_GUI }"
+
+ApplicationModel subclass:#JavaAppletDemo2
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'examples-Java-Applets'
+!
+
+!JavaAppletDemo2 class methodsFor:'documentation'!
+
+documentation
+"
+ Simple app using a java applet
+
+ [author:]
+ Claus Gittinger (cg@betti)
+"
+!
+
+examples
+"
+ examples to be added.
+ [exBegin]
+ JavaAppletDemo2 open
+ [exEnd]
+"
+! !
+
+!JavaAppletDemo2 class methodsFor:'interface specs'!
+
+windowSpec
+ "this window spec was automatically generated by the ST/X UIPainter"
+
+ "do not manually edit this - the painter/builder may not be able to
+ handle the specification if its corrupted."
+
+ "
+ UIPainter new openOnClass:CodingExamples_GUI::JavaAppletDemo2 andSelector:#windowSpec
+ CodingExamples_GUI::JavaAppletDemo2 new openInterface:#windowSpec
+ "
+ "CodingExamples_GUI::JavaAppletDemo2 open"
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #'window:'
+ #(#WindowSpec
+ #'name:' 'standardSystemView'
+ #'layout:' #(#LayoutFrame 61 0 177 0 369 0 661 0)
+ #'label:' 'unnamed canvas'
+ #'min:' #(#Point 10 10)
+ #'max:' #(#Point 1280 1024)
+ #'bounds:' #(#Rectangle 61 177 370 662)
+ #'usePreferredExtent:' false
+ )
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#LabelSpec
+ #'name:' 'label1'
+ #'layout:' #(#LayoutFrame 0 0.0 7 0 0 1.0 48 0)
+ #'label:' 'Java applet example 2'
+ #'style:' #(#FontDescription #times #bold #roman 18)
+ )
+ #(#ActionButtonSpec
+ #'name:' 'actionButton1'
+ #'layout:' #(#AlignmentOrigin 179 0 -14 1 0.5 1)
+ #'label:' 'dismiss'
+ #'model:' #closeRequest
+ )
+ #(#ViewSpec
+ #'name:' 'view1'
+ #'layout:' #(#LayoutFrame 0 0.0 60 0.0 0 1.0 -60 1.0)
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#JavaAppletComponentSpec
+ #'name:' 'javaAppletComponent2'
+ #'layout:' #(#LayoutFrame 0 0.0 1 0.0 0 1.0 -1 1.0)
+ #'codeURL:' 'Chart.class'
+ #'codeBaseURL:' 'file:examples/BarChart'
+ #'parameterDictionary:'
+ #(#Dictionary
+ 'c4_color' 'red'
+ 'orientation' 'vertical'
+ 'c2_style' 'solid'
+ 'columns' '4'
+ 'title' 'Performance'
+ 'c3_label' 'Q3'
+ 'c4' '30'
+ 'scale value' '5'
+ 'c1_style' 'striped'
+ 'c4_style' 'solid'
+ 'c3_color' 'magenta'
+ 'c3' '5'
+ 'c2_label' 'Q2'
+ 'c2_color ' 'green'
+ 'c2' '20'
+ 'c1_color' 'blue'
+ 'c3_style' 'striped'
+ 'c1_label' 'Q1'
+ 'c1' '10'
+ 'c4_label' 'Q4'
+ )
+ #'level:' -1
+ )
+ )
+ )
+ #'level:' -1
+ )
+ )
+ )
+ )
+
+ "Modified: / 30.1.1998 / 11:38:09 / cg"
+! !
+
+!JavaAppletDemo2 class methodsFor:'documentation'!
+
+version
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/CodingExamples_GUI__JavaAppletDemo3.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,82 @@
+"{ NameSpace: CodingExamples_GUI }"
+
+ApplicationModel subclass:#JavaAppletDemo3
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'examples-Java-Applets'
+!
+
+!JavaAppletDemo3 class methodsFor:'documentation'!
+
+documentation
+"
+ Java Reversi app
+ This wrapps a Java Reversi Game application into a smalltalk view.
+
+ [author:]
+ Claus Gittinger (cg@betti)
+"
+!
+
+examples
+"
+ examples to be added.
+ [exBegin]
+ JavaAppletDemo3 open
+ [exEnd]
+"
+! !
+
+!JavaAppletDemo3 class methodsFor:'interface specs'!
+
+windowSpec
+ "this window spec was automatically generated by the ST/X UIPainter"
+
+ "do not manually edit this - the painter/builder may not be able to
+ handle the specification if its corrupted."
+
+ "
+ UIPainter new openOnClass:CodingExamples_GUI::JavaAppletDemo3 andSelector:#windowSpec
+ CodingExamples_GUI::JavaAppletDemo3 new openInterface:#windowSpec
+ "
+ "CodingExamples_GUI::JavaAppletDemo3 open"
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #'window:'
+ #(#WindowSpec
+ #'name:' 'Canvas'
+ #'layout:' #(#LayoutFrame 216 0 173 0 533 0 563 0)
+ #'label:' 'Java Reversi'
+ #'min:' #(#Point 10 10)
+ #'max:' #(#Point 1280 1024)
+ #'bounds:' #(#Rectangle 216 173 534 564)
+ #'usePreferredExtent:' false
+ )
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#JavaAppletComponentSpec
+ #'name:' 'javaAppletComponent1'
+ #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ #'codeURL:' 'KReversi.class'
+ #'codeBaseURL:' 'file:examples/KReversi'
+ #'level:' -1
+ )
+ )
+ )
+ )
+
+ "Modified: / 1.2.1998 / 17:48:26 / cg"
+! !
+
+!JavaAppletDemo3 class methodsFor:'documentation'!
+
+version
+ ^ '$Id$'
+! !
\ No newline at end of file
Binary file examples/HelloWorld.class has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/HelloWorld.java Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,5 @@
+class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println("Hello, world!");
+ }
+}
\ No newline at end of file
Binary file examples/JUnit4Tests.class has changed
--- a/examples/Make.proto Thu Sep 23 13:52:13 2010 +0000
+++ b/examples/Make.proto Fri Aug 19 08:58:19 2011 +0000
@@ -1,4 +1,4 @@
-# $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/examples/Make.proto,v 1.1 1999/12/23 18:16:18 cg Exp $
+# $Header: /cvs/stx/stx/libjava/examples/Make.proto,v 1.2 2011/08/18 18:42:48 vrany Exp $
#
# -- Make.proto created from project at 'From Smalltalk/X, Version:3.5.5 on 8-nov-1999 at 21:44:28'
#
--- a/examples/Make.spec Thu Sep 23 13:52:13 2010 +0000
+++ b/examples/Make.spec Fri Aug 19 08:58:19 2011 +0000
@@ -1,4 +1,4 @@
-# $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/examples/Make.spec,v 1.1 2006/08/18 14:28:53 cg Exp $
+# $Header: /cvs/stx/stx/libjava/examples/Make.spec,v 1.2 2011/08/18 18:42:48 vrany Exp $
#
# --- Automatically created Make.spec
@@ -13,7 +13,7 @@
EXTRA_TARGTES=
OBJS= \
- JavaAppletDemo1.$(O) \
- JavaAppletDemo2.$(O) \
- JavaAppletDemo3.$(O)
+ CodingExamples_GUI__JavaAppletDemo1.$(O) \
+ CodingExamples_GUI__JavaAppletDemo2.$(O) \
+ CodingExamples_GUI__JavaAppletDemo3.$(O)
--- a/examples/abbrev.stc Thu Sep 23 13:52:13 2010 +0000
+++ b/examples/abbrev.stc Fri Aug 19 08:58:19 2011 +0000
@@ -1,3 +1,3 @@
-CodingExamples_GUI::JavaAppletDemo1 JavaAppletDemo1 stx:libjava/examples 'examples-Java-Applets' 0
-CodingExamples_GUI::JavaAppletDemo2 JavaAppletDemo2 stx:libjava/examples 'examples-Java-Applets' 0
-CodingExamples_GUI::JavaAppletDemo3 JavaAppletDemo3 stx:libjava/examples 'examples-Java-Applets' 0
+CodingExamples_GUI::CodingExamples_GUI__JavaAppletDemo1 CodingExamples_GUI__JavaAppletDemo1 stx:libjava/examples 'examples-Java-Applets' 0
+CodingExamples_GUI::CodingExamples_GUI__JavaAppletDemo2 CodingExamples_GUI__JavaAppletDemo2 stx:libjava/examples 'examples-Java-Applets' 0
+CodingExamples_GUI::CodingExamples_GUI__JavaAppletDemo3 CodingExamples_GUI__JavaAppletDemo3 stx:libjava/examples 'examples-Java-Applets' 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/FooLookup.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,41 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+Lookup subclass:#FooLookup
+ instanceVariableNames:''
+ classVariableNames:'Instance'
+ poolDictionaries:''
+ category:'Languages-Java-Lookup'
+!
+
+
+!FooLookup class methodsFor:'instance creation'!
+
+instance
+ Instance ifNil: [
+ Instance := self basicNew.
+ ].
+ ^ Instance.
+
+ "Modified: / 25-02-2011 / 14:45:03 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+new
+ ^ self instance.
+
+ "Created: / 25-02-2011 / 14:44:43 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!FooLookup methodsFor:'lookup'!
+
+lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+ ^ Lookup builtin lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+
+ "Created: / 21-02-2011 / 13:38:55 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 25-02-2011 / 20:23:01 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!FooLookup class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/HashSetInJavaResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,27 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestResource subclass:#HashSetInJavaResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Experiments'
+!
+
+
+!HashSetInJavaResource methodsFor:'running'!
+
+setUp
+ JavaObjectDictionary new flush.
+ Java removeClass: (Java classForName:'SetManipulator').
+
+ Java addToClassPath: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-projects/Conversion/bin' ) pathName.
+ JavaObjectDictionary new registerJavaObject:(Java classForName:'java.util.HashSet') toStObject: StHashSet.
+
+ "Created: / 24-01-2011 / 17:18:24 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!HashSetInJavaResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/HashSetInJavaTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,70 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestCase subclass:#HashSetInJavaTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Experiments'
+!
+
+
+!HashSetInJavaTests class methodsFor:'accessing'!
+
+resources
+ ^ Array with: HashSetInJavaResource.
+
+ "Created: / 24-01-2011 / 17:19:06 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!HashSetInJavaTests methodsFor:'testing'!
+
+testIsKindOf
+ self assertTrue: (StHashSet new isKindOf: (Java classForName: 'java.util.HashSet')).
+ self assertTrue: (StHashSet new isKindOf: (Java classForName: 'java.lang.Object')).
+
+ "Created: / 24-01-2011 / 17:20:49 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+testIsKindOf2
+ "does it work for interfaces?"
+ self assertTrue: (StHashSet new isKindOf: (Java classForName: 'java.util.Set')).
+
+ "Created: / 24-01-2011 / 17:45:29 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+testStHashSet
+ | map res |
+ map := StHashSet new.
+ res := (Java classForName:'SetManipulator') new repeatIt: map.
+ self assert: res == map.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 24-01-2011 / 16:24:02 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 24-01-2011 / 17:38:04 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+testStHashSet2
+ | map res |
+ map := StHashSet new.
+ res := (Java classForName:'SetManipulator') new getSetClass: map.
+ self assert: res = 'java.util.HashSet'.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 24-01-2011 / 17:37:51 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+testStHashSet3
+ | map res |
+ map := StHashSet new.
+ res := (Java classForName:'SetManipulator') new getHashSetClass: map.
+ self assert: res = 'java.util.HashSet'.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 24-01-2011 / 17:38:56 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!HashSetInJavaTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/Make.proto Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,109 @@
+# $Header: /cvs/stx/stx/libjava/experiments/Make.proto,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_experiments.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# The Makefile as generated by this Make.proto supports the following targets:
+# make - compile all st-files to a classLib
+# make clean - clean all temp files
+# make clobber - clean all
+#
+# This file contains definitions for Unix based platforms.
+# It shares common definitions with the win32-make in Make.spec.
+
+#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=../..
+INCLUDE_TOP=$(TOP)/..
+
+# subdirectories where targets are to be made:
+SUBDIRS=
+
+
+# subdirectories where Makefiles are to be made:
+# (only define if different from SUBDIRS)
+# ALLSUBDIRS=
+
+REQUIRED_SUPPORT_DIRS=
+
+# if your embedded C code requires any system includes,
+# add the path(es) here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic
+
+
+# if you need any additional defines for embedded C code,
+# add them here:,
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+LIBNAME=libstx_libjava_experiments
+STCLOCALOPT='-package=$(PACKAGE)' -I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -H. -varPrefix=$(LIBNAME)
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=
+LOCAL_SHARED_LIBS=
+
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=
+
+OBJS= $(COMMON_OBJS) $(UNIX_OBJS)
+
+
+
+all:: preMake classLibRule postMake
+
+pre_objs::
+
+
+
+
+
+# add more install actions here
+install::
+
+# add more install actions for aux-files (resources) here
+installAux::
+
+# add more preMake actions here
+preMake::
+
+# add more postMake actions here
+postMake:: cleanjunk
+
+prereq: $(REQUIRED_SUPPORT_DIRS)
+ cd ../../librun && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+
+
+cleanjunk::
+
+clean::
+ -rm -f *.o *.H
+
+clobber:: clean
+ -rm -f *.so *.dll
+
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)FooLookup.$(O) FooLookup.$(H): FooLookup.st $(INCLUDE_TOP)/stx/libbasic/Lookup.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)NoReflectionObject.$(O) NoReflectionObject.$(H): NoReflectionObject.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)PerformanceTestStObject.$(O) PerformanceTestStObject.$(H): PerformanceTestStObject.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)StCounter.$(O) StCounter.$(H): StCounter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)StHashSet.$(O) StHashSet.$(H): StHashSet.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)StString.$(O) StString.$(H): StString.st $(INCLUDE_TOP)/stx/libbasic/String.$(H) $(INCLUDE_TOP)/stx/libbasic/CharacterArray.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)stx_libjava_experiments.$(O) stx_libjava_experiments.$(H): stx_libjava_experiments.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)StIdentityCounter.$(O) StIdentityCounter.$(H): StIdentityCounter.st $(INCLUDE_TOP)/stx/libjava/experiments/StCounter.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/Make.spec Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,76 @@
+# $Header: /cvs/stx/stx/libjava/experiments/Make.spec,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_experiments.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains specifications which are common to all platforms.
+#
+
+# Do NOT CHANGE THESE DEFINITIONS
+# (otherwise, ST/X will have a hard time to find out the packages location from its packageID,
+# to find the source code of a class and to find the library for a package)
+MODULE=stx
+MODULE_DIR=libjava/experiments
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -H. : create header files locally
+# (if removed, they will be created as common
+# -Pxxx : defines the package
+# -Zxxx : a prefix for variables within the classLib
+# -Dxxx : defines passed to to CC for inline C-code
+# -Ixxx : include path passed to CC for inline C-code
+# +optspace : optimized for space
+# +optspace2 : optimized more for space
+# +optspace3 : optimized even more for space
+# +optinline : generate inline code for some ST constructs
+# +inlineNew : additionally inline new
+# +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -warn : no warnings
+# -warnNonStandard : no warnings about ST/X extensions
+# -warnEOLComments : no warnings about EOL comment extension
+# -warnPrivacy : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+ FooLookup \
+ NoReflectionObject \
+ PerformanceTestStObject \
+ StCounter \
+ StHashSet \
+ StString \
+ stx_libjava_experiments \
+ StIdentityCounter \
+
+
+
+
+COMMON_OBJS= \
+ $(OUTDIR)FooLookup.$(O) \
+ $(OUTDIR)NoReflectionObject.$(O) \
+ $(OUTDIR)PerformanceTestStObject.$(O) \
+ $(OUTDIR)StCounter.$(O) \
+ $(OUTDIR)StHashSet.$(O) \
+ $(OUTDIR)StString.$(O) \
+ $(OUTDIR)stx_libjava_experiments.$(O) \
+ $(OUTDIR)StIdentityCounter.$(O) \
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/Makefile Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,19 @@
+#
+# DO NOT EDIT
+#
+# make uses this file (Makefile) only, if there is no
+# file named "makefile" (lower-case m) in the same directory.
+# My only task is to generate the real makefile and call make again.
+# Thereafter, I am no longer used and needed.
+#
+
+.PHONY: run
+
+run: makefile
+ $(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile:
+ $(TOP)/rules/stmkmf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/NoReflectionObject.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,79 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+Object subclass:#NoReflectionObject
+ instanceVariableNames:''
+ classVariableNames:'Instance'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+!NoReflectionObject class methodsFor:'documentation'!
+
+documentation
+"
+ Null Object for JavaObjectDictionary - RENAME, the name is stupid!!
+
+ [author:]
+ kursjan
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+! !
+
+!NoReflectionObject class methodsFor:'instance creation'!
+
+instance
+ Instance ifNil: [ Instance := self basicNew ].
+ ^ Instance.
+
+ "Created: / 09-01-2011 / 21:33:55 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+new
+ ^ self instance.
+
+ "Created: / 09-01-2011 / 21:33:55 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!NoReflectionObject methodsFor:'queries'!
+
+ifNil: block
+ ^ block value.
+
+ "Created: / 17-01-2011 / 19:10:24 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+includesBehavior: aClass
+ ^ false.
+
+ "Created: / 09-01-2011 / 21:05:56 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+isNil
+ ^ true
+
+ "Created: / 17-01-2011 / 19:10:11 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+methodDictionary
+ ^ MethodDictionary withAll: Dictionary new.
+
+ "Created: / 17-01-2011 / 10:52:44 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+superclass
+ ^ nil
+
+ "Created: / 17-01-2011 / 10:53:15 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!NoReflectionObject class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/PerformanceTestStObject.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,30 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+Object subclass:#PerformanceTestStObject
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!PerformanceTestStObject methodsFor:'testing'!
+
+foo
+ "do nothing"
+
+ "Created: / 17-02-2011 / 16:28:03 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+repeat: anObject
+ "do nothing"
+ ^ anObject
+
+ "Created: / 17-02-2011 / 16:28:12 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!PerformanceTestStObject class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/PerformanceTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,71 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestCase subclass:#PerformanceTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!PerformanceTests methodsFor:'testing'!
+
+_testPerformance
+ | objectCount objects loops mc jmc time |
+ "Not real Test, just brief overview of performance
+ Measure time of method invocation
+ - without parameter on ST object
+ - with Java object as a parameter on ST object
+ - without parameter on Java object
+ - with Java object as a parameter on Java object
+ See transcript for results
+ "
+ objectCount := 100.
+ objects := OrderedCollection new.
+ loops := 100000.
+ mc := PerformanceTestStObject new.
+ jmc := (Java classForName:'PerformanceTestObject') new.
+ objectCount timesRepeat: [
+ objects add: Object new.
+ ].
+
+ time := Time millisecondsToRun: [
+ loops timesRepeat:[
+ mc repeat: objects atRandom.
+ ]
+ ].
+ Transcript showCR: 'st time with object: ', time asString, 'ms'.
+
+ time := Time millisecondsToRun: [
+ loops timesRepeat:[
+ objects atRandom.
+ mc foo.
+ ]
+ ].
+ Transcript showCR: 'st time no parameter: ', time asString, 'ms'.
+
+ time := Time millisecondsToRun: [
+ loops timesRepeat:[
+ jmc repeat: objects atRandom.
+ ]
+ ].
+ Transcript showCR: 'Java time with object: ', time asString, 'ms'.
+
+ time := Time millisecondsToRun: [
+ loops timesRepeat:[
+ objects atRandom.
+ jmc foo.
+ ]
+ ].
+ Transcript showCR: 'Java time no parameter: ', time asString, 'ms'.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 17-02-2011 / 16:23:38 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 21-02-2011 / 11:08:05 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!PerformanceTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StCounter.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,115 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+Object subclass:#StCounter
+ instanceVariableNames:'foo count javaObject'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!StCounter class methodsFor:'instance creation'!
+
+new
+ "return an initialized instance"
+
+ ^ self basicNew initialize.
+! !
+
+!StCounter class methodsFor:'accessing'!
+
+javaObject
+ ^ JavaObjectDictionary new reflectionOf: self name
+
+ "Created: / 09-01-2011 / 21:02:37 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter methodsFor:'accessing'!
+
+count
+ ^ count
+!
+
+inc
+ count := count + 2.
+
+ "Created: / 09-01-2011 / 13:51:22 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+javaObject
+ ^ self class javaObject.
+"/ javaObject ifNil: [
+"/ javaObject:= Java classForName: 'Counter'.
+"/ ].
+"/ ^ javaObject.
+
+ "Created: / 09-01-2011 / 13:56:56 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:02:18 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter methodsFor:'error handling'!
+
+doesNotUnderstand:aMessage
+ | method |
+ aMessage selector = #'getCount()I' ifTrue:[ ^ self getCount.].
+ aMessage selector = #'incCount()V' ifTrue:[ ^ self incCount.].
+ method := JavaClass
+ lookupMethod:aMessage selector
+ numArgs:aMessage arguments size
+ in:self javaObject
+ static:false.
+ ^ method
+ ifNil:[ super doesNotUnderstand:aMessage.]
+ ifNotNil:[ method valueWithReceiver:self arguments:aMessage arguments.]
+
+ "Created: / 09-01-2011 / 13:42:08 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 15:54:04 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter methodsFor:'initialization'!
+
+initialize
+ "Invoked when a new instance is created."
+ foo := 123.
+ count := 0.
+
+ "/ super initialize. -- commented since inherited method does nothing
+
+ "Modified: / 09-01-2011 / 15:59:47 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter methodsFor:'java protocol'!
+
+getCount
+ Transcript showCR: 'aaa'.
+ ^ count
+
+ "Created: / 09-01-2011 / 12:59:04 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 15:52:19 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+incCount
+ count := count + 2.
+
+ "Created: / 09-01-2011 / 13:03:29 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter methodsFor:'testing'!
+
+isKindOf: aClass
+ "This override is neccessary for ST <-> Java Object conversions"
+ (self javaObject includesBehavior: aClass) ifTrue:
+ [
+ ^ true.
+ ].
+ ^ super isKindOf: aClass.
+
+ "Created: / 09-01-2011 / 13:28:10 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:22:41 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StCounter class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StHashSet.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,90 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+Object variableByteSubclass:#StHashSet
+ instanceVariableNames:'map'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!StHashSet class methodsFor:'accessing'!
+
+javaObject
+ ^ JavaObjectDictionary new reflectionOf: self name
+
+ "Created: / 09-01-2011 / 21:02:37 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StHashSet methodsFor:'accessing'!
+
+javaObject
+ ^ self class javaObject.
+"/ javaObject ifNil: [
+"/ javaObject:= Java classForName: 'Counter'.
+"/ ].
+"/ ^ javaObject.
+
+ "Created: / 09-01-2011 / 13:56:56 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:02:18 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StHashSet methodsFor:'error handling'!
+
+doesNotUnderstand:aMessage
+ | method |
+ aMessage selector = #'__map()Ljava/util/HashMap;' ifTrue:[ ^ self getMap].
+ aMessage selector = #'__map(Ljava/util/HashMap;)V' ifTrue:[ ^ self setMap: aMessage arguments first.].
+
+ method := JavaClass
+ lookupMethod:aMessage selector
+ numArgs:aMessage arguments size
+ in:self javaObject
+ static:false.
+
+ ^ method
+ ifNil:[ super doesNotUnderstand:aMessage.]
+ ifNotNil:[ method valueWithReceiver:self arguments:aMessage arguments.]
+
+ "Created: / 09-01-2011 / 13:42:08 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 15:54:04 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 24-01-2011 / 16:20:15 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StHashSet methodsFor:'java protocol'!
+
+getMap
+ map isNil ifTrue: [
+ map := (Java classForName:'java.util.HashMap') new.
+ ].
+
+ ^ map.
+
+ "Created: / 24-01-2011 / 16:21:45 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+setMap: aMap
+ map := aMap.
+
+ "Created: / 24-01-2011 / 16:22:34 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StHashSet methodsFor:'testing'!
+
+isKindOf: aClass
+ "This override is neccessary for ST <-> Java Object conversions"
+ (self javaObject includesBehavior: aClass) ifTrue:
+ [
+ ^ true.
+ ].
+ ^ super isKindOf: aClass.
+
+ "Created: / 09-01-2011 / 13:28:10 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:22:41 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StHashSet class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StIdentityCounter.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,26 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+StCounter subclass:#StIdentityCounter
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!StIdentityCounter methodsFor:'accessing'!
+
+javaObject
+ javaObject ifNil: [
+ javaObject:= Java classForName: 'IdentityCounter'.
+ ].
+ ^ javaObject.
+
+ "Created: / 09-01-2011 / 15:46:49 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StIdentityCounter class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StInJavaResource.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,27 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestResource subclass:#StInJavaResource
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Experiments'
+!
+
+
+!StInJavaResource methodsFor:'accessing'!
+
+setUp
+ Java addToClassPath: ((Smalltalk packageDirectoryForPackageId:'stx:libjava') / 'java' / 'libjava-projects/Conversion/bin' ) pathName.
+ JavaObjectDictionary new flush.
+ JavaObjectDictionary new registerJavaObject:(Java classForName:'Counter') toStObject: StCounter.
+ JavaObjectDictionary new registerJavaObject:(Java classForName:'java.lang.String') toStObject: StString.
+
+ "Created: / 24-01-2011 / 17:21:58 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 25-02-2011 / 12:38:17 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StInJavaResource class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StInJavaTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,182 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestCase subclass:#StInJavaTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!StInJavaTests class methodsFor:'accessing'!
+
+resources
+ ^ Array with: StInJavaResource
+
+ "Created: / 24-01-2011 / 17:21:47 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StInJavaTests methodsFor:'testing'!
+
+_testIsKindOf
+ self assertTrue: (StCounter new isKindOf: (Java classForName: 'Counter')).
+
+ "Created: / 09-01-2011 / 13:21:17 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testJavaCounter
+ self shouldnt: [(Java classForName:'CounterManipulator') main:#() ] raise: Exception.
+
+ "Created: / 09-01-2011 / 12:57:31 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 19:55:38 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 24-01-2011 / 17:22:34 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+_testJavaCounter2
+ | counter |
+ counter := (Java classForName:'Counter') new.
+ self shouldnt: [(Java classForName:'CounterManipulator') new doSomething: counter ] raise: Exception.
+
+ "Created: / 09-01-2011 / 12:57:55 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 14:02:59 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testJavaCounter3
+ | counter res |
+ counter := (Java classForName:'Counter') new.
+ res := (Java classForName:'CounterManipulator') new incCounter: counter.
+ self assert: res = 1.
+ res := (Java classForName:'CounterManipulator') new incCounter: counter.
+ self assert: res = 2.
+
+ "Created: / 09-01-2011 / 13:05:40 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testJavaCounterWithStObject
+ | counter |
+ counter := StCounter new.
+ (Java classForName:'CounterManipulator') new doSomething: counter.
+
+ "Created: / 09-01-2011 / 12:58:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testJavaCounterWithStObject2
+ | counter res |
+ counter := StCounter new.
+ res := (Java classForName:'CounterManipulator') new incCounter: counter.
+ self assert: res = 2
+
+ "Created: / 09-01-2011 / 13:50:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStCounter
+ | counter |
+ counter := StCounter new.
+ self assert: counter count = 0.
+ counter incCount.
+ self assert: counter count = 2.
+
+ "Created: / 09-01-2011 / 13:10:28 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectJavaMethod
+ | counter |
+ counter := StCounter new.
+ "#sayHello does not exists in StCounter - we have to call JavaMethod"
+ self shouldnt: [(Java classForName:'CounterManipulator') new counterHello: counter ] raise: Exception.
+
+ "Created: / 09-01-2011 / 13:54:44 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectJavaMethod2
+ | counter |
+ counter := StCounter new.
+ "#sayHello does not exists in StCounter - we have to call JavaMethod"
+ self shouldnt: [(Java classForName:'CounterManipulator') new counterGreetings: counter ] raise: Exception.
+
+ "Created: / 09-01-2011 / 14:11:20 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectJavaMethod3
+ | counter |
+ counter := StCounter new.
+ self assert: ((Java classForName:'CounterManipulator') new counterGreetings: counter) = 'Hi, this is Counter FROM JAVA'
+
+ "Created: / 09-01-2011 / 14:16:41 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectJavaMethod4
+ | counter |
+ counter := StCounter new.
+ self shouldnt: [(Java classForName:'CounterManipulator') new
+ statelessIncCounterBy: counter with: 2
+ ] raise: Exception.
+
+ "Created: / 09-01-2011 / 14:50:14 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectJavaMethod5
+ | counter res |
+ counter := StCounter new.
+ res:= (Java classForName:'CounterManipulator') new
+ statelessIncCounterBy: counter with: 2.
+ self assert: res = 4.
+
+ "Created: / 09-01-2011 / 14:50:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectSupersend
+ | counter |
+ counter := StIdentityCounter new.
+ self shouldnt: [counter id] raise: Exception.
+
+ "Created: / 09-01-2011 / 15:45:09 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStObjectSupersend2
+ | counter |
+ counter := StIdentityCounter new.
+ self assert: (Java as_ST_String: counter id) = 'id#0'.
+ counter incCount.
+ self assert: (Java as_ST_String: counter id) = 'id#2'.
+
+ "Created: / 09-01-2011 / 15:47:39 / Jan Kurs <kurs.jan@post.cz>"
+!
+
+_testStString
+ | string res |
+ string := StString fromString: 'hello'.
+ res := (Java classForName:'StringManipulator') new repeatIt: string.
+ self assert: res == string.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-01-2011 / 12:16:39 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+_testStString2
+ | string res |
+ string := StString fromString: 'hello'.
+ res := (Java classForName:'StringManipulator') new hashOfHello.
+ self assert: string hashCode = res.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 17-01-2011 / 12:15:54 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 17-01-2011 / 16:43:56 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+_testStString3
+ | string res |
+ string := StString fromString: 'hello'.
+ res := (Java classForName:'StringManipulator') new className: string.
+ self assert: 'java.lang.String' = res.
+
+ "Modified: / 09-01-2011 / 21:58:53 / Jan Kurs <kurs.jan@post.cz>"
+ "Created: / 17-01-2011 / 17:28:55 / kursjan <kursjan@fit.cvut.cz>"
+ "Modified: / 17-01-2011 / 19:13:57 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StInJavaTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/StString.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,112 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+String variableByteSubclass:#StString
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!StString class methodsFor:'accessing'!
+
+javaObject
+ ^ JavaObjectDictionary new reflectionOf: self name
+
+ "Created: / 09-01-2011 / 21:02:37 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StString methodsFor:'accessing'!
+
+javaObject
+ ^ self class javaObject.
+"/ javaObject ifNil: [
+"/ javaObject:= Java classForName: 'Counter'.
+"/ ].
+"/ ^ javaObject.
+
+ "Created: / 09-01-2011 / 13:56:56 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:02:18 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StString methodsFor:'error handling'!
+
+doesNotUnderstand:aMessage
+ | method |
+ aMessage selector = #'__hash()I' ifTrue:[ ^ self getHash.].
+ aMessage selector = #'__count()I' ifTrue:[ ^ self getCount.].
+ aMessage selector = #'__offset()I' ifTrue:[ ^ self getOffset.].
+ aMessage selector = #'__value()[C' ifTrue:[ ^ self getValue.].
+ aMessage selector = #'__hash(I)V' ifTrue:[ ^ self setHash: aMessage arguments first].
+ method := JavaClass
+ lookupMethod:aMessage selector
+ numArgs:aMessage arguments size
+ in:self javaObject
+ static:false.
+ ^ method
+ ifNil:[ super doesNotUnderstand:aMessage.]
+ ifNotNil:[ method valueWithReceiver:self arguments:aMessage arguments.]
+
+ "Created: / 09-01-2011 / 13:42:08 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 15:54:04 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 17-01-2011 / 12:17:11 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StString methodsFor:'java protocol'!
+
+getCount
+ ^ self size.
+
+ "Created: / 17-01-2011 / 11:24:29 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+getHash
+ "
+ hash should be cached in the future
+ "
+ self breakPoint: #libjava.
+ ^ 0
+
+ "Created: / 17-01-2011 / 11:23:48 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+getOffset
+ ^ 0.
+
+ "Created: / 17-01-2011 / 11:24:43 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+getValue
+ "VM requires instance of String class"
+ self breakPoint: #libjava.
+ ^ String fromString: self.
+
+ "Created: / 17-01-2011 / 11:24:35 / kursjan <kursjan@fit.cvut.cz>"
+!
+
+setHash:newHash
+ "hash is not cached for this time"
+ self breakPoint: #libjava
+
+ "Created: / 17-01-2011 / 11:35:26 / kursjan <kursjan@fit.cvut.cz>"
+! !
+
+!StString methodsFor:'testing'!
+
+isKindOf: aClass
+ "This override is neccessary for ST <-> Java Object conversions"
+ (self javaObject includesBehavior: aClass) ifTrue:
+ [
+ ^ true.
+ ].
+ ^ super isKindOf: aClass.
+
+ "Created: / 09-01-2011 / 13:28:10 / Jan Kurs <kurs.jan@post.cz>"
+ "Modified: / 09-01-2011 / 21:22:41 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!StString class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/TodoTests.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,28 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+TestCase subclass:#TodoTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Languages-Java-Tests'
+!
+
+
+!TodoTests methodsFor:'testing'!
+
+testFactoryMethod
+ | counter |
+ "I want the StCounter to be created any time. Even in Java code"
+ counter := (Java classForName:'CounterManipulator') new createCounter.
+ self assert: (counter isKindOf: Object).
+ self assert: (counter isKindOf: StCounter).
+ self assert: (counter isKindOf: (Java classForName:'java.lang.Object')).
+
+ "Created: / 09-01-2011 / 19:51:28 / Jan Kurs <kurs.jan@post.cz>"
+! !
+
+!TodoTests class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/abbrev.stc Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,14 @@
+FooLookup FooLookup stx:libjava/experiments 'Languages-Java-Lookup' 0
+HashSetInJavaResource HashSetInJavaResource stx:libjava/experiments 'Languages-Java-Experiments' 1
+HashSetInJavaTests HashSetInJavaTests stx:libjava/experiments 'Languages-Java-Experiments' 4
+NoReflectionObject NoReflectionObject stx:libjava/experiments 'Languages-Java-Support' 0
+PerformanceTestStObject PerformanceTestStObject stx:libjava/experiments 'Languages-Java-Tests' 0
+PerformanceTests PerformanceTests stx:libjava/experiments 'Languages-Java-Tests' 4
+StCounter StCounter stx:libjava/experiments 'Languages-Java-Tests' 0
+StHashSet StHashSet stx:libjava/experiments 'Languages-Java-Tests' 0
+StInJavaResource StInJavaResource stx:libjava/experiments 'Languages-Java-Experiments' 1
+StInJavaTests StInJavaTests stx:libjava/experiments 'Languages-Java-Tests' 4
+StString StString stx:libjava/experiments 'Languages-Java-Tests' 0
+TodoTests TodoTests stx:libjava/experiments 'Languages-Java-Tests' 4
+stx_libjava_experiments stx_libjava_experiments stx:libjava/experiments '* Projects & Packages *' 4
+StIdentityCounter StIdentityCounter stx:libjava/experiments 'Languages-Java-Tests' 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/bc.mak Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,62 @@
+# $Header: /cvs/stx/stx/libjava/experiments/bc.mak,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_experiments.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains make rules for the win32 platform (using borland-bcc).
+# It shares common definitions with the unix-make in Make.spec.
+# The nt.mak supports the following targets:
+# bmake - compile all st-files to a classLib (dll)
+# bmake clean - clean all temp files
+# bmake clobber - clean all
+#
+#
+TOP=..\..
+INCLUDE_TOP=$(TOP)\..
+
+
+
+!INCLUDE $(TOP)\rules\stdHeader_bc
+
+!INCLUDE Make.spec
+
+LIBNAME=libstx_libjava_experiments
+RESFILES=experiments.res
+
+
+
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic
+LOCALDEFINES=
+
+STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -H. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -varPrefix=$(LIBNAME)
+LOCALLIBS=
+
+OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
+
+ALL:: classLibRule
+
+classLibRule: $(OUTDIR) $(OUTDIR)$(LIBNAME).dll
+
+!INCLUDE $(TOP)\rules\stdRules_bc
+
+# build all prerequisite packages for this package
+prereq:
+ pushd ..\..\librun & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+
+
+
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)FooLookup.$(O) FooLookup.$(H): FooLookup.st $(INCLUDE_TOP)\stx\libbasic\Lookup.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)NoReflectionObject.$(O) NoReflectionObject.$(H): NoReflectionObject.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)PerformanceTestStObject.$(O) PerformanceTestStObject.$(H): PerformanceTestStObject.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)StCounter.$(O) StCounter.$(H): StCounter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)StHashSet.$(O) StHashSet.$(H): StHashSet.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)StString.$(O) StString.$(H): StString.st $(INCLUDE_TOP)\stx\libbasic\String.$(H) $(INCLUDE_TOP)\stx\libbasic\CharacterArray.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)stx_libjava_experiments.$(O) stx_libjava_experiments.$(H): stx_libjava_experiments.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)StIdentityCounter.$(O) StIdentityCounter.$(H): StIdentityCounter.st $(INCLUDE_TOP)\stx\libjava\experiments\StCounter.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/bmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using borland bcc
+@REM type bmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/experiments.rc Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,35 @@
+//
+// DO NOT EDIT
+// automagically generated from the projectDefinition: stx_libjava_experiments.
+//
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 6,1,0,1
+ PRODUCTVERSION 6,1,2,1
+ FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
+ FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VS_USER_DEFINED
+
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "CompanyName", "eXept Software AG\0"
+ VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
+ VALUE "FileVersion", "6.1.0.1\0"
+ VALUE "InternalName", "stx:libjava/experiments\0"
+ VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\0"
+ VALUE "ProductName", "Smalltalk/X\0"
+ VALUE "ProductVersion", "6.1.2.1\0"
+ VALUE "ProductDate", "Fri, 08 Apr 2011 11:35:02 GMT\0"
+ END
+
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN // Language | Translation
+ VALUE "Translation", 0x409, 0x4E4 // U.S. English, Windows Multilingual
+ END
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/lcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using lcc compiler
+@REM type lcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak USELCC=1 %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/libInit.cc Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,41 @@
+/*
+ * $Header: /cvs/stx/stx/libjava/experiments/libInit.cc,v 1.1 2011/08/18 19:06:54 vrany Exp $
+ *
+ * DO NOT EDIT
+ * automagically generated from the projectDefinition: stx_libjava_experiments.
+ */
+#define __INDIRECTVMINITCALLS__
+#include <stc.h>
+
+#ifdef WIN32
+# pragma codeseg INITCODE "INITCODE"
+#endif
+
+#if defined(INIT_TEXT_SECTION) || defined(DLL_EXPORT)
+DLL_EXPORT void _libstx_libjava_experiments_Init() INIT_TEXT_SECTION;
+// DLL_EXPORT void _libstx_libjava_experiments_InitDefinition() INIT_TEXT_SECTION;
+#endif
+
+// void _libstx_libjava_experiments_InitDefinition(pass, __pRT__, snd)
+// OBJ snd; struct __vmData__ *__pRT__; {
+// __BEGIN_PACKAGE2__("libstx_libjava_experiments__DFN", _libstx_libjava_experiments_InitDefinition, "stx:libjava/experiments");
+// _stx_137libjava_137experiments_Init(pass,__pRT__,snd);
+
+// __END_PACKAGE__();
+// }
+
+void _libstx_libjava_experiments_Init(pass, __pRT__, snd)
+OBJ snd; struct __vmData__ *__pRT__; {
+__BEGIN_PACKAGE2__("libstx_libjava_experiments", _libstx_libjava_experiments_Init, "stx:libjava/experiments");
+_FooLookup_Init(pass,__pRT__,snd);
+_NoReflectionObject_Init(pass,__pRT__,snd);
+_PerformanceTestStObject_Init(pass,__pRT__,snd);
+_StCounter_Init(pass,__pRT__,snd);
+_StHashSet_Init(pass,__pRT__,snd);
+_StString_Init(pass,__pRT__,snd);
+_stx_137libjava_137experiments_Init(pass,__pRT__,snd);
+_StIdentityCounter_Init(pass,__pRT__,snd);
+
+
+__END_PACKAGE__();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/stx_libjava_experiments.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,59 @@
+"{ Package: 'stx:libjava/experiments' }"
+
+LibraryDefinition subclass:#stx_libjava_experiments
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'* Projects & Packages *'
+!
+
+
+!stx_libjava_experiments class methodsFor:'description - contents'!
+
+classNamesAndAttributes
+ "lists the classes which are to be included in the project.
+ Each entry in the list may be: a single class-name (symbol),
+ or an array-literal consisting of class name and attributes.
+ Attributes are: #autoload or #<os> where os is one of win32, unix,..."
+
+ ^ #(
+ "<className> or (<className> attributes...) in load order"
+ FooLookup
+ (HashSetInJavaResource autoload)
+ (HashSetInJavaTests autoload)
+ NoReflectionObject
+ PerformanceTestStObject
+ (PerformanceTests autoload)
+ StCounter
+ StHashSet
+ (StInJavaResource autoload)
+ (StInJavaTests autoload)
+ StString
+ (TodoTests autoload)
+ #'stx_libjava_experiments'
+ StIdentityCounter
+ )
+!
+
+extensionMethodNames
+ "lists the extension methods which are to be included in the project.
+ Entries are 2-element array literals, consisting of class-name and selector."
+
+ ^ #(
+ )
+! !
+
+!stx_libjava_experiments class methodsFor:'description - svn'!
+
+svnRevisionNr
+ "Return a SVN revision number of myself.
+ This number is updated after a commit"
+
+ ^ "$SVN-Revision:"'nil'"$"
+! !
+
+!stx_libjava_experiments class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/vcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using microsoft visual c
+@REM type vcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak -DUSEVC %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/extensions.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,872 @@
+"{ 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'
+ 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'!
+
+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
+
+ ^'['.
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using lcc compiler
+@REM type lcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak USELCC=1 %1 %2
+
+
--- a/libInit.cc Thu Sep 23 13:52:13 2010 +0000
+++ b/libInit.cc Fri Aug 19 08:58:19 2011 +0000
@@ -1,71 +1,132 @@
/*
- * DO NOT EDIT
- * automagically generated from Make.proto (by make libInit.cc)
+ * $Header: /cvs/stx/stx/libjava/libInit.cc,v 1.8 2011/08/18 18:42:48 vrany Exp $
+ *
+ * DO NOT EDIT
+ * automagically generated from the projectDefinition: stx_libjava.
*/
#define __INDIRECTVMINITCALLS__
#include <stc.h>
-#define INIT_TEXT_SECT /* as nothing */
+
#ifdef WIN32
# pragma codeseg INITCODE "INITCODE"
-#else /* not WIN32 */
-# if defined(__GNUC__) && !defined(NO_SECTION_ATTRIBUTES)
-# if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ > 2
-# undef INIT_TEXT_SECT
-# define INIT_TEXT_SECT __attribute__((section(".stxitext")))
-# endif
-# endif /* not GNUC */
-#endif /* not WIN32 */
-#ifdef INIT_TEXT_SECT
-DLL_EXPORT extern void _libstx_libjava_Init() INIT_TEXT_SECT;
+#endif
+
+#if defined(INIT_TEXT_SECTION) || defined(DLL_EXPORT)
+DLL_EXPORT void _libstx_libjava_Init() INIT_TEXT_SECTION;
+// DLL_EXPORT void _libstx_libjava_InitDefinition() INIT_TEXT_SECTION;
#endif
+
+// void _libstx_libjava_InitDefinition(pass, __pRT__, snd)
+// OBJ snd; struct __vmData__ *__pRT__; {
+// __BEGIN_PACKAGE2__("libstx_libjava__DFN", _libstx_libjava_InitDefinition, "stx:libjava");
+// _stx_137libjava_Init(pass,__pRT__,snd);
+
+// __END_PACKAGE__();
+// }
+
void _libstx_libjava_Init(pass, __pRT__, snd)
OBJ snd; struct __vmData__ *__pRT__; {
__BEGIN_PACKAGE2__("libstx_libjava", _libstx_libjava_Init, "stx:libjava");
-_JavaBehavior_Init(pass,__pRT__,snd);
-_JavaClass_Init(pass,__pRT__,snd);
+_Byte_Init(pass,__pRT__,snd);
_Java_Init(pass,__pRT__,snd);
-_JavaRef_Init(pass,__pRT__,snd);
-_JavaClassRef_Init(pass,__pRT__,snd);
+_JavaAnnotation_Init(pass,__pRT__,snd);
+_JavaAnnotationContainer_Init(pass,__pRT__,snd);
+_JavaAnnotationDefault_Init(pass,__pRT__,snd);
+_JavaAnnotationDictionary_Init(pass,__pRT__,snd);
+_JavaAnnotationValue_Init(pass,__pRT__,snd);
+_JavaArray_Init(pass,__pRT__,snd);
+_JavaBehavior_Init(pass,__pRT__,snd);
+_JavaByteCodeProcessor_Init(pass,__pRT__,snd);
_JavaClassReader_Init(pass,__pRT__,snd);
-_JavaClassPointerRef_Init(pass,__pRT__,snd);
_JavaConstantPool_Init(pass,__pRT__,snd);
_JavaContext_Init(pass,__pRT__,snd);
+_JavaDecompiler_Init(pass,__pRT__,snd);
+_JavaDescriptor_Init(pass,__pRT__,snd);
+_JavaError_Init(pass,__pRT__,snd);
+_JavaEvaluator_Init(pass,__pRT__,snd);
_JavaExceptionTableEntry_Init(pass,__pRT__,snd);
_JavaField_Init(pass,__pRT__,snd);
-_JavaFieldref_Init(pass,__pRT__,snd);
-_JavaMethodref_Init(pass,__pRT__,snd);
+_JavaInflater_Init(pass,__pRT__,snd);
+_JavaJavadocNode_Init(pass,__pRT__,snd);
+_JavaLanguage_Init(pass,__pRT__,snd);
+_JavaLibraries_Init(pass,__pRT__,snd);
_JavaLocalVariableTable_Init(pass,__pRT__,snd);
_JavaLocalVariableTableEntry_Init(pass,__pRT__,snd);
+_JavaLookup_Init(pass,__pRT__,snd);
_JavaMethod_Init(pass,__pRT__,snd);
-_JavaMethodWithBreakpoint_Init(pass,__pRT__,snd);
-_JavaMethodWithException_Init(pass,__pRT__,snd);
-_JavaMethodWithHandler_Init(pass,__pRT__,snd);
-_JavaInterfaceMethodref_Init(pass,__pRT__,snd);
-_JavaNameandType_Init(pass,__pRT__,snd);
-_JavaNativeMethod_Init(pass,__pRT__,snd);
+_JavaNameAndType2_Init(pass,__pRT__,snd);
+_JavaNativeMemory_Init(pass,__pRT__,snd);
+_JavaNode_Init(pass,__pRT__,snd);
_JavaObject_Init(pass,__pRT__,snd);
+_JavaObjectDictionary_Init(pass,__pRT__,snd);
+_JavaPackage_Init(pass,__pRT__,snd);
+_JavaParseResult_Init(pass,__pRT__,snd);
+_JavaPopUpView_Init(pass,__pRT__,snd);
_JavaProcess_Init(pass,__pRT__,snd);
-_JavaBuiltInClassPointerRef_Init(pass,__pRT__,snd);
+_JavaRef2_Init(pass,__pRT__,snd);
+_JavaRelease_Init(pass,__pRT__,snd);
+_JavaResolver_Init(pass,__pRT__,snd);
_JavaSlotIndexCache_Init(pass,__pRT__,snd);
+_JavaSourceCodeCache_Init(pass,__pRT__,snd);
+_JavaSourceFileWriter_Init(pass,__pRT__,snd);
+_JavaStartup_Init(pass,__pRT__,snd);
+_JavaTestsLoader_Init(pass,__pRT__,snd);
+_JavaTopView_Init(pass,__pRT__,snd);
_JavaUnresolvedConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedClassConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedRefConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedMethodrefConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedInterfaceMethodrefConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedFieldrefConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedNameandTypeConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedSTArrayConstant_Init(pass,__pRT__,snd);
-_JavaUnresolvedStringConstant_Init(pass,__pRT__,snd);
_JavaVM_Init(pass,__pRT__,snd);
-_JavaTopView_Init(pass,__pRT__,snd);
-_JavaPopUpView_Init(pass,__pRT__,snd);
+_JavaView_Init(pass,__pRT__,snd);
+_PPJavaNode_Init(pass,__pRT__,snd);
+_Short_Init(pass,__pRT__,snd);
_SmalltalkAppletContext_Init(pass,__pRT__,snd);
_SmalltalkAppletStub_Init(pass,__pRT__,snd);
-_JavaAppletComponentSpec_Init(pass,__pRT__,snd);
-_UIGalleryJavaEntry_Init(pass,__pRT__,snd);
-_JavaView_Init(pass,__pRT__,snd);
-_JavaDecompiler_Init(pass,__pRT__,snd);
+_stx_137libjava_Init(pass,__pRT__,snd);
+_JavaAnnotationArrayValue_Init(pass,__pRT__,snd);
+_JavaAnnotationClassValue_Init(pass,__pRT__,snd);
+_JavaAnnotationEnumValue_Init(pass,__pRT__,snd);
+_JavaAnnotationNestedAnnotationValue_Init(pass,__pRT__,snd);
+_JavaAnnotationPrimitiveValue_Init(pass,__pRT__,snd);
+_JavaByteCodeDisassembler_Init(pass,__pRT__,snd);
_JavaByteCodeEnumerator_Init(pass,__pRT__,snd);
+_JavaByteCodeInterpreter_Init(pass,__pRT__,snd);
+_JavaClass_Init(pass,__pRT__,snd);
+_JavaClassAnnotationContainer_Init(pass,__pRT__,snd);
+_JavaClassContentRef2_Init(pass,__pRT__,snd);
+_JavaClassRef2_Init(pass,__pRT__,snd);
_JavaEmbeddedFrameView_Init(pass,__pRT__,snd);
+_JavaFieldAnnotationContainer_Init(pass,__pRT__,snd);
+_JavaFieldDescriptor_Init(pass,__pRT__,snd);
+_JavaFormalParameterNode_Init(pass,__pRT__,snd);
+_JavaInvalidRefError_Init(pass,__pRT__,snd);
+_JavaMethodAnnotationContainer_Init(pass,__pRT__,snd);
+_JavaMethodDeclarationNode_Init(pass,__pRT__,snd);
+_JavaMethodDeclaratorNode_Init(pass,__pRT__,snd);
+_JavaMethodDescriptor_Init(pass,__pRT__,snd);
+_JavaMethodNode_Init(pass,__pRT__,snd);
+_JavaMethodWithException_Init(pass,__pRT__,snd);
+_JavaParser_Init(pass,__pRT__,snd);
+_JavaStringRef2_Init(pass,__pRT__,snd);
+_JavaTypeNode_Init(pass,__pRT__,snd);
+_JavaUnhandledExceptionError_Init(pass,__pRT__,snd);
+_JavaUnresolvedClassConstant_Init(pass,__pRT__,snd);
+_JavaUnresolvedStringConstant_Init(pass,__pRT__,snd);
+_JavadocDeclarationNode_Init(pass,__pRT__,snd);
+_JavaArrayTypeNode_Init(pass,__pRT__,snd);
+_JavaBooleanTypeNode_Init(pass,__pRT__,snd);
+_JavaBothOldAndNewClassRef_Init(pass,__pRT__,snd);
+_JavaByteCodeSteppableInterpreter_Init(pass,__pRT__,snd);
+_JavaCharTypeNode_Init(pass,__pRT__,snd);
+_JavaClassOrInterfaceTypeNode_Init(pass,__pRT__,snd);
+_JavaDoubleTypeNode_Init(pass,__pRT__,snd);
+_JavaFieldRef2_Init(pass,__pRT__,snd);
+_JavaFloatTypeNode_Init(pass,__pRT__,snd);
+_JavaIntTypeNode_Init(pass,__pRT__,snd);
+_JavaLongTypeNode_Init(pass,__pRT__,snd);
+_JavaMethodRef2_Init(pass,__pRT__,snd);
+_JavaMethodWithHandler_Init(pass,__pRT__,snd);
+_JavaVoidTypeNode_Init(pass,__pRT__,snd);
+_JavaInterfaceMethodRef2_Init(pass,__pRT__,snd);
+_JavaNativeMethod_Init(pass,__pRT__,snd);
+
+_stx_137libjava_extensions_Init(pass,__pRT__,snd);
__END_PACKAGE__();
}
--- a/libjava.rc Thu Sep 23 13:52:13 2010 +0000
+++ b/libjava.rc Fri Aug 19 08:58:19 2011 +0000
@@ -1,14 +1,10 @@
-/*------------------------------------------------------------------------*/
-/* $Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/libjava.rc,v 1.2 2005/12/22 16:55:32 cg Exp $ */
-/*------------------------------------------------------------------------*/
-
-// #if (__BORLANDC__ < 0x0550)
-// #include <ver.h>
-// #endif
-
+//
+// DO NOT EDIT
+// automagically generated from the projectDefinition: stx_libjava.
+//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 5,2,0,0
- PRODUCTVERSION 5,2,7,1
+ FILEVERSION 6,2,0,1
+ PRODUCTVERSION 6,2,1,1
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
FILEOS VOS_NT_WINDOWS32
@@ -21,12 +17,13 @@
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "eXept Software AG\0"
- VALUE "FileDescription", "Smalltalk/X Java Support\0"
- VALUE "FileVersion", "$Revision: 1.2 $\0"
- VALUE "InternalName", "libjava\0"
- VALUE "LegalCopyright", "Copyright eXept Software AG 1998-2006\0"
+ VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
+ VALUE "FileVersion", "6.2.0.1\0"
+ VALUE "InternalName", "stx:libjava\0"
+ VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\b SWING Research Group, Czech Technical University In Prague\0"
VALUE "ProductName", "Smalltalk/X\0"
- VALUE "ProductVersion", "5.2.7.1\0"
+ VALUE "ProductVersion", "6.2.1.1\0"
+ VALUE "ProductDate", "Thu, 18 Aug 2011 11:28:36 GMT\0"
END
END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/list-cvs.txt Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,151 @@
+abbrev.stc
+AbstractJavaTestCase.st
+autopackage
+bc.mak
+bmake.bat
+builder
+Byte.st
+docs
+examples
+experiments
+extensions.st
+java
+JavaAnnotationArrayValue.st
+JavaAnnotationClassValue.st
+JavaAnnotationContainer.st
+JavaAnnotationDefault.st
+JavaAnnotationDictionary.st
+JavaAnnotationEnumValue.st
+JavaAnnotationNestedAnnotationValue.st
+JavaAnnotationPrimitiveValue.st
+JavaAnnotation.st
+JavaAnnotationValue.st
+JavaAntProjectResource.st
+JavaArray.st
+JavaArrayTypeNode.st
+JavaBehavior.st
+JavaBooleanTypeNode.st
+JavaBothOldAndNewClassRef.st
+JavaByteCodeDisassembler.st
+JavaByteCodeDisassemblerTests.st
+JavaByteCodeEnumerator.st
+JavaByteCodeInterpreter.st
+JavaByteCodeInterpreterTests.st
+JavaByteCodeProcessor.st
+JavaByteCodeProcessorTests.st
+JavaByteCodeSteppableInterpreter.st
+JavaCharTypeNode.st
+JavaClassAnnotationContainer.st
+JavaClassContentRef2.st
+JavaClassOrInterfaceTypeNode.st
+JavaClassReader2Tests.st
+JavaClassReader.st
+JavaClassReaderTests.st
+JavaClassRef2.st
+JavaClassRefTests.st
+JavaClass.st
+JavaConstantPool.st
+JavaContext.st
+JavaDecompiler.st
+JavaDescriptor.st
+JavadocDeclarationNode.st
+JavaDoubleTypeNode.st
+JavaEmbeddedFrameView.st
+JavaError.st
+JavaEvaluator.st
+JavaExceptionTableEntry.st
+JavaExceptionThrowerMock.st
+JavaFieldAnnotationContainer.st
+JavaFieldDescriptor.st
+JavaFieldRef2.st
+JavaFieldRefTests.st
+JavaField.st
+JavaFloatTypeNode.st
+JavaFormalParameterNode.st
+JavaInflater.st
+JavaInitializedResource.st
+JavaInterfaceMethodRef2.st
+JavaInterfaceMethodRefTests.st
+JavaIntTypeNode.st
+JavaInvalidRefError.st
+JavaJavadocNode.st
+JavaJUnitTests.st
+JavaLanguage.st
+JavaLibrariesResource.st
+JavaLibraries.st
+JavaLocalVariableTableEntry.st
+JavaLocalVariableTable.st
+JavaLongTypeNode.st
+JavaLookup.st
+JavaLookupTestsResource.st
+JavaMethodAnnotationContainer.st
+JavaMethodDeclarationNode.st
+JavaMethodDeclaratorNode.st
+JavaMethodDescriptor.st
+JavaMethodNode.st
+JavaMethodRef2.st
+JavaMethodRefTests.st
+JavaMethod.st
+JavaMethodWithException.st
+JavaMethodWithHandler.st
+JavaNameAndType2.st
+JavaNativeMemory.st
+JavaNativeMethod.st
+JavaNode.st
+JavaObjectDictionary.st
+JavaObject.st
+JavaPackage.st
+JavaParseResult.st
+JavaParserNavigationTests.st
+JavaParser.st
+JavaParserTestCase.st
+JavaParserTests.st
+JavaPopUpView.st
+JavaProcess.st
+JavaRef2.st
+JavaRefMock.st
+JavaRefTests.st
+JavaRelease.st
+JavaResolver.st
+JavaRuntimeConstantPoolTests.st
+JavaSlotIndexCache.st
+JavaSourceCodeCache.st
+JavaSourceFileWriter.st
+Java.st
+JavaStartup.st
+JavaStringRef2.st
+JavaTestCaseProxy.st
+JavaTestsLoader.st
+JavaTestsResource.st
+JavaTopView.st
+JavaTypeNode.st
+JavaUnhandledExceptionError.st
+JavaUnresolvedClassConstant.st
+JavaUnresolvedConstant.st
+JavaUnresolvedStringConstant.st
+JavaUTF8Tests.st
+JavaView.st
+JavaVM.st
+JavaVoidTypeNode.st
+JUnitTestCaseProxy.st
+lcmake.bat
+libInit.cc
+libjava.rc
+list-cvs.txt
+loadAll
+loadClasses
+LookupTests.st
+Makefile
+Make.proto
+Make.spec
+nt.def
+package.deps.rake
+PPJavaNode.st
+Short.st
+smacc
+SmalltalkAppletContext.st
+SmalltalkAppletStub.st
+startup
+stx_libjava.st
+TestletTestCaseProxy.st
+vcmake.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/list-svn.txt Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,152 @@
+abbrev.stc
+AbstractJavaTestCase.st
+autopackage
+bc.mak
+bmake.bat
+builder
+Byte.st
+docs
+examples
+experiments
+extensions.st
+java
+JavaAnnotationArrayValue.st
+JavaAnnotationClassValue.st
+JavaAnnotationContainer.st
+JavaAnnotationDefault.st
+JavaAnnotationDictionary.st
+JavaAnnotationEnumValue.st
+JavaAnnotationNestedAnnotationValue.st
+JavaAnnotationPrimitiveValue.st
+JavaAnnotation.st
+JavaAnnotationValue.st
+JavaAntProjectResource.st
+JavaArray.st
+JavaArrayTypeNode.st
+JavaBehavior.st
+JavaBooleanTypeNode.st
+JavaBothOldAndNewClassRef.st
+JavaByteCodeDisassembler.st
+JavaByteCodeDisassemblerTests.st
+JavaByteCodeEnumerator.st
+JavaByteCodeInterpreter.st
+JavaByteCodeInterpreterTests.st
+JavaByteCodeProcessor.st
+JavaByteCodeProcessorTests.st
+JavaByteCodeSteppableInterpreter.st
+JavaCharTypeNode.st
+JavaClassAnnotationContainer.st
+JavaClassContentRef2.st
+JavaClassOrInterfaceTypeNode.st
+JavaClassReader2Tests.st
+JavaClassReader.st
+JavaClassReaderTests.st
+JavaClassRef2.st
+JavaClassRefTests.st
+JavaClass.st
+JavaConstantPool.st
+JavaContext.st
+JavaDecompiler.st
+JavaDescriptor.st
+JavadocDeclarationNode.st
+JavaDoubleTypeNode.st
+JavaEmbeddedFrameView.st
+JavaError.st
+JavaEvaluator.st
+JavaExceptionTableEntry.st
+JavaExceptionThrowerMock.st
+JavaFieldAnnotationContainer.st
+JavaFieldDescriptor.st
+JavaFieldRef2.st
+JavaFieldRefTests.st
+JavaField.st
+JavaFloatTypeNode.st
+JavaFormalParameterNode.st
+JavaInflater.st
+JavaInitializedResource.st
+JavaInterfaceMethodRef2.st
+JavaInterfaceMethodRefTests.st
+JavaIntTypeNode.st
+JavaInvalidRefError.st
+JavaJavadocNode.st
+JavaJUnitTests.st
+JavaLanguage.st
+JavaLibrariesResource.st
+JavaLibraries.st
+JavaLocalVariableTableEntry.st
+JavaLocalVariableTable.st
+JavaLongTypeNode.st
+JavaLookup.st
+JavaLookupTestsResource.st
+JavaMethodAnnotationContainer.st
+JavaMethodDeclarationNode.st
+JavaMethodDeclaratorNode.st
+JavaMethodDescriptor.st
+JavaMethodNode.st
+JavaMethodRef2.st
+JavaMethodRefTests.st
+JavaMethod.st
+JavaMethodWithException.st
+JavaMethodWithHandler.st
+JavaNameAndType2.st
+JavaNativeMemory.st
+JavaNativeMethod.st
+JavaNode.st
+JavaObjectDictionary.st
+JavaObject.st
+JavaPackage.st
+JavaParseResult.st
+JavaParserNavigationTests.st
+JavaParser.st
+JavaParserTestCase.st
+JavaParserTests.st
+JavaPopUpView.st
+JavaProcess.st
+JavaRef2.st
+JavaRefMock.st
+JavaRefTests.st
+JavaRelease.st
+JavaResolver.st
+JavaRuntimeConstantPoolTests.st
+JavaSlotIndexCache.st
+JavaSourceCodeCache.st
+JavaSourceFileWriter.st
+Java.st
+JavaStartup.st
+JavaStringRef2.st
+JavaTestCaseProxy.st
+JavaTestsLoader.st
+JavaTestsResource.st
+JavaTopView.st
+JavaTypeNode.st
+JavaUnhandledExceptionError.st
+JavaUnresolvedClassConstant.st
+JavaUnresolvedConstant.st
+JavaUnresolvedStringConstant.st
+JavaUTF8Tests.st
+JavaView.st
+JavaVM.st
+JavaVoidTypeNode.st
+JUnitTestCaseProxy.st
+lcmake.bat
+libInit.cc
+libjava.rc
+list-cvs.txt
+list-svn.txt
+loadAll
+loadClasses
+LookupTests.st
+Makefile
+Make.proto
+Make.spec
+nt.def
+package.deps.rake
+PPJavaNode.st
+Short.st
+smacc
+SmalltalkAppletContext.st
+SmalltalkAppletStub.st
+startup
+stx_libjava.st
+TestletTestCaseProxy.st
+vcmake.bat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package.deps.rake Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,96 @@
+
+# Package dependencies.
+# Automatically generated by project defintion.
+
+task "stx:goodies/refactoryBrowser/helpers" => "stx:libbasic"
+
+
+task "stx:goodies/refactoryBrowser/parser" => "stx:libbasic"
+
+task "stx:goodies/smaCC" => "stx:goodies/refactoryBrowser/parser"
+task "stx:goodies/smaCC" => "stx:libhtml"
+task "stx:goodies/smaCC" => "stx:libview2"
+task "stx:goodies/smaCC" => "stx:goodies/refactoryBrowser/changes"
+task "stx:goodies/smaCC" => "stx:goodies/sunit"
+task "stx:goodies/smaCC" => "stx:libbasic2"
+task "stx:goodies/smaCC" => "stx:libwidg2"
+task "stx:goodies/smaCC" => "stx:libbasic"
+task "stx:goodies/smaCC" => "stx:goodies/refactoryBrowser/helpers"
+
+task "stx:libwidg" => "stx:libview2"
+task "stx:libwidg" => "stx:libview"
+task "stx:libwidg" => "stx:libbasic2"
+task "stx:libwidg" => "stx:libui"
+task "stx:libwidg" => "stx:libbasic"
+
+task "stx:goodies/sunit" => "stx:libview2"
+task "stx:goodies/sunit" => "stx:libtool"
+task "stx:goodies/sunit" => "stx:libview"
+task "stx:goodies/sunit" => "stx:libbasic"
+
+task "squeak:petitparser" => "stx:goodies/sunit"
+task "squeak:petitparser" => "stx:libbasic2"
+task "squeak:petitparser" => "stx:libbasic"
+
+task "stx:libview2" => "stx:libview"
+task "stx:libview2" => "stx:libbasic2"
+task "stx:libview2" => "stx:libbasic"
+
+task "stx:libbasic2" => "stx:libbasic"
+
+task "stx:libview" => "stx:libbasic2"
+task "stx:libview" => "stx:libbasic"
+
+task "stx:libhtml" => "stx:libwidg"
+task "stx:libhtml" => "stx:libview"
+task "stx:libhtml" => "stx:libbasic"
+
+task "stx:libtool" => "stx:goodies/refactoryBrowser/parser"
+task "stx:libtool" => "stx:libui"
+task "stx:libtool" => "stx:libview"
+task "stx:libtool" => "stx:libview2"
+task "stx:libtool" => "stx:libwidg"
+task "stx:libtool" => "stx:libbasic2"
+task "stx:libtool" => "stx:libwidg2"
+task "stx:libtool" => "stx:libbasic"
+task "stx:libtool" => "stx:libbasic3"
+task "stx:libtool" => "stx:libboss"
+task "stx:libtool" => "stx:libcomp"
+
+task "stx:libcomp" => "stx:libbasic"
+
+task "stx:goodies/refactoryBrowser/changes" => "stx:goodies/refactoryBrowser/helpers"
+task "stx:goodies/refactoryBrowser/changes" => "stx:goodies/refactoryBrowser/parser"
+task "stx:goodies/refactoryBrowser/changes" => "stx:libbasic3"
+task "stx:goodies/refactoryBrowser/changes" => "stx:libbasic"
+
+task "stx:libboss" => "stx:libbasic"
+
+task "stx:libwidg2" => "stx:libview"
+task "stx:libwidg2" => "stx:libui"
+task "stx:libwidg2" => "stx:libview2"
+task "stx:libwidg2" => "stx:libwidg"
+task "stx:libwidg2" => "stx:libbasic2"
+task "stx:libwidg2" => "stx:libbasic"
+
+task "stx:libbasic3" => "stx:libbasic2"
+task "stx:libbasic3" => "stx:libbasic"
+
+task "stx:libui" => "stx:libview2"
+task "stx:libui" => "stx:libview"
+task "stx:libui" => "stx:libbasic"
+
+task "stx:libjava" => "stx:libwidg2"
+task "stx:libjava" => "squeak:petitparser"
+task "stx:libjava" => "stx:libbasic3"
+task "stx:libjava" => "stx:libcomp"
+task "stx:libjava" => "stx:libbasic2"
+task "stx:libjava" => "stx:libview2"
+task "stx:libjava" => "stx:goodies/sunit"
+task "stx:libjava" => "stx:libhtml"
+task "stx:libjava" => "stx:libwidg"
+task "stx:libjava" => "stx:libbasic"
+task "stx:libjava" => "stx:goodies/smaCC"
+task "stx:libjava" => "stx:libview"
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/smacc/parser.txt Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,793 @@
+%id <LT> ;
+%id <GT> ;
+%id <IDENTIFIER> ;
+
+goal : compilation_unit
+ ;
+
+# 19.3) Lexical Structure.
+literal : <INTEGER_LITERAL>
+ | <FLOATING_POINT_LITERAL>
+ | <BOOLEAN_LITERAL>
+# | "true"
+# | "false"
+ | <CHARACTER_LITERAL>
+ | <STRING_LITERAL>
+ | <NULL_LITERAL>
+ ;
+
+# 19.4) Types, Values, and Variables
+type : primitive_type
+ {
+ '1' first
+ }
+ | reference_type
+ {
+ '1' first
+ }
+ ;
+primitive_type :
+ numeric_type
+ | "boolean"
+ {
+ Array with:
+ (JavaBooleanTypeNode new
+ token: '1').
+ }
+ ;
+numeric_type: integral_type
+ | floating_point_type
+ ;
+integral_type :
+ "byte"
+ {
+ JavaByteTypeNode new
+ token: '1'.
+ }
+ | "short"
+ {
+ JavaShortTypeNode new
+ token: '1'.
+ }
+ | "int"
+ {
+ JavaIntTypeNode new
+ token: '1'.
+ }
+ | "long"
+ {
+ JavaLongTypeNode new
+ token: '1'.
+ }
+ | "char"
+ {
+ JavaCharTypeNode new
+ token: '1'.
+ }
+ ;
+floating_point_type :
+ "float"
+ {
+ JavaFloatTypeNode new
+ token: '1'.
+ }
+ | "double"
+ {
+ JavaDoubleTypeNode new
+ token: '1'.
+ }
+ ;
+
+reference_type :
+ class_or_interface_type
+ | array_type
+ ;
+class_or_interface_type :
+ name
+ {
+ JavaClassOrInterfaceTypeNode new
+ token: '1'.
+ }
+ |
+ name "<?>"
+ {
+ JavaClassOrInterfaceTypeNode new
+ token: '1'.
+ }
+ |
+ name "<T>"
+ {
+ JavaClassOrInterfaceTypeNode new
+ token: '1'.
+ }
+ |
+ name "<Class<T>>"
+ {
+ JavaClassOrInterfaceTypeNode new
+ token: '1'.
+ }
+ ;
+
+
+class_type : class_or_interface_type;
+interface_type : class_or_interface_type;
+
+array_type : primitive_type dims
+ {
+ JavaArrayTypeNode new
+ token: '1'
+ }
+ | name dims
+ {
+ JavaArrayTypeNode new
+ token: '1'
+ }
+ | name "<T>" dims
+ {
+ JavaArrayTypeNode new
+ token: '1'
+ }
+ | name "<Class<T>>" dims
+ {
+ JavaArrayTypeNode new
+ token: '1'
+ }
+ | name "<Class<?>>" dims
+ {
+ JavaArrayTypeNode new
+ token: '1'
+ }
+ ;
+
+# 19.5) Names
+name : simple_name
+ | qualified_name
+ ;
+simple_name : <IDENTIFIER>
+ ;
+qualified_name :
+ name "." <IDENTIFIER>
+ ;
+
+# 19.6) "package"s
+compilation_unit :
+ package_declaration_opt
+ import_declarations_opt
+ type_declarations_opt
+ ;
+package_declaration_opt : package_declaration | ;
+import_declarations_opt : import_declarations | ;
+type_declarations_opt : type_declarations | ;
+
+import_declarations :
+ import_declaration
+ | import_declarations import_declaration
+ ;
+type_declarations :
+ type_declaration
+ | type_declarations type_declaration
+ ;
+package_declaration :
+ "package" name ";"
+ ;
+import_declaration :
+ single_type_import_declaration
+ | type_import_on_demand_declaration
+ ;
+single_type_import_declaration :
+ "import" name ";"
+ ;
+type_import_on_demand_declaration :
+ "import" name "." "*" ";"
+ ;
+type_declaration :
+ class_declaration
+ | interface_declaration
+ | ";"
+ ;
+
+# 19.7) Productions used only in the LALR(1) grammar
+modifiers_opt:
+ | modifiers
+ ;
+modifiers : modifier
+ | modifiers modifier
+ ;
+modifier : "public" | "protected" | "private"
+ | "static"
+ | "abstract" | "final" | "native" | "synchronized" | "transient" | "volatile"
+ | "strictfp" # note that semantic analysis must check that the
+ # context of the modifier allows strictfp.
+ ;
+
+# 19.8) Classes
+
+# 19.8.1) Class Declaration:
+class_declaration :
+ modifiers_opt "class" <IDENTIFIER> super_opt interfaces_opt class_body
+ |
+ modifiers_opt "class" <IDENTIFIER> "<T>" super_opt interfaces_opt class_body
+ ;
+super : "extends" class_type
+ ;
+super_opt :
+ | super
+ ;
+interfaces : "implements" interface_type_list
+ ;
+interfaces_opt:
+ | interfaces
+ ;
+interface_type_list :
+ interface_type
+ | interface_type_list "," interface_type
+ ;
+class_body : "{" class_body_declarations_opt "}"
+ ;
+class_body_declarations_opt :
+ | class_body_declarations ;
+class_body_declarations :
+ class_body_declaration
+ | class_body_declarations class_body_declaration
+ ;
+class_body_declaration :
+ class_member_declaration
+ | static_initializer
+ | constructor_declaration
+ | block
+ ;
+class_member_declaration :
+ field_declaration
+ | method_declaration
+ # repeat the prod for 'class_declaration' here:
+ | modifiers_opt "class" <IDENTIFIER> super_opt interfaces_opt class_body
+ | interface_declaration
+ | ";"
+ ;
+
+# 19.8.2) Field Declarations
+field_declaration :
+ modifiers_opt type variable_declarators ";"
+ ;
+variable_declarators :
+ variable_declarator
+ | variable_declarators "," variable_declarator
+ ;
+variable_declarator :
+ variable_declarator_id
+ | variable_declarator_id "=" variable_initializer
+ ;
+variable_declarator_id :
+ <IDENTIFIER>
+ | variable_declarator_id "[" "]"
+ ;
+variable_initializer :
+ expression
+ | array_initializer
+ ;
+
+# 19.8.3) Method Declarations
+method_declaration :
+ method_header method_body
+ ;
+method_header :
+ modifiers_opt type method_declarator throws_opt
+ {
+ JavaMethodNode new
+ javadoc: self scanner lastJavadoc;
+ modifiers: '1' ;
+ type: '2';
+ declarator: '3'
+ }
+ | modifiers_opt "void" method_declarator throws_opt
+ {
+ JavaMethodNode new
+ javadoc: self scanner lastJavadoc;
+ modifiers: '1' ;
+ type: JavaVoidTypeNode new ;
+ declarator: '3'
+ }
+ ;
+
+method_declarator :
+ method_identifier "(" formal_parameter_list_opt ")"
+ {
+ JavaMethodDeclaratorNode new
+ identifier: '1' first value;
+ formalParameterList: '3'
+ }
+ | method_declarator "[" "]" # deprecated
+ # be careful; the above production also allows 'void foo() []'
+ ;
+
+method_identifier :
+ <IDENTIFIER>
+ ;
+formal_parameter_list_opt :
+ | formal_parameter_list
+ ;
+formal_parameter_list :
+ formal_parameter
+ {
+ OrderedCollection new
+ add: '1';
+ yourself
+ }
+ | formal_parameter_list "," formal_parameter
+ {
+ '1'
+ add: '3';
+ yourself
+ }
+ ;
+formal_parameter :
+ type variable_declarator_id
+ {
+ JavaFormalParameterNode new
+ type: '1';
+ variableDeclaratorId: '2'
+ }
+ | "final" type variable_declarator_id
+ {
+ JavaFormalParameterNode new
+ type: '1';
+ variableDeclaratorId: '2'
+ }
+ ;
+throws_opt :
+ | throws
+ ;
+throws : "throws" class_type_list
+ ;
+class_type_list :
+ class_type
+ | class_type_list "," class_type
+ ;
+method_body : block
+ | ";"
+ ;
+
+# 19.8.4) Static Initializers
+static_initializer :
+ "static" block
+ ;
+
+# 19.8.5) Constructor Declarations
+constructor_declaration :
+ modifiers_opt constructor_declarator throws_opt
+ constructor_body
+ ;
+constructor_declarator :
+ simple_name "(" formal_parameter_list_opt ")"
+ ;
+constructor_body :
+ "{" explicit_constructor_invocation
+ block_statements "}"
+ | "{" explicit_constructor_invocation "}"
+ | "{" block_statements "}"
+ | "{" "}"
+ ;
+explicit_constructor_invocation :
+ "this" "(" argument_list_opt ")" ";"
+ | "super" "(" argument_list_opt ")" ";"
+ | primary "." "this" "(" argument_list_opt ")" ";"
+ | primary "." "super" "(" argument_list_opt ")" ";"
+ ;
+
+# 19.9) Interfaces
+
+# 19.9.1) Interface Declarations
+interface_declaration :
+ modifiers_opt "interface" <IDENTIFIER> extends_interfaces_opt
+ interface_body
+ ;
+extends_interfaces_opt :
+ | extends_interfaces
+ ;
+extends_interfaces :
+ "extends" interface_type
+ | extends_interfaces "," interface_type
+ ;
+interface_body :
+ "{" interface_member_declarations_opt "}"
+ ;
+interface_member_declarations_opt :
+ | interface_member_declarations
+ ;
+interface_member_declarations :
+ interface_member_declaration
+ | interface_member_declarations interface_member_declaration
+ ;
+interface_member_declaration :
+ constant_declaration
+ | abstract_method_declaration
+ | class_declaration
+ | interface_declaration
+ ;
+constant_declaration :
+ field_declaration
+ # need to semantically check that modifiers of field declaration
+ # include only PUBLIC, "static", or "final". Other modifiers are
+ # disallowed.
+ ;
+abstract_method_declaration :
+ method_header ";"
+ ;
+
+# 19.10) Arrays
+array_initializer :
+ "{" variable_initializers "," "}"
+ | "{" variable_initializers "}"
+ | "{" "," "}"
+ | "{" "}"
+ ;
+variable_initializers :
+ variable_initializer
+ | variable_initializers "," variable_initializer
+ ;
+
+# 19.11) Blocks and Statements
+block : "{" block_statements_opt "}"
+ ;
+block_statements_opt :
+ | block_statements
+ ;
+block_statements :
+ block_statement
+ | block_statements block_statement
+ ;
+block_statement :
+ local_variable_declaration_statement
+ | statement
+ | class_declaration
+ | interface_declaration
+ ;
+local_variable_declaration_statement :
+ local_variable_declaration ";"
+ ;
+local_variable_declaration :
+ type variable_declarators
+ | "final" type variable_declarators
+ ;
+statement : statement_without_trailing_substatement
+ | labeled_statement
+ | if_then_statement
+ | if_then_else_statement
+ | while_statement
+ | for_statement
+ ;
+statement_no_short_if :
+ statement_without_trailing_substatement
+ | labeled_statement_no_short_if
+ | if_then_else_statement_no_short_if
+ | while_statement_no_short_if
+ | for_statement_no_short_if
+ ;
+statement_without_trailing_substatement :
+ block
+ | empty_statement
+ | expression_statement
+ | switch_statement
+ | do_statement
+ | break_statement
+ | continue_statement
+ | return_statement
+ | synchronized_statement
+ | throw_statement
+ | try_statement
+ ;
+empty_statement :
+ ";"
+ ;
+labeled_statement :
+ <IDENTIFIER> ":" statement
+ ;
+labeled_statement_no_short_if :
+ <IDENTIFIER> ":" statement_no_short_if
+ ;
+expression_statement :
+ statement_expression ";"
+ ;
+statement_expression :
+ assignment
+ | preincrement_expression
+ | predecrement_expression
+ | postincrement_expression
+ | postdecrement_expression
+ | method_invocation
+ | class_instance_creation_expression
+ ;
+if_then_statement :
+ "if" "(" expression ")" statement
+ ;
+if_then_else_statement :
+ "if" "(" expression ")" statement_no_short_if
+ "else" statement
+ ;
+if_then_else_statement_no_short_if :
+ "if" "(" expression ")" statement_no_short_if
+ "else" statement_no_short_if
+ ;
+switch_statement :
+ "switch" "(" expression ")" switch_block
+ ;
+switch_block :
+ "{" switch_block_statement_groups switch_labels "}"
+ | "{" switch_block_statement_groups "}"
+ | "{" switch_labels "}"
+ | "{" "}"
+ ;
+switch_block_statement_groups :
+ switch_block_statement_group
+ | switch_block_statement_groups switch_block_statement_group
+ ;
+switch_block_statement_group :
+ switch_labels block_statements
+ ;
+switch_labels :
+ switch_label
+ | switch_labels switch_label
+ ;
+switch_label :
+ "case" constant_expression ":"
+ | "default" ":"
+ ;
+
+while_statement :
+ "while" "(" expression ")" statement
+ ;
+while_statement_no_short_if :
+ "while" "(" expression ")" statement_no_short_if
+ ;
+do_statement :
+ "do" statement "while" "(" expression ")" ";"
+ ;
+for_statement :
+ "for" "(" for_init_opt ";" expression_opt ";"
+ for_update_opt ")" statement
+ ;
+for_statement_no_short_if :
+ "for" "(" for_init_opt ";" expression_opt ";"
+ for_update_opt ")" statement_no_short_if
+ ;
+for_init_opt :
+ | for_init
+ ;
+for_init : statement_expression_list
+ | local_variable_declaration
+ ;
+for_update_opt :
+ | for_update
+ ;
+for_update : statement_expression_list
+ ;
+statement_expression_list :
+ statement_expression
+ | statement_expression_list "," statement_expression
+ ;
+
+identifier_opt :
+ | <IDENTIFIER>
+ ;
+
+break_statement :
+ "break" identifier_opt ";"
+ ;
+
+continue_statement :
+ "continue" identifier_opt ";"
+ ;
+return_statement :
+ "return" expression_opt ";"
+ ;
+throw_statement :
+ "throw" expression ";"
+ ;
+synchronized_statement :
+ "synchronized" "(" expression ")" block
+ ;
+try_statement :
+ "try" block catches
+ | "try" block catches_opt finally
+ ;
+catches_opt :
+ | catches
+ ;
+catches : catch_clause
+ | catches catch_clause
+ ;
+catch_clause :
+ "catch" "(" formal_parameter ")" block
+ ;
+finally : "finally" block
+ ;
+
+# 19.12) Expressions
+primary : primary_no_new_array
+ | array_creation_expression
+ ;
+primary_no_new_array :
+ literal
+ | "this"
+ | "(" expression ")"
+ | class_instance_creation_expression
+ | field_access
+ | method_invocation
+ | array_access
+ | primitive_type "." "class"
+ | "void" "." "class"
+ | array_type "." "class"
+ | name "." "class"
+ | name "." "this"
+ ;
+class_instance_creation_expression :
+ "new" class_type "(" argument_list_opt ")"
+ | "new" class_type "(" argument_list_opt ")" class_body
+ | primary "." "new" <IDENTIFIER>
+ "(" argument_list_opt ")"
+ | primary "." "new" <IDENTIFIER>
+ "(" argument_list_opt ")" class_body
+ ;
+argument_list_opt :
+ | argument_list
+ ;
+argument_list :
+ expression
+ | argument_list "," expression
+ ;
+array_creation_expression :
+ "new" primitive_type dim_exprs dims_opt
+ | "new" class_or_interface_type dim_exprs dims_opt
+ | "new" primitive_type dims array_initializer
+ | "new" class_or_interface_type dims array_initializer
+ ;
+dim_exprs : dim_expr
+ | dim_exprs dim_expr
+ ;
+dim_expr : "[" expression "]"
+ ;
+dims_opt :
+ | dims
+ ;
+dims : "[" "]"
+ | dims "[" "]"
+ ;
+field_access :
+ primary "." <IDENTIFIER>
+ | "super" "." <IDENTIFIER>
+ | name "." "super" "." <IDENTIFIER>
+ ;
+method_invocation :
+ name "(" argument_list_opt ")"
+ | primary "." <IDENTIFIER> "(" argument_list_opt ")"
+ | "super" "." <IDENTIFIER> "(" argument_list_opt ")"
+ | name "." "super" "." <IDENTIFIER> "(" argument_list_opt ")"
+ ;
+array_access :
+ name "[" expression "]"
+ | primary_no_new_array "[" expression "]"
+ ;
+postfix_expression :
+ primary
+ | name
+ | postincrement_expression
+ | postdecrement_expression
+ ;
+postincrement_expression :
+ postfix_expression "++"
+ ;
+postdecrement_expression :
+ postfix_expression "--"
+ ;
+unary_expression :
+ preincrement_expression
+ | predecrement_expression
+ | "+" unary_expression
+ | "-" unary_expression
+ | unary_expression_not_plus_minus
+ ;
+preincrement_expression :
+ "++" unary_expression
+ ;
+predecrement_expression :
+ "--" unary_expression
+ ;
+unary_expression_not_plus_minus :
+ postfix_expression
+ | "~" unary_expression
+ | "!" unary_expression
+ | cast_expression
+ ;
+cast_expression :
+ "(" primitive_type dims_opt ")" unary_expression
+ | "(" expression ")" unary_expression_not_plus_minus
+ | "(" name dims ")" unary_expression_not_plus_minus
+ ;
+multiplicative_expression :
+ unary_expression
+ | multiplicative_expression "*" unary_expression
+ | multiplicative_expression "/" unary_expression
+ | multiplicative_expression "%" unary_expression
+ ;
+additive_expression :
+ multiplicative_expression
+ | additive_expression "+" multiplicative_expression
+ | additive_expression "-" multiplicative_expression
+ ;
+shift_expression :
+ additive_expression
+ | shift_expression "<<" additive_expression
+ | shift_expression ">>" additive_expression
+ | shift_expression ">>>" additive_expression
+ ;
+relational_expression :
+ shift_expression
+ | relational_expression <LT> shift_expression
+ | relational_expression <GT> shift_expression
+ | relational_expression "<=" shift_expression
+ | relational_expression ">=" shift_expression
+ | relational_expression "instanceof" reference_type
+ ;
+equality_expression :
+ relational_expression
+ | equality_expression "==" relational_expression
+ | equality_expression "!=" relational_expression
+ ;
+and_expression :
+ equality_expression
+ | and_expression "&" equality_expression
+ ;
+exclusive_or_expression :
+ and_expression
+ | exclusive_or_expression "^" and_expression
+ ;
+inclusive_or_expression :
+ exclusive_or_expression
+ | inclusive_or_expression "|" exclusive_or_expression
+ ;
+conditional_and_expression :
+ inclusive_or_expression
+ | conditional_and_expression "&&" inclusive_or_expression
+ ;
+conditional_or_expression :
+ conditional_and_expression
+ | conditional_or_expression "||" conditional_and_expression
+ ;
+conditional_expression :
+ conditional_or_expression
+ | conditional_or_expression "?" expression
+ ":" conditional_expression
+ ;
+assignment_expression :
+ conditional_expression
+ | assignment
+ ;
+assignment : left_hand_side assignment_operator assignment_expression
+ ;
+left_hand_side :
+ name
+ | field_access
+ | array_access
+ ;
+assignment_operator :
+ "="
+ | "*="
+ | "/="
+ | "%="
+ | "+="
+ | "-="
+ | "<<="
+ | ">>="
+ | ">>>="
+ | "&="
+ | "^="
+ | "|="
+ ;
+expression_opt :
+ | expression
+ ;
+expression : assignment_expression
+ ;
+constant_expression :
+ expression
+ ;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/smacc/scanner.txt Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,27 @@
+<DECIMAL_INTEGER>: 0 | [1-9] [0-9]* ;
+<HEX_INTEGER>: 0[xX][0-9a-fA-F]+ ;
+<OCTAL_INTEGER>: 0[0-7]+ ;
+
+<EXPONENT>: [eE] [\-\+]? [0-9]+ ;
+<FLOAT_TYPE>: [fFdD] ;
+
+<ESCAPE_SEQUENCE>: \\ ([btnfr\"\'\\] | ([0-3] [0-7]{0,2} | [4-7][0-7]?)) ;
+
+<INTEGER_LITERAL>: (<DECIMAL_INTEGER> | <HEX_INTEGER> | <OCTAL_INTEGER>) [lL]? ;
+<FLOATING_POINT_LITERAL>: [0-9]+ \. [0-9]* <EXPONENT>? <FLOAT_TYPE>? | \. [0-9]+ <EXPONENT>? <FLOAT_TYPE>? | [0-9]+ <EXPONENT> <FLOAT_TYPE>? | [0-9]+ <FLOAT_TYPE> ;
+<BOOLEAN_LITERAL>: true | false ;
+<CHARACTER_LITERAL>: \' ([^\\\'] | <ESCAPE_SEQUENCE> ) \' ;
+<STRING_LITERAL>: \" ([^\\\"] | <ESCAPE_SEQUENCE> )* \" ;
+<NULL_LITERAL>: null ;
+
+<IDENTIFIER>: [a-zA-Z_] \w* ;
+
+<GT>: \> ;
+<LT>: \< ;
+
+
+<eol>: \r | \n | \r\n ;
+<whitespace>: \s+ ;
+<JAVADOC>: \/\*\*;
+<comment>: \/\/ [^\r\n]* <eol> ;
+<comment2>: \/\* ;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/JavaStartup.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,79 @@
+"{ Package: 'stx:libjava/startup' }"
+
+StandaloneStartup subclass:#JavaStartup
+ instanceVariableNames:''
+ classVariableNames:'ClassPath'
+ poolDictionaries:''
+ category:'Languages-Java-Support'
+!
+
+
+!JavaStartup class methodsFor:'constants & defaults'!
+
+applicationRegistryPath
+ "the key under which this application stores its process ID in the registry
+ as a collection of path-components.
+ i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
+ in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
+ (would also be used as a relative path for a temporary lock file under unix).
+ Used to detect if another instance of this application is already running."
+
+ ^ #('stx' 'java_x')
+
+ "Created: / 07-02-2011 / 10:55:08 / Marcel Hlopko <hlopik@gmail.com>"
+!
+
+applicationUUID
+ "answer an application-specific unique uuid.
+ This is used as the name of some exclusive OS-resource, which is used to find out,
+ if another instance of this application is already running.
+ Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used."
+
+ ^ 'ST_X_JAVA_X'.
+
+ "Created: / 07-02-2011 / 10:52:50 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaStartup class methodsFor:'startup'!
+
+main:argv
+ "Currently only -c option for classpath setting working"
+
+ |class arguments classAndArguments classpath classpathFromEnv|
+
+ classpath := OrderedCollection new.
+ classpathFromEnv := OperatingSystem getEnvironment:#CLASSPATH.
+ classpathFromEnv isNil ifFalse:[
+ (classpathFromEnv asArrayOfSubstringsSeparatedBy:$:) do:[:each |
+ classpath add:each
+ ]
+ ].
+ classAndArguments := OrderedCollection new.
+ (GetOpt new)
+ at:$c
+ put:[:opt :arg | (arg asArrayOfSubstringsSeparatedBy:$:) do: [:each | classpath add: each]];
+ at:$? put:[:arg | self error:'not yet implemented'];
+ default:[:arg | classAndArguments add:arg];
+ parse:argv.
+ class := classAndArguments at:1.
+ arguments := classAndArguments
+ removeFirst;
+ yourself.
+ Java flushAllJavaResources.
+ self breakPoint:#mh.
+ Java initialize.
+ JavaVM initializeVM.
+ classpath do:[:each |
+ Java addToClassPath:each
+ ].
+ (Java classForName:class) main:arguments asArray.
+
+ "Created: / 07-02-2011 / 10:55:41 / Marcel Hlopko <hlopik@gmail.com>"
+ "Modified: / 08-02-2011 / 00:55:42 / Marcel Hlopko <hlopik@gmail.com>"
+! !
+
+!JavaStartup class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/Make.spec Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,64 @@
+# $Header: /cvs/stx/stx/libjava/startup/Make.spec,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_startup.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file contains specifications which are common to all platforms.
+#
+
+# Do NOT CHANGE THESE DEFINITIONS
+# (otherwise, ST/X will have a hard time to find out the packages location from its packageID,
+# to find the source code of a class and to find the library for a package)
+MODULE=stx
+MODULE_DIR=libjava/startup
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -H. : create header files locally
+# (if removed, they will be created as common
+# -Pxxx : defines the package
+# -Zxxx : a prefix for variables within the classLib
+# -Dxxx : defines passed to to CC for inline C-code
+# -Ixxx : include path passed to CC for inline C-code
+# +optspace : optimized for space
+# +optspace2 : optimized more for space
+# +optspace3 : optimized even more for space
+# +optinline : generate inline code for some ST constructs
+# +inlineNew : additionally inline new
+# +inlineMath : additionally inline some floatPnt math stuff
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+
+# Argument(s) to the stc compiler (stc --usage).
+# -warn : no warnings
+# -warnNonStandard : no warnings about ST/X extensions
+# -warnEOLComments : no warnings about EOL comment extension
+# -warnPrivacy : no warnings about privateClass extension
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=-warnNonStandard
+
+COMMON_CLASSES= \
+ JavaStartup \
+ stx_libjava_startup \
+
+
+
+
+COMMON_OBJS= \
+ $(OUTDIR)JavaStartup.$(O) \
+ $(OUTDIR)stx_libjava_startup.$(O) \
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/Makefile Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,19 @@
+#
+# DO NOT EDIT
+#
+# make uses this file (Makefile) only, if there is no
+# file named "makefile" (lower-case m) in the same directory.
+# My only task is to generate the real makefile and call make again.
+# Thereafter, I am no longer used and needed.
+#
+
+.PHONY: run
+
+run: makefile
+ $(MAKE) -f makefile
+
+#only needed for the definition of $(TOP)
+include Make.proto
+
+makefile:
+ $(TOP)/rules/stmkmf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/abbrev.stc Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,2 @@
+JavaStartup JavaStartup stx:libjava/startup 'Languages-Java-Support' 1
+stx_libjava_startup stx_libjava_startup stx:libjava/startup '* Projects & Packages *' 4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/bc.mak Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,482 @@
+# $Header: /cvs/stx/stx/libjava/startup/bc.mak,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_startup.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+
+TOP=..\..
+INCLUDE_TOP=$(TOP)\..
+
+# CFLAGS1= -WD -w-pro -w-ccc -w-rch -w-aus -w-par -x- -r- -k -y -v -vi- -c -tWDR
+CFLAGS1= -w-pro -w-ccc -w-rch -w-aus -w-par -x- -r- -k -y -v -vi- -c
+
+CFLAGS_CONSOLE=-tWC -tWR -D_NO_VCL;WIN32
+CFLAGS_NOCONSOLE=-tWR -D_NO_VCL;WIN32GUI;WIN32
+LFLAGS_CONSOLE=-ap
+LFLAGS_NOCONSOLE=-aa
+CRT_STARTUP_CONSOLE=c0x32.obj
+CRT_STARTUP_NOCONSOLE=c0w32.obj
+
+CFLAGS_LOCAL=$(CFLAGS_APPTYPE) \
+ -DSTARTUP_CLASS="\"JavaStartup\"" \
+ -DSTARTUP_SELECTOR="\"start\"" \
+ -DUSE_MODULE_TABLE
+
+#
+
+!INCLUDE $(TOP)\rules\stdHeader_bc
+!INCLUDE Make.spec
+
+OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
+
+
+
+#
+LIBNAME=dummy
+STCOPT="+optinline"
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libjava -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libcomp
+LOCALDEFINES=
+GLOBALDEFINES=
+
+STCLOCALOPT='-package=$(PACKAGE)' $(LOCALDEFINES) $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) $(COMMONSYMFLAG) -varPrefix=$(LIBNAME)
+
+LINKER = ilink32
+
+# LFLAGS = -L$(TOP)\libbc;$(BCB)\lib;$(DEBUGLIBPATH) -H:0x400000 -Hc:0x100000 -S:0x40000 -Sc:0x10000 -ap -Tpe -x -Gn -v -Ao:0x10000
+LFLAGS = -L$(TOP)\libbc;$(BCB)\lib -S:0x40000 -Sc:0x10000 $(LFLAGS_APPTYPE) -Tpe -x -Gn -v -Ao:0x10000
+
+PROJECT_NOCONSOLE = startup.exe
+PROJECT_CONSOLE = startup.com
+ALLOBJFILES = main.obj
+RESFILES = startupWinRC.res
+ALLOBJ = $(CRT_STARTUP) $(ALLOBJFILES) $(OBJS)
+DEFFILE=$(TOP)\rules\bc_exe.def
+
+LIBFILES=$(TOP)\libbc\librun.lib
+ALLLIB=$(LIBFILES) import32.lib $(RT_LIB)
+
+REQUIRED_LIBS=librun.dll \
+ libstx_libbasic.dll \
+ libstx_goodies_refactoryBrowser_helpers.dll \
+ libstx_goodies_refactoryBrowser_parser.dll \
+ libstx_libbasic2.dll \
+ libstx_libcomp.dll \
+ libstx_libview.dll \
+ libstx_libbasic3.dll \
+ libstx_libview2.dll \
+ libstx_libboss.dll \
+ libstx_goodies_refactoryBrowser_changes.dll \
+ libstx_goodies_sunit.dll \
+ libstx_libui.dll \
+ libsqueak_petitparser.dll \
+ libstx_libwidg.dll \
+ libstx_libhtml.dll \
+ libstx_libwidg2.dll \
+ libstx_goodies_smaCC.dll \
+ libstx_libtool.dll \
+ libstx_libjava.dll \
+
+
+REQUIRED_FILES=cs3245.dll X11.dll Xext.dll symbols.stc $(REQUIRED_LIBS)
+
+REQUIRED_SUPPORT_DIRS=RESOURCEFILES
+
+target: ALL postBuildCleanup
+
+# the executable, all required files and a self-installing-installer-exe
+ALL:: prereq exe postBuildCleanup setup
+
+exe: newBuildDate consoleApp $(REQUIRED_SUPPORT_DIRS)
+
+# the executable only
+# with console
+consoleApp:
+ -del main.obj
+ $(MAKE) -N -f bc.mak \
+ MAKE_BAT=$(MAKE_BAT) \
+ PROJECT=$(PROJECT_CONSOLE) \
+ CFLAGS_APPTYPE="$(CFLAGS_CONSOLE)" \
+ LFLAGS_APPTYPE="$(LFLAGS_CONSOLE)" \
+ CRT_STARTUP="$(CRT_STARTUP_CONSOLE)" theExe
+
+# without console
+noConsoleApp:
+ -del main.obj
+ $(MAKE) -N -f bc.mak \
+ MAKE_BAT=$(MAKE_BAT) \
+ PROJECT=$(PROJECT_NOCONSOLE) \
+ CFLAGS_APPTYPE="$(CFLAGS_NOCONSOLE) -DWIN_LOGFILE="\\"\"startup.log\\"\""" \
+ LFLAGS_APPTYPE="$(LFLAGS_NOCONSOLE)" \
+ CRT_STARTUP="$(CRT_STARTUP_NOCONSOLE)" theExe
+
+# the executable only (internal target; needs some defines)
+theExe: $(OUTDIR) $(OBJS) $(REQUIRED_FILES) show $(PROJECT)
+
+# build all prerequisite packages for this package
+prereq:
+ pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\refactoryBrowser\helpers & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libboss & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\refactoryBrowser\changes & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\..\squeak\petitparser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\goodies\smaCC & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\librun & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+
+
+# a nullsoft installable delivery
+setup: install_startup.exe
+
+newBuildDate:
+ del buildDate.h
+
+# This uses the Nullsoft Installer Package and works in Windows only
+
+install_startup.exe: $(PROJECT) postBuildCleanup startup.nsi
+ $(MAKENSIS) startup.nsi
+
+new:
+ $(MAKE_BAT) clean
+ $(MAKE_BAT)
+
+RESOURCEFILES: startup_RESOURCES startup_BITMAPS \
+ stx_RESOURCES stx_STYLES stx_BITMAPS
+
+
+startup_RESOURCES: resources\stx\libjava\startup\NUL
+ -copy ..\resources\*.rs resources\stx\libjava\startup\..
+ -copy ..\resources\*.style resources\stx\libjava\startup\..
+
+startup_BITMAPS: resources\stx\libjava\startup\bitmaps\NUL
+ -copy *.ico resources\stx\libjava\startup\bitmaps
+ -copy *.gif resources\stx\libjava\startup\bitmaps
+
+resources\stx\libjava\startup\bitmaps\NUL: resources\stx\libjava\startup\NUL
+ mkdir resources\stx\libjava\startup\bitmaps
+
+resources\stx\libjava\startup\NUL: resources\stx\libjava\NUL
+ mkdir resources\stx\libjava\startup
+
+resources\stx\libjava\NUL: resources\stx\NUL
+ mkdir resources\stx\libjava
+
+
+
+stx_RESOURCES: \
+ keyboard.rc \
+ keyboardMacros.rc \
+ host.rc \
+ h_win32.rc \
+ display.rc \
+ d_win32.rc \
+ libbasic_RESOURCES \
+ libview_RESOURCES \
+ libtool_RESOURCES \
+ libtool2_RESOURCES
+
+keyboard.rc: $(TOP)\projects\smalltalk\keyboard.rc
+ copy $(TOP)\projects\smalltalk\keyboard.rc *.*
+
+keyboardMacros.rc: $(TOP)\projects\smalltalk\keyboardMacros.rc
+ copy $(TOP)\projects\smalltalk\keyboardMacros.rc *.*
+
+host.rc: $(TOP)\projects\smalltalk\host.rc
+ copy $(TOP)\projects\smalltalk\host.rc *.*
+
+h_win32.rc: $(TOP)\projects\smalltalk\h_win32.rc
+ copy $(TOP)\projects\smalltalk\h_win32.rc *.*
+
+display.rc: $(TOP)\projects\smalltalk\display.rc
+ copy $(TOP)\projects\smalltalk\display.rc *.*
+
+d_win32.rc: $(TOP)\projects\smalltalk\d_win32.rc
+ copy $(TOP)\projects\smalltalk\d_win32.rc *.*
+
+stx_STYLES: resources\stx\libview\NUL resources\stx\libview\styles\NUL
+ -copy $(TOP)\libview\styles\*.style resources\stx\libview\styles\*.*
+ -copy $(TOP)\libview\styles\*.common resources\stx\libview\styles\*.*
+
+stx_BITMAPS: \
+ libwidg_BITMAPS
+
+libwidg_BITMAPS: resources\stx\libwidg\bitmaps\NUL
+ -copy $(TOP)\libwidg\bitmaps\*.xpm resources\stx\libwidg\bitmaps\*.*
+
+libbasic_RESOURCES: resources\stx\libbasic\NUL
+ copy $(TOP)\libbasic\resources\*.rs resources\stx\libbasic\*.*
+
+libtool_RESOURCES: resources\stx\libtool\NUL
+ -copy $(TOP)\libtool\resources\*.rs resources\stx\libtool\*.*
+
+libtool2_RESOURCES: resources\stx\libtool2\NUL
+ -copy $(TOP)\libtool2\resources\*.rs resources\stx\libtool2\*.*
+
+libview_RESOURCES: resources\stx\libview\NUL
+ -copy $(TOP)\libview\resources\*.rs resources\stx\libview\*.*
+
+libview2_RESOURCES: resources\stx\libview2\NUL
+ -copy $(TOP)\libview2\resources\*.rs resources\stx\libview2\*.*
+
+resources\stx\libbasic\NUL: resources\stx\NUL
+ mkdir resources\stx\libbasic
+
+resources\stx\libtool\NUL: resources\stx\NUL
+ mkdir resources\stx\libtool
+
+resources\stx\libtool2\NUL: resources\stx\NUL
+ mkdir resources\stx\libtool2
+
+resources\stx\libview\NUL: resources\stx\NUL
+ mkdir resources\stx\libview
+
+resources\stx\libview\styles\NUL: resources\stx\libview\NUL
+ mkdir resources\stx\libview\styles
+
+resources\stx\libview2\NUL: resources\stx\NUL
+ mkdir resources\stx\libview2
+
+resources\stx\libwidg\bitmaps\NUL: resources\stx\libwidg\NUL
+ mkdir resources\stx\libwidg\bitmaps
+
+resources\stx\libwidg\NUL: resources\stx\NUL
+ mkdir resources\stx\libwidg
+
+resources\stx\NUL: resources\NUL
+ mkdir resources\stx
+
+resources\NUL:
+ mkdir resources
+
+bitmaps\NUL:
+ mkdir bitmaps
+
+doc\NUL:
+ mkdir doc
+
+
+
+
+
+
+libstx_libbasic.dll: ..\..\libbasic\$(OBJDIR)\libstx_libbasic.dll
+ copy ..\..\libbasic\$(OBJDIR)\libstx_libbasic.dll *.*
+
+..\..\libbasic\$(OBJDIR)\libstx_libbasic.dll:
+ pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_goodies_refactoryBrowser_helpers.dll: ..\..\goodies\refactoryBrowser\helpers\$(OBJDIR)\libstx_goodies_refactoryBrowser_helpers.dll
+ copy ..\..\goodies\refactoryBrowser\helpers\$(OBJDIR)\libstx_goodies_refactoryBrowser_helpers.dll *.*
+
+..\..\goodies\refactoryBrowser\helpers\$(OBJDIR)\libstx_goodies_refactoryBrowser_helpers.dll:
+ pushd ..\..\goodies\refactoryBrowser\helpers & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_goodies_refactoryBrowser_parser.dll: ..\..\goodies\refactoryBrowser\parser\$(OBJDIR)\libstx_goodies_refactoryBrowser_parser.dll
+ copy ..\..\goodies\refactoryBrowser\parser\$(OBJDIR)\libstx_goodies_refactoryBrowser_parser.dll *.*
+
+..\..\goodies\refactoryBrowser\parser\$(OBJDIR)\libstx_goodies_refactoryBrowser_parser.dll:
+ pushd ..\..\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libbasic2.dll: ..\..\libbasic2\$(OBJDIR)\libstx_libbasic2.dll
+ copy ..\..\libbasic2\$(OBJDIR)\libstx_libbasic2.dll *.*
+
+..\..\libbasic2\$(OBJDIR)\libstx_libbasic2.dll:
+ pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libcomp.dll: ..\..\libcomp\$(OBJDIR)\libstx_libcomp.dll
+ copy ..\..\libcomp\$(OBJDIR)\libstx_libcomp.dll *.*
+
+..\..\libcomp\$(OBJDIR)\libstx_libcomp.dll:
+ pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libview.dll: ..\..\libview\$(OBJDIR)\libstx_libview.dll
+ copy ..\..\libview\$(OBJDIR)\libstx_libview.dll *.*
+
+..\..\libview\$(OBJDIR)\libstx_libview.dll:
+ pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libbasic3.dll: ..\..\libbasic3\$(OBJDIR)\libstx_libbasic3.dll
+ copy ..\..\libbasic3\$(OBJDIR)\libstx_libbasic3.dll *.*
+
+..\..\libbasic3\$(OBJDIR)\libstx_libbasic3.dll:
+ pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libview2.dll: ..\..\libview2\$(OBJDIR)\libstx_libview2.dll
+ copy ..\..\libview2\$(OBJDIR)\libstx_libview2.dll *.*
+
+..\..\libview2\$(OBJDIR)\libstx_libview2.dll:
+ pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libboss.dll: ..\..\libboss\$(OBJDIR)\libstx_libboss.dll
+ copy ..\..\libboss\$(OBJDIR)\libstx_libboss.dll *.*
+
+..\..\libboss\$(OBJDIR)\libstx_libboss.dll:
+ pushd ..\..\libboss & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_goodies_refactoryBrowser_changes.dll: ..\..\goodies\refactoryBrowser\changes\$(OBJDIR)\libstx_goodies_refactoryBrowser_changes.dll
+ copy ..\..\goodies\refactoryBrowser\changes\$(OBJDIR)\libstx_goodies_refactoryBrowser_changes.dll *.*
+
+..\..\goodies\refactoryBrowser\changes\$(OBJDIR)\libstx_goodies_refactoryBrowser_changes.dll:
+ pushd ..\..\goodies\refactoryBrowser\changes & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_goodies_sunit.dll: ..\..\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll
+ copy ..\..\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll *.*
+
+..\..\goodies\sunit\$(OBJDIR)\libstx_goodies_sunit.dll:
+ pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libui.dll: ..\..\libui\$(OBJDIR)\libstx_libui.dll
+ copy ..\..\libui\$(OBJDIR)\libstx_libui.dll *.*
+
+..\..\libui\$(OBJDIR)\libstx_libui.dll:
+ pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libsqueak_petitparser.dll: ..\..\..\squeak\petitparser\$(OBJDIR)\libsqueak_petitparser.dll
+ copy ..\..\..\squeak\petitparser\$(OBJDIR)\libsqueak_petitparser.dll *.*
+
+..\..\..\squeak\petitparser\$(OBJDIR)\libsqueak_petitparser.dll:
+ pushd ..\..\..\squeak\petitparser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libwidg.dll: ..\..\libwidg\$(OBJDIR)\libstx_libwidg.dll
+ copy ..\..\libwidg\$(OBJDIR)\libstx_libwidg.dll *.*
+
+..\..\libwidg\$(OBJDIR)\libstx_libwidg.dll:
+ pushd ..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libhtml.dll: ..\..\libhtml\$(OBJDIR)\libstx_libhtml.dll
+ copy ..\..\libhtml\$(OBJDIR)\libstx_libhtml.dll *.*
+
+..\..\libhtml\$(OBJDIR)\libstx_libhtml.dll:
+ pushd ..\..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libwidg2.dll: ..\..\libwidg2\$(OBJDIR)\libstx_libwidg2.dll
+ copy ..\..\libwidg2\$(OBJDIR)\libstx_libwidg2.dll *.*
+
+..\..\libwidg2\$(OBJDIR)\libstx_libwidg2.dll:
+ pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_goodies_smaCC.dll: ..\..\goodies\smaCC\$(OBJDIR)\libstx_goodies_smaCC.dll
+ copy ..\..\goodies\smaCC\$(OBJDIR)\libstx_goodies_smaCC.dll *.*
+
+..\..\goodies\smaCC\$(OBJDIR)\libstx_goodies_smaCC.dll:
+ pushd ..\..\goodies\smaCC & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libtool.dll: ..\..\libtool\$(OBJDIR)\libstx_libtool.dll
+ copy ..\..\libtool\$(OBJDIR)\libstx_libtool.dll *.*
+
+..\..\libtool\$(OBJDIR)\libstx_libtool.dll:
+ pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+libstx_libjava.dll: ..\$(OBJDIR)\libstx_libjava.dll
+ copy ..\$(OBJDIR)\libstx_libjava.dll *.*
+
+..\$(OBJDIR)\libstx_libjava.dll:
+ pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+
+
+
+
+sources\NUL:
+ mkdir sources
+
+show:
+ @echo LFLAGS= $(LFLAGS)
+ @echo ALLOBJ= $(ALLOBJ)
+ @echo PROJECT= $(PROJECT)
+ @echo ALLLIB= $(ALLLIB)
+ @echo DEFFILE= $(DEFFILE)
+ @echo ALLRES= $(ALLRES)
+
+$(PROJECT_CONSOLE): $(ALLOBJFILES) $(OBJS) $(RESFILES) $(DEFFILE)
+ $(BCB)\BIN\$(LINKER) $(LFLAGS) $(ALLOBJ), $(PROJECT_CONSOLE),, $(ALLLIB), $(DEFFILE), $(RESFILES)
+
+$(PROJECT_NOCONSOLE): $(ALLOBJFILES) $(OBJS) $(RESFILES) $(DEFFILE)
+ $(BCB)\BIN\$(LINKER) $(LFLAGS) $(ALLOBJ), $(PROJECT_NOCONSOLE),, $(ALLLIB), $(DEFFILE), $(RESFILES)
+
+#$(PROJECT): $(ALLOBJFILES) $(RESFILES) $(DEFFILE)
+# $(BCB)\BIN\$(LINKER) @&&!
+# $(LFLAGS) +
+# $(ALLOBJ), +
+# $(PROJECT),, +
+# $(ALLLIB), +
+# $(DEFFILE), +
+# $(RESFILES)
+#!
+
+
+!INCLUDE $(TOP)\rules\stdRules_bc
+
+#
+# additional rules
+#
+startupWin.res: startupWin.rc startup.ico
+
+main.obj: buildDate.h main.c bc.mak
+
+main.c: $(TOP)\librun\main.c
+ copy $(TOP)\librun\main.c main.c
+
+buildDate.h: $(TOP)\librun\genDate.exe
+ $(TOP)\librun\genDate.exe
+
+librun.dll: $(TOP)\librun\librun.dll
+ copy $(TOP)\librun\librun.dll librun.dll
+
+cs3245.dll: $(TOP)\support\win32\borland\cs3245.dll
+ copy $(TOP)\support\win32\borland\cs3245.dll cs3245.dll
+
+X11.dll: $(TOP)\support\win32\X11.dll
+ copy $(TOP)\support\win32\X11.dll X11.dll
+
+Xext.dll: $(TOP)\support\win32\Xext.dll
+ copy $(TOP)\support\win32\Xext.dll Xext.dll
+
+symbols.stc: $(TOP)\include\symbols.stc
+ copy $(TOP)\include\symbols.stc symbols.stc
+
+
+
+
+clean::
+ -del genDate.exe
+ -del c0x32.dll
+ -del c0x32.lib
+ -del buildDate.h
+ -del $(PROJECT)
+ -del install_startup.exe
+ -del stx.lib
+ -del stx.dll
+ -del cs3245.dll
+ -del $(REQUIRED_FILES)
+ -del main.c
+ -del *.log
+ -del *.res
+ -rmdir /S /Q resources
+ -rmdir /S /Q objbc
+
+clobber:: clean
+ -del *.dll *.exe *.com
+
+# stupid win-make does not allow empty - therefore delete something which is not there...
+postBuildCleanup::
+ -del xxxxx.xxxxx
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+$(OUTDIR)JavaStartup.$(O) JavaStartup.$(H): JavaStartup.st $(INCLUDE_TOP)\stx\libbasic\StandaloneStartup.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)stx_libjava_startup.$(O) stx_libjava_startup.$(H): stx_libjava_startup.st $(INCLUDE_TOP)\stx\libbasic\ApplicationDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+
+# ENDMAKEDEPEND --- do not remove this line
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/bmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using borland bcc
+@REM type bmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/lcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using lcc compiler
+@REM type lcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak USELCC=1 %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/modules.c Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,22 @@
+/* $Header: /cvs/stx/stx/libjava/startup/modules.c,v 1.1 2011/08/18 19:06:54 vrany Exp $
+ *
+ * DO NOT EDIT
+ * automagically generated from the projectDefinition: stx_libjava_startup.
+ *
+ * Warning: once you modify this file, do not rerun
+ * stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+ */
+typedef void (*vf)();
+
+extern void _JavaStartup_Init();
+extern void _stx_137libjava_137startup_Init();
+
+
+static vf modules[] = {
+ _JavaStartup_Init,
+_stx_137libjava_137startup_Init,
+
+ (vf)0
+};
+
+vf *__modules__ = modules;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/modules.stx Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,38 @@
+# $Header: /cvs/stx/stx/libjava/startup/modules.stx,v 1.1 2011/08/18 19:06:54 vrany Exp $
+#
+# DO NOT EDIT
+# automagically generated from the projectDefinition: stx_libjava_startup.
+#
+# Warning: once you modify this file, do not rerun
+# stmkmp or projectDefinition-build again - otherwise, your changes are lost.
+#
+# This file is (currently) only used with win-95 / win-NT versions of STX.
+# It lists the dll's which are to be loaded at startup time.
+# Notice, lines starting with a "#" are comments.
+# Lines starting with a "*" are treated as comments by the VM, but are usually loaded
+# by the application at the very beginning.
+#
+# All classes loaded at startup time will be present as precompiled classes.
+# Others might be autoloaded.
+#
+libstx_libbasic
+libstx_goodies_refactoryBrowser_helpers
+libstx_goodies_refactoryBrowser_parser
+libstx_libbasic2
+libstx_libcomp
+libstx_libview
+libstx_libbasic3
+libstx_libview2
+libstx_libboss
+libstx_goodies_refactoryBrowser_changes
+libstx_goodies_sunit
+libstx_libui
+libsqueak_petitparser
+libstx_libwidg
+libstx_libhtml
+libstx_libwidg2
+libstx_goodies_smaCC
+libstx_libtool
+libstx_libjava
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/startup.nsi Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,203 @@
+; $Header: /cvs/stx/stx/libjava/startup/startup.nsi,v 1.1 2011/08/18 19:06:54 vrany Exp $
+; Script generated by ProjectDefinition.
+
+!define PRODUCT_NAME "Smalltalk/X JVM"
+!define PRODUCT_FILENAME "Smalltalk_X JVM"
+!define PRODUCT_VERSION "6.1.2.1"
+!define PRODUCT_PUBLISHER "eXept Software AG"
+!define PRODUCT_WEB_SITE "http://www.exept.de"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_FILENAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+!define STX_ROOT "..\..\.."
+
+SetCompressor /solid lzma
+
+!include "MUI2.nsh"
+
+; MUI Settings
+
+!define MUI_WELCOMEPAGE_TITLE_3LINES
+!define MUI_ABORTWARNING
+!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
+;; !define MUI_ICON "nil.ico"
+!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
+;; !define MUI_UNICON "nil.ico"
+
+; Language Selection Dialog Settings
+!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
+!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
+!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+; !define MUI_LICENSEPAGE_CHECKBOX
+
+
+!insertmacro MUI_PAGE_COMPONENTS
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+!insertmacro MUI_LANGUAGE "German"
+
+; MUI end ------
+
+
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+VIProductVersion "${PRODUCT_VERSION}.0"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_NAME}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${PRODUCT_PUBLISHER}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "6.1.0.1"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_NAME} Installer"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${PRODUCT_VERSION}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright 2010-2011 Jan Vrany, Jan Kurs, Marcel Hlopko\nCopyright 1988-2011Claus Gittinger \nCopyright 1998-2011 eXept Software AG"
+
+
+OutFile "Smalltalk_X JVMSetup.exe"
+InstallDir "$PROGRAMFILES\stx"
+ShowInstDetails show
+ShowUnInstDetails show
+
+Function .onInit
+ !insertmacro MUI_LANGDLL_DISPLAY
+FunctionEnd
+
+InstType Full
+InstType Partial
+
+Section "Programme" Section1
+ SectionIn 1 2
+ SetOutPath "$INSTDIR\bin"
+ SetOverwrite ifnewer
+ File "startup.com"
+ File "*.dll"
+ File "symbols.stc"
+ File "*.stx"
+ File "*.rc"
+ File /r "resources"
+
+
+
+
+ WriteRegStr HKCR "Stx.Smalltalk_X JVM.1" "" "Smalltalk_X JVM File"
+ WriteRegStr HKCR "Stx.Smalltalk_X JVM.1\DefaultIcon" "" '$INSTDIR\bin\startup.exe,0'
+ WriteRegStr HKCR "Stx.Smalltalk_X JVM.1\Shell\open" "" $(appOpen)
+ WriteRegStr HKCR "Stx.Smalltalk_X JVM.1\Shell\open\command" "" '"$INSTDIR\bin\startup.exe" -- "%1"'
+SectionEnd
+
+;; Section "Online-Documentation for Smalltalk/X JVM" Section2
+;; SectionIn 1
+;; SetOutPath "$INSTDIR\doc"
+;; SetOverwrite ifnewer
+;; File /r /x CVS "${STX_ROOT}\stx\startup\doc\*"
+;; SectionEnd
+
+;; Section "Smalltalk/X JVM Libraries and Demos" Section3
+;; SectionIn 1
+;; SetOutPath "$INSTDIR\lib"
+;; SetOverwrite ifnewer
+;; ; File /r /x CVS "${STX_ROOT}\stx\startup\examples\*"
+;; SectionEnd
+;;
+;; Section "Smalltalk/X JVM Reports and Printing" Section4
+;; SectionIn 1
+;; SetOutPath "$INSTDIR\reportGenerator"
+;; SetOverwrite ifnewer
+;; ; File /r /x CVS "..\reportGenerator\java" "..\reportGenerator\rules" "..\reportGenerator\*.xml" "..\reportGenerator\*.xslt" "..\reportGenerator\CloseApp.exe" "..\reportGenerator\expecco.jpg"
+;; SectionEnd
+
+
+
+
+
+
+
+
+Section -AdditionalIcons
+ SetOutPath "$INSTDIR\bin"
+ WriteIniStr "$INSTDIR\${PRODUCT_FILENAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
+ CreateDirectory "$SMPROGRAMS\${PRODUCT_FILENAME}"
+ CreateShortCut "$SMPROGRAMS\${PRODUCT_FILENAME}\startup.lnk" "$INSTDIR\bin\startup.exe"
+ CreateShortCut "$DESKTOP\startup.lnk" "$INSTDIR\bin\startup.exe"
+ CreateShortCut "$SMPROGRAMS\${PRODUCT_FILENAME}\Website.lnk" "$INSTDIR\${PRODUCT_FILENAME}.url"
+ CreateShortCut "$SMPROGRAMS\${PRODUCT_FILENAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+SectionEnd
+
+LangString appOpen ${LANG_GERMAN} "Mit Smalltalk/X JVM ffnen"
+LangString appOpen ${LANG_ENGLISH} "Open with Smalltalk/X JVM"
+
+LangString DESC_Section1 ${LANG_ENGLISH} "Program components of Smalltalk/X JVM"
+LangString DESC_Section1 ${LANG_GERMAN} "Alle Programmkomponenten von Smalltalk/X JVM"
+;; LangString DESC_Section2 ${LANG_ENGLISH} "Online-Documentation of Smalltalk/X JVM"
+;; LangString DESC_Section2 ${LANG_GERMAN} "Online-Dokumentation zu Smalltalk/X JVM"
+;; LangString DESC_Section3 ${LANG_ENGLISH} "Libraries and Demo Projects"
+;; LangString DESC_Section3 ${LANG_GERMAN} "Bibliotheken und Beispielprojekte"
+;; LangString DESC_Section4 ${LANG_ENGLISH} "Logfile Printing and Report Generation"
+;; LangString DESC_Section4 ${LANG_GERMAN} "Drucken und Report-Generierung aus Log-Dateien"
+;; LangString DESC_Section3 ${LANG_ENGLISH} "Sources of ST/X (Base-System)"
+;; LangString DESC_Section3 ${LANG_GERMAN} "Quellcode von ST/X (Basis-System)"
+;; LangString DESC_Section4 ${LANG_ENGLISH} "Sources of Smalltalk/X JVM"
+;; LangString DESC_Section4 ${LANG_GERMAN} "Quellcode von Smalltalk/X JVM"
+
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
+;; !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
+;; !insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
+;; !insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "Smalltalk/X JVM wurde erfolgreich deinstalliert"
+FunctionEnd
+
+Function un.onInit
+!insertmacro MUI_UNGETLANGUAGE
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Mchten Sie Smalltalk/X JVM und alle seine Komponenten deinstallieren?" IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ Delete "$INSTDIR\${PRODUCT_FILENAME}.url"
+ Delete "$INSTDIR\uninst.exe"
+
+ Delete "$INSTDIR\*"
+ RMDir /r "$INSTDIR"
+
+ Delete "$SMPROGRAMS\${PRODUCT_FILENAME}\Uninstall.lnk"
+ Delete "$SMPROGRAMS\${PRODUCT_FILENAME}\Website.lnk"
+ Delete "$SMPROGRAMS\${PRODUCT_FILENAME}\startup.lnk"
+ Delete "$DESKTOP\startup.lnk"
+
+ RMDir "$SMPROGRAMS\${PRODUCT_FILENAME}"
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ DeleteRegKey HKCR "Stx.Smalltalk_X JVM.1"
+
+
+ SetAutoClose true
+SectionEnd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/startupWinRC.rc Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,43 @@
+//
+// DO NOT EDIT
+// automagically generated from the projectDefinition: stx_libjava_startup.
+//
+#define IDR_MAINFRAME 128
+#define IDR_SPLASH 129
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 6,1,0,1
+ PRODUCTVERSION 6,1,2,1
+// FILEFLAGSMASK 0x3fL
+ FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
+ FILEFLAGS VS_FF_PRERELEASE | VS_FF_SPECIALBUILD
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VS_USER_DEFINED
+
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "CompanyName", "SWING Research Group & eXept Software AG\0"
+ VALUE "FileDescription", "Smalltalk/X Java Launcher\0"
+ VALUE "FileVersion", "6.1.0.1\0"
+ VALUE "InternalName", "stx:libjava/startup\0"
+ VALUE "LegalCopyright", "Copyright 2010-2011 Jan Vrany, Jan Kurs, Marcel Hlopko\nCopyright 1988-2011Claus Gittinger \nCopyright 1998-2011 eXept Software AG\0"
+ VALUE "ProductName", "Smalltalk/X JVM\0"
+ VALUE "ProductVersion", "6.1.2.1\0"
+ VALUE "ProductDate", "Thu, 07 Apr 2011 18:25:04 GMT\0"
+ END
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN // Language | Translation
+ VALUE "Translation", 0x409, 0x4E4 // U.S. English, Windows Multilingual
+ END
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/stx_libjava_startup.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,146 @@
+"{ Package: 'stx:libjava/startup' }"
+
+ApplicationDefinition subclass:#stx_libjava_startup
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'* Projects & Packages *'
+!
+
+
+!stx_libjava_startup class methodsFor:'description'!
+
+excludedFromPreRequisites
+ "list all packages which should be ignored in the automatic
+ preRequisites scan. See #preRequisites for more."
+
+ ^ #(
+ )
+!
+
+isGUIApplication
+ "return true, if this is a GUI application.
+ (these need more libraries and use a different startup procedure)"
+
+ ^ false
+!
+
+preRequisites
+ "list all required packages.
+ This list can be maintained manually or (better) generated and
+ updated by scanning the superclass hierarchies and looking for
+ global variable accesses. (the browser has a menu function for that)
+ Howevery, often too much is found, and you may want to explicitely
+ exclude individual packages in the #excludedFromPrerequisites method."
+
+ ^ #(
+ #'stx:libbasic' "ApplicationDefinition - superclass of stx_libjava_startup "
+ #'stx:libcomp'
+ #'stx:libjava' "Java - referenced by JavaStartup class>>main: "
+ )
+!
+
+subProjects
+ "list packages which are known as subprojects.
+ This method is generated automatically; however, when generating automatically,
+ packages are only added - never removed, unless listed in #excludedFromSubProjects."
+
+ ^ #(
+)
+! !
+
+!stx_libjava_startup class methodsFor:'description - contents'!
+
+classNamesAndAttributes
+ "lists the classes which are to be included in the project.
+ Each entry in the list may be: a single class-name (symbol),
+ or an array-literal consisting of class name and attributes.
+ Attributes are: #autoload or #<os> where os is one of win32, unix,..."
+
+ ^ #(
+ "<className> or (<className> attributes...) in load order"
+ JavaStartup
+ #'stx_libjava_startup'
+ )
+!
+
+extensionMethodNames
+ "lists the extension methods which are to be included in the project.
+ Entries are 2-element array literals, consisting of class-name and selector."
+
+ ^ #(
+ )
+! !
+
+!stx_libjava_startup class methodsFor:'description - project information'!
+
+applicationIconFileName
+ "Return the name (without suffix) of an icon-file (the app's icon); will be included in the rc-resource file"
+
+ ^ nil
+ "/ ^ self applicationName
+!
+
+companyName
+ "Return a companyname which will appear in <lib>.rc"
+
+ ^ 'SWING Research Group & eXept Software AG'
+
+ "Modified: / 07-04-2011 / 20:22:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+description
+ "Return a description string which will appear in vc.def / bc.def"
+
+ ^ 'Smalltalk/X Java Launcher'
+
+ "Modified: / 07-04-2011 / 20:23:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+legalCopyright
+ "Return a copyright string which will appear in <lib>.rc"
+
+ ^ 'Copyright 2010-2011 Jan Vrany, Jan Kurs, Marcel Hlopko\nCopyright 1988-2011Claus Gittinger \nCopyright 1998-2011 eXept Software AG'
+
+ "Modified: / 07-04-2011 / 20:24:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+productName
+ "Return a product name which will appear in <lib>.rc"
+
+ ^ 'Smalltalk/X JVM'
+
+ "Modified: / 07-04-2011 / 20:24:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!stx_libjava_startup class methodsFor:'description - startup'!
+
+startupClassName
+ "the name of the class which starts the show in its <startupSelector> method.
+ Usually, the name of a subclass of StandAloneStartup."
+
+ ^ 'JavaStartup'
+
+ "Modified: / 07-04-2011 / 20:24:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+startupSelector
+ "the message that is sent to the startupClass to start the show"
+
+ ^ #'start'
+! !
+
+!stx_libjava_startup class methodsFor:'description - svn'!
+
+svnRevisionNr
+ "Return a SVN revision number of myself.
+ This number is updated after a commit"
+
+ ^ "$SVN-Revision:"'nil'"$"
+! !
+
+!stx_libjava_startup class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/startup/vcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using microsoft visual c
+@REM type vcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak -DUSEVC %1 %2
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stx_libjava.st Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,516 @@
+"
+ 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' }"
+
+LibraryDefinition subclass:#stx_libjava
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'* Projects & Packages *'
+!
+
+!stx_libjava 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.
+
+"
+! !
+
+!stx_libjava class methodsFor:'accessing'!
+
+svnRepositoryUrl
+
+ ^'https://jv@swing.fit.cvut.cz/svn/stx/libjava/branches/jk_new_structure/src'
+
+!
+
+svnRepositoryUrlBase
+
+ | url |
+ url := stx_libjava svnRepositoryUrl.
+ url ifNil:[url := 'https://swing.fit.cvut.cz/svn/stx/libjava/trunk/src'].
+ (url endsWith: 'src') ifTrue:[url := url copyTo: url size - 4].
+ ^url
+
+ "Created: / 08-04-2011 / 16:57:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!stx_libjava class methodsFor:'accessing - tests'!
+
+excludedFromTestSuite
+ "List of testcases and/or tests excluded from testsuite.
+ Entries maybe ClassName or #(ClassName testName)
+ "
+ ^ #(
+ LookupTests
+ )
+
+ "Created: / 03-06-2011 / 17:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testSuite
+
+ | suite javaTestCases stTests |
+ suite := super testSuite.
+ stTests := suite tests.
+ suite := TestSuite new.
+ suite name: self package.
+ JavaTestsLoader load.
+
+ javaTestCases := OrderedCollection new.
+
+ Java allClassesDo:
+ [:jclass|
+ (jclass ~~ (Java at:'stx.libjava.tests.JUnit3Tests')
+ and:[jclass ~~ (Java at:'stx.libjava.tests.JUnit4Tests')
+ and:[jclass isTestCaseLike]])
+ ifTrue:
+ [ | tc |
+ tc := jclass asTestCase.
+ (tc askFor:#isTestlet) ifTrue:[
+ tc shouldFork: true.
+ ].
+ tc isAbstract ifFalse:[javaTestCases add:tc ]]].
+
+ javaTestCases do:
+ [:each |
+ suite addTests:each buildSuite tests ].
+
+
+ suite tests addAll: stTests.
+
+ suite tests withIndexDo:
+ [:t :i|
+ Stdout nextPutAll: i printString; space; nextPutAll: t printString; cr].
+
+ ^suite
+
+ "
+ stx_libjava testSuite
+
+ "
+
+ "Created: / 07-05-2011 / 19:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-05-2011 / 22:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-06-2011 / 17:23:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+testSuiteWithoutJavaTests
+
+ ^super testSuite.
+
+ "Created: / 21-06-2011 / 17:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!stx_libjava class methodsFor:'description'!
+
+excludedFromPreRequisites
+ "list all packages which should be ignored in the automatic
+ preRequisites scan. See #preRequisites for more."
+
+ ^ #(
+ )
+!
+
+preRequisites
+ "list all required packages.
+ This list can be maintained manually or (better) generated and
+ updated by scanning the superclass hierarchies and looking for
+ global variable accesses. (the browser has a menu function for that)
+ Howevery, often too much is found, and you may want to explicitely
+ exclude individual packages in the #excludedFromPrerequisites method."
+
+ ^ #(
+ #'squeak:petitparser' "PPParser - superclass of JavaParser::BlockParser "
+ #'stx:goodies/sunit' "TestSuite - referenced by stx_libjava class>>testSuite "
+ #'stx:libbasic' "Object - superclass of JavaMethodWithHandler "
+ #'stx:libbasic2' "ZipArchive - referenced by Java class>>classSource:package:in: "
+ #'stx:libbasic3' "MessageTracer - referenced by JavaMethod>>setBreakPoint "
+ #'stx:libcomp' "ObjectFileLoader - referenced by JavaVM class>>_Runtime_loadFileInternalI: "
+ #'stx:libhtml' "URL - referenced by JavaEmbeddedFrameView>>setupAppletFrameIn:initializeJava: "
+ #'stx:libtool' "DebugView - referenced by Java class>>flushClasses "
+ #'stx:libview' "DisplaySurface - superclass of JavaView "
+ #'stx:libview2' "Plug - referenced by JavaSourceCodeCache>>findMethodLine:inMethods: "
+ #'stx:libwidg' "Label - referenced by JavaVM class>>processEvent: "
+ #'stx:libwidg2' "MenuPanel - referenced by JavaVM class>>processEvent: "
+ )
+! !
+
+!stx_libjava class methodsFor:'description - contents'!
+
+classNamesAndAttributes
+ "lists the classes which are to be included in the project.
+ Each entry in the list may be: a single class-name (symbol),
+ or an array-literal consisting of class name and attributes.
+ Attributes are: #autoload or #<os> where os is one of win32, unix,..."
+
+ ^ #(
+ "<className> or (<className> attributes...) in load order"
+ (AbstractJavaTestCase autoload)
+ Byte
+ (JUnitTestCaseProxy autoload)
+ Java
+ JavaAnnotation
+ JavaAnnotationContainer
+ JavaAnnotationDefault
+ JavaAnnotationDictionary
+ JavaAnnotationValue
+ (JavaAntProjectResource autoload)
+ JavaArray
+ JavaBehavior
+ (JavaByteCodeDisassemblerTests autoload)
+ (JavaByteCodeInterpreterTests autoload)
+ JavaByteCodeProcessor
+ (JavaByteCodeProcessorTests autoload)
+ JavaClassReader
+ (JavaClassReader2Tests autoload)
+ (JavaClassReaderTests autoload)
+ (JavaClassRefTests autoload)
+ JavaConstantPool
+ JavaContext
+ JavaDecompiler
+ JavaDescriptor
+ JavaError
+ JavaExceptionTableEntry
+ (JavaExceptionThrowerMock autoload)
+ JavaField
+ (JavaFieldRefTests autoload)
+ JavaInflater
+ (JavaInitializedResource autoload)
+ (JavaInterfaceMethodRefTests autoload)
+ (JavaJUnitTests autoload)
+ JavaJavadocNode
+ JavaLanguage
+ JavaLibraries
+ (JavaLibrariesResource autoload)
+ JavaLocalVariableTable
+ JavaLocalVariableTableEntry
+ JavaLookup
+ (JavaLookupTestsResource autoload)
+ JavaMethod
+ (JavaMethodRefTests autoload)
+ JavaNameAndType2
+ JavaNativeMemory
+ JavaNode
+ JavaObject
+ JavaObjectDictionary
+ JavaPackage
+ JavaParseResult
+ (JavaParserNavigationTests autoload)
+ (JavaParserTestCase autoload)
+ (JavaParserTests autoload)
+ JavaPopUpView
+ JavaProcess
+ JavaRef2
+ (JavaRefMock autoload)
+ (JavaRefTests autoload)
+ JavaRelease
+ JavaResolver
+ (JavaRuntimeConstantPoolTests autoload)
+ JavaSlotIndexCache
+ JavaSourceCodeCache
+ JavaSourceFileWriter
+ JavaStartup
+ (JavaTestCaseProxy autoload)
+ JavaTestsLoader
+ (JavaTestsResource autoload)
+ JavaTopView
+ (JavaUTF8Tests autoload)
+ JavaUnresolvedConstant
+ JavaVM
+ JavaView
+ (LookupTests autoload)
+ PPJavaNode
+ Short
+ SmalltalkAppletContext
+ SmalltalkAppletStub
+ (TestletTestCaseProxy autoload)
+ #'stx_libjava'
+ JavaAnnotationArrayValue
+ JavaAnnotationClassValue
+ JavaAnnotationEnumValue
+ JavaAnnotationNestedAnnotationValue
+ JavaAnnotationPrimitiveValue
+ JavaByteCodeDisassembler
+ JavaByteCodeEnumerator
+ JavaByteCodeInterpreter
+ JavaClass
+ JavaClassAnnotationContainer
+ JavaClassContentRef2
+ JavaClassRef2
+ JavaEmbeddedFrameView
+ JavaFieldAnnotationContainer
+ JavaFieldDescriptor
+ JavaFormalParameterNode
+ JavaInvalidRefError
+ JavaMethodAnnotationContainer
+ JavaMethodDeclarationNode
+ JavaMethodDeclaratorNode
+ JavaMethodDescriptor
+ JavaMethodNode
+ JavaMethodWithException
+ JavaParser
+ JavaStringRef2
+ JavaTypeNode
+ JavaUnhandledExceptionError
+ JavaUnresolvedClassConstant
+ JavaUnresolvedStringConstant
+ JavadocDeclarationNode
+ JavaArrayTypeNode
+ JavaBooleanTypeNode
+ JavaBothOldAndNewClassRef
+ JavaByteCodeSteppableInterpreter
+ JavaCharTypeNode
+ JavaClassOrInterfaceTypeNode
+ JavaDoubleTypeNode
+ JavaFieldRef2
+ JavaFloatTypeNode
+ JavaIntTypeNode
+ JavaLongTypeNode
+ JavaMethodRef2
+ JavaMethodWithHandler
+ JavaVoidTypeNode
+ JavaInterfaceMethodRef2
+ JavaNativeMethod
+ )
+!
+
+extensionMethodNames
+ "lists the extension methods which are to be included in the project.
+ Entries are 2-element array literals, consisting of class-name and selector."
+
+ ^ #(
+ BooleanArray isInterface
+ Object isJavaArray
+ Object isJavaNameAndType
+ Object isJavaPackage
+ Object isJavaRef
+ String asArrayOfSubstringsSeparatedBy:
+ UserPreferences javaTestsDirectory
+ UserPreferences javaTestsDirectory:
+ ZipArchive nextBytes:of:startingAt:into:startingAt:
+ 'Boolean class' isJavaPrimitiveType
+ 'Boolean class' javaArrayClass
+ 'Boolean class' javaName
+ 'BooleanArray class' isInterface
+ 'BooleanArray class' isJavaArrayClass
+ 'BooleanArray class' isJavaReferenceType
+ 'BooleanArray class' javaComponentClass
+ 'BooleanArray class' javaName
+ 'ByteArray class' isInterface
+ 'ByteArray class' isJavaArrayClass
+ 'ByteArray class' isJavaReferenceType
+ 'ByteArray class' javaArrayClass
+ 'ByteArray class' javaComponentClass
+ 'ByteArray class' javaName
+ 'Character class' isJavaPrimitiveType
+ 'Character class' javaArrayClass
+ 'Character class' javaName
+ 'CharacterArray class' decodeFromJavaUTF8:
+ 'CharacterArray class' fromJavaUTF8Bytes:
+ 'CharacterArray class' isJavaArrayClass
+ 'CharacterArray class' javaArrayClass
+ 'CharacterArray class' javaComponentClass
+ 'DoubleArray class' isInterface
+ 'DoubleArray class' isJavaArrayClass
+ 'DoubleArray class' isJavaReferenceType
+ 'DoubleArray class' javaComponentClass
+ 'DoubleArray class' javaName
+ 'Float class' isJavaPrimitiveType
+ 'Float class' javaArrayClass
+ 'Float class' javaName
+ 'FloatArray class' isInterface
+ 'FloatArray class' isJavaArrayClass
+ 'FloatArray class' isJavaReferenceType
+ 'FloatArray class' javaComponentClass
+ 'FloatArray class' javaName
+ 'GenericToolbarIconLibrary class' javaClassBrowserIcon
+ 'Integer class' isJavaPrimitiveType
+ 'Integer class' javaArrayClass
+ 'Integer class' javaName
+ 'LargeInteger class' isJavaPrimitiveType
+ 'LargeInteger class' javaArrayClass
+ 'LargeInteger class' javaName
+ 'Object class' isJavaArrayClass
+ 'Object class' isJavaClassType
+ 'Object class' isJavaPrimitiveType
+ 'Object class' isJavaReferenceType
+ 'Object class' isJavaType
+ 'ShortFloat class' isJavaPrimitiveType
+ 'ShortFloat class' javaArrayClass
+ 'ShortFloat class' javaName
+ 'SignedIntegerArray class' isInterface
+ 'SignedIntegerArray class' isJavaArrayClass
+ 'SignedIntegerArray class' javaArrayClass
+ 'SignedIntegerArray class' javaComponentClass
+ 'SignedIntegerArray class' javaName
+ 'SignedLongIntegerArray class' isInterface
+ 'SignedLongIntegerArray class' isJavaArrayClass
+ 'SignedLongIntegerArray class' isJavaReferenceType
+ 'SignedLongIntegerArray class' javaComponentClass
+ 'SignedLongIntegerArray class' javaName
+ 'UndefinedObject class' isJavaPrimitiveType
+ 'UndefinedObject class' javaName
+ 'WordArray class' isInterface
+ 'WordArray class' isJavaArrayClass
+ 'WordArray class' isJavaReferenceType
+ 'WordArray class' javaArrayClass
+ 'WordArray class' javaComponentClass
+ 'WordArray class' javaName
+ )
+! !
+
+!stx_libjava class methodsFor:'description - project information'!
+
+applicationIconFileName
+ "Return the name (without suffix) of an icon-file (the app's icon); will be included in the rc-resource file"
+
+ ^ nil
+ "/ ^ self applicationName
+!
+
+companyName
+ "Return a companyname which will appear in <lib>.rc"
+
+ ^ 'eXept Software AG'
+!
+
+description
+ "Return a description string which will appear in vc.def / bc.def"
+
+ ^ 'Smalltalk/X Class library'
+!
+
+legalCopyright
+ "Return a copyright string which will appear in <lib>.rc"
+
+ ^ 'Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\b SWING Research Group, Czech Technical University In Prague'
+
+ "Modified: / 26-07-2011 / 17:13:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+productName
+ "Return a product name which will appear in <lib>.rc"
+
+ ^ 'Smalltalk/X'
+! !
+
+!stx_libjava class methodsFor:'description - svn'!
+
+svnRepositoryUrlString
+ "Return a SVN repository URL of myself.
+ (Generated since 2011-04-08)
+ "
+
+ ^ '$URL$'
+!
+
+svnRevisionNr
+ "Return a SVN revision number of myself.
+ This number is updated after a commit"
+
+ ^ "$SVN-Revision:"'1260'"$"
+! !
+
+!stx_libjava class methodsFor:'file generation'!
+
+basicFileNamesToGenerate
+ "answer a dictionary (filename -> generator method) with all the files, that have to be generated for this
+ package"
+
+ |dict|
+
+ dict := super basicFileNamesToGenerate.
+
+ dict
+ at:'builder/package.deps.rake' put: #'generate_package_dot_deps_dot_rake'.
+
+ ^ dict.
+
+ "Created: / 11-03-2011 / 09:32:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!stx_libjava class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id$'
+! !
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vcmake.bat Fri Aug 19 08:58:19 2011 +0000
@@ -0,0 +1,8 @@
+@REM -------
+@REM make using microsoft visual c
+@REM type vcmake, and wait...
+@REM do not edit - automatically generated from ProjectDefinition
+@REM -------
+make.exe -N -f bc.mak -DUSEVC %1 %2
+
+