src/JavaObject.st
author hlopkmar
Tue, 08 Nov 2011 13:48:55 +0000
branchjk_new_structure
changeset 1093 255c230a1c55
parent 1022 38b710d7dfbc
child 1109 9bd0544f9046
permissions -rw-r--r--
hacking monitors, not working yet :P
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
     1
"
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     5
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
     7
 license:
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
     8
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    14
 hereby transferred.
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    15
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    17
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    19
 obtaining a copy of this software and associated documentation
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    20
 files (the 'Software'), to deal in the Software without
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    21
 restriction, including without limitation the rights to use,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    23
 copies of the Software, and to permit persons to whom the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    24
 Software is furnished to do so, subject to the following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    25
 conditions:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    26
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    27
 The above copyright notice and this permission notice shall be
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    28
 included in all copies or substantial portions of the Software.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    29
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    38
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    40
     of one of the above copright owners.
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    41
"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    43
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    44
Object subclass:#JavaObject
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    45
	instanceVariableNames:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    46
	classVariableNames:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    47
	poolDictionaries:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    48
	category:'Languages-Java-Classes'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    49
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    50
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    51
!JavaObject class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    52
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    53
copyright
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    54
"
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    55
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    56
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    57
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    58
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    59
 Parts of the code written by Claus Gittinger are under following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    60
 license:
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    61
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    62
 This software is furnished under a license and may be used
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    63
 only in accordance with the terms of that license and with the
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    64
 inclusion of the above copyright notice.   This software may not
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    65
 be provided or otherwise made available to, or used by, any
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    66
 other person.  No title to or ownership of the software is
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    67
 hereby transferred.
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    68
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    69
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    70
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    71
 Permission is hereby granted, free of charge, to any person
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    72
 obtaining a copy of this software and associated documentation
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    73
 files (the 'Software'), to deal in the Software without
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    74
 restriction, including without limitation the rights to use,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    75
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    76
 copies of the Software, and to permit persons to whom the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    77
 Software is furnished to do so, subject to the following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    78
 conditions:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    79
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    80
 The above copyright notice and this permission notice shall be
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    81
 included in all copies or substantial portions of the Software.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    82
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    83
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    84
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    85
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    86
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    87
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    88
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    89
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    90
 OTHER DEALINGS IN THE SOFTWARE.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    91
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    92
 [1] Code written at SWING Research Group contain a signature
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    93
     of one of the above copright owners.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 752
diff changeset
    94
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    95
"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    96
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    97
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    98
!JavaObject class methodsFor:'misc'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    99
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   100
resolveClassRefs
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   101
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   102
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   103
resolveClassRefsIgnoring:setOfClasses
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   104
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   105
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   106
!JavaObject class methodsFor:'smalltalk interface'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   107
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   108
convertJavaObject:val signature:retValSignature
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   109
^ val.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   110
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   111
    retValSignature = 'void' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   112
	^ #void
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   113
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   114
    retValSignature = 'boolean' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   115
	val == 0 ifTrue:[^ false].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   116
	^ true
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   117
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   118
    retValSignature = 'int' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   119
	val isInteger ifFalse:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   120
	    self halt
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   121
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   122
	^ val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   123
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   124
    retValSignature = 'char[]' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   125
	"/ these are ST-strings
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   126
	^ val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   127
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   128
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   129
    retValSignature = 'char' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   130
	"/ these are ST-characters
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   131
	val isInteger ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   132
	    ^ Character value:val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   133
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   134
	self halt.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   135
	^ val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   136
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   137
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   138
    retValSignature = 'Object' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   139
	^ val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   140
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   141
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   142
    retValSignature = 'String' ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   143
	^ Java as_ST_String:val
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   144
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   145
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   146
    'no conversion for: ' print. val class name print. ' to: ' print. retValSignature printNL.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   147
    ^ val.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   148
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   149
    "Modified: 8.8.1997 / 12:07:23 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   150
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   151
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   152
javaStringFrom:aString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   153
    "hard-coding internas of java.lang.String here is bad ..."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   154
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   155
    self halt.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   156
    ^ Java as_String:aString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   157
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   158
    "Modified: 7.8.1997 / 21:17:32 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   159
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   160
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   161
stringFromJavaString:aJavaString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   162
    "hard-coding internas of java.lang.String here is bad ..."
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   163
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   164
    self halt.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   165
    ^ Java as_ST_String:aJavaString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   166
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   167
    "Modified: 8.8.1997 / 12:07:29 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   168
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   169
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   170
!JavaObject methodsFor:'initialization'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   171
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   172
initializeToZero
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   173
    |sz|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   174
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   175
    sz := self class instSize.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   176
    1 to:sz do:[:i |
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   177
	self instVarAt:i put:0
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   178
    ]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   179
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   180
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   181
!JavaObject methodsFor:'message sending'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   182
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   183
doesNotUnderstand:aMessage
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   184
    "as a courtesy to the smalltalker, try to map methods"
