--- a/Java.st Tue Apr 13 13:26:06 2010 +0200
+++ b/Java.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/Java.st,v 1.133 2009-08-23 09:25:26 cg Exp $'
+ ^ '$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!
--- a/JavaBehavior.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaBehavior.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaBehavior.st,v 1.3 2009-10-09 14:04:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/JavaBehavior.st,v 1.4 2011-08-18 18:42:48 vrany Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libjava/JavaBehavior.st,v 1.3 2009-10-09 14:04:26 cg Exp $'
+ ^ '§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!
--- a/JavaByteCodeEnumerator.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaByteCodeEnumerator.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaByteCodeEnumerator.st,v 1.3 2002-11-22 20:13:48 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaClass.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaClass.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaClass.st,v 1.126 2009-08-24 19:33:19 cg Exp $'
+ ^ '$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!
--- a/JavaClassReader.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaClassReader.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaClassReader.st,v 1.92 2009-10-09 14:21:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/JavaClassReader.st,v 1.93 2011-08-18 18:42:48 vrany Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libjava/JavaClassReader.st,v 1.92 2009-10-09 14:21:53 cg Exp $'
+ ^ '§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!
--- a/JavaConstantPool.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaConstantPool.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaConstantPool.st,v 1.14 2002-11-22 20:11:58 cg Exp $'
+ ^ '$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!
--- a/JavaContext.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaContext.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaContext.st,v 1.35 2010-04-13 11:26:06 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaDecompiler.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaDecompiler.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaDecompiler.st,v 1.49 2002-11-22 20:13:46 cg Exp $'
+ ^ '$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!
--- a/JavaEmbeddedFrameView.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaEmbeddedFrameView.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaEmbeddedFrameView.st,v 1.25 2004-03-20 19:26:20 stefan Exp $'
+ ^ '$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 $'
! !
--- a/JavaExceptionTableEntry.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaExceptionTableEntry.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaExceptionTableEntry.st,v 1.15 2002-11-22 20:12:59 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaField.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaField.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.17 2009-10-09 14:04:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.18 2011-08-18 18:42:48 vrany Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.17 2009-10-09 14:04:34 cg Exp $'
+ ^ '§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!
--- a/JavaLocalVariableTable.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaLocalVariableTable.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaLocalVariableTable.st,v 1.7 2002-11-22 20:12:55 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaLocalVariableTableEntry.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaLocalVariableTableEntry.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaLocalVariableTableEntry.st,v 1.7 2002-11-22 20:12:57 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaMethod.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaMethod.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.106 2009-10-09 14:04:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.107 2011-08-18 18:42:48 vrany Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.106 2009-10-09 14:04:17 cg Exp $'
+ ^ '§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!
--- a/JavaMethodWithException.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaMethodWithException.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaMethodWithException.st,v 1.6 2002-11-22 20:09:15 cg Exp $'
+ ^ '$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!
--- a/JavaMethodWithHandler.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaMethodWithHandler.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaMethodWithHandler.st,v 1.8 2002-11-22 20:09:06 cg Exp $'
+ ^ '$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!
--- a/JavaNativeMethod.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaNativeMethod.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaNativeMethod.st,v 1.8 2002-11-22 20:09:13 cg Exp $'
+ ^ '$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!
--- a/JavaObject.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaObject.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaObject.st,v 1.53 2002-11-22 20:09:11 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaPopUpView.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaPopUpView.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaPopUpView.st,v 1.3 2002-11-22 20:13:55 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaProcess.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaProcess.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaProcess.st,v 1.14 2002-11-22 20:09:21 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaSlotIndexCache.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaSlotIndexCache.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaSlotIndexCache.st,v 1.3 2002-11-22 20:13:02 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaTopView.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaTopView.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaTopView.st,v 1.7 2002-11-22 20:14:03 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaUnresolvedClassConstant.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaUnresolvedClassConstant.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaUnresolvedClassConstant.st,v 1.43 2002-11-22 20:11:24 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaUnresolvedConstant.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaUnresolvedConstant.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaUnresolvedConstant.st,v 1.12 2002-11-22 20:11:32 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaUnresolvedStringConstant.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaUnresolvedStringConstant.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaUnresolvedStringConstant.st,v 1.8 2002-11-22 20:11:48 cg Exp $'
+ ^ '$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 $'
! !
--- a/JavaVM.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaVM.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaVM.st,v 1.183 2009-10-09 14:25:28 cg Exp $'
-!
-
-version_CVS
- ^ '$Header: /cvs/stx/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!
--- a/JavaView.st Tue Apr 13 13:26:06 2010 +0200
+++ b/JavaView.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/JavaView.st,v 1.23 2002-11-22 20:14:05 cg Exp $'
+ ^ '$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 $'
! !
--- a/Make.proto Tue Apr 13 13:26:06 2010 +0200
+++ b/Make.proto Thu Aug 18 20:42:48 2011 +0200
@@ -1,65 +1,41 @@
-# $Header: /cvs/stx/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 Tue Apr 13 13:26:06 2010 +0200
+++ b/Make.spec Thu Aug 18 20:42:48 2011 +0200
@@ -1,56 +1,259 @@
-# $Header: /cvs/stx/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) \
+
+
+
--- a/SmalltalkAppletContext.st Tue Apr 13 13:26:06 2010 +0200
+++ b/SmalltalkAppletContext.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/SmalltalkAppletContext.st,v 1.9 2002-11-22 20:13:53 cg Exp $'
+ ^ '$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 $'
! !
--- a/SmalltalkAppletStub.st Tue Apr 13 13:26:06 2010 +0200
+++ b/SmalltalkAppletStub.st Thu Aug 18 20:42:48 2011 +0200
@@ -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
- ^ '$Header: /cvs/stx/stx/libjava/SmalltalkAppletStub.st,v 1.9 2002-11-22 20:14:07 cg Exp $'
+ ^ '$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 $'
! !
--- a/abbrev.stc Tue Apr 13 13:26:06 2010 +0200
+++ b/abbrev.stc Thu Aug 18 20:42:48 2011 +0200
@@ -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 Tue Apr 13 13:26:06 2010 +0200
+++ b/bc.mak Thu Aug 18 20:42:48 2011 +0200
@@ -1,156 +1,170 @@
-# $Header: /cvs/stx/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 Tue Apr 13 13:26:06 2010 +0200
+++ b/bmake.bat Thu Aug 18 20:42:48 2011 +0200
@@ -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
+
+
--- a/examples/JavaAppletDemo1.st Tue Apr 13 13:26:06 2010 +0200
+++ b/examples/JavaAppletDemo1.st Thu Aug 18 20:42:48 2011 +0200
@@ -100,5 +100,5 @@
!JavaAppletDemo1 class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/examples/JavaAppletDemo1.st,v 1.5 1999/12/23 18:07:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/examples/Attic/JavaAppletDemo1.st,v 1.6 2011-08-18 18:42:48 vrany Exp $'
! !
--- a/examples/JavaAppletDemo2.st Tue Apr 13 13:26:06 2010 +0200
+++ b/examples/JavaAppletDemo2.st Thu Aug 18 20:42:48 2011 +0200
@@ -123,5 +123,5 @@
!JavaAppletDemo2 class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/examples/JavaAppletDemo2.st,v 1.4 1999/12/23 18:07:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/examples/Attic/JavaAppletDemo2.st,v 1.5 2011-08-18 18:42:48 vrany Exp $'
! !
--- a/examples/JavaAppletDemo3.st Tue Apr 13 13:26:06 2010 +0200
+++ b/examples/JavaAppletDemo3.st Thu Aug 18 20:42:48 2011 +0200
@@ -78,5 +78,5 @@
!JavaAppletDemo3 class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/examples/JavaAppletDemo3.st,v 1.3 1999/12/23 18:07:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libjava/examples/Attic/JavaAppletDemo3.st,v 1.4 2011-08-18 18:42:48 vrany Exp $'
! !
--- a/examples/Make.proto Tue Apr 13 13:26:06 2010 +0200
+++ b/examples/Make.proto Thu Aug 18 20:42:48 2011 +0200
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libjava/examples/Make.proto,v 1.2 2011/08/18 18:42:48 vrany 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 Tue Apr 13 13:26:06 2010 +0200
+++ b/examples/Make.spec Thu Aug 18 20:42:48 2011 +0200
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/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
--- a/libInit.cc Tue Apr 13 13:26:06 2010 +0200
+++ b/libInit.cc Thu Aug 18 20:42:48 2011 +0200
@@ -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 Tue Apr 13 13:26:06 2010 +0200
+++ b/libjava.rc Thu Aug 18 20:42:48 2011 +0200
@@ -1,14 +1,10 @@
-/*------------------------------------------------------------------------*/
-/* $Header: /cvs/stx/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