1001
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   185
    ^ JavaClass 
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   186
        perform: aMessage 
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   187
        onReceiver: self 
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   188
        from: thisContext sender 
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   189
        ifNotFound: [ super doesNotUnderstand: aMessage]
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   190
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   191
"/    [
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   192
"/    ^ JavaLookup instance 
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   193
"/            perform: aMessage onReceiver: self from: thisContext sender.
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   194
"/    ] on: JavaDoesNotUnderstandException
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   195
"/    do: [:e |
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   196
"/       ^ super doesNotUnderstand: aMessage.
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   197
"/    ]
949
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   198
"/    |args numArgs javaMethod sel retVal m|
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   199
"/
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   200
"/    args := aMessage arguments.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   201
"/    numArgs := args size.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   202
"/    sel := aMessage selector.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   203
"/
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   204
"/    javaMethod := JavaClass lookupMethod:sel numArgs:numArgs in:self class static:false.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   205
"/    javaMethod notNil ifTrue:[
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   206
"/        args notNil ifTrue:[
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   207
"/            args := JavaClass 
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   208
"/                        convertArgsToJava:args 
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   209
"/                        asSpecifiedIn:(javaMethod argSignature)
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   210
"/                        numArgs:numArgs.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   211
"/        ].
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   212
"/        javaMethod isWrapped ifTrue:[
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   213
"/            m := javaMethod originalMethod
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   214
"/        ] ifFalse:[
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   215
"/            m := javaMethod
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   216
"/        ].
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   217
"/        retVal := javaMethod 
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   218
"/            valueWithReceiver:self 
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   219
"/            arguments:args
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   220
"/            selector:m selector 
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   221
"/            search:m javaClass
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   222
"/            sender:nil.
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   223
"/
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   224
"/        ^ JavaClass convertToSmalltalk:retVal type:(m returnType).
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   225
"/    ].
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   226
"/    ^ super doesNotUnderstand:aMessage
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   227
949
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   228
    "Modified: / 16-11-1998 / 16:50:56 / cg"
1001
2f02d9b0e50b Minor refactoring
kursjan
parents: 949
diff changeset
   229
    "Modified: / 19-09-2011 / 23:43:56 / Jan Kurs <kursjan@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   230
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   231
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   232
!JavaObject methodsFor:'printing & storing'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   233
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   234
displayString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   235
    |myClass javaString|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   236
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   237
    myClass := self class.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   238
    myClass == Java java_lang_String ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   239
        ^ '''' , (Java as_ST_String:self) , ''''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   240
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   241
    myClass == (Java at:'java.lang.Class') ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   242
        ^ super displayString , '(' 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   243
            , (JavaVM reflection classForJavaClassObject:self) displayString , ')'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   244
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   245
    myClass == (Java at:'java.lang.reflect.Method') ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   246
        ^ super displayString , '(' 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   247
            , (JavaVM methodForJavaMethodObject:self) displayString , ')'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   248
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   249
    Object errorSignal 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   250
        handle:[:ex | javaString := ''.]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   251
        do:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   252
            javaString := Java 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   253
                        as_ST_String:(self perform:#'toString()Ljava/lang/String;').
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   254
        ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   255
    ^ super displayString , ' (' , javaString , ')'.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   256
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   257
    "Modified: / 04-11-1998 / 18:35:00 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   258
    "Modified: / 28-01-2011 / 15:10:05 / Marcel Hlopko <hlopik@gmail.com>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   259
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   260
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   261
javaDisplayString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   262
    Object errorSignal handle:[:ex |
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   263
        ex return.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   264
    ] do:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   265
        ^ Java as_ST_String:(self perform:#toString).
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   266
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   267
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   268
    ^ super displayString.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   269
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   270
    "Created: / 7.4.1997 / 17:38:13 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   271
    "Modified: / 4.11.1998 / 21:07:19 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   272
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   273
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   274
printString
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   275
    |myClass javaString|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   276
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   277
    myClass := self class.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   278
    myClass == Java java_lang_String ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   279
        ^ '''' , (Java as_ST_String:self) , ''''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   280
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   281
    myClass == (Java at:'java.lang.Class') ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   282
        ^ super printString , '(' 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   283
            , (JavaVM reflection classForJavaClassObject:self) displayString , ')'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   284
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   285
    myClass == (Java at:'java.lang.reflect.Method') ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   286
        ^ super printString , '(' 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   287
            , (JavaVM methodForJavaMethodObject:self) displayString , ')'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   288
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   289
    Object errorSignal 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   290
        handle:[:ex | javaString := ''.]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   291
        do:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   292
            javaString := Java 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   293
                        as_ST_String:(self perform:#'toString()Ljava/lang/String;').
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   294
        ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   295
    ^ super printString , ' (' , javaString , ')'.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   296
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   297
    "Modified: / 04-11-1998 / 18:35:00 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   298
    "Created: / 20-12-2010 / 23:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   299
    "Modified: / 28-01-2011 / 15:10:17 / Marcel Hlopko <hlopik@gmail.com>"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   300
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   301
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   302
!JavaObject methodsFor:'queries'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   303
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   304
isJavaClassRef
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   305
    ^ false
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   306
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   307
    "Created: / 9.11.1999 / 17:13:37 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   308
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   309
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   310
isJavaMethodRef
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   311
    ^ false
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   312
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   313
    "Created: / 9.11.1999 / 15:43:21 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   314
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   315
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   316
isJavaObject
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   317
    ^ true
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   318
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   319
    "Created: 26.3.1997 / 13:34:17 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   320
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   321
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   322
!JavaObject methodsFor:'smalltalk interface'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   323
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   324
lookupMethod:selector numArgs:nargs
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   325
    "lookup a method"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   326
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   327
    |method cls sel|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   328
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   329
    sel := selector.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   330
    (sel includes:$:) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   331
	sel := sel copyTo:(sel indexOf:$:)-1    
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   332
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   333
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   334
    sel := sel asSymbolIfInterned.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   335
    sel notNil ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   336
	cls := self class.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   337
	[cls notNil and:[cls ~~ JavaObject]] whileTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   338
	    cls methodDictionary keysAndValuesDo:[:jSel :aMethod |
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   339
		(jSel == sel ) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   340
		    ^ aMethod
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   341
		]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   342
	    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   343
	    cls methodDictionary keysAndValuesDo:[:jSel :aMethod |
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   344
		(aMethod name = sel 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   345
		or:[aMethod signatureNameWithoutReturnType = sel]) ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   346
		    aMethod numArgs == nargs ifTrue:[
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   347
			^ aMethod
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   348
		    ]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   349
		]
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   350
	    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   351
	    cls := cls superclass.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   352
	].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   353
    ].
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   354
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   355
    ^ nil
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   356
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   357
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   358
     |stack|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   359
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   360
     stack := (Java at:'java.util.Stack') basicNew.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   361
     stack lookupMethod:#'<init>' numArgs:0. 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   362
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   363
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   364
     |stack|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   365
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   366
     stack := (Java at:'java.util.Stack') new.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   367
     stack lookupMethod:#isEmpty numArgs:0. 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   368
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   369
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   370
     |frame|
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   371
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   372
     frame := (Java at:'java.awt.Frame') new.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   373
     frame lookupMethod:#'<init> (String)' numArgs:1. 
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   374
    "
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   375
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   376
    "Modified: 22.3.1997 / 00:56:54 / cg"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   377
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   378
1093
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   379
!JavaObject methodsFor:'unwind'!
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   380
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   381
unwindHandlerInContext: aContext 
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   382
    "given a context which has been marked for unwind,
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   383
     retrieve the handler block. This method is called when ST
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   384
     exception raises and stack is unwinding. JavaClass instance
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   385
     has an opportunity to clean up monitors"
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   386
    
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   387
    ^ JavaVM unwindHandlerForJavaContext: aContext.
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   388
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   389
    "Created: / 08-11-2011 / 12:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   390
! !
255c230a1c55 hacking monitors, not working yet :P
hlopkmar
parents: 1022
diff changeset
   391
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   392
!JavaObject class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   393
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   394
version
1022
38b710d7dfbc svn properties fixed
vranyj1
parents: 1001
diff changeset
   395
    ^ '$Id$'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   396
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   397
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   398
version_SVN
1022
38b710d7dfbc svn properties fixed
vranyj1
parents: 1001
diff changeset
   399
    ^ '$Id$'
949
8452984ed807 New Implementation of JavaLookup. Slow, no boxing, unboxing is old and needs to be rewritten.
kursjan
parents: 923
diff changeset
   400
! !