JavaClass.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 17 Feb 2015 16:16:50 +0100
branchcvs_MAIN
changeset 3428 a0fb3a6e51b4
parent 3427 9f7e8a7548fc
child 3431 82790b1e6d54
permissions -rw-r--r--
JavaClass: added JavaClass>>sourceDecompiled with better description text. This also allows for customization in subclasses. Xgrafted from 848666cb09c2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
454
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
     1
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3303
diff changeset
     2
 COPYRIGHT (c) 1996-2015 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
     3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
     5
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3303
diff changeset
     6
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
454
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
     8
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
     9
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    10
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    12
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    13
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    14
 hereby transferred.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
    15
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    18
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    19
     as of 1.9.2010
2080
452972372142 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
    20
"
674
f83368a07379 *** empty log message ***
cg
parents: 654
diff changeset
    21
"{ Package: 'stx:libjava' }"
f83368a07379 *** empty log message ***
cg
parents: 654
diff changeset
    22
3326
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    23
"{ NameSpace: Smalltalk }"
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    24
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
    25
JavaBehavior subclass:#JavaClass
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
    26
	instanceVariableNames:'classLoader binaryName fields staticFields annotations'
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
    27
	classVariableNames:'ArgumentConversionErrorSignal OrderOfClassInits'
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    28
	poolDictionaries:'JavaConstants'
2107
f4509f6767fa category change
Claus Gittinger <cg@exept.de>
parents: 2106
diff changeset
    29
	category:'Languages-Java-Classes'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    30
!
083530508d9c intitial checkin
cg
parents:
diff changeset
    31
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
    32
MethodDictionary variableSubclass:#Attributes
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    33
	instanceVariableNames:''
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    34
	classVariableNames:'Empty'
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    35
	poolDictionaries:''
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    36
	privateIn:JavaClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    37
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
    38
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    39
Object subclass:#JavaClassVersionDiedHandler
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    40
	instanceVariableNames:''
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    41
	classVariableNames:''
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    42
	poolDictionaries:''
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    43
	privateIn:JavaClass
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    44
!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
    45
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    46
!JavaClass class methodsFor:'documentation'!
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    47
454
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    48
copyright
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    49
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3303
diff changeset
    50
 COPYRIGHT (c) 1996-2015 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    51
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    52
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    53
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3303
diff changeset
    54
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    55
                            SWING Research Group, Czech Technical University in Prague
454
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    56
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    57
 This software is furnished under a license and may be used
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    58
 only in accordance with the terms of that license and with the
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    59
 inclusion of the above copyright notice.   This software may not
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    60
 be provided or otherwise made available to, or used by, any
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    61
 other person.  No title to or ownership of the software is
38f590639d65 *** empty log message ***
cg
parents: 451
diff changeset
    62
 hereby transferred.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
    63
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    64
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    65
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    66
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    67
     as of 1.9.2010
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    68
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    69
"
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    70
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
    71
133
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    72
examples
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    73
"
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    74
    (Java at:'java.util.Stack') new inspect
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    75
    (Java at:'java.util.Vector') new inspect
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    76
"
adaf7cad0bc2 checkin from browser
cg
parents: 132
diff changeset
    77
! !
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    78
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
    79
!JavaClass class methodsFor:'instance creation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    80
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
    81
binaryName: aString numStatic: nStatic
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    82
    | meta  cls |
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    83
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    84
    "create the metaclass first"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
    85
    meta := JavaMetaclass new.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    86
    meta setSuperclass: self.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    87
    meta instSize: (meta superclass instSize + nStatic).
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
    88
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
    89
"/    meta setName:(aString , 'class') asSymbol.
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
    90
"/    meta setClassVariableString:''.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
    91
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    92
    meta flags: (meta flags bitOr: Behavior flagJavaClass).
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
    93
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    94
"/    meta setSuperclass:JavaObject class. "then let the new meta create the class"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
    95
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
    96
    cls := meta new.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    97
    cls setSuperclass: JavaObject.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    98
    cls instSize: 0.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
    99
    cls flags: 0.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   100
    cls setAccessFlags: 0.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   101
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   102
"/    cls setClassVariableString:''.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   103
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   104
    cls setInstanceVariableString: ''.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   105
    cls setCategory: #java.
2956
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
   106
    cls setLockWord.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   107
2847
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   108
    cls setBinaryName: aString.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   109
    "Make sure `name` slot of Java classes always contain a symbol.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   110
     There's code in the VM which compares class names, therefore having nil
2847
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   111
     there causes segfault.
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   112
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   113
     Also, because __jbindnative() reads class name slot (instead of binaryName),
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   114
     temporarily set Class.name slot to its binary name. This is certainly
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   115
     kludge, but allows old VM to work with new naming scheme. Will wanish."
2847
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
   116
    cls setName: aString.
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   117
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   118
    ^ cls
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   119
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   120
    "Created: / 15-04-1996 / 15:52:55 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   121
    "Modified: / 03-01-1998 / 22:32:25 / cg"
2956
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
   122
    "Modified: / 06-12-2013 / 22:59:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
38
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   123
!
3f1b61722466 checkin from browser
cg
parents: 34
diff changeset
   124
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   125
name:aString
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   126
    self shouldNotImplement
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   127
083530508d9c intitial checkin
cg
parents:
diff changeset
   128
    "Created: 15.4.1996 / 15:52:55 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   129
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   130
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   131
!JavaClass class methodsFor:'boxing-unboxing'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   132
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   133
box: stArgumentsCollection to: typesCollection
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   134
    " box smalltalk arguments collection to Java arguments "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   135
    ^ stArgumentsCollection with: typesCollection collect: [ :stObject :javaType |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   136
        (JavaTypeBox  typeBoxForJava: javaType) box: stObject.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   137
    ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   138
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   139
    "Created: / 25-09-2011 / 20:20:35 / Jan Kurs <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   140
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   141
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   142
unbox:jObj returnType: returnType
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   143
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   144
    "JV@2011-02-04"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   145
    "Hack for primitive types"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   146
    "/    JK: it is hack, but it is fast :)
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   147
    (JavaDescriptor baseTypesByTypeName keys includes: returnType) ifTrue:[^jObj].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   148
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   149
    ^ (JavaTypeBox typeBoxForJava: returnType) unbox: jObj.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   150
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   151
    "Created: / 30-08-2011 / 22:13:41 / Jan Kurs <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   152
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   153
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   154
!JavaClass class methodsFor:'class initialization'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   155
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   156
initialize
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   157
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   158
    ArgumentConversionErrorSignal := Signal new notifierString:'argument conversion error'.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   159
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   160
    "Created: / 20-10-2010 / 11:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   161
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   162
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   163
!JavaClass class methodsFor:'method lookup'!
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   164
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   165
canConvertArgsToJava:argArray asSpecifiedIn:argSigSpecArray
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   166
    "given a smalltalk argument array, return true, if these can be converted to java objects as appropriate."
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   167
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   168
    argArray
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   169
	with:argSigSpecArray
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   170
	do:[:arg :type |
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   171
		self
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   172
		    convertToJava:arg
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   173
		    type:type
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   174
		    ifFail:[:msg :default| ^ false]].
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   175
    ^ true
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   176
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   177
    "Created: / 5.11.1998 / 18:25:05 / cg"
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   178
    "Modified: / 6.11.1998 / 00:45:58 / cg"
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   179
!
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   180
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   181
convertArgsToJava:argArray asSpecifiedIn:argSigSpecArray numArgs:na
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   182
    "given a smalltalk argument array, convert to java objects as appropriate.
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   183
     Currently, only Strings and booleans are converted."
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   184
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   185
    |sigIndex newArgIndex newArgArray|
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   186
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   187
    sigIndex := newArgIndex := 1.
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   188
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   189
    newArgArray := Array new:na.
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   190
    argArray do:[:arg |
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   191
	|type newArg|
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   192
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   193
	type := argSigSpecArray at:sigIndex.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   194
	sigIndex := sigIndex + 1.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   195
	newArg := self convertToJava:arg type:type.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   196
	newArgArray at:newArgIndex put:newArg.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   197
	newArgIndex := newArgIndex + 1.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   198
	(type == #long or:[type == #double]) ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   199
	    newArgIndex > na ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   200
		self halt:'should not happen'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   201
	    ].
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   202
	    newArgArray at:newArgIndex put:nil.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   203
	    newArgIndex := newArgIndex + 1.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   204
	]
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   205
    ].
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   206
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   207
    ^ newArgArray
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   208
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   209
    "Created: / 5.11.1998 / 18:30:57 / cg"
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   210
    "Modified: / 6.11.1998 / 00:45:00 / cg"
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   211
!
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   212
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   213
convertToJava:arg type:type
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   214
    "given a smalltalk argument, convert to a java object as appropriate."
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   215
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   216
    ^ self
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   217
        convertToJava:arg
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   218
        type:type
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   219
        ifFail:[:msg :default |
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   220
                    ArgumentConversionErrorSignal
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   221
                        raiseWith:arg
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   222
                        errorString:msg.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   223
                    default
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   224
               ]
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   225
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   226
    "Created: / 06-11-1998 / 00:45:13 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   227
    "Modified: / 20-10-2010 / 11:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   228
!
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   229
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   230
convertToJava: arg type: type ifFail: failBlock
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   231
    "given a smalltalk argument, convert to a java object as appropriate.
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   232
     Currently, only a few types are converted."
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   233
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   234
    | expectedCls  f  failValue |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   235
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   236
    type == #boolean ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   237
        arg == true ifTrue: [ ^ 1 ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   238
        arg == false ifTrue: [ ^ 0 ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   239
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   240
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   241
    type == #int ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   242
        arg isInteger ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   243
            (arg between: (16r8000000 * -1) and: 16r7FFFFFFF) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   244
            ^ failBlock value: ('integer range; cannot convert argument to ' , type)
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   245
                value: 0.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   246
        ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   247
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   248
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   249
    type == #long ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   250
        arg isInteger ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   251
            (arg "(-1 * 16r800000000000000) -->" between: -576460752303423488
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   252
                and: 16r7FFFFFFFFFFFFFFF) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   253
            ^ failBlock value: ('integer range; cannot convert argument to ' , type)
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   254
                value: 0
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   255
        ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   256
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   257
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   258
    (type == #float) ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   259
        arg isLimitedPrecisionReal ifTrue: [ ^ arg asShortFloat ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   260
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0.0.
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   261
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   262
    (type = 'java.lang.Float') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   263
        arg isLimitedPrecisionReal ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   264
            f := (Java at: 'java.lang.Float') new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   265
            f perform: #'<init>(F)V' with: (arg asShortFloat).
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   266
            self halt.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   267
            ^ f.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   268
        ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   269
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0.0.
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   270
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   271
    (type = 'java.lang.Double') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   272
        arg isLimitedPrecisionReal ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   273
            f := (Java at: 'java.lang.Double') new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   274
            f perform: #'<init>(D)V' with: (arg asFloat).
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   275
            self halt.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   276
            ^ f.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   277
        ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   278
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0.0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   279
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   280
    (type == #double) ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   281
        arg isLimitedPrecisionReal ifTrue: [ ^ arg asFloat ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   282
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0.0.
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   283
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   284
    (type == #char) ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   285
        arg isCharacter ifTrue: [ ^ arg asciiValue ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   286
        ^ failBlock value: ('cannot convert argument to ' , type) value: 0
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   287
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   288
    (type = 'char[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   289
        arg isString ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   290
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   291
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   292
    (type = 'int[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   293
        (arg isArray or: [ arg isMemberOf: SignedIntegerArray ]) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   294
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   295
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   296
    (type = 'long[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   297
        (arg isArray or: [ arg isMemberOf: SignedIntegerArray ]) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   298
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   299
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   300
    (type = 'float[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   301
        (arg isArray or: [ arg isMemberOf: FloatArray ]) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   302
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   303
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   304
    (type = 'double[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   305
        (arg isArray or: [ arg isMemberOf: DoubleArray ]) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   306
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   307
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   308
    (type endsWith: '[]') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   309
        (arg isArray or: [ arg isNil ]) ifTrue: [ ^ arg ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   310
        ^ failBlock value: ('cannot convert argument to ' , type) value: ''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   311
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   312
    expectedCls := JavaVM classForName: type.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   313
    (arg isKindOf: expectedCls) ifTrue: [
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   314
        "/ matches class and subclasses
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   315
        ^ arg
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   316
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   317
    (type = 'java.lang.Object') ifTrue: [
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   318
        "/ matches any
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   319
        ^ arg
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   320
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   321
    (type = 'java.lang.String') ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   322
        arg isString ifTrue: [ ^ Java as_String: arg ].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   323
        failValue := ''
2080
452972372142 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 749
diff changeset
   324
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   325
    arg isNil ifTrue: [
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   326
        "/ matches any
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   327
        ^ arg
456
bbed0c5ce05f checkin from browser
cg
parents: 454
diff changeset
   328
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   329
    self halt.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   330
    ^ failBlock value: ('cannot convert argument to ' , type) value: failValue
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   331
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   332
    "Created: / 06-11-1998 / 00:46:19 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   333
    "Modified: / 06-11-2001 / 13:28:29 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   334
    "Modified: / 17-01-2011 / 10:08:04 / kursjan <kursjan@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   335
    "Modified: / 17-03-2011 / 14:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   336
!
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   337
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   338
convertToSmalltalk:jObj type:type
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   339
    "given a java return value, convert to a smalltalk object as appropriate.
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   340
     Currently, only a few types are converted."
336
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   341
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   342
    "JV@2011-02-04"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   343
    "Hack for primitive types"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   344
    (JavaDescriptor baseTypesByTypeName keys includes: type) ifTrue:[^jObj].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   345
    "jObj is registered for the specified type?"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   346
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   347
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   348
    (JavaObjectDictionary new reflectionOf: jObj class name)  = (Java classForName: type) ifTrue: [
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   349
        ^ jObj
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   350
    ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   351
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   352
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   353
    type == #boolean ifTrue:[
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   354
        jObj == 0 ifTrue:[
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   355
            ^ false
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   356
        ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   357
        ^ true
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   358
    ].
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   359
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   360
    type == #void ifTrue:[
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   361
        ^ nil
336
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   362
    ].
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   363
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   364
    (type = 'java.lang.String') ifTrue:[
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   365
        ^ Java as_ST_String:jObj
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   366
    ].
336
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   367
433
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   368
"/    (type = 'java.lang.Float') ifTrue:[
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   369
"/        ^ jObj instVarNamed:'value'
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   370
"/    ].
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   371
"/    (type = 'java.lang.Double') ifTrue:[
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   372
"/        ^ jObj instVarNamed:'value'
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   373
"/    ].
d9d6841784f1 checkin from browser
cg
parents: 428
diff changeset
   374
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   375
    (type == #char) ifTrue:[
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   376
        jObj isInteger ifTrue:[
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   377
            ^ Character value:jObj
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   378
        ].
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   379
    ].
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   380
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   381
    ^ jObj
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
   382
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   383
    "Created: / 06-11-1998 / 00:49:53 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   384
    "Modified: / 11-11-1998 / 02:08:11 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   385
    "Modified: / 17-01-2011 / 10:42:56 / kursjan <kursjan@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   386
    "Modified: / 08-04-2011 / 17:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
336
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   387
!
263450c8902e checkin from browser
cg
parents: 321
diff changeset
   388
236
46195f733e51 *** empty log message ***
cg
parents: 229
diff changeset
   389
lookupMethod:selector numArgs:nargs in:aClass static:staticMethod
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   390
    "lookup a method"
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   391
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   392
    |method cls sel|
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   393
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   394
    sel := selector.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   395
    (sel includes:$:) ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   396
	sel := sel copyTo:(sel indexOf:$:)-1
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   397
    ].
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   398
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   399
    sel := sel asSymbolIfInterned.
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   400
    sel notNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   401
	cls := aClass.
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   402
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   403
	[cls notNil
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   404
	and:[cls ~~ JavaObject
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   405
	and:[cls ~~ JavaClass]]] whileTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   406
	    cls methodDictionary keysAndValuesDo:[:jSel :m |
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   407
		|aMethod|
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   408
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   409
		aMethod := m.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   410
		aMethod isWrapped ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   411
		    aMethod := aMethod originalMethod
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   412
		].
456
bbed0c5ce05f checkin from browser
cg
parents: 454
diff changeset
   413
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   414
		((jSel == sel)
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   415
		or:[aMethod name = sel
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   416
		or:[aMethod signatureNameWithoutReturnType = sel]])
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   417
		ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   418
		    aMethod numArgs == nargs ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   419
			staticMethod == (aMethod isStatic) ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   420
			    ^ m
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   421
			]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   422
		    ]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   423
		]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   424
	    ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   425
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   426
	    cls := cls superclass.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   427
	].
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   428
    ].
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   429
"/ self halt.
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   430
    ^ nil
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   431
375
988259a6fa03 checkin from browser
cg
parents: 360
diff changeset
   432
    "Created: / 17.8.1997 / 18:25:47 / cg"
456
bbed0c5ce05f checkin from browser
cg
parents: 454
diff changeset
   433
    "Modified: / 16.11.1998 / 16:46:48 / cg"
415
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   434
!
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   435
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   436
lookupMethods:selector numArgs:nargs in:aClass static:staticMethod
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   437
    "lookup methods matching a selector.
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   438
     This is a special entry for doesNotUnderstand redirection
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   439
     (the caller must select the one method which fits the argument(s) best."
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   440
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   441
    |methods cls sel|
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   442
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   443
    sel := selector.
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   444
    (sel includes:$:) ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   445
	sel := sel copyTo:(sel indexOf:$:)-1
415
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   446
    ].
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   447
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   448
    sel := sel asSymbolIfInterned.
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   449
    sel notNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   450
	cls := aClass.
415
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   451
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   452
	[cls notNil
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   453
	and:[cls ~~ JavaObject
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   454
	and:[cls ~~ JavaClass]]] whileTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   455
	    cls methodDictionary keysAndValuesDo:[:jSel :aMethod |
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   456
		((jSel == sel)
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   457
		or:[aMethod name = sel
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   458
		or:[aMethod signatureNameWithoutReturnType = sel]])
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   459
		ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   460
		    (nargs isNil
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   461
		    or:[aMethod numArgs == nargs]) ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   462
			staticMethod == (aMethod isStatic) ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   463
			    methods isNil ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   464
				methods := OrderedCollection new
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   465
			    ].
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   466
			    methods add:aMethod
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   467
			]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   468
		    ]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   469
		]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   470
	    ].
415
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   471
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   472
	    cls := cls superclass.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   473
	].
415
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   474
    ].
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   475
    ^ methods ? #()
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   476
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   477
    "Created: / 4.11.1998 / 19:04:51 / cg"
b8abde6f5a0d cleanup (removed obsolete invoke stuff)
cg
parents: 413
diff changeset
   478
    "Modified: / 4.11.1998 / 19:31:33 / cg"
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   479
! !
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
   480
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   481
!JavaClass class methodsFor:'others'!
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   482
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   483
version_HG
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   484
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   485
    ^ '$Changeset: <not expanded> $'
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   486
! !
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
   487
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   488
!JavaClass class methodsFor:'signature parsing'!
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   489
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   490
initialValueFromSignature:aSignature
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   491
    "given a signature, return an initializer value"
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   492
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   493
    |s|
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   494
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   495
    s := aSignature readStream.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   496
    ^ self initialValueFromStream:s.
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   497
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   498
    "
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   499
     JavaClass initialValueFromSignature:'LObject;'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   500
     JavaClass initialValueFromSignature:'B'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   501
     JavaClass initialValueFromSignature:'I'
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   502
    "
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   503
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   504
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   505
! !
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
   506
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   507
!JavaClass class methodsFor:'special'!
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   508
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   509
deinitClasses
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   510
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   511
    Smalltalk allClassesDo:
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   512
        [:cls|cls isJavaClass ifTrue:[cls deinit]].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   513
    self flushClassesInitOrder.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   514
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   515
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   516
        JavaClass deinitClasses
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   517
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   518
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   519
    "Created: / 25-10-2010 / 16:47:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   520
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   521
2104
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   522
flushClassesInitOrder
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   523
    OrderOfClassInits := nil
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   524
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   525
    "Created: / 6.11.2001 / 09:49:49 / cg"
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   526
!
1b6366474dbf isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
   527
435
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   528
orderOfClassInits
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   529
    ^ OrderOfClassInits
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   530
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   531
    "Created: / 12.11.1998 / 15:35:57 / cg"
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   532
!
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   533
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   534
setInstanceVariableStringFromFields:f in:aClass
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   535
    |varNames|
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   536
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   537
    varNames := ''.
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   538
    f do:[:aField |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
   539
	varNames := varNames , aField name , ' '
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   540
    ].
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   541
    aClass setInstanceVariableString:varNames.
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   542
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   543
    "Created: 15.4.1996 / 16:42:52 / cg"
435
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   544
!
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   545
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   546
startRememberingOrderOfClassInits
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   547
    OrderOfClassInits := OrderedCollection new.
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   548
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   549
    "Created: / 12.11.1998 / 15:26:32 / cg"
de6d4b3a67ac remember class init-order
cg
parents: 433
diff changeset
   550
    "Modified: / 12.11.1998 / 15:29:10 / cg"
40
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   551
! !
7f332a95e015 checkin from browser
cg
parents: 38
diff changeset
   552
2603
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   553
!JavaClass methodsFor:'* uncategorized *'!
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   554
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   555
includesInterface: interface
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   556
    | cls |
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   557
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   558
    self == interface ifTrue: [ ^ true ].
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   559
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   560
    cls := self.
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   561
    [ cls isJavaClass ] whileTrue:[
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   562
        cls interfaces do:[:i|(i includesInterface: interface) ifTrue:[ ^ true ]].
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   563
        cls := cls superclass.
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   564
    ].
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   565
    ^ false.
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   566
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   567
    "Created: / 21-05-2013 / 00:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   568
! !
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
   569
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   570
!JavaClass methodsFor:'accessing'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   571
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   572
allFields
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   573
    "Returns all fields, including those inherited from
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   574
     a superclass"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   575
    | cls all |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   576
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   577
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   578
    all  := OrderedCollection new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   579
    [ cls isJavaClass ] whileTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   580
        all addAll: cls fields.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   581
        cls := cls superclass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   582
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   583
    ^all.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   584
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   585
    "Created: / 04-04-2012 / 01:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   586
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   587
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   588
allInterfaces
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   589
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   590
    | ifaces cls |
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   591
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   592
    ifaces := Set new.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   593
    cls := self.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   594
    [ cls isJavaClass ] whileTrue:
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   595
        [cls interfaces do:[:iface| ifaces add: iface; addAll: iface allInterfaces].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   596
        cls := cls superclass].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   597
    ^ifaces.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   598
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   599
    "Created: / 05-02-2011 / 23:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   600
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   601
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   602
allStaticFields
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   603
    "Returns all fields, including those inherited from
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   604
     a superclass"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   605
    | cls all |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   606
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   607
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   608
    all  := OrderedCollection new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   609
    [ cls isJavaClass ] whileTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   610
        all addAll: cls staticFields.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   611
        cls := cls superclass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   612
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   613
    ^all.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   614
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   615
    "Created: / 04-04-2012 / 01:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   616
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   617
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   618
annotations
3326
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   619
    annotations isNil ifTrue:[
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   620
        ^ JavaClassAnnotationContainer empty
3196
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   621
    ].
3326
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   622
    ^ annotations
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   623
a373d416ae8c Fix in JavaClass>>annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   624
    "Modified: / 11-01-2015 / 07:47:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   625
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   626
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   627
annotations:something
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   628
    annotations := something.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   629
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   630
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   631
binaryName
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   632
    "Returns binary name of the class (i.e., name with slashes).
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   633
     To get name as seen by programmer, use #javaName"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   634
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   635
    ^ binaryName
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   636
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   637
    "Created: / 08-10-2013 / 19:24:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   638
!
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   639
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   640
classLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   641
    ^ classLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   642
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   643
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   644
classLoader:classLoaderOrNil
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   645
    classLoader := classLoaderOrNil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   646
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   647
    "Modified: / 18-02-2012 / 20:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   648
!
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   649
651
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   650
compiledMethodAt:name
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   651
    "redefined to find the constructor"
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   652
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   653
    |m|
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   654
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   655
    m := super compiledMethodAt:name.
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   656
    m isNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   657
	name = self lastName ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   658
	    ^ super compiledMethodAt:#'<init>()V'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   659
	].
651
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   660
    ].
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   661
    ^ m
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   662
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   663
    "
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   664
     JAVA::java::lang::Object compiledMethodAt:#Object
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   665
    "
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   666
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   667
    "Created: / 24.12.1999 / 02:02:50 / cg"
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   668
    "Modified: / 24.12.1999 / 02:04:46 / cg"
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   669
!
c4f8130fb962 checkin from browser
cg
parents: 626
diff changeset
   670
185
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   671
compiledMethodAt:name signature:sig
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   672
    "lookup the classes methodDictionary"
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   673
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   674
    methodDictionary keysAndValuesDo:[:mFullSelector :aMethod |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   675
	aMethod name == name ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   676
	    aMethod signature == sig ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   677
		^ aMethod
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   678
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
   679
	]
185
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   680
    ].
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   681
    ^ nil
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   682
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   683
    "Created: 1.8.1997 / 00:01:58 / cg"
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   684
!
99ff1b6d90fe *** empty log message ***
cg
parents: 183
diff changeset
   685
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   686
constantPool
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   687
    ^ constantPool
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   688
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   689
3199
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   690
declaringClass
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   691
    | innerClassesAttr |
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   692
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   693
    innerClassesAttr := self getAttribute: #InnerClasses.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   694
    innerClassesAttr notNil ifTrue:[
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   695
        innerClassesAttr do:[:each |
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   696
            | innerClassRef outerClassRef |
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   697
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   698
            innerClassRef := self constantPool at: each innerClassRefIndex.
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   699
            outerClassRef := each outerClassRefIndex ~~ 0 ifTrue:[ self constantPool at: each outerClassRefIndex  ] ifFalse:[ nil ].
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   700
            (innerClassRef name = binaryName and:[outerClassRef notNil]) ifTrue:[
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   701
                ^ outerClassRef resolve: false.
3199
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   702
            ]
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   703
        ].
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   704
    ].
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   705
    ^ nil
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   706
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   707
    "Created: / 04-08-2014 / 22:42:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   708
    "Modified: / 03-12-2014 / 14:23:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3199
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   709
!
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   710
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   711
enclosingClass
3204
ea55682eefe7 Align JavaClass>>enclosingClass with java.lang.Class.getEnclosingClass()
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3199
diff changeset
   712
    "Returns the immediately enclosing class of the underlying
ea55682eefe7 Align JavaClass>>enclosingClass with java.lang.Class.getEnclosingClass()
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3199
diff changeset
   713
     this class.  If the this class is a top level class this
ea55682eefe7 Align JavaClass>>enclosingClass with java.lang.Class.getEnclosingClass()
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3199
diff changeset
   714
     method returns nil."
ea55682eefe7 Align JavaClass>>enclosingClass with java.lang.Class.getEnclosingClass()
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3199
diff changeset
   715
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   716
    | enclosingMethodAttr |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   717
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   718
    enclosingMethodAttr := self getAttribute: #EnclosingMethod.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   719
    enclosingMethodAttr isNil ifTrue:[
3204
ea55682eefe7 Align JavaClass>>enclosingClass with java.lang.Class.getEnclosingClass()
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3199
diff changeset
   720
        ^ self declaringClass
2733
3d97124aebf5 Fixes for syntax highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   721
    ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   722
    ^ (self constantPool at: enclosingMethodAttr first) resolve: false.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   723
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   724
    "Created: / 13-09-2013 / 01:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   725
    "Modified: / 03-12-2014 / 12:59:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   726
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   727
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   728
enclosingMethod
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   729
    | enclosingMethodAttr enclosingClass |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   730
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   731
    enclosingMethodAttr := self getAttribute: #EnclosingMethod.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   732
    enclosingMethodAttr isNil ifTrue:[ ^ nil ].
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   733
    enclosingMethodAttr second == 0 ifTrue:[ ^ nil ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   734
    enclosingClass := (self constantPool at: enclosingMethodAttr first) resolve: false.
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   735
    ^ enclosingClass compiledMethodAt: (self constantPool at: enclosingMethodAttr second) selector
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   736
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   737
    "Created: / 13-09-2013 / 01:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
   738
    "Modified: / 03-12-2014 / 13:00:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   739
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
   740
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   741
ensureHasAnnotations
3196
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   742
    annotations isNil ifTrue:[
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   743
        annotations := JavaAnnotationContainer for:self
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   744
    ].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   745
    ^ annotations
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   746
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   747
    "Created: / 25-02-2011 / 16:02:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   748
    "Modified: / 16-03-2011 / 17:13:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
3196
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   749
    "Modified: / 04-08-2014 / 15:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   750
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   751
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   752
fields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   753
    ^ fields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   754
!
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   755
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   756
javaClass
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   757
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
   758
    ^ self
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   759
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   760
    "Modified: / 22-05-2011 / 13:32:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   761
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   762
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   763
javaComponentClass
2908
064418faa2e3 Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2906
diff changeset
   764
064418faa2e3 Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2906
diff changeset
   765
    "/ this is really confusing design, should return nil here and only
064418faa2e3 Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2906
diff changeset
   766
    "/ overwrite in JavaArray....
064418faa2e3 Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2906
diff changeset
   767
    ^self
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   768
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   769
    "Created: / 20-12-2010 / 22:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   770
    "Modified: / 30-05-2011 / 23:26:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2908
064418faa2e3 Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2906
diff changeset
   771
    "Modified (comment): / 08-11-2013 / 23:07:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
691
8dcc24aeaa95 *** empty log message ***
cg
parents: 689
diff changeset
   772
!
8dcc24aeaa95 *** empty log message ***
cg
parents: 689
diff changeset
   773
2085
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   774
javaName
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   775
    "the javaname - as seen by a java programmer.
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   776
     (with '/'s replaced by dots) extract from the fullName"
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   777
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   778
    ^ binaryName copyReplaceAll:$/ with:$.
2085
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   779
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   780
    "
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   781
     Java allClasses first fullName
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   782
     Java allClasses first name
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   783
     Java allClasses first javaName
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   784
     Java allClasses first javaPackage
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   785
     Java allClasses first package
2085
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   786
    "
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   787
!
dc0785700fbb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   788
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   789
javaPackage
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   790
    "the javaPackage - as seen by a java programmer.
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   791
     (with '/'s replaced by dots) extract from the fullName"
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   792
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   793
    |components|
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   794
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   795
    components := binaryName asCollectionOfSubstringsSeparatedBy:$/.
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   796
    components size > 1 ifTrue:[
2554
46bb4696954a Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2436
diff changeset
   797
        ^ (components copyButLast:1) asStringWith:$.
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   798
    ].
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   799
    ^ binaryName
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   800
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   801
    "
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   802
     Java allClasses first fullName
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   803
     Java allClasses first javaPackage
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   804
     Java allClasses first package
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   805
    "
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   806
!
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   807
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   808
javaPackageAsDirname
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   809
    "the javaPackage - as directory in class path"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   810
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   811
    |components|
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   812
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   813
    components := binaryName asCollectionOfSubstringsSeparatedBy:$/.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   814
    components size > 1 ifTrue:[
2554
46bb4696954a Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 2436
diff changeset
   815
        ^ (components copyButLast:1) asStringWith: Filename separator
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   816
    ].
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   817
    ^ binaryName
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   818
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   819
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   820
     Java allClasses first fullName
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   821
     Java allClasses first javaPackage
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   822
     Java allClasses first package
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   823
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   824
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   825
    "Created: / 30-11-2010 / 12:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   826
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   827
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   828
javaWrapperClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   829
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   830
    binaryName == #'java/lang/String' ifTrue:[ ^ String ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   831
    self error:'Should not happen'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   832
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   833
    "Created: / 20-04-2012 / 20:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   834
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   835
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   836
lastName
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   837
    ^ binaryName copyFrom:(binaryName lastIndexOf:$/)+1
423
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   838
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   839
    "Created: / 5.11.1998 / 19:16:00 / cg"
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   840
!
08af061c56a8 javaClass now uses its fullName in name
cg
parents: 418
diff changeset
   841
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   842
nameWithoutNameSpacePrefix
3180
a80e78c59918 Make JavaClass>>nameWithoutNameSpacePrefix returning the lastName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3173
diff changeset
   843
    ^ self lastName
a80e78c59918 Make JavaClass>>nameWithoutNameSpacePrefix returning the lastName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3173
diff changeset
   844
a80e78c59918 Make JavaClass>>nameWithoutNameSpacePrefix returning the lastName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3173
diff changeset
   845
    "Created: / 20-01-1997 / 13:05:30 / cg"
a80e78c59918 Make JavaClass>>nameWithoutNameSpacePrefix returning the lastName.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3173
diff changeset
   846
    "Modified: / 25-07-2014 / 10:09:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   847
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   848
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   849
nameWithoutPrefix
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   850
    ^ self lastName
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   851
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   852
    "Created: / 20-01-1997 / 13:06:06 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   853
    "Modified: / 20-04-2012 / 18:35:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   854
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
   855
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   856
package
3186
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   857
    "Return the package symbol of the class as seen by Smalltalk"
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   858
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   859
    | packageAnnotation p i |
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   860
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   861
    "/ First, look if the class is annotated by stx.libjava.annotation.Package.
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   862
    "/ If so, return annotation's value as package name...
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   863
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   864
    annotations notNil ifTrue:[
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   865
        packageAnnotation := annotations runtimeVisible at: 'Lstx/libjava/annotation/Package;' ifAbsent:[ nil ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   866
        packageAnnotation notNil ifTrue:[
3186
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   867
            ^ packageAnnotation value
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   868
        ].
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   869
    ].
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   870
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
   871
    ((self getAttribute: #EnclosingMethod) notNil or:[ (self getAttribute: #InnerClasses) notNil ]) ifTrue:[
3207
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   872
        | top |
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   873
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   874
        top := self topEnclosingClass.
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   875
        top notNil ifTrue:[ ^ top package ].
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   876
    ].
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   877
3186
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   878
    "/ If not, extract java package name and prepend java:.
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   879
    "/ For default package, return java:(default).
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   880
    i := binaryName lastIndexOf:$/.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
   881
    p := binaryName copyTo:i - 1.
3186
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   882
    p isEmpty ifTrue:[
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   883
        ^ #'java:(default)'
2083
85a87edefd8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
   884
    ].
684
d5ee4cc0ffc2 *** empty log message ***
cg
parents: 679
diff changeset
   885
    ^ 'java:' , p
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   886
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   887
    "
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   888
     Java allClasses first fullName
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   889
     Java allClasses first package
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   890
     Java allClasses first javaPackage
22
d22e13bdf100 checkin from browser
cg
parents: 21
diff changeset
   891
    "
3186
945bee015640 Made JavaClass>>package returning Smalltalk/X package name from annotation, if annotated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   892
3207
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
   893
    "Modified: / 05-08-2014 / 22:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   894
!
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   895
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   896
protectionDomain
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   897
    ^ attributes at: #ProtectionDomain ifAbsent:[ nil ]
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   898
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   899
    "Modified: / 07-12-2014 / 01:39:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   900
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   901
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   902
protectionDomain:something
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   903
    attributes  := attributes at: #ProtectionDomain putOrAppend: something
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   904
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   905
    "Modified: / 07-12-2014 / 01:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   906
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   907
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   908
runtimeVisibleAnnotationsAsBytesOrNil
3196
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   909
    annotations isNil ifTrue:[
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   910
        ^ nil
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   911
    ].
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   912
    annotations runtimeVisible isNil ifTrue:[
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   913
        ^ nil
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   914
    ].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   915
    ^ annotations runtimeVisible bytes
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   916
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   917
    "Created: / 25-02-2011 / 16:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3196
d617b4590431 (Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
   918
    "Modified: / 04-08-2014 / 15:54:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   919
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   920
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   921
setSignature: aSymbol
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   922
    attributes := attributes at: #GenericSignature putOrAppend: aSymbol.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   923
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   924
    "Created: / 13-08-2011 / 00:30:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   925
    "Modified: / 07-12-2014 / 01:39:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   926
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   927
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   928
signatureJ
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   929
    "stupid naming, but superclass defines signature too"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   930
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   931
    ^ attributes at: #GenericSignature ifAbsent:[ nil ]
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   932
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   933
    "Created: / 13-08-2011 / 00:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   934
    "Modified: / 07-12-2014 / 01:39:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   935
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
   936
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   937
source
3428
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   938
    "Returns a source of the class as String or nil of no source is found along the Java's source paths."
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   939
    | sourceString stream |
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   940
    (sourceString := self sourceString) notNil ifTrue: [ ^ sourceString ].
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   941
    ^ [
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   942
        stream := self sourceStream.
2739
b34398d8856b Bugfix: JavaClass>>source: check for missing source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2737
diff changeset
   943
        stream notNil ifTrue:[
2780
7638771efcbe Fix in JavaClass>>source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2744
diff changeset
   944
            stream contents withTabsExpanded asString.
2739
b34398d8856b Bugfix: JavaClass>>source: check for missing source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2737
diff changeset
   945
        ] ifFalse:[
b34398d8856b Bugfix: JavaClass>>source: check for missing source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2737
diff changeset
   946
            nil
b34398d8856b Bugfix: JavaClass>>source: check for missing source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2737
diff changeset
   947
        ].
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   948
    ] ensure:[
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   949
        stream notNil ifTrue:[stream close]
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   950
    ].
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   951
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   952
    "
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   953
     (Java at:'java.awt.Frame') source
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   954
     (Java at:'ArcTest') source
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   955
     (Java at:'ArcCanvas') source
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   956
    "
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
   957
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
   958
    "Modified: / 30-07-1997 / 14:31:01 / cg"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   959
    "Modified: / 07-12-2014 / 01:32:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3428
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   960
    "Modified (comment): / 17-02-2015 / 13:43:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   961
!
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   962
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   963
sourceDecompiled
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   964
    "Returns a decompiled source code as String."
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   965
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   966
    | resources | 
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   967
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   968
    resources := self classResources.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   969
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   970
    ^ String streamContents:[:s |
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   971
        s nextPutAll: '/**'; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   972
        s nextPutAll: ' * ' ; nextPutAll: (resources string: 'No source has been found along configured source path:'); cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   973
        s nextPutAll: ' * ' ; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   974
        Java effectiveSourceDirectories do:[:d | 
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   975
            s nextPutAll: ' *     '; nextPutAll: d asString; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   976
        ].
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   977
        s nextPutAll: ' * ' ; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   978
        s nextPutAll: ' * ' ; nextPutAll: (resources string: 'You may add more source directories or archives by evaluating:'); cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   979
        s nextPutAll: ' * ' ; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   980
        s nextPutAll: ' *     '; nextPutAll: 'Java addToSourceDirectories: ''/path/to/sources''.' ; cr.
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   981
        s nextPutAll: ' */'; cr.                                                                       
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   982
        JavaDecompiler definitionOf:self on:s
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   983
    ]
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   984
    "
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   985
    JAVA java lang Object sourceDecompiled
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   986
    "
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   987
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
   988
    "Created: / 17-02-2015 / 12:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
76
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   989
!
9ff95e14dbfb *** empty log message ***
cg
parents: 74
diff changeset
   990
24
4a9822b95fc0 checkin from browser
cg
parents: 22
diff changeset
   991
sourceFile
3211
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
   992
    ^ classFilename
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
   993
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
   994
    "Modified: / 07-08-2014 / 12:26:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   995
!
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
   996
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   997
sourceStream
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   998
    | sourceString |
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
   999
    ^ (sourceString := self sourceString) notNil
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1000
        ifTrue:[ sourceString readStream ]
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1001
        ifFalse:[Java classSourceStreamFor: self ]
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1002
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1003
    "
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1004
     (Java at:'java.awt.Frame') source
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1005
     (Java at:'ArcTest') source
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1006
     (Java at:'ArcCanvas') source
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1007
    "
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1008
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1009
    "Created: / 19-09-2013 / 12:41:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1010
    "Modified: / 07-12-2014 / 01:32:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2737
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1011
!
83f8416e153c Cleanup. Change source API in `Java` to return stream rather than string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1012
2529
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  1013
sourceString
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1014
    ^attributes at: #SourceString ifAbsent: [ nil ]
2529
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  1015
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  1016
    "Created: / 19-04-2013 / 09:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1017
    "Modified: / 07-12-2014 / 01:32:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2529
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  1018
!
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  1019
83
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
  1020
staticFields
2d61ef3579e4 *** empty log message ***
cg
parents: 79
diff changeset
  1021
    ^ staticFields
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1022
!
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1023
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1024
superinterface
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1025
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1026
    | ifaces |
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1027
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1028
    self assert: self isInterface message: 'Type must be an interface'.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1029
    (ifaces := self interfaces) size == 0 ifTrue:[^nil].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1030
    ifaces size = 1 ifTrue:[^ifaces first].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1031
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1032
    self error: 'Should not happen!!'.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1033
    ^nil
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1034
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1035
    "Created: / 04-02-2011 / 12:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1036
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1037
2847
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1038
theClass
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1039
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1040
    ^ self
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1041
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1042
!
5ea0697eef5f Hack for old VM JavaClass>>binaryName:numStatic:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2846
diff changeset
  1043
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1044
topEnclosingClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1045
    | current enclosing |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1046
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1047
    current := enclosing := self enclosingClass.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1048
    [ current notNil ] whileTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1049
        enclosing := current.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1050
        current := current enclosingClass.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2561
diff changeset
  1051
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1052
    ^ enclosing
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1053
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1054
    "Created: / 13-09-2013 / 11:22:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1055
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1056
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1057
topEnclosingMethod
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1058
    | current enclosing |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1059
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1060
    current := enclosing := self enclosingMethod.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1061
    [ current notNil ] whileTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1062
        enclosing := current.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1063
        current := current enclosingMethod.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1064
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1065
    ^ enclosing
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1066
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  1067
    "Created: / 13-09-2013 / 11:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2561
diff changeset
  1068
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2561
diff changeset
  1069
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1070
typeOfField:aFieldName
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1071
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1072
    fields do:[:aField |
172
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1073
	aField name = aFieldName ifTrue:[
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1074
	    ^ aField type
c3a531a73cda *** empty log message ***
cg
parents: 170
diff changeset
  1075
	]
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1076
    ].
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1077
    self error:'no such field'
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1078
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1079
    "
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1080
     (JAVA at:#'java/awt/image/ColorModel') typeOfField:'pixel_bits'
132
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1081
    "
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1082
03c680d3427b *** empty log message ***
cg
parents: 130
diff changeset
  1083
    "Modified: 21.1.1997 / 22:48:28 / cg"
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1084
!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1085
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1086
versions
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1087
    "
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1088
    Return all existing versions of this class.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1089
    A new version is added when a class is
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1090
    updated by runtime code reload and removed when all instances of
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1091
        the version die
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1092
    "
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1093
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1094
    ^ attributes at: #Versions ifAbsent: [ nil ]
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1095
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1096
    "Created: / 14-04-2013 / 12:10:54 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1097
    "Modified: / 07-12-2014 / 01:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1098
!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1099
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1100
versions: aWeakArray
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1101
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1102
    set this class' versions. It is expected that all versions of the
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1103
    class will share the same weak array instance.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1104
    "
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1105
    attributes :=attributes at:#Versions putOrAppend: aWeakArray.
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1106
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  1107
    "Created: / 14-04-2013 / 12:28:09 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1108
    "Modified: / 07-12-2014 / 01:36:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2817
96f3e2254489 remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2800
diff changeset
  1109
!
96f3e2254489 remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2800
diff changeset
  1110
96f3e2254489 remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2800
diff changeset
  1111
versionsArray
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1112
    | versions |
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1113
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1114
    versions := self versions.
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1115
    ^ versions isNil ifTrue: [ Array with: self ] ifFalse: [ versions ].
2817
96f3e2254489 remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2800
diff changeset
  1116
96f3e2254489 remove JavaConstantPool#ConstantPools weak array, use JavaVM registry instead
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2800
diff changeset
  1117
    "Created: / 08-10-2013 / 18:38:52 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1118
    "Modified: / 07-12-2014 / 01:37:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1119
! !
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
  1120
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1121
!JavaClass methodsFor:'accessing - java'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1122
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1123
javaMirror
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1124
    ^self javaMirrorClass forClass: self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1125
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1126
    "Created: / 01-08-2012 / 00:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1127
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1128
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1129
javaMirrorClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1130
    ^JavaMirror mirrorClassForJavaClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1131
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1132
    "Created: / 31-07-2012 / 17:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1133
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1134
213
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1135
!JavaClass methodsFor:'adding / removing'!
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1136
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1137
removeFromSystem
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1138
     Java removeClass:self
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1139
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1140
    "Created: 12.8.1997 / 02:46:51 / cg"
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1141
! !
4b4b6ad3f5f8 *** empty log message ***
cg
parents: 204
diff changeset
  1142
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1143
!JavaClass methodsFor:'autoboxing'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1144
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1145
javaBox:anObject
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1146
    ^ anObject
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1147
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1148
    "Created: / 14-08-2011 / 22:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1149
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1150
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1151
javaUnwrap: object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1152
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1153
    | nm |
2906
3dd946439657 Fix in JavaClass>>#javaUnwrap: care for nil/null.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2885
diff changeset
  1154
3dd946439657 Fix in JavaClass>>#javaUnwrap: care for nil/null.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2885
diff changeset
  1155
    object isNil ifTrue:[ ^ nil ].
3dd946439657 Fix in JavaClass>>#javaUnwrap: care for nil/null.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2885
diff changeset
  1156
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1157
    nm := object class binaryName.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1158
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1159
    nm == #'java/lang/Byte' ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1160
        ^object instVarNamed: #value.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1161
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1162
    nm == #'java/lang/Short' ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1163
        ^object instVarNamed: #value.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1164
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1165
    nm == #'java/lang/Integer' ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1166
        ^object instVarNamed: #value.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1167
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1168
    nm == #'java/lang/Long' ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1169
        ^object instVarNamed: #value.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1170
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1171
    nm == #'java/lang/Character' ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1172
        ^Character codePoint: (object instVarNamed: #value)
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1173
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1174
    nm == #'java/lang/Boolean' ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1175
        ^(object instVarNamed: #value) == 1
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1176
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1177
    nm == #'java/lang/String' ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1178
        ^ Java as_ST_String: object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1179
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1180
    nm == #'java/lang/Class' ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1181
        ^ JavaVM classForJavaClassObject: object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1182
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1183
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1184
    ^object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1185
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1186
    "Created: / 10-12-2011 / 19:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1187
    "Modified: / 12-12-2011 / 18:05:29 / kursjan <kursjan@fit.cvut.cz>"
2906
3dd946439657 Fix in JavaClass>>#javaUnwrap: care for nil/null.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2885
diff changeset
  1188
    "Modified: / 07-11-2013 / 12:50:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1189
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1190
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1191
javaWrap: object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1192
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1193
    object isNil ifTrue:[ ^ nil ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1194
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1195
    object class isJavaPrimitiveType ifTrue:[
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1196
       (self binaryName == #'java/lang/Object' or:[self == object class javaWrapperClass]) ifTrue:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1197
            ^object class javaWrapperClass newCleared
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1198
                instVarNamed: #value put: object;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1199
                yourself
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1200
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1201
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1202
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1203
    object isString ifTrue:[
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1204
        (self binaryName == #'java/lang/Object' or:[
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1205
        self binaryName == #'java/lang/String']) ifTrue:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1206
            ^ Java as_String: object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1207
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1208
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1209
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1210
    ^object
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1211
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1212
    "Modified: / 12-12-2011 / 18:05:29 / kursjan <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1213
    "Created: / 24-02-2012 / 19:32:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1214
    "Modified: / 08-10-2013 / 22:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1215
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1216
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1217
!JavaClass methodsFor:'browser interface'!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1218
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1219
isVisualStartable
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1220
    "return true, if this is an application class,
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1221
     which can be started via #open"
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1222
    "/ if I have a main() method, I am
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1223
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1224
    (self compiledMethodAt: #'main([Ljava/lang/String;)V') notNil ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1225
        ^ true
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1226
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1227
    (self isSubclassOf: (JavaVM at: 'java/applet/Applet')) ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1228
        ^ true.
2087
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1229
    ].
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1230
    ^ false
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1231
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1232
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1233
open
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1234
    "start a thread for my main method"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1235
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1236
    "/ if I have a main, call it ...
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1237
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1238
    (self compiledMethodAt:#'main([Ljava/lang/String;)V') notNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1239
	^ self startMain
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1240
    ].
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1241
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1242
    "/ otherwise, create a frame and wrap me;
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1243
    "/ as in:
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1244
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1245
"/    public static void main(String args[]) {
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1246
"/        Frame f = new Frame("myName");
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1247
"/        mySelf me = new mySelf();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1248
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1249
"/        me.init();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1250
"/        me.start();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1251
"/
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1252
"/        f.add("Center", me);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1253
"/        f.setSize(300, 300);
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1254
"/        f.show();
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1255
"/    }
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1256
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1257
    ^ self startApplet
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1258
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1259
    "Created: / 15.1.1998 / 17:18:30 / cg"
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1260
    "Modified: / 3.11.1998 / 22:51:47 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1261
! !
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1262
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
  1263
!JavaClass methodsFor:'compiler interface'!
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
  1264
566
72e93eb27907 checkin from browser
cg
parents: 546
diff changeset
  1265
browserClass
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1266
    "return the browser to use for this class -
566
72e93eb27907 checkin from browser
cg
parents: 546
diff changeset
  1267
     this can be redefined in special classes, to get different browsers"
72e93eb27907 checkin from browser
cg
parents: 546
diff changeset
  1268
679
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  1269
"/    ^ JavaBrowser
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  1270
    ^ super browserClass.
566
72e93eb27907 checkin from browser
cg
parents: 546
diff changeset
  1271
72e93eb27907 checkin from browser
cg
parents: 546
diff changeset
  1272
    "Modified: / 14.10.1998 / 15:28:38 / cg"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1273
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1274
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1275
syntaxHighlighterClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1276
    "return the class to use for syntaxHighlighting (prettyPrinting) this class -
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1277
     this can be redefined in special classes, to highlight classes with
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1278
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1279
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1280
    ^ self class == JavaClass ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1281
        super syntaxHighlighterClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1282
    ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1283
        JavaLanguage instance syntaxHighlighterClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1284
    ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1285
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1286
    "Created: / 15-02-2012 / 01:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
183
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
  1287
! !
d1d05241d1f5 checkin from browser
cg
parents: 181
diff changeset
  1288
624
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1289
!JavaClass methodsFor:'compiling'!
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1290
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1291
recompileMethodsAccessingGlobal:aGlobalKey
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1292
    "/ dummy for now
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1293
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1294
    "Created: / 9.11.1999 / 16:42:09 / cg"
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1295
! !
35975d55bbb5 checkin from browser
cg
parents: 619
diff changeset
  1296
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  1297
!JavaClass methodsFor:'documentation support'!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  1298
626
cg
parents: 625
diff changeset
  1299
htmlDocumentation
cg
parents: 625
diff changeset
  1300
    ^ nil "/ replace by access to javadoc-generated documentation later
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  1301
626
cg
parents: 625
diff changeset
  1302
    "Modified: 22.3.1997 / 14:18:50 / cg"
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  1303
! !
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  1304
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1305
!JavaClass methodsFor:'exception handling support'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1306
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1307
accepts: signal
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1308
    "Return true, iff receicer is a throwable and
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1309
     handles given signal (presumably another throwable class)"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1310
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1311
    | cls |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1312
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1313
    signal isJavaClass ifFalse:[ ^ false ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1314
    self == signal ifTrue:[ ^ true ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1315
    cls := signal.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1316
    [ cls ~~ JavaObject ] whileTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1317
        self == cls ifTrue:[ ^ true ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1318
        cls := cls superclass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1319
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1320
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1321
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1322
    "Created: / 18-03-2012 / 14:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1323
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1324
2853
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1325
creator
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1326
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1327
    ^self class.
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1328
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1329
    "Created: / 14-10-2013 / 11:29:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1330
!
095a83d77fe3 Added #creator for mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2851
diff changeset
  1331
2603
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
  1332
handlerForSignal:exceptionHandler context:theContext originator:originator
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
  1333
    ^nil
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
  1334
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
  1335
!
000dff7f0e7b Optimization of JavaClass>>includesBehavior:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2591
diff changeset
  1336
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1337
handles: anObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1338
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1339
    Transcript showCR:'>>>> JavaClass>>handles: ' , anObject printString.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1340
    Transcript showCR:'     from: ', thisContext sender printString.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1341
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1342
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1343
    "Created: / 18-03-2012 / 14:19:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1344
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1345
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1346
isControlInterrupt
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1347
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1348
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1349
    "Created: / 20-08-2012 / 14:17:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1350
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1351
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1352
isExceptionCreator
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1354
"/    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1355
    ^self isThrowable
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1356
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1357
    "Created: / 18-03-2012 / 20:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1358
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1359
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1360
isExceptionHandler
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1361
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1362
"/    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1363
    ^self isThrowable
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1364
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1365
    "Created: / 18-03-2012 / 14:18:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1366
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1367
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1368
isQuerySignal
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1369
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1370
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1371
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1372
    "Created: / 18-03-2012 / 22:18:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1373
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1374
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1375
isThrowable
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1376
    "Returns true, if the receiver is an instance
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1377
     of java.lang.Throwable, false otherwise"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1378
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1379
    | cls |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1380
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1381
    [ cls ~~ JavaObject ] whileTrue:[
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1382
        cls binaryName == #'java/lang/Throwable' ifTrue:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1383
            ^true
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1384
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1385
        cls := cls superclass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1386
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1387
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1388
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1389
    "Created: / 18-03-2012 / 20:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1390
    "Modified: / 08-10-2013 / 22:36:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1391
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1392
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1393
parent
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1394
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1395
    ^nil
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1396
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1397
    "Created: / 18-03-2012 / 22:19:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1398
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1399
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1400
signal
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1401
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1402
    ^self class.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1403
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1404
    "Created: / 05-07-2012 / 08:56:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1405
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1406
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1407
!JavaClass methodsFor:'executing programs'!
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1408
626
cg
parents: 625
diff changeset
  1409
startApplet
2087
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1410
    |f me stub top appFrame|
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1411
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1412
    top := StandardSystemView new.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1413
    appFrame := JavaEmbeddedFrameView new.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1414
    appFrame origin:0.0@0.0 corner:1.0@1.0.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1415
    top addSubView:appFrame.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1416
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1417
    appFrame appletIsPreloaded:true.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1418
    appFrame codeURL:'file:/dummy'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1419
    appFrame codeBaseURL:'file:/dummy'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1420
    appFrame autoSetupApplet:true.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1421
    appFrame autoStartApplet:true.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1422
    appFrame autoDestroyApplet:true.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1423
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1424
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1425
    top open.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1426
    ^ self.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1427
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1428
    "/ TODO: setup embeddedAppletFrame correctly
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1429
    "/ (for getParameter to work ...)
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1430
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1431
    "/ create a frame and wrap me;
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1432
    "/ as in:
693
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1433
2087
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1434
"/    public static void main(String args[]) {
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1435
"/        Frame f = new Frame("myName");
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1436
"/        mySelf me = new mySelf();
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1437
"/
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1438
"/        me.init();
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1439
"/        me.start();
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1440
"/
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1441
"/        f.add("Center", me);
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1442
"/        f.setSize(300, 300);
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1443
"/        f.show();
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1444
"/    }
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1445
    f := (Java at:'java.awt.Frame') basicNew.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1446
    f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name).
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1447
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1448
    me := self basicNew.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1449
    me perform:#'<init>()V'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1450
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1451
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1452
    stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1453
    me instVarNamed:'stub' put:stub.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1454
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1455
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1456
    me perform:#'init()V'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1457
    me perform:#'start()V'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1458
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1459
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1460
    f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1461
	 with:(Java as_String:'Center')
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1462
	 with:me.
2087
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1463
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1464
    f perform:#'setSize(II)V' with:300 with:300.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1465
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1466
    f perform:#'show()V'.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1467
self halt.
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1468
2e1a2d10b891 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  1469
    "Modified: / 3.11.1998 / 23:04:41 / cg"
693
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1470
    "/ TODO: setup embeddedAppletFrame correctly
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1471
    "/ (for getParameter to work ...)
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1472
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1473
    "/ create a frame and wrap me;
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1474
    "/ as in:
626
cg
parents: 625
diff changeset
  1475
693
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1476
"/    public static void main(String args[]) {
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1477
"/        Frame f = new Frame("myName");
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1478
"/        mySelf me = new mySelf();
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1479
"/
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1480
"/        me.init();
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1481
"/        me.start();
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1482
"/
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1483
"/        f.add("Center", me);
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1484
"/        f.setSize(300, 300);
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1485
"/        f.show();
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1486
"/    }
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1487
    f := (Java at:'java.awt.Frame') basicNew.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1488
    f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name).
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1489
self halt.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1490
    me := self basicNew.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1491
    me perform:#'<init>()V'.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1492
self halt.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1493
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1494
    stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1495
    me instVarNamed:'stub' put:stub.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1496
self halt.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1497
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1498
    me perform:#'init()V'.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1499
    me perform:#'start()V'.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1500
self halt.
2beae7b13cdb *** empty log message ***
cg
parents: 691
diff changeset
  1501
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1502
    f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;'
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1503
	 with:(Java as_String:'Center')
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1504
	 with:me.
626
cg
parents: 625
diff changeset
  1505
self halt.
413
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1506
    f perform:#'setSize(II)V' with:300 with:300.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1507
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1508
    f perform:#'show()V'.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1509
self halt.
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1510
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1511
    "Modified: / 3.11.1998 / 23:04:41 / cg"
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1512
!
51672b6b5010 checkin from browser
cg
parents: 407
diff changeset
  1513
626
cg
parents: 625
diff changeset
  1514
startMain
cg
parents: 625
diff changeset
  1515
    "start a thread for my main() method"
cg
parents: 625
diff changeset
  1516
cg
parents: 625
diff changeset
  1517
    ^ self startMainWithArgumentString:nil
cg
parents: 625
diff changeset
  1518
cg
parents: 625
diff changeset
  1519
    "Modified: / 30.12.1998 / 20:24:58 / cg"
cg
parents: 625
diff changeset
  1520
!
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1521
626
cg
parents: 625
diff changeset
  1522
startMainWithArgumentString:aCommandLineString
cg
parents: 625
diff changeset
  1523
    "start a thread for my main() method, passing a string with arguments"
cg
parents: 625
diff changeset
  1524
cg
parents: 625
diff changeset
  1525
    |p|
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1526
626
cg
parents: 625
diff changeset
  1527
    p := Java javaProcessForMainOf:self argumentString:aCommandLineString.
cg
parents: 625
diff changeset
  1528
    p notNil ifTrue:[
2561
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1529
        p resume.
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1530
        AbortOperationRequest handle:[:ex |
626
cg
parents: 625
diff changeset
  1531
p == JavaVM javaScreenUpdaterThread ifTrue:[self halt].
654
da8d060a3150 checkin from browser
cg
parents: 651
diff changeset
  1532
p == JavaVM javaEventQueueThread ifTrue:[self halt].
2561
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1533
            p terminate.
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1534
            ex reject.
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1535
        ] do:[
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1536
            p waitUntilTerminated
2e27f294057e exception access
Claus Gittinger <cg@exept.de>
parents: 2554
diff changeset
  1537
        ].
508
21d8af9a9b41 checkin from browser
cg
parents: 492
diff changeset
  1538
    ]
21d8af9a9b41 checkin from browser
cg
parents: 492
diff changeset
  1539
654
da8d060a3150 checkin from browser
cg
parents: 651
diff changeset
  1540
    "Modified: / 24.12.1999 / 02:35:04 / cg"
626
cg
parents: 625
diff changeset
  1541
! !
312
f753abec575a more app-starters
cg
parents: 281
diff changeset
  1542
626
cg
parents: 625
diff changeset
  1543
!JavaClass methodsFor:'fileOut'!
cg
parents: 625
diff changeset
  1544
cg
parents: 625
diff changeset
  1545
basicFileOutDefinitionOn:aStream withNameSpace:nameSpaceBoolean
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1546
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1547
    | source |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1548
    source := self theNonMetaclass source.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1549
    source notNil ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1550
        aStream nextPutAll: source
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1551
    ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1552
        JavaDecompiler definitionOf:self on:aStream
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1553
    ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1554
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1555
    "Modified: / 22-03-1997 / 14:30:28 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1556
    "Modified: / 14-12-2011 / 22:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
626
cg
parents: 625
diff changeset
  1557
!
cg
parents: 625
diff changeset
  1558
cg
parents: 625
diff changeset
  1559
fileOut
cg
parents: 625
diff changeset
  1560
    self warn:'fileOut not yet supported'
cg
parents: 625
diff changeset
  1561
cg
parents: 625
diff changeset
  1562
    "Modified: 22.3.1997 / 14:30:28 / cg"
cg
parents: 625
diff changeset
  1563
    "Created: 22.3.1997 / 14:35:43 / cg"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1564
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1565
3215
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1566
fileOutAs:filenameString
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1567
    "create a file consisting of all methods in myself in
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1568
     sourceForm, from which the class can be reconstructed (by filing in).
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1569
     The given fileName should be a full path, including suffix.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1570
     Care is taken, to not clobber any existing file in
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1571
     case of errors (for example: disk full).
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1572
     Also, since the classes methods need a valid sourcefile, the current
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1573
     sourceFile may not be rewritten."
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1574
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1575
    |filename fileExists needRename sameFile s mySourceFileID anySourceRef outStream savFilename|
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1576
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1577
    self isLoaded ifFalse:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1578
        ^ FileOutErrorSignal
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1579
            raiseRequestWith:self
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1580
                 errorString:' - will not fileOut unloaded class: ', self name
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1581
    ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1582
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1583
    filename := filenameString asFilename.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1584
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1585
    "
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1586
     if file exists, copy the existing to a .sav-file,
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1587
     create the new file as XXX.new-file,
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1588
     and, if that worked rename afterwards ...
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1589
    "
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1590
    [
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1591
        fileExists := filename exists.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1592
        fileExists ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1593
            sameFile := false.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1594
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1595
            "/ check carefully - maybe, my source does not really come from that
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1596
            "/ file (i.e. all of my methods have their source as string)
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1597
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1598
            anySourceRef := self sourceString isNil.
3215
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1599
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1600
            anySourceRef ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1601
                s := self sourceStream.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1602
                s notNil ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1603
                    OperatingSystem isUNIXlike ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1604
                        mySourceFileID := s pathName asFilename info id.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1605
                        sameFile := (filename info id) == mySourceFileID.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1606
                    ] ifFalse:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1607
                        mySourceFileID := s pathName asFilename asAbsoluteFilename.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1608
                        sameFile := (filename asFilename asAbsoluteFilename) = mySourceFileID.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1609
                    ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1610
                    s close.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1611
                ] ifFalse:[
3215
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1612
                    sameFile := false.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1613
                ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1614
            ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1615
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1616
            sameFile ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1617
                ^ FileOutErrorSignal
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1618
                    raiseRequestWith:filenameString
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1619
                    errorString:(' - may not overwrite sourcefile: %1\try again after loading sources in the browser' withCRs bindWith:filenameString)
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1620
            ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1621
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1622
            outStream := FileStream newTemporaryIn:filename directory.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1623
            outStream fileName accessRights:filename accessRights.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1624
            needRename := true
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1625
        ] ifFalse:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1626
            "/ another possible trap: if my sourceFileName is
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1627
            "/ the same as the written one AND the new files directory
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1628
            "/ is along the sourcePath, we also need a temporary file
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1629
            "/ first, to avoid accessing the newly written file.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1630
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1631
            self instAndClassMethodsDo:[:m |
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1632
                |mSrc mSrcFilename|
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1633
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1634
                (anySourceRef isNil and:[(mSrc := m sourceFilename) notNil]) ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1635
                    mSrcFilename := mSrc asFilename.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1636
                    (mSrcFilename baseName = filename baseName
3215
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1637
                     and:[mSrcFilename exists]) ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1638
                        anySourceRef := mSrcFilename.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1639
                    ]
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1640
                ]
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1641
            ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1642
            anySourceRef notNil ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1643
                outStream := FileStream newTemporaryIn:filename directory.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1644
                outStream fileName accessRights:anySourceRef accessRights.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1645
                needRename := true
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1646
            ] ifFalse:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1647
                outStream := filename writeStream.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1648
                needRename := false
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1649
            ]
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1650
        ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1651
    ] on:FileStream openErrorSignal do:[:ex|
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1652
        ^ FileOutErrorSignal
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1653
                raiseRequestWith:filename name
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1654
                errorString:(' - cannot create file:', filename name)
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1655
    ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1656
    self fileOutOn:outStream.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1657
    outStream syncData; close.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1658
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1659
    "
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1660
     finally, replace the old-file
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1661
     be careful, if the old one is a symbolic link; in this case,
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1662
     we have to do a copy ...
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1663
    "
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1664
    needRename ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1665
        fileExists ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1666
            savFilename := filename addSuffix:'.sav~'.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1667
            filename renameTo:savFilename.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1668
        ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1669
        outStream fileName renameTo:filename.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1670
        fileExists ifTrue:[
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1671
            savFilename delete.
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1672
        ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1673
    ].
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1674
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1675
    "Created: / 08-08-2014 / 21:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1676
    "Modified: / 07-12-2014 / 01:33:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3215
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1677
!
1f63ee2cdd97 Fixed JavaClass>>fileOutAs:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3214
diff changeset
  1678
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1679
fileOutInto: directory
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1680
    "writes itself into the given directory including package hierarchy"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1681
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1682
    | packageDir |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1683
    packageDir := directory / self javaPackageAsDirname.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1684
    packageDir recursiveMakeDirectory.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1685
    packageDir / (self lastName , '.java')
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1686
        writingFileDo: [:out | self fileOutOn: out ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1687
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1688
    "Created: / 08-12-2012 / 22:32:19 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1689
    "Modified: / 09-12-2012 / 09:07:58 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1690
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1691
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1692
fileOutMethod:aMethod on:aStream
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1693
    "file out aMethod onto aStream. Used for example to write individual changeChunks"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1694
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1695
    |cat source privacy|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1696
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1697
    self assert: aMethod programmingLanguage isSmalltalk.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1698
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1699
    aStream nextPutChunkSeparator.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1700
"/    aStream nextPutAll: 'JAVA'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1701
"/    (self name tokensBasedOn: $/) do:[:each|
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1702
"/        aStream space; nextPutAll: each.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1703
"/    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1704
    aStream nextPutAll:'(Java classForName:'''.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1705
    aStream nextPutAll:(self javaName).
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1706
    aStream nextPutAll:''')'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1707
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1708
    (privacy := aMethod privacy) ~~ #public ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1709
        aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1710
    ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1711
        aStream nextPutAll:' methodsFor:'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1712
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1713
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1714
    cat := aMethod category ? ''.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1715
    aStream nextPutAll:cat asString storeString.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1716
    aStream nextPutChunkSeparator; cr; cr.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1717
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1718
    source := aMethod source.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1719
    source isNil ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1720
        FileOutErrorSignal
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1721
            raiseRequestWith:self
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1722
            errorString:(' - no source for method: ' ,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1723
                         self name , '>>' ,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1724
                         (self selectorAtMethod:aMethod))
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1725
    ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1726
        aStream nextChunkPut:source.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1727
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1728
    aStream space.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1729
    aStream nextPutChunkSeparator.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1730
    aStream cr
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1731
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1732
    "Created: / 05-09-2012 / 00:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  1733
    "Modified: / 08-10-2013 / 22:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1734
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1735
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1736
fileOutOn: aWriteStream
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1737
aWriteStream nextPutAll: self theNonMetaclass source.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1738
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1739
    "Created: / 08-12-2012 / 22:25:28 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1740
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1741
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1742
!JavaClass methodsFor:'interop support'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1743
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1744
perform:aMessage onReceiver:receiver from:sender ifNotFound:aBlock
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1745
2521
c8bbef09a411 Added skipInDebuggerWklkback pragma to show the relevant context when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2504
diff changeset
  1746
    <resource: #skipInDebuggersWalkBack>
c8bbef09a411 Added skipInDebuggerWklkback pragma to show the relevant context when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2504
diff changeset
  1747
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1748
    | lo method  selector class args|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1749
    selector := aMessage selector.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1750
    args := aMessage arguments.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1751
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1752
    (selector includes: $() ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1753
        "Java selector, search static methods"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1754
        method := methodDictionary at:selector ifAbsent:[nil].
2791
6a57107d168a Improvement in interop/java extensions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2780
diff changeset
  1755
        (method notNil and:[method isStatic]) ifTrue:[
2937
65d127f0c9c1 Fix in interop - make sure the class is initialized when invoking static method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2916
diff changeset
  1756
            "/ Must ensure the class is initialized here!! See documentation
65d127f0c9c1 Fix in interop - make sure the class is initialized when invoking static method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2916
diff changeset
  1757
            "/ for INVOKESTATIC
65d127f0c9c1 Fix in interop - make sure the class is initialized when invoking static method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2916
diff changeset
  1758
            method javaClass classInit.
65d127f0c9c1 Fix in interop - make sure the class is initialized when invoking static method.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2916
diff changeset
  1759
            "/ Now, fire the method
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1760
            ^ method valueWithReceiver:self arguments:args selector:selector search:self class
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1761
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1762
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1763
2715
6cb9da58d6b3 Fix in interop - delegate to receiver's class, not to `self class`...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2705
diff changeset
  1764
    class := receiver class.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1765
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1766
    lo := class getLookupObject isNil ifTrue: [ JavaLookup instance ] ifFalse: [ class lookupObject ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1767
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1768
    method := lo lookupMethodForSelector: selector
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1769
            directedTo: class
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1770
            for: receiver
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1771
            withArguments: args
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1772
            from: thisContext sender
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1773
            ilc: nil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1774
2791
6a57107d168a Improvement in interop/java extensions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2780
diff changeset
  1775
    ^ method isNil ifTrue:[
6a57107d168a Improvement in interop/java extensions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2780
diff changeset
  1776
        aBlock value.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1777
    ] ifFalse:[
2970
c9408352a572 Fix in JavaClass>>#perform:onReceiver:from:ifNotFound: pass selector/sender when evaluatinh method using Method>>valueWith:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2968
diff changeset
  1778
        method valueWithReceiver: receiver arguments: args selector: aMessage selector search: receiver class sender: sender
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1779
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1780
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1781
    "Created: / 19-09-2011 / 23:33:06 / Jan Kurs <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1782
    "Modified: / 10-04-2012 / 16:47:31 / kursjan"
2970
c9408352a572 Fix in JavaClass>>#perform:onReceiver:from:ifNotFound: pass selector/sender when evaluatinh method using Method>>valueWith:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2968
diff changeset
  1783
    "Modified: / 07-01-2014 / 13:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  1784
! !
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  1785
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1786
!JavaClass methodsFor:'java initialization'!
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  1787
626
cg
parents: 625
diff changeset
  1788
classInit
2885
64b02ee49807 Addes synchronization in JavaClass>>classInit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2854
diff changeset
  1789
    "Perform the initialization of a class or interface. "
64b02ee49807 Addes synchronization in JavaClass>>classInit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2854
diff changeset
  1790
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1791
    | m |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1792
    (accessFlags bitAnd: ACX_INITIALIZED) ~~ 0 ifTrue: [ ^ self ].
2885
64b02ee49807 Addes synchronization in JavaClass>>classInit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2854
diff changeset
  1793
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1794
    self synchronized:[
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1795
        (((accessFlags bitAnd: ACX_INITIALIZED) == 0) and:[(accessFlags bitAnd: ACX_INITIALIZING) == 0]) ifTrue: [
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1796
            accessFlags := accessFlags bitOr: ACX_INITIALIZING.
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1797
            superclass ~~ JavaObject ifTrue: [ superclass classInit ].
3198
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1798
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1799
            "JV@2014-08-04: Flush caches here."
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1800
            "/ Class reader does not flush caches, instead caches are flushed
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1801
            "/ here, at the very last moment, when a class is actually initialized. This should
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1802
            "/ be sufficent as an object cannot be sent a message unless a class is
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1803
            "/ initialized first. This saves us a little bit of time when reading classes
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1804
            "/ but cost time when initializing the class, so normally this is not much
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1805
            "/ of a saving. However, this helps in cases Java class is only read into memory
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1806
            "/ and never initialized - that's what JBrowser Workspace does.
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1807
            ObjectMemory flushCaches.
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1808
            "JV@2011-12-03: Also call initializeStaticFields"
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1809
            self initializeStaticFields.
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1810
            m := self compiledMethodAt: #'<clinit>()V'.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1811
            m notNil ifTrue: [
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1812
                    "/Logger log: ('calling <clinit>()V of %1' bindWith: self name) severity: #trace facility: 'JVM'.
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1813
                    OrderOfClassInits notNil ifTrue: [ OrderOfClassInits add: self. ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1814
                    m
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1815
                        valueWithReceiver: self
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1816
                        arguments: #()
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1817
                        selector: #'<clinit>()V'
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1818
                        search: self class
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1819
                        sender: nil.
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1820
                   "/Logger log: ('calling <clinit>()V of %1 done' bindWith: self name) severity: #trace facility: 'JVM'.
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1821
            ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1822
            accessFlags := accessFlags bitOr:  ACX_INITIALIZED.
2957
02b58c7079ac Added JavaObject>>synchronized: and JavaClass>>synchronized:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2956
diff changeset
  1823
            accessFlags := accessFlags bitAnd: ACX_INITIALIZING bitInvert32.
2885
64b02ee49807 Addes synchronization in JavaClass>>classInit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2854
diff changeset
  1824
        ].
626
cg
parents: 625
diff changeset
  1825
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1826
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1827
    (JavaVM booted and: [JavaVM eagerResolvingEnabled] )ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1828
        JavaClassReader classLoaderQuerySignal answer: classLoader
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1829
            do: [ self resolveAll. ]
626
cg
parents: 625
diff changeset
  1830
    ].
cg
parents: 625
diff changeset
  1831
cg
parents: 625
diff changeset
  1832
    "
cg
parents: 625
diff changeset
  1833
     JavaVM instructionTrace:true.
cg
parents: 625
diff changeset
  1834
     JavaVM callTrace:true.
cg
parents: 625
diff changeset
  1835
cg
parents: 625
diff changeset
  1836
     (Java classNamed:'java.lang.String') classInit
cg
parents: 625
diff changeset
  1837
     (Java classNamed:'java.lang.System') classInit
cg
parents: 625
diff changeset
  1838
cg
parents: 625
diff changeset
  1839
     (Java classNamed:'java/io/FileDescriptor') classInit
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1840
     (Java classNamed:'java.util.Properties') classInit"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  1841
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1842
    "Modified: / 12-11-1998 / 15:41:11 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1843
    "Modified: / 18-08-2011 / 19:37:33 / jv"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1844
    "Modified: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
3198
a4ddeef7c5e9 Class reading optimization [4/4]: defer cache flushing at class initialization time.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3196
diff changeset
  1845
    "Modified (comment): / 04-08-2014 / 17:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1846
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1847
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1848
classInitInternal
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1849
    "Called by the JIT-compiled code when a class needs to be initialized"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1850
2583
064a97a8936d Fix in classInitInternal.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2578
diff changeset
  1851
    | m |
064a97a8936d Fix in classInitInternal.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2578
diff changeset
  1852
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1853
    self classInit.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1854
    "Force recompilation"
2583
064a97a8936d Fix in classInitInternal.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2578
diff changeset
  1855
    (m := thisContext sender method) isJavaMethod ifTrue:[m flushCode].
064a97a8936d Fix in classInitInternal.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2578
diff changeset
  1856
064a97a8936d Fix in classInitInternal.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2578
diff changeset
  1857
626
cg
parents: 625
diff changeset
  1858
!
cg
parents: 625
diff changeset
  1859
cg
parents: 625
diff changeset
  1860
initializeStaticFields
cg
parents: 625
diff changeset
  1861
    staticFields isNil ifTrue:[^ self].
cg
parents: 625
diff changeset
  1862
cg
parents: 625
diff changeset
  1863
    staticFields do:[:f |
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1864
        |val type|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1865
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1866
        (val := f constantValue) isNil ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1867
            "/ careful: int/long etc. constants must be initialized
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1868
            "/ with correct type.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1869
            type := f type.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1870
            type == #long ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1871
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1872
            ] ifFalse:[type == #int ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1873
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1874
            ] ifFalse:[type == #float ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1875
                val := 0.0 asShortFloat
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1876
            ] ifFalse:[type == #double ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1877
                val := 0.0
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1878
            ] ifFalse:[type == #byte ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1879
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1880
            ] ifFalse:[type == #char ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1881
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1882
            ] ifFalse:[type == #'unsigned short' ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1883
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1884
            ] ifFalse:[type == #boolean ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1885
                val := 0.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1886
            ]]]]]]]].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1887
        ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1888
            val class == JavaStringRef2 ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1889
                val := val resolve
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1890
            ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1891
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1892
        self instVarNamed:(f name) put:val.
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  1893
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1894
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1895
    "Modified: / 03-12-2011 / 12:28:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1896
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1897
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1898
resolveAll
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1899
    "resolve every ref in constantPool"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1900
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1901
    constantPool do: [
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1902
        :each |
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1903
        (each isJavaRef or: [ each isJavaNameAndType ]) ifTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1904
            each resolve: false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1905
        ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1906
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1907
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1908
    "Created: / 18-11-2011 / 15:26:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1909
    "Modified: / 23-02-2012 / 17:14:09 / Marcel Hlopko <hlopik@gmail.com>"
626
cg
parents: 625
diff changeset
  1910
! !
cg
parents: 625
diff changeset
  1911
cg
parents: 625
diff changeset
  1912
!JavaClass methodsFor:'java instance creation'!
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1913
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1914
basicNew
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1915
    "Create a new cleared JAVA instance. Its instVars are cleared to the
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1916
     corresponding typed values; however, constructor is not invoked."
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1917
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1918
    "/ Reimplemeted for speed as a C function. That function is
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1919
    "/ also called from JIT-compiled code, resulting in 40-50% speedup
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1920
    "/ when running Java code
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1921
2980
604d4f079e66 Fix in JavaClass>>basicNew initialize class if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2970
diff changeset
  1922
    self isInitialized ifFalse:[
604d4f079e66 Fix in JavaClass>>basicNew initialize class if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2970
diff changeset
  1923
        self classInit
604d4f079e66 Fix in JavaClass>>basicNew initialize class if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2970
diff changeset
  1924
    ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  1925
%{
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1926
    extern OBJ ___new();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1927
    RETURN ( ___new(self) );
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1928
%}.
3214
c38fcee7b0da Fixes bad bug in Java thread handling that caused memory/resource leak.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3211
diff changeset
  1929
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  1930
    "Modified: / 07-12-2014 / 02:11:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1931
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1932
626
cg
parents: 625
diff changeset
  1933
initValueFor:instVarName
cg
parents: 625
diff changeset
  1934
    |idx field|
cg
parents: 625
diff changeset
  1935
cg
parents: 625
diff changeset
  1936
    idx := fields findFirst:[:field | field name = instVarName].
cg
parents: 625
diff changeset
  1937
    idx == 0 ifTrue:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1938
        superclass ~~ JavaObject ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1939
            ^ superclass initValueFor:instVarName
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1940
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1941
        ^0 "/lockWord"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1942
    ] ifFalse:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1943
        field := fields at:idx.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1944
        ^ field initialValue
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1945
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1946
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1947
    "Modified: / 26-08-2012 / 20:08:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1948
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  1949
626
cg
parents: 625
diff changeset
  1950
newCleared
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1951
    <resource: #obsolete>
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1952
    "Use #basicNew"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1953
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1954
    ^self basicNew
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1955
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1956
    "Modified: / 13-11-1998 / 14:10:45 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  1957
    "Modified: / 10-03-2011 / 22:38:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1958
    "Modified: / 02-11-2012 / 21:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
451
50d24dc93f8b checkin from browser
cg
parents: 438
diff changeset
  1959
!
50d24dc93f8b checkin from browser
cg
parents: 438
diff changeset
  1960
626
cg
parents: 625
diff changeset
  1961
newWith_String:argString
cg
parents: 625
diff changeset
  1962
    "create a new instance, preset its fields,
cg
parents: 625
diff changeset
  1963
     and call its JAVA init function passing a String arg"
cg
parents: 625
diff changeset
  1964
cg
parents: 625
diff changeset
  1965
    |newJavaObject|
cg
parents: 625
diff changeset
  1966
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1967
    newJavaObject := self basicNew.
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  1968
    newJavaObject
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1969
        perform:#'<init>(Ljava/lang/String;)V'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1970
        with:(Java as_String:argString).
626
cg
parents: 625
diff changeset
  1971
    ^ newJavaObject
cg
parents: 625
diff changeset
  1972
cg
parents: 625
diff changeset
  1973
    "
cg
parents: 625
diff changeset
  1974
     ((Java classNamed:'java.lang.ArrayStoreException') newWith_String:'foo') inspect
cg
parents: 625
diff changeset
  1975
    "
cg
parents: 625
diff changeset
  1976
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1977
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1978
    "Created: / 13-11-1998 / 14:17:01 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1979
    "Modified: / 02-11-2012 / 21:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
626
cg
parents: 625
diff changeset
  1980
!
cg
parents: 625
diff changeset
  1981
cg
parents: 625
diff changeset
  1982
newWith_int:arg
cg
parents: 625
diff changeset
  1983
    "create a new instance, preset its fields,
cg
parents: 625
diff changeset
  1984
     and call its JAVA init function passing an int arg"
cg
parents: 625
diff changeset
  1985
cg
parents: 625
diff changeset
  1986
    |newJavaObject|
cg
parents: 625
diff changeset
  1987
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1988
    newJavaObject := self basicNew.
626
cg
parents: 625
diff changeset
  1989
    newJavaObject perform:#'<init>(I)V' with:arg.
cg
parents: 625
diff changeset
  1990
    ^ newJavaObject
cg
parents: 625
diff changeset
  1991
cg
parents: 625
diff changeset
  1992
    "
cg
parents: 625
diff changeset
  1993
     ((Java classNamed:'java.lang.Integer') newWith_int:123) inspect
451
50d24dc93f8b checkin from browser
cg
parents: 438
diff changeset
  1994
    "
50d24dc93f8b checkin from browser
cg
parents: 438
diff changeset
  1995
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1996
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1997
    "Created: / 13-11-1998 / 14:17:01 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1998
    "Modified: / 02-11-2012 / 21:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  1999
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2000
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2001
!JavaClass methodsFor:'java instance creation-proxying'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2002
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2003
new
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2004
    "create a new instance, preset its fields,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2005
     and call its JAVA init function"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2006
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2007
    |newJavaObject|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2008
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2009
    newJavaObject := self basicNew.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2010
    newJavaObject initialize.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2011
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2012
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2013
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2014
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2015
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2016
     (Java classNamed:'java.lang.String') new inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2017
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2018
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2019
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2020
    "Modified: / 09-06-2012 / 21:48:36 / Jan Kurs (kursjan@fit.cvut.cz)"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2021
    "Modified: / 02-11-2012 / 21:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2022
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2023
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2024
new: arg1
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2025
    "create a new instance and call one-arg constructor"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2026
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2027
    |newJavaObject|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2028
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2029
    newJavaObject := self basicNew.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2030
    newJavaObject perform:#'<init>:' with: arg1.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2031
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2032
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2033
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2034
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2035
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2036
     (Java classNamed:'java.lang.String') new inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2037
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2038
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2039
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2040
    "Created: / 17-03-2012 / 15:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2041
    "Modified: / 02-11-2012 / 21:10:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2042
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2043
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2044
new: arg1 _: arg2
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2045
    ^self new: arg1 with: arg2
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2046
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2047
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2048
    "Created: / 17-03-2012 / 15:12:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2049
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2050
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2051
new: arg1 _: arg2 _: arg3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2052
    ^self new: arg1 with: arg2 with: arg3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2053
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2054
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2055
    "Created: / 17-03-2012 / 15:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2056
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2057
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2058
new: arg1 _: arg2 _: arg3 _: arg4
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2059
    ^self new: arg1 with: arg2 with: arg3 with: arg4
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2060
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2061
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2062
    "Created: / 17-03-2012 / 15:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2063
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2064
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2065
new: arg1 _: arg2 _: arg3 _: arg4 _: arg5
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2066
    ^ self
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2067
        new: arg1
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2068
        with: arg2
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2069
        with: arg3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2070
        with: arg4
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2071
        with: arg5
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2072
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2073
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2074
    "Created: / 17-03-2012 / 15:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2075
    "Created: / 03-04-2012 / 12:17:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2076
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2077
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2078
new: arg1 with: arg2
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2079
    "create a new instance and call 2-arg constructor"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2080
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2081
    |newJavaObject|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2082
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2083
    newJavaObject := self basicNew.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2084
    newJavaObject perform:#'<init>:_:' with: arg1 with: arg2.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2085
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2086
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2087
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2088
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2089
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2090
     (Java classNamed:'java.lang.String') new inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2091
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2092
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2093
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2094
    "Created: / 17-03-2012 / 15:12:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2095
    "Modified: / 02-11-2012 / 21:10:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2096
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2097
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2098
new: arg1 with: arg2 with: arg3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2099
    "create a new instance and call 3-arg constructor"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2100
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2101
    |newJavaObject|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2102
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2103
    newJavaObject := self basicNew.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2104
    newJavaObject perform:#'<init>:_:_:' with: arg1 with: arg2 with: arg3.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2105
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2106
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2107
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2108
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2109
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2110
     (Java classNamed:'java.lang.String') new inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2111
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2112
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2113
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2114
    "Created: / 17-03-2012 / 15:12:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2115
    "Modified: / 02-11-2012 / 21:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2116
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2117
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2118
new: arg1 with: arg2 with: arg3 with: arg4
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2119
    "create a new instance and call 4-arg constructor"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2120
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2121
    |newJavaObject|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2122
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2123
    newJavaObject := self basicNew.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2124
    newJavaObject perform:#'<init>:_:_:_:' with: arg1 with: arg2 with: arg3 with: arg4.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2125
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2126
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2127
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2128
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2129
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2130
     (Java classNamed:'java.lang.String') new inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2131
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2132
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2133
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2134
    "Created: / 17-03-2012 / 15:12:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2135
    "Modified: / 02-11-2012 / 21:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2136
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2137
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2138
new: arg1 with: arg2 with: arg3 with: arg4 with: arg5
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2139
    "create a new instance and call 4-arg constructor"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2140
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2141
    | newJavaObject |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2142
    newJavaObject := self basicNew.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2143
    newJavaObject
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2144
        perform: #'<init>:_:_:_:_:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2145
        with: arg1
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2146
        with: arg2
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2147
        with: arg3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2148
        with: arg4
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2149
        with: arg5.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2150
    ^ newJavaObject
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2151
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2152
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2153
     (Java classNamed:'java.lang.String') basicNew inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2154
     (Java classNamed:'java.lang.String') newCleared inspect
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2155
     (Java classNamed:'java.lang.String') new inspect"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2156
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2157
    "Modified: / 04-11-1998 / 18:04:34 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2158
    "Created: / 17-03-2012 / 15:12:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2159
    "Created: / 02-04-2012 / 10:52:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2160
    "Modified: / 02-11-2012 / 21:10:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  2161
! !
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  2162
229
b91c9462ac83 *** empty log message ***
cg
parents: 215
diff changeset
  2163
!JavaClass methodsFor:'message sending'!
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  2164
626
cg
parents: 625
diff changeset
  2165
doesNotUnderstand:aMessage
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2166
    | sender |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2167
    sender := thisContext sender.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2168
    ^self
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2169
        perform: aMessage
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2170
        onReceiver: self
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2171
        from: sender
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2172
        ifNotFound: [ super doesNotUnderstand: aMessage ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2173
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2174
    "Modified: / 16-11-1998 / 16:50:56 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2175
    "Modified: / 19-09-2011 / 23:43:56 / Jan Kurs <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2176
    "Modified (comment): / 01-01-2012 / 19:36:41 / kursjan <kursjan@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2177
    "Modified: / 03-01-2012 / 21:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2178
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2179
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2180
lookupFieldFor:fname static: searchStatic onlyPublic: publicOnly
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2181
    "Lookup a field with given name in class and all
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2182
     its subclasses, return an instance of JavaField
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2183
     or nil, if none is found.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2184
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2185
     If searchStatic is true, static fields are searched,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2186
     otherwise it searches inst and interface fields.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2187
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2188
     If publicOnly is true, only public field are searched"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2189
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2190
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2191
    | cls field |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2192
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2193
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2194
    [ cls ~~ JavaObject ] whileTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2195
        searchStatic ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2196
            field := cls findStaticFieldByName: fname.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2197
            field isNil ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2198
                field := cls findInterfaceFieldByName: fname
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2199
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2200
            ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2201
        ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2202
            field := cls findInstFieldByName: fname
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2203
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2204
        field notNil ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2205
            (publicOnly and:[field isPublic not]) ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2206
                ^ nil
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2207
            ] ifFalse:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2208
                ^ field
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2209
            ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2210
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2211
        cls := cls superclass.
626
cg
parents: 625
diff changeset
  2212
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2213
    ^nil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2214
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2215
    "Created: / 17-03-2012 / 16:41:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
79
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
  2216
!
9604109538d8 checkin from browser
cg
parents: 77
diff changeset
  2217
626
cg
parents: 625
diff changeset
  2218
lookupMethodFor:selector
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2219
    |method cls sel queue |
626
cg
parents: 625
diff changeset
  2220
cg
parents: 625
diff changeset
  2221
    sel := selector asSymbolIfInterned.
cg
parents: 625
diff changeset
  2222
    sel notNil ifTrue:[
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2223
        queue := OrderedCollection with: self.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2224
        [ queue isEmpty ] whileFalse:[
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2225
            cls := queue removeFirst.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2226
            method := cls compiledMethodAt:sel.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2227
            method notNil ifTrue:[ ^ method ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2228
            cls isInterface ifFalse:[
3381
cd0cdb3628f9 Fix in JavaClass: fixed bad bug in lookupMethodFor: - lookup method up to Object class, not just to JavaObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3329
diff changeset
  2229
                cls superclass notNil ifTrue:[queue add: cls superclass]
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2230
            ].
3381
cd0cdb3628f9 Fix in JavaClass: fixed bad bug in lookupMethodFor: - lookup method up to Object class, not just to JavaObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3329
diff changeset
  2231
            cls isJavaClass ifTrue:[  
cd0cdb3628f9 Fix in JavaClass: fixed bad bug in lookupMethodFor: - lookup method up to Object class, not just to JavaObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3329
diff changeset
  2232
                queue addAll: cls interfaces.
cd0cdb3628f9 Fix in JavaClass: fixed bad bug in lookupMethodFor: - lookup method up to Object class, not just to JavaObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3329
diff changeset
  2233
            ].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2234
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  2235
    ].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2236
    "/cls ifNotNil:[^super lookupMethodFor: selector].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 42
diff changeset
  2237
    ^ nil
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2238
3381
cd0cdb3628f9 Fix in JavaClass: fixed bad bug in lookupMethodFor: - lookup method up to Object class, not just to JavaObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3329
diff changeset
  2239
    "Modified: / 04-02-2015 / 15:14:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
438
9142cf2fc8fa code cleanup
cg
parents: 435
diff changeset
  2240
!
9142cf2fc8fa code cleanup
cg
parents: 435
diff changeset
  2241
626
cg
parents: 625
diff changeset
  2242
performStatic:selector
cg
parents: 625
diff changeset
  2243
    "send a static message, without args."
cg
parents: 625
diff changeset
  2244
cg
parents: 625
diff changeset
  2245
    |javaMethod sel|
cg
parents: 625
diff changeset
  2246
cg
parents: 625
diff changeset
  2247
    sel := selector asSymbolIfInterned.
cg
parents: 625
diff changeset
  2248
    sel notNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2249
	javaMethod := methodDictionary at:sel.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2250
	javaMethod notNil ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2251
	    javaMethod isStatic ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2252
		^ javaMethod
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2253
		    valueWithReceiver:self
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2254
		    arguments:#()
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2255
	    ]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2256
	].
626
cg
parents: 625
diff changeset
  2257
    ].
cg
parents: 625
diff changeset
  2258
cg
parents: 625
diff changeset
  2259
    ^ self doesNotUnderstand:(Message selector:selector)
438
9142cf2fc8fa code cleanup
cg
parents: 435
diff changeset
  2260
9142cf2fc8fa code cleanup
cg
parents: 435
diff changeset
  2261
    "Modified: / 15.1.1998 / 00:31:27 / cg"
9142cf2fc8fa code cleanup
cg
parents: 435
diff changeset
  2262
    "Created: / 12.11.1998 / 16:29:20 / cg"
626
cg
parents: 625
diff changeset
  2263
!
cg
parents: 625
diff changeset
  2264
cg
parents: 625
diff changeset
  2265
performStatic:selector with:arg
cg
parents: 625
diff changeset
  2266
    "send a static message, with one args."
cg
parents: 625
diff changeset
  2267
cg
parents: 625
diff changeset
  2268
    |javaMethod sel|
cg
parents: 625
diff changeset
  2269
cg
parents: 625
diff changeset
  2270
    sel := selector asSymbolIfInterned.
cg
parents: 625
diff changeset
  2271
    sel notNil ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2272
	javaMethod := methodDictionary at:sel.
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2273
	javaMethod notNil ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2274
	    javaMethod isStatic ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2275
		^ javaMethod
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2276
		    valueWithReceiver:self
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2277
		    arguments:(Array with:arg)
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2278
		    selector:selector
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2279
		    search:nil
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2280
		    sender:nil
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2281
	    ]
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2282
	].
626
cg
parents: 625
diff changeset
  2283
    ].
cg
parents: 625
diff changeset
  2284
cg
parents: 625
diff changeset
  2285
    ^ self doesNotUnderstand:(Message selector:selector argument:arg)
cg
parents: 625
diff changeset
  2286
cg
parents: 625
diff changeset
  2287
    "Modified: / 15.1.1998 / 00:31:27 / cg"
cg
parents: 625
diff changeset
  2288
    "Created: / 10.12.1998 / 21:50:29 / cg"
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  2289
! !
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  2290
2436
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2291
!JavaClass methodsFor:'misc ui support'!
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2292
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2293
iconInBrowserSymbol
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2294
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2295
    <resource: #programImage>
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2296
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2297
    | jle jlre |
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2298
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2299
    self isInterface ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2300
        self isPrivate ifTrue:[^#javaPrivateInterfaceBrowserIcon].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2301
        self isProtected ifTrue:[^#javaProtectedInterfaceBrowserIcon].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2302
        ^#javaPublicInterfaceBrowserIcon
2436
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2303
    ].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2304
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2305
    self isEnum ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2306
        self isPrivate ifTrue:[^#javaPrivateEnumBrowserIcon].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2307
        self isProtected ifTrue:[^#javaProtectedEnumBrowserIcon].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2308
        ^#javaPublicEnumBrowserIcon
2436
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2309
    ].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2310
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2311
    (jle := Java at:'java.lang.Exception') notNil ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2312
        (jlre := Java at:'java.lang.RuntimeException') notNil ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2313
            (self includesBehavior: jlre) ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2314
                ^#javaRuntimeExceptionBrowserIcon
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2315
            ]
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2316
        ].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2317
        (self includesBehavior: jle) ifTrue:[
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2318
            ^#javaExceptionBrowserIcon
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2319
        ]
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2320
    ].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2321
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2322
    self isPrivate ifTrue:[^#javaPrivateClassBrowserIcon].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2323
    self isProtected ifTrue:[^#javaProtectedClassBrowserIcon].
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2324
    ^#javaPublicClassBrowserIcon
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2325
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2326
    "Created: / 20-12-2010 / 19:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a2d9e86960c4 JavaClass: added iconInBrowserSymbol (used by Expecco)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2396
diff changeset
  2327
! !
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2328
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2329
!JavaClass methodsFor:'printOut'!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2330
626
cg
parents: 625
diff changeset
  2331
printNameInHierarchy
cg
parents: 625
diff changeset
  2332
    "return my name as printed in the hierarchy"
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2333
626
cg
parents: 625
diff changeset
  2334
    ^ self displayString
cg
parents: 625
diff changeset
  2335
cg
parents: 625
diff changeset
  2336
    "Modified: 22.3.1997 / 14:16:55 / cg"
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2337
!
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2338
626
cg
parents: 625
diff changeset
  2339
printOutOn:aStream
cg
parents: 625
diff changeset
  2340
    self warn:'printOut not yet supported'
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2341
626
cg
parents: 625
diff changeset
  2342
    "Created: 22.3.1997 / 14:36:12 / cg"
cg
parents: 625
diff changeset
  2343
!
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2344
626
cg
parents: 625
diff changeset
  2345
printOutProtocolOn:aStream
160
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2346
    self warn:'printOut not yet supported'
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2347
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2348
    "Created: 22.3.1997 / 14:36:28 / cg"
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2349
! !
1890a9128220 more interfaces for regular browser
cg
parents: 157
diff changeset
  2350
626
cg
parents: 625
diff changeset
  2351
!JavaClass methodsFor:'printing & storing'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  2352
626
cg
parents: 625
diff changeset
  2353
displayString
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2354
    ^ self javaName
626
cg
parents: 625
diff changeset
  2355
cg
parents: 625
diff changeset
  2356
"/    ^ 'JAVA-' , name .
cg
parents: 625
diff changeset
  2357
"/    ^ name , '(Java)'  "/ 'JavaClass(' , name , ')'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  2358
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2359
    "Created: / 15-04-1996 / 16:02:48 / cg"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2360
    "Modified: / 18-07-1998 / 22:56:30 / cg"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2361
    "Modified: / 08-10-2013 / 19:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
626
cg
parents: 625
diff changeset
  2362
! !
cg
parents: 625
diff changeset
  2363
cg
parents: 625
diff changeset
  2364
!JavaClass methodsFor:'private accessing'!
cg
parents: 625
diff changeset
  2365
cg
parents: 625
diff changeset
  2366
addMethod:m name:name signature:signature
cg
parents: 625
diff changeset
  2367
    |sel|
63
74442cd26c02 changes for new methodDict
cg
parents: 60
diff changeset
  2368
626
cg
parents: 625
diff changeset
  2369
    sel := (name , signature) asSymbol.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2370
    self primAddSelector:sel withMethod:m.
626
cg
parents: 625
diff changeset
  2371
    ^ self.
cg
parents: 625
diff changeset
  2372
cg
parents: 625
diff changeset
  2373
"/    selectorArray isNil ifTrue:[
cg
parents: 625
diff changeset
  2374
"/        selectorArray := #().
cg
parents: 625
diff changeset
  2375
"/        methodArray := #()
cg
parents: 625
diff changeset
  2376
"/    ].
cg
parents: 625
diff changeset
  2377
"/    selectorArray := selectorArray copyWith:(name , signature) asSymbol. "/ name.
cg
parents: 625
diff changeset
  2378
"/"/    selectorArray := selectorArray copyWith:name asSymbol. "/ name.
98
bd1f320e757e *** empty log message ***
cg
parents: 90
diff changeset
  2379
"/    methodArray := methodArray copyWith:m
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  2380
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2381
    "Created: / 15-04-1996 / 16:42:52 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2382
    "Modified: / 04-04-2012 / 01:18:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  2383
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  2384
626
cg
parents: 625
diff changeset
  2385
addSelector:newSelector withMethod:newMethod
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2386
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2387
    ^super addSelector:newSelector withMethod:newMethod
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2388
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2389
"/    "redefined to not flush smalltalk caches and send NO smalltalk-class
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2390
"/     change notification. Will eventually flush Java caches."
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2391
"/
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2392
"/    |nargs oldMethod|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2393
"/
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2394
"/    oldMethod := self compiledMethodAt:newSelector.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2395
"/    (self primAddSelector:newSelector withMethod:newMethod) ifFalse:[^ false].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2396
"/
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2397
"/    ^ true
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2398
"/
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2399
"/
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2400
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2401
    "Created: / 20-01-1997 / 13:00:48 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2402
    "Modified: / 20-04-2012 / 20:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  2403
!
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  2404
626
cg
parents: 625
diff changeset
  2405
setAccessFlags:flags
3
e3c2a84b2a72 checkin from browser
cg
parents: 1
diff changeset
  2406
    accessFlags := flags.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  2407
083530508d9c intitial checkin
cg
parents:
diff changeset
  2408
    "Created: 15.4.1996 / 16:42:52 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  2409
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  2410
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2411
setAttributes: aSequenceableCollection
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2412
    aSequenceableCollection isNil ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2413
        attributes := Attributes empty.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2414
    ] ifFalse:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2415
        aSequenceableCollection class == Attributes ifTrue:[
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2416
            attributes := aSequenceableCollection
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2417
        ] ifFalse:[
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  2418
            attributes := Attributes new: aSequenceableCollection size // 2.
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  2419
            aSequenceableCollection pairWiseDo:[ :key :value | attributes at: key put: value. ]
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2420
        ]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2421
    ]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2422
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2423
    "Created: / 13-09-2013 / 00:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  2424
    "Modified: / 07-12-2014 / 01:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2425
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2426
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2427
setBinaryName: aString
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2428
    binaryName := aString asSymbol.
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2429
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2430
    "Created: / 15-04-1996 / 16:42:52 / cg"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2431
    "Modified: / 05-11-1998 / 19:14:39 / cg"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2432
    "Modified (format): / 09-10-2013 / 00:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2433
!
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2434
626
cg
parents: 625
diff changeset
  2435
setFields:f
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2436
    | nignored nvals vals names |
626
cg
parents: 625
diff changeset
  2437
cg
parents: 625
diff changeset
  2438
    JavaClass setInstanceVariableStringFromFields:f in:self.
cg
parents: 625
diff changeset
  2439
cg
parents: 625
diff changeset
  2440
    instSize := superclass instSize + f size.
cg
parents: 625
diff changeset
  2441
    fields := f.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2442
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2443
    f withIndexDo:[:field :index|
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2444
        field setClass: self.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2445
        field setIndex: superclass instSize + index.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2446
    ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2447
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2448
    "Now, collect initValues. Ignore the lockword, if any"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2449
    nignored := JavaObject instSize. "/except possible instvars in JavaObject (lockword)
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2450
    nvals := self instSize - nignored.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2451
    nvals > 0 ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2452
        vals := Array new: nvals.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2453
        names := self allInstVarNames.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2454
        JavaObject instSize + 1 to: names size do:[:i|
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2455
            | val |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2456
            val := self initValueFor: (names at: i).
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2457
            val notNil ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2458
                vals at: i - nignored put: val.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2459
                initValues := vals.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2460
            ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2461
        ].
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2462
    ]
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  2463
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2464
    "Created: / 15-04-1996 / 16:42:52 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2465
    "Modified: / 06-11-1998 / 01:53:01 / cg"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2466
    "Modified: / 02-11-2012 / 21:49:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  2467
!
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  2468
3100
cf2d8949d5a5 Better coding style of JavaClass/JavaBehaviour>>setInterfaces:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3097
diff changeset
  2469
setInterfaces: aCollection
cf2d8949d5a5 Better coding style of JavaClass/JavaBehaviour>>setInterfaces:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3097
diff changeset
  2470
cf2d8949d5a5 Better coding style of JavaClass/JavaBehaviour>>setInterfaces:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3097
diff changeset
  2471
    super setInterfaces: aCollection.
cf2d8949d5a5 Better coding style of JavaClass/JavaBehaviour>>setInterfaces:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3097
diff changeset
  2472
    aCollection notEmptyOrNil ifTrue:[
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
  2473
        aCollection do:[:ifaceRefIndex|
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2474
            (self constantPool at: ifaceRefIndex) name = 'groovy/lang/GroovyObject' ifTrue:[
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2475
                self class changeClassTo: GroovyMetaclass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2476
                self class setSuperclass: GroovyClass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2477
            ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2478
        ]
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  2479
    ]
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  2480
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2481
    "Created: / 20-02-2012 / 22:47:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
  2482
    "Modified: / 27-11-2014 / 17:03:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2483
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2484
2956
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
  2485
setLockWord
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
  2486
    _lockWord_ := 0
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
  2487
17be352f0130 Added lockWord to JavaBehavior to enable thinlocking for static methods and resolver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2937
diff changeset
  2488
    "Created: / 06-12-2013 / 23:00:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2489
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2490
2529
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  2491
setSource: aStringOrNil
764ab6925cf5 Update compiler problems when old class is updated.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2521
diff changeset
  2492
    self assert: (aStringOrNil isNil or:[aStringOrNil isString]).
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  2493
    attributes := attributes at:#SourceString putOrAppend: aStringOrNil
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2494
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2495
    "Created: / 15-04-1996 / 16:42:52 / cg"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2496
    "Created: / 18-02-2012 / 19:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  2497
    "Modified: / 07-12-2014 / 01:34:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
110
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  2498
!
dfb03e2ea321 *** empty log message ***
cg
parents: 98
diff changeset
  2499
626
cg
parents: 625
diff changeset
  2500
setSourceFile:aFilename
3211
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
  2501
    classFilename := aFilename.
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
  2502
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
  2503
    "Created: / 15-04-1996 / 16:42:52 / cg"
c771a69d7f7d Removed slot JavaClass#sourceFile.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3207
diff changeset
  2504
    "Modified: / 07-08-2014 / 12:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
626
cg
parents: 625
diff changeset
  2505
!
cg
parents: 625
diff changeset
  2506
cg
parents: 625
diff changeset
  2507
setStaticFields:f
cg
parents: 625
diff changeset
  2508
    JavaClass setInstanceVariableStringFromFields:f in:self class.
cg
parents: 625
diff changeset
  2509
cg
parents: 625
diff changeset
  2510
    staticFields := f.
cg
parents: 625
diff changeset
  2511
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2512
    "Modified: / 17-08-2011 / 09:26:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
626
cg
parents: 625
diff changeset
  2513
!
60
a763b1780ec0 checkin from browser
cg
parents: 54
diff changeset
  2514
626
cg
parents: 625
diff changeset
  2515
setSuperclass:aClass
cg
parents: 625
diff changeset
  2516
    |iVars numIvars|
247
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  2517
626
cg
parents: 625
diff changeset
  2518
    aClass isNil ifTrue:[
cg
parents: 625
diff changeset
  2519
	super setSuperclass:JavaObject
cg
parents: 625
diff changeset
  2520
    ] ifFalse:[
cg
parents: 625
diff changeset
  2521
	(aClass isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
cg
parents: 625
diff changeset
  2522
	    self halt.
cg
parents: 625
diff changeset
  2523
	].
cg
parents: 625
diff changeset
  2524
	super setSuperclass:aClass.
cg
parents: 625
diff changeset
  2525
    ].
cg
parents: 625
diff changeset
  2526
cg
parents: 625
diff changeset
  2527
    iVars := self instVarNames.
cg
parents: 625
diff changeset
  2528
    ((numIvars := iVars size) > 0) ifTrue:[
cg
parents: 625
diff changeset
  2529
	(superclass notNil and:[(superclass isMemberOf:JavaUnresolvedClassConstant) not]) ifTrue:[
cg
parents: 625
diff changeset
  2530
	    instSize := superclass instSize + numIvars
cg
parents: 625
diff changeset
  2531
	] ifFalse:[
cg
parents: 625
diff changeset
  2532
	    instSize := numIvars
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 249
diff changeset
  2533
	]
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  2534
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  2535
4560bb77bb36 checkin from browser
cg
parents: 24
diff changeset
  2536
    "Created: 15.4.1996 / 16:42:52 / cg"
247
67dd93db3d80 adapt to change in ClassDescription
cg
parents: 236
diff changeset
  2537
    "Modified: 22.8.1997 / 15:06:45 / cg"
626
cg
parents: 625
diff changeset
  2538
! !
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  2539
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2540
!JavaClass methodsFor:'private-accessing'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2541
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2542
attributes
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2543
    "return the extra class attributes or nil"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2544
    ^ attributes
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2545
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2546
    "Created: / 13-09-2013 / 00:53:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2547
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2548
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2549
attributes:aClassAttributesObject
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2550
    self shouldNotImplement
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2551
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2552
    "Created: / 13-09-2013 / 00:52:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2553
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2554
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2555
classAttributes
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2556
    ^ self attributes
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2557
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2558
    "Created: / 13-09-2013 / 00:52:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2559
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2560
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2561
classAttributes:aClassAttributesObject
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2562
    self shouldNotImplement.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2563
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2564
    "Created: / 13-09-2013 / 00:52:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2565
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2566
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2567
getAttribute:key
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2568
    "get an attribute (by symbolic key)"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2569
3199
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
  2570
    ^ attributes at: key ifAbsent: nil
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2571
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2572
    "Created: / 13-09-2013 / 00:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3199
189c572dbe71 Fixed getDeclaringClass() native.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3180
diff changeset
  2573
    "Modified: / 04-08-2014 / 22:33:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2574
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2575
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2576
setAttribute:key to:aValue
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2577
    self shouldNotImplement
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2578
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2579
    "Created: / 13-09-2013 / 00:54:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2580
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  2581
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2582
!JavaClass methodsFor:'private-changes management'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2583
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2584
writingChangeWithTimeStamp:doStampIt do:aBlock
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2585
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2586
    "No changes for Java classes now"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2587
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2588
    "Created: / 14-12-2010 / 18:07:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2589
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2590
626
cg
parents: 625
diff changeset
  2591
!JavaClass methodsFor:'queries'!
cg
parents: 625
diff changeset
  2592
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2593
anonymousClasses
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2594
    "Return set of anonymous classes defined in this class. Anonymous classes that 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2595
     are not yet loaded are loaded but not initialized."
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2596
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2597
    ^ self anonymousClassesIgnoreUnloaded:false
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2598
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2599
    "Created: / 11-12-2014 / 17:33:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2600
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2601
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2602
anonymousClassesIgnoreUnloaded
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2603
    "Return set of anonymous classes defined in this class. 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2604
     Those not yet loaded are ommited from the returned set"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2605
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2606
    ^ self anonymousClassesIgnoreUnloaded:true
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2607
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2608
    "Created: / 11-12-2014 / 17:34:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2609
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2610
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2611
anonymousClassesIgnoreUnloaded:ignoreUnloaded
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2612
    "Return set of anonymous classes defined in this class. If ignoreUnloaded is true,
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2613
     anonymous classes that are not loaded will not appear in the returned set.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2614
     If ignoreUnloaded is false and anonynous class is not loaded yet, it is
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2615
     loaded but not initialized."
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2616
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2617
    ^ Array streamContents: [ :stream | self anonymousClassesIgnoreUnloaded: ignoreUnloaded do: [:class | stream nextPut: class ] ]
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2618
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2619
    "Created: / 11-12-2014 / 17:34:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2620
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2621
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2622
anonymousClassesIgnoreUnloaded:ignoreUnloaded do: block
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2623
    "Iterate over a set of anonynous classes. If ignoreUnloaded is true,
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2624
     anonynous classes that are not loaded will be skipped.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2625
     If ignoreUnloaded is false and anonynous class is not loaded yet, it is
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2626
     loaded but not initialized.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2627
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2628
     See JVM spec, Section 4.7.6 The InnerClasses Attribute
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2629
    "
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2630
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2631
    | innerClassesAttr |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2632
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2633
    innerClassesAttr := self getAttribute:#InnerClasses.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2634
    innerClassesAttr notNil ifTrue:[
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2635
        | cp |
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2636
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2637
        cp := self constantPool.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2638
        innerClassesAttr do:[:each |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2639
            | innerClassRef |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2640
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2641
            innerClassRef := cp at: each innerClassRefIndex.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2642
            innerClassRef name ~= binaryName ifTrue:[ 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2643
                each nameIndex == 0"Anonynous class" ifTrue:[ 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2644
                    | innerClass |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2645
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2646
                    innerClass := JavaVM classNamed:innerClassRef name definedBy:classLoader.
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2647
                    (innerClass isNil and:[ ignoreUnloaded not ]) ifTrue:[ 
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2648
                        innerClass := innerClassRef resolve: false.
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2649
                    ].   
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2650
                    innerClass notNil ifTrue:[ block value: innerClass ].        
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2651
                ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2652
            ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2653
        ]
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2654
    ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2655
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2656
    "Created: / 11-12-2014 / 17:35:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2657
    "Modified: / 20-01-2015 / 09:29:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2658
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2659
626
cg
parents: 625
diff changeset
  2660
canBeSubclassed
cg
parents: 625
diff changeset
  2661
    "return true, if its allowed to create subclasses of the receiver."
426
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2662
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2663
    self isFinal ifTrue:[^ false].
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2664
    self isInterface ifTrue:[^ false].
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2665
    ^ true
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2666
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2667
    "Created: / 5.11.1998 / 23:04:50 / cg"
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2668
!
ddb18042134a checkin from browser
cg
parents: 425
diff changeset
  2669
2746
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2670
canCacheReferences
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2671
    ^ self versions isNil or: [ self versions isEmpty ].
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2672
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2673
    "Created: / 10-09-2013 / 00:07:40 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2674
!
3d4c32e21475 add JavaClass>>canCacheReferences
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2711
diff changeset
  2675
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2676
canHaveExtensions
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2677
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2678
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2679
    "Created: / 13-04-2012 / 18:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2680
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2681
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2682
containsMethodsAnnotatedWith:aJavaTypeName
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2683
    | methods |
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2684
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2685
    methods := self selectMethodsAnnotatedWith:aJavaTypeName.
3097
c37c50e0aa5a Fix in containsMethodsAnnotatedWith: - do not compare binary names, compare superclasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2980
diff changeset
  2686
    methods notEmptyOrNil ifTrue:[ ^ true ].
c37c50e0aa5a Fix in containsMethodsAnnotatedWith: - do not compare binary names, compare superclasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2980
diff changeset
  2687
    superclass ~~ JavaObject
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2688
        ifTrue:[ ^ superclass containsMethodsAnnotatedWith:aJavaTypeName. ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2689
    ^ false.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2690
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2691
    "Created: / 02-03-2011 / 23:01:14 / Marcel Hlopko <hlopik@gmail.com>"
3097
c37c50e0aa5a Fix in containsMethodsAnnotatedWith: - do not compare binary names, compare superclasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2980
diff changeset
  2692
    "Modified: / 27-04-2014 / 20:58:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2693
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2694
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2695
hasFinalize
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2696
    ^ (accessFlags bitAnd:ACX_HASFINALIZE) ~~ 0
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2697
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2698
    "Created: / 02-11-2012 / 18:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2699
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2700
626
cg
parents: 625
diff changeset
  2701
hasInterface:aJavaInterface
cg
parents: 625
diff changeset
  2702
    "return true, if I respond to all methods as
cg
parents: 625
diff changeset
  2703
     required by the argument, an aJavaInterface"
cg
parents: 625
diff changeset
  2704
cg
parents: 625
diff changeset
  2705
    interfaces size > 0 ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2706
	self interfaces do:[:if |
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2707
	    aJavaInterface == if ifTrue:[
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2708
		^ true
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2709
	    ].
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2710
	]
626
cg
parents: 625
diff changeset
  2711
    ].
cg
parents: 625
diff changeset
  2712
    superclass isJavaClass ifTrue:[
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2713
	^ superclass hasInterface:aJavaInterface
626
cg
parents: 625
diff changeset
  2714
    ].
cg
parents: 625
diff changeset
  2715
    ^ false.
cg
parents: 625
diff changeset
  2716
cg
parents: 625
diff changeset
  2717
"/    aJavaInterface methodDictionary keysAndValuesDo:[:sel :mthd |
587
131f0c4afb89 checkin from browser
cg
parents: 582
diff changeset
  2718
"/        (self canUnderstand:sel) ifFalse:[
131f0c4afb89 checkin from browser
cg
parents: 582
diff changeset
  2719
"/            ^ false.
131f0c4afb89 checkin from browser
cg
parents: 582
diff changeset
  2720
"/        ]
131f0c4afb89 checkin from browser
cg
parents: 582
diff changeset
  2721
"/    ].
53
e10c1dd4ea3b checkin from browser
cg
parents: 52
diff changeset
  2722
    ^ true
281
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  2723
67c5b913b645 *** empty log message ***
cg
parents: 264
diff changeset
  2724
    "Modified: / 28.1.1998 / 01:46:16 / cg"
587
131f0c4afb89 checkin from browser
cg
parents: 582
diff changeset
  2725
52
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  2726
!
1dc41619b6f8 checkin from browser
cg
parents: 43
diff changeset
  2727
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2728
hasMagicAccessRights
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2729
    "Classes subclassing from sun.reflect.MagicAccessorImpl are not subject to access rights checks. Another non-documented gem found in openjdk sources :)"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2730
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2731
    | magicAccessor |
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
  2732
    magicAccessor := JavaVM classNamed: 'sun.reflect.MagicAccessorImpl' definedBy: nil.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2733
    ^ magicAccessor notNil and: [ self includesBehavior: magicAccessor ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2734
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2735
    "Created: / 18-11-2012 / 16:11:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
  2736
    "Modified: / 02-05-2013 / 01:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2737
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2738
3223
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2739
innerClasses
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2740
    "Return set of inner classes. Inner classes that are yet loaded, are
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2741
     loaded but not initialized."
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2742
    ^ self innerClassesIgnoreUnloaded:false
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2743
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2744
    "Created: / 08-08-2014 / 16:08:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2745
!
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2746
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2747
innerClassesIgnoreUnloaded
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2748
    "Return a set of inner classes. Those not yet loaded
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2749
     are ommited from the returned set"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2750
3223
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2751
    ^ self innerClassesIgnoreUnloaded:true
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2752
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2753
    "Created: / 08-08-2014 / 16:07:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2754
!
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2755
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2756
innerClassesIgnoreUnloaded:ignoreUnloaded
3223
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2757
    "Return a set of inner classes. If ignoreUnloaded is true,
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2758
     inner classes that are not loaded will not appear in the returned set.
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2759
     If ignoreUnloaded is false and inner class is not loaded yet, it is
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2760
     loaded but not initialized."
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2761
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2762
    ^ Array streamContents: [ :stream | self innerClassesIgnoreUnloaded: ignoreUnloaded do: [:class | stream nextPut: class ] ]
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2763
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2764
    "Created: / 08-08-2014 / 16:06:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2765
    "Modified: / 11-12-2014 / 15:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2766
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2767
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2768
innerClassesIgnoreUnloaded:ignoreUnloaded do: block
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2769
    "Iterate over a set of inner classes. If ignoreUnloaded is true,
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2770
     inner classes that are not loaded will be skipped.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2771
     If ignoreUnloaded is false and inner class is not loaded yet, it is
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2772
     loaded but not initialized.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2773
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2774
     See JVM spec, Section 4.7.6 The InnerClasses Attribute
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2775
    "
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2776
3223
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2777
    | innerClassesAttr |
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2778
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2779
    innerClassesAttr := self getAttribute:#InnerClasses.
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2780
    innerClassesAttr notNil ifTrue:[
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2781
        | cp |
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2782
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2783
        cp := self constantPool.
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
  2784
        innerClassesAttr do:[:each |
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2785
            | outerClassRefIndex outerClassRef |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2786
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2787
            outerClassRefIndex := each outerClassRefIndex.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2788
            outerClassRefIndex ~~ 0 ifTrue:[ 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2789
                outerClassRef := cp at: outerClassRefIndex.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2790
                outerClassRef name = self binaryName ifTrue:[ 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2791
                    | innerClassRef innerClass |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2792
3303
af659e602072 Fixes for class unloading.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3301
diff changeset
  2793
                    innerClassRef := cp at: each innerClassRefIndex.
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2794
                    innerClass := JavaVM classNamed:innerClassRef name definedBy:classLoader.
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2795
                    (innerClass isNil and:[ ignoreUnloaded not ]) ifTrue:[ 
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2796
                        innerClass := innerClassRef resolve: false.
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2797
                    ].
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2798
                    innerClass notNil ifTrue:[ block value: innerClass ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2799
                ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2800
            ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2801
        ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2802
    ].
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2803
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2804
    "Created: / 11-12-2014 / 15:37:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3329
4c3b0badaa5f Oops, fixed endless recursion in JavaClass>>innerClasses...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3326
diff changeset
  2805
    "Modified (format): / 20-01-2015 / 09:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2806
!
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2807
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2808
isAnonymous
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2809
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2810
    | innerClassesAttr |
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2811
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2812
    innerClassesAttr := self getAttribute: #InnerClasses.
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2813
    innerClassesAttr notNil ifTrue:[
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2814
        innerClassesAttr do:[:each |
3290
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
  2815
            | innerClassRef |
76d4443744ed JavaClass memory optimization (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3276
diff changeset
  2816
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2817
            innerClassRef := self constantPool at: each innerClassRefIndex.
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2818
            (innerClassRef name = binaryName) ifTrue:[
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2819
                each nameIndex == 0 ifTrue:[ 
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2820
                    ^ true
3223
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2821
                ].
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2822
            ]
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2823
        ].
7940d8a38e51 Oops, added missing methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3215
diff changeset
  2824
    ].
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2825
    ^ false
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2826
                
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2827
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2828
        (Java at:'java.io.Console') isAnonymous
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2829
        (Java at:'java.io.Console$1') isAnonymous
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2830
        (Java at:'java.io.Console$1$1') isAnonymous
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2831
        (Java at:'sun.misc.Launcher$ExtClassLoader') isAnonymous
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2832
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2833
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2834
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2835
    "Created: / 18-03-1997 / 17:48:01 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2836
    "Created: / 07-08-2011 / 15:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3301
1155c0d79d45 Fixed JavaClass#innerClasses, added #anonynousClasses
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3293
diff changeset
  2837
    "Modified: / 11-12-2014 / 15:53:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2838
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2839
2618
e7757e5d593c Initial attempt to generalized builtin class support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2603
diff changeset
  2840
isBuiltInClass
2966
afd174546057 Post-merge fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2965
diff changeset
  2841
    ^JavaVM builtInClassNames includes: binaryName
2618
e7757e5d593c Initial attempt to generalized builtin class support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2603
diff changeset
  2842
e7757e5d593c Initial attempt to generalized builtin class support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2603
diff changeset
  2843
    "Created: / 22-05-2013 / 20:38:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2966
afd174546057 Post-merge fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2965
diff changeset
  2844
    "Modified: / 18-12-2013 / 12:46:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2618
e7757e5d593c Initial attempt to generalized builtin class support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2603
diff changeset
  2845
!
e7757e5d593c Initial attempt to generalized builtin class support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2603
diff changeset
  2846
2916
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2847
isCloneable
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2848
    "Return true, if the receiver implements java.lang.Cloneable,
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2849
     i.e., if it can be cloned using Object#clone()"
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2850
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2851
    (accessFlags bitAnd:ACX_CLONEABLE) ~~ 0 ifTrue:[ ^ true ].
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2852
    self interfaces do:[:interface |
2916
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2853
        interface isCloneable ifTrue:[
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2854
            "/ Cache the information here so subsequent call
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2855
            "/ call to clone() can make use of fast flag-check
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2856
            accessFlags := accessFlags bitOr:ACX_CLONEABLE.
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2857
            ^ true.
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2858
        ].
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2859
    ].
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2860
    superclass isCloneable ifTrue:[
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2861
        "/ Cache the information here so subsequent call
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2862
        "/ call to clone() can make use of fast flag-check
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2863
        accessFlags := accessFlags bitOr:ACX_CLONEABLE.
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2864
        ^ true.
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2865
    ].
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2866
    ^ false.
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2867
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2868
    "Created: / 12-11-2013 / 00:33:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2869
    "Modified: / 12-11-2013 / 11:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2870
!
3d8a63dbf6dd Oops, fix for JavaClass>>isCloneable - handle subclasses of a class that implements Cloneable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2908
diff changeset
  2871
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2872
isFullyResolved
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  2873
    constantPool do: [:each | (each isJavaRef and: [each isResolved not]) ifTrue: [^false]].
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  2874
    ^ true.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2875
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2876
    "Created: / 08-12-2011 / 20:44:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  2877
    "Modified (format): / 02-10-2013 / 21:29:57 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2878
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2879
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2880
isJavaArrayClass
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2881
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2882
    ^false
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2883
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2884
    "Created: / 05-02-2011 / 22:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2885
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2886
626
cg
parents: 625
diff changeset
  2887
isJavaClass
148
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  2888
    ^ self ~~ JavaClass
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  2889
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  2890
    "Created: 18.3.1997 / 17:48:01 / cg"
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  2891
!
db560ebab8b5 *** empty log message ***
cg
parents: 133
diff changeset
  2892
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2893
isJavaClassType
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2894
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2895
    ^self isInterface not
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2896
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2897
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2898
        (Java classForName:'java.lang.Class') isJavaClassType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2899
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2900
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2901
    "Created: / 11-02-2011 / 08:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2902
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2903
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2904
isJavaInterfaceType
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2905
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2906
    ^self isInterface
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2907
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2908
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2909
        (Java classForName:'java.lang.Class') isJavaInterfaceType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2910
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2911
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2912
    "Created: / 11-02-2011 / 08:09:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2913
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2914
626
cg
parents: 625
diff changeset
  2915
isJavaMethodRef
cg
parents: 625
diff changeset
  2916
    ^ false
cg
parents: 625
diff changeset
  2917
cg
parents: 625
diff changeset
  2918
    "Created: / 9.11.1999 / 15:42:10 / cg"
cg
parents: 625
diff changeset
  2919
!
cg
parents: 625
diff changeset
  2920
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2921
isJavaPrimitiveType
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2922
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2923
    ^false
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2924
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2925
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2926
        (Java classForName:'java.lang.Class') isJavaPrimitiveType
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2927
        ByteArray isJavaPrimitiveType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2928
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2929
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2930
    "Created: / 21-12-2010 / 23:03:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2931
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2932
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2933
isJavaReferenceType
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2934
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2935
    ^true
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2936
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2937
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2938
        (Java classForName:'java.lang.Class') isJavaReferenceType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2939
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2940
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2941
    "Created: / 20-12-2010 / 21:54:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2942
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2943
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2944
isJavaType
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2945
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2946
    ^true
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2947
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2948
    "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  2949
        (Java classForName:'java.lang.Class') isJavaType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2950
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2951
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2952
    "Created: / 20-12-2010 / 21:53:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2953
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2954
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2955
isJavaWrapperClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2956
    "Returns true, iff receiver is one of the Java wrapper classes or String"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2957
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2958
    binaryName == #'java/lang/Byte' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2959
    binaryName == #'java/lang/Short' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2960
    binaryName == #'java/lang/Integer' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2961
    binaryName == #'java/lang/Long' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2962
    binaryName == #'java/lang/Character' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2963
    binaryName == #'java/lang/Boolean' ifTrue:[^true].
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2964
    binaryName == #'java/lang/String' ifTrue:[^true]."/Not really a wrapper, but..."
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2965
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2966
    ^false.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2967
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2968
    "Created: / 26-12-2011 / 22:03:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2969
    "Modified: / 09-10-2013 / 00:43:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2970
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  2971
626
cg
parents: 625
diff changeset
  2972
isUnresolved
cg
parents: 625
diff changeset
  2973
    "return true, if the receiver is unresolved;
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  2974
     javaClasses are never; JavaUnresolvedClasses are always"
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  2975
90
918e2740098c resolve rewritten
cg
parents: 86
diff changeset
  2976
    ^ false
345
7cfa66af11a0 checkin from browser
cg
parents: 336
diff changeset
  2977
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2978
    "Modified: / 07-05-1998 / 12:23:14 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  2979
    "Created: / 06-03-2011 / 22:57:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  2980
!
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  2981
679
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2982
nameInBrowser
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2983
    "return a nameString as shown in browsers"
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2984
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2985
    ^ self javaName
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2986
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  2987
    "Modified: / 08-10-2013 / 22:44:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
679
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2988
!
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2989
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2990
nameInSmalltalk
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2991
    "Return the name of the class under which it could be found in
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2992
     system dictionary (Smalltalk)"
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2993
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2994
    ^ self nameSpaceName , '::' , self lastName.
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2995
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2996
    "Modified: / 19-10-1998 / 20:07:24 / cg"
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  2997
    "Modified: / 14-09-2013 / 22:54:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
679
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2998
!
8983c2db7e24 *** empty log message ***
cg
parents: 675
diff changeset
  2999
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3000
nameSpaceName
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3001
    "Return the name of the class under which it could be found in
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3002
     system dictionary (Smalltalk).
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3003
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3004
     The top namespace is
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3005
        (i) either JAVA iff the class is loaded by primordial or ext or system class loader
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3006
        (ii) or JAVA_XXXXXXXX where XXXXXXXX is hashcode of the classloader that loaded given class.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3007
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3008
     "
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3009
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3010
    ^ String
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3011
        streamContents: [:s |
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3012
            | parts |
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3013
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3014
            s nextPutAll: 'JAVA'.
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3015
            classLoader notNil ifTrue: [
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3016
                | systemLoader  extLoader |
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3017
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3018
                systemLoader := JavaVM systemClassLoader.
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3019
                systemLoader notNil ifTrue: [
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3020
                    classLoader ~~ systemLoader ifTrue: [
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3021
                        extLoader := systemLoader instVarNamed: #parent.
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3022
                        classLoader ~~ extLoader ifTrue: [
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3023
                            "Class was not loaded by primordial nor ext nor system class loader"
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3024
                            s
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3025
                                nextPut: $_;
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3026
                                nextPutAll: (classLoader identityHash printStringRadix: 16 padTo: 8).
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3027
                        ]
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3028
                    ]
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3029
                ]
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3030
            ].
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3031
            parts := self binaryName asCollectionOfSubstringsSeparatedBy: $/.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3032
            parts
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3033
                from: 1
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3034
                to: (parts size - 1)
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3035
                do: [:aPart |
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3036
                    s nextPutAll: '::'.
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3037
                    s nextPutAll: aPart
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3038
                ].
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3039
        ].
626
cg
parents: 625
diff changeset
  3040
cg
parents: 625
diff changeset
  3041
    "
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3042
     JAVA::java::lang::Object nameInSmalltalk
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  3043
     JAVA::java::lang::Object nameSpacePath
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3044
     JAVA::java::lang::Object name"
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3045
2730
272689c14005 Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2729
diff changeset
  3046
    "Created: / 14-09-2013 / 22:53:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2842
881eb22c2724 Bugfix in JavaClass>>nameSpaceName: all classes loaded by primordial, ext or system class loader should go to JAVA namespace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3047
    "Modified: / 10-10-2013 / 01:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
393
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  3048
!
1efe41b5bc98 #removeClass: fix
cg
parents: 375
diff changeset
  3049
3207
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3050
owningClass
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3051
    ^ self enclosingClass
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3052
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3053
    "Created: / 05-08-2014 / 22:35:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3054
!
6cb006c63c4a Return enclusing class's package for inner classes. Make #owningClass to return enclosing class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3206
diff changeset
  3055
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3056
selectMethodsAnnotatedWith:aJavaTypeName
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3057
    ^ self methodDictionary values select:
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3058
            [:method |
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3059
            (method isJavaMethod
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3060
                and:[method annotations notNil
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3061
                    and:[(method annotations runtimeVisible at:aJavaTypeName ifAbsent:nil) notNil]])].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3062
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3063
    "Created: / 02-03-2011 / 23:06:42 / Marcel Hlopko <hlopik@gmail.com>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3064
    "Modified: / 14-12-2011 / 22:35:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3065
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3066
626
cg
parents: 625
diff changeset
  3067
supportsMethodCategories
cg
parents: 625
diff changeset
  3068
    ^ self isJavaClass not
175
68da52e100ab *** empty log message ***
cg
parents: 172
diff changeset
  3069
626
cg
parents: 625
diff changeset
  3070
    "Created: / 30.7.1997 / 14:58:58 / cg"
cg
parents: 625
diff changeset
  3071
    "Modified: / 7.5.1998 / 12:25:54 / cg"
cg
parents: 625
diff changeset
  3072
!
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  3073
626
cg
parents: 625
diff changeset
  3074
typeName
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3075
    ^ 'L' , self fullName , ';'.
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  3076
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 312
diff changeset
  3077
    "
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3078
     (Java at:'java.util.Stack') typeName"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3079
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3080
    "Modified: / 10-02-1998 / 17:13:26 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3081
    "Modified: / 02-03-2011 / 22:48:40 / Marcel Hlopko <hlopik@gmail.com>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3082
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3083
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3084
!JavaClass methodsFor:'queries-protocol'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3085
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3086
equalsOrIsSubclassOf: aJavaClass
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3087
    self = aJavaClass ifTrue: [^true].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3088
    ^ self isSubclassOf:aJavaClass.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3089
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3090
    "Created: / 30-05-2011 / 23:07:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3091
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3092
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3093
includesBehavior: aClass
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3094
    ^ (aClass isJavaClass not or: [ aClass isInterface not ])
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3095
        ifTrue: [ self name == aClass name or:[ super includesBehavior: aClass ]]
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3096
        ifFalse: [self name == aClass name or: [ self allInterfaces includes: aClass ]].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3097
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3098
    "Created: / 05-02-2011 / 23:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3099
    "Modified (format): / 09-10-2013 / 01:29:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3100
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3101
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3102
isSubclassOf: aClass
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3103
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3104
    | cls |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3105
    aClass isNil ifTrue:[^false].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3106
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3107
    [ cls notNil ] whileTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3108
        "JV-2011-10-20: Q: is one subclass of another if its
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3109
         are subclass but loaded using different classloader?"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3110
        cls == aClass ifTrue:[
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3111
            ^true
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3112
        ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3113
        cls := cls superclass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3114
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3115
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3116
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3117
    "Created: / 20-10-2011 / 16:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3118
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3119
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3120
!JavaClass methodsFor:'reflection'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3121
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3122
findInstFieldByName: fieldName
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3123
    "tries to find a field in current class (not superclasses)"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3124
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3125
    | result |
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3126
    result := self fields
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3127
                detect: [:each | each name = fieldName ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3128
                ifNone: [ nil ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3129
    ^ result.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3130
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3131
    "Created: / 07-12-2011 / 23:05:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3132
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3133
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3134
findInterfaceFieldByName: fieldName
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3135
    | result  seenIfaces  ifaces |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3136
    ifaces := OrderedCollection withAll: self interfaces.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3137
    seenIfaces := Set new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3138
    [ ifaces notEmpty ] whileTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3139
        | iface |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3140
        iface := ifaces removeFirst.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3141
        result := iface staticFields
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3142
                    detect: [:each | each name = fieldName ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3143
                    ifNone: [ nil ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3144
        result notNil ifTrue: [ ^ result ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3145
        seenIfaces add: iface.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3146
        iface interfaces do: [
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3147
            :each |
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3148
            (seenIfaces includes: each) not ifTrue: [ ifaces add: each ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3149
        ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3150
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3151
    ^ nil.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3152
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3153
    "Created: / 07-12-2011 / 23:05:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3154
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3155
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3156
findStaticFieldByName: fieldName
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3157
    "tries to find a field in current class (not superclasses)"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3158
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3159
    | result |
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3160
    result := self staticFields
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3161
                detect: [:each | each name = fieldName ]
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3162
                ifNone: [ nil ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3163
    ^ result.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3164
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3165
    "Created: / 07-12-2011 / 23:05:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3166
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3167
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3168
lookupFieldByNameAndType: aJavaNameAndType
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3169
    | field  cls |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3170
    cls := self.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3171
    [ cls ~~ JavaObject ] whileTrue: [
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3172
        field := cls findInstFieldByName: aJavaNameAndType name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3173
        field notNil ifTrue: [ ^ field ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3174
        field := cls findStaticFieldByName: aJavaNameAndType name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3175
        field notNil ifTrue: [ ^ field ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3176
        field := cls findInterfaceFieldByName: aJavaNameAndType name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3177
        field notNil ifTrue: [ ^ field ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3178
        cls := cls superclass.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3179
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3180
    self breakPoint: #mh.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3181
    ^ nil.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3182
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3183
    "Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3184
    "Modified: / 13-08-2011 / 00:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3185
    "Modified: / 07-12-2011 / 23:05:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3186
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3187
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3188
lookupMethodByNameAndType: aJavaNameAndType
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3189
    ^ self lookupMethodFor: aJavaNameAndType selector.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3190
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3191
    "Created: / 11-04-2011 / 21:28:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3192
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3193
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3194
lookupStaticFieldByNameAndType: aJavaNameAndType
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3195
    | field  cls |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3196
    cls := self.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3197
    [ cls ~= JavaObject ] whileTrue: [
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3198
        field := cls findStaticFieldByName: aJavaNameAndType name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3199
        field notNil ifTrue: [ ^ field ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3200
        field := cls findInterfaceFieldByName: aJavaNameAndType name.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3201
        field notNil ifTrue: [ ^ field ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3202
        cls := cls superclass.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3203
    ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3204
    self breakPoint: #mh.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3205
    ^ nil.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3206
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3207
    "Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3208
    "Modified: / 26-08-2011 / 18:27:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3209
    "Modified: / 07-12-2011 / 23:06:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
626
cg
parents: 625
diff changeset
  3210
! !
cg
parents: 625
diff changeset
  3211
cg
parents: 625
diff changeset
  3212
!JavaClass methodsFor:'special'!
cg
parents: 625
diff changeset
  3213
cg
parents: 625
diff changeset
  3214
asClassPointerRef
cg
parents: 625
diff changeset
  3215
"/ self halt.
cg
parents: 625
diff changeset
  3216
     ^ self
cg
parents: 625
diff changeset
  3217
cg
parents: 625
diff changeset
  3218
    "Created: / 10.11.1998 / 02:07:01 / cg"
cg
parents: 625
diff changeset
  3219
    "Modified: / 8.1.1999 / 14:11:26 / cg"
428
4b400c64ccec checkin from browser
cg
parents: 426
diff changeset
  3220
!
4b400c64ccec checkin from browser
cg
parents: 426
diff changeset
  3221
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3222
deinit
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3223
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3224
    accessFlags := accessFlags bitClear: ACX_INITIALIZED.
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3225
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3226
    "Created: / 25-10-2010 / 12:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3227
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3228
626
cg
parents: 625
diff changeset
  3229
deref
2118
b73d5b8e93c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  3230
	^ self
428
4b400c64ccec checkin from browser
cg
parents: 426
diff changeset
  3231
626
cg
parents: 625
diff changeset
  3232
    "Created: / 10.11.1998 / 02:08:06 / cg"
428
4b400c64ccec checkin from browser
cg
parents: 426
diff changeset
  3233
!
4b400c64ccec checkin from browser
cg
parents: 426
diff changeset
  3234
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3235
javaArrayClass
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3236
    "/ self halt.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3237
    "/  ^ Array
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3238
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3239
    ^ JavaArray javaArrayClassFor:self
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3240
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3241
    "Created: / 10-11-1998 / 02:07:32 / cg"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3242
    "Modified: / 08-01-1999 / 14:11:34 / cg"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3243
    "Modified: / 05-07-2012 / 23:24:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2966
afd174546057 Post-merge fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2965
diff changeset
  3244
! !
203
67af98594672 *** empty log message ***
cg
parents: 200
diff changeset
  3245
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3246
!JavaClass methodsFor:'support - refactorings'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3247
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3248
directlyDefinesMethod: aSelector
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3249
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3250
    ^self methodDictionary includes: aSelector.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3251
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3252
    "Created: / 16-03-2011 / 14:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3253
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3254
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3255
metaclass
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3256
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3257
    ^self class
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3258
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3259
    "Created: / 16-03-2011 / 14:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3260
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3261
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3262
!JavaClass methodsFor:'support - sUnit'!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3263
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3264
asTestCase
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3265
    self isTestletLike
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3266
        ifTrue: [^ TestletTestCaseProxy for: self ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3267
    ^ JUnitTestCaseProxy for: self.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3268
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3269
    "Created: / 04-03-2011 / 08:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3270
    "Modified: / 29-04-2011 / 17:52:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3271
    "Modified: / 07-05-2011 / 18:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3272
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3273
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3274
asTestlet
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3275
    ^ TestletTestCaseProxy for: self
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3276
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3277
    "Created: / 29-04-2011 / 16:53:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3278
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3279
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3280
buildSuite
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3281
    self isTestletLike ifTrue: [ ^(TestletTestCaseProxy for: self) buildSuite ].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3282
^ (JUnitTestCaseProxy for: self) buildSuite
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3283
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3284
    "Created: / 29-05-2011 / 22:45:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3285
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3286
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3287
isJUnitTestCaseLike
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3288
    | cls |
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3289
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3290
    "try JUnit 4.x"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3291
    (self containsMethodsAnnotatedWith: #'Lorg/junit/Test;') ifTrue: [
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3292
        ^ true
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3293
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3294
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3295
    "Try jUnit 3.x"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3296
    cls := self superclass.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3297
    [ cls ~~ JavaObject ] whileTrue:[
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3298
        cls binaryName == #'junit/framework/TestCase' ifTrue:[ ^ true ].
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3299
        cls := cls superclass.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3300
    ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3301
    ^false
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3302
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3303
        JAVA::java::lang::Object isTestCaseLike
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3304
        JAVA::stx::libjava::tests::junit::JUnit3Tests isTestCaseLike
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3305
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3306
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3307
    "Created: / 23-10-2011 / 22:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2800
diff changeset
  3308
    "Modified: / 08-10-2013 / 22:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3309
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3310
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3311
isTestCaseLike
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3312
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3313
    JavaVM booted ifFalse:[ ^ false ].
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3314
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3315
    ^self isJUnitTestCaseLike or:[ self isTestletLike ]
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3316
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3317
    "
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3318
        JAVA::java::lang::Object isTestCaseLike
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3319
        JAVA::stx::libjava::tests::junit::JUnit3Tests isTestCaseLike"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3320
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3321
    "Created: / 28-02-2011 / 21:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3322
    "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3323
    "Modified: / 29-05-2011 / 22:48:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3324
    "Modified: / 02-12-2011 / 23:09:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3325
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3326
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3327
isTestSelector: selector
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3328
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3329
    "Hack, you're right, blame on me"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3330
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3331
    | junit_framework_TestCase m |
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3332
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3333
    ((selector == #'test(Lgnu/testlet/TestHarness;)V')
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3334
        and:[self ~~ (Java at:'gnu.testlet.Testlet')])
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3335
            ifTrue:[^true].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3336
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3337
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3338
    junit_framework_TestCase := Java at:'junit.framework.TestCase'.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3339
    (junit_framework_TestCase notNil and:
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3340
        [self includesBehavior:junit_framework_TestCase])
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3341
        ifTrue:[^selector startsWith: 'test'].
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3342
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3343
    m := self lookupSelector: selector.
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3344
    "Sorry fo that, but I need this method to be fast"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3345
    ^m notNil and:[m annotations runtimeVisible includesKey: 'Lorg/junit/Test;'].
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3346
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3347
    "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3348
    "Created: / 04-03-2011 / 07:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3349
!
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3350
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3351
isTestletLike
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3352
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3353
    ^self interfaceNames includes:'gnu.testlet.Testlet'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3354
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3355
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3356
        self interfaces
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3357
    "
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3358
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3359
    "Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>"
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3360
    "Created: / 29-04-2011 / 17:02:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3361
    "Modified: / 13-02-2013 / 09:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3362
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3363
2968
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3364
!JavaClass methodsFor:'synchronized evaluation'!
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3365
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3366
freeSynchronizationSemaphore
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3367
    "free synchronizationSemaphore. May be used, to save memory when
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3368
     an object is no longer used synchronized."
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3369
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3370
    ^ self shouldNotImplement
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3371
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3372
    "
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3373
     self synchronized:[].
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3374
     self synchronizationSemaphore.
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3375
     self freeSynchronizationSemaphore.
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3376
    "
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3377
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3378
    "Created: / 28-01-1997 / 19:31:20 / stefan"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3379
    "Modified: / 08-12-2013 / 22:21:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3380
!
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3381
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3382
synchronizationSemaphore
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3383
    "return the synchronization semaphore for myself.
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3384
     subclasses may redefine"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3385
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3386
    ^ self shouldNotImplement
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3387
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3388
    "
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3389
      self synchronizationSemaphore
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3390
    "
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3391
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3392
    "Modified: / 28-01-1997 / 19:47:09 / stefan"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3393
    "Modified: / 08-12-2013 / 22:21:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3394
!
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3395
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3396
synchronizationSemaphore:aSemaphore
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3397
    "set the synchronisationSemaphore for myself.
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3398
     subclasses may redefine this method"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3399
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3400
    ^ self shouldNotImplement
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3401
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3402
    "Modified: / 28-01-1997 / 19:37:48 / stefan"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3403
    "Modified: / 08-12-2013 / 22:21:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3404
!
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3405
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3406
synchronized:aBlock
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3407
    "Evaluate aBlock synchronized, i.e. use a monitor for this object"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3408
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3409
%{
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3410
    extern void __monitorEnter(OBJ obj);
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3411
    __monitorEnter(self);
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3412
%}.
2968
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3413
    aBlock ensure:[
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3414
%{
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3415
    extern void __monitorExit(OBJ obj);
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3416
    __monitorExit(self);
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3417
%}.
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3418
    1. "/ To make stc happy (stc needs a return value but primitive code has none)
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3419
    ].
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3420
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3421
    "Created: / 28-01-1997 / 17:52:56 / stefan"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3422
    "Modified: / 30-01-1997 / 13:38:54 / cg"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3423
    "Modified: / 20-02-1997 / 09:43:35 / stefan"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3424
    "Modified: / 08-12-2013 / 22:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3425
! !
d4963adcb114 Added JavaClass>>synchronized: that uses thinlocks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2966
diff changeset
  3426
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3427
!JavaClass methodsFor:'unwind'!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3428
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3429
unwindHandlerInContext: aContext
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3430
    "given a context which has been marked for unwind,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3431
     retrieve the handler block. This method is called when ST
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3432
     exception raises and stack is unwinding. JavaClass instance
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3433
     has an opportunity to clean up monitors"
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3434
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3435
    ^ JavaVM unwindHandlerForJavaContext: aContext.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3436
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3437
    "Created: / 08-11-2011 / 12:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3438
! !
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3439
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3440
!JavaClass methodsFor:'versions'!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3441
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3442
mergeVersionsWith: aJavaClass
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3443
    "
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3444
    take both self and aJavaClass and ensure that:
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3445
    1) both share the same versions array instance
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3446
    2) versions instance includes both self and aJavaClass.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3447
    "
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3448
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3449
    self markMultipleVersions.
3291
2cf782f380f2 JavaClass memory optimization (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3290
diff changeset
  3450
    aJavaClass markMultipleVersions.
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3451
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3452
    (self versions isNil and: [ aJavaClass versions isNil ]) ifTrue: [
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3453
        | versionsArray |
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3454
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3455
        versionsArray := WeakArray with: self with: aJavaClass.
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3456
        versionsArray addDependent: JavaClass::JavaClassVersionDiedHandler new.
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3457
        self versions: versionsArray.
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3458
        aJavaClass versions: versionsArray.
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3459
        ^ self.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3460
    ].
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3461
    self versions isNil ifTrue: [
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3462
        self versions: aJavaClass versions.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3463
        self versions add: self.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3464
        ^ self.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3465
    ].
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3466
    aJavaClass versions isNil ifTrue: [
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3467
        aJavaClass versions: self versions.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3468
        self versions add: aJavaClass.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3469
        ^ self.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3470
    ].
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3471
    self error: 'merge of two classes both of which have multiple versions not supported'.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3472
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3473
    "Created: / 14-04-2013 / 13:44:03 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3474
    "Modified: / 02-10-2013 / 21:52:39 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3293
14292924cac7 JavaClass memory optimization (part 4)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3292
diff changeset
  3475
    "Modified (format): / 07-12-2014 / 01:30:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2561
diff changeset
  3476
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2561
diff changeset
  3477
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3478
!JavaClass::Attributes class methodsFor:'accessing'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3479
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3480
empty
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3481
    ^ Empty
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3482
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3483
    "Created: / 13-09-2013 / 00:50:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3484
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3485
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3486
!JavaClass::Attributes class methodsFor:'documentation'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3487
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3488
documentation
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3489
"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3490
    A special container for class attributes allowing
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3491
    for dense, memory-efficient storage.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3492
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3493
    [author:]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3494
        Jan Vrany <jan.vrany@fit.cvut.cz>
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3495
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3496
    [instance variables:]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3497
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3498
    [class variables:]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3499
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3500
    [see also:]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3501
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3502
"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3503
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3504
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3505
!JavaClass::Attributes class methodsFor:'initialization'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3506
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3507
initialize
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3508
    "Invoked at system start or when the class is dynamically loaded."
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3509
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3510
    "/ please change as required (and remove this comment)
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3511
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3512
    Empty := self new:0.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3513
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3514
    "Modified: / 13-09-2013 / 00:51:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3515
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2715
diff changeset
  3516
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3517
!JavaClass::JavaClassVersionDiedHandler class methodsFor:'documentation'!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3518
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3519
history
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3520
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3521
    "Created: #update:with:from: / 14-04-2013 / 14:04:20 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3522
    "Modified: #update:with:from: / 02-10-2013 / 21:49:51 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3523
! !
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3524
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3525
!JavaClass::JavaClassVersionDiedHandler methodsFor:'notification'!
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3526
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3527
update:aParameter with:anArgument from:source
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3528
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3529
    aParameter = #ElementExpired ifFalse: [
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3530
        self error: 'only #ElementExpired updates supported'.
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3531
    ].
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3532
    self assert: (source notNil and: [ source size >= 1 ]).
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3533
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3534
    source size = 1 ifTrue: [
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3535
        "only one version remaining - we can start caching. Let's change the flag"
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3536
        | javaClass |
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3537
        javaClass := (source at: 1).
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3538
        javaClass markNonMultipleVersions.
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3539
    ].
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3540
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3541
    "Created: / 14-04-2013 / 14:04:20 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2757
66f842986836 cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents: 2754
diff changeset
  3542
    "Modified: / 02-10-2013 / 21:49:51 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2504
08bdd02727cf JavaClass>>mergeVersionsWith:
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2476
diff changeset
  3543
! !
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2566
diff changeset
  3544
130
0483a6fd7d43 handle namespace requests;
cg
parents: 125
diff changeset
  3545
!JavaClass class methodsFor:'documentation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  3546
083530508d9c intitial checkin
cg
parents:
diff changeset
  3547
version
3428
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
  3548
    ^ '$Header: /cvs/stx/stx/libjava/JavaClass.st,v 1.139 2015-02-17 15:16:50 vrany Exp $'
2197
6c7576efbf16 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  3549
!
6c7576efbf16 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  3550
6c7576efbf16 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
  3551
version_CVS
3428
a0fb3a6e51b4 JavaClass: added JavaClass>>sourceDecompiled with better description text.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3427
diff changeset
  3552
    ^ '$Header: /cvs/stx/stx/libjava/JavaClass.st,v 1.139 2015-02-17 15:16:50 vrany Exp $'
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3553
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3554
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3555
version_SVN
2566
f1cea8b752ba Merged branch default (CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2529 2561
diff changeset
  3556
    ^ 'Id'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  3557
! !
2151
c0b6570c6f9b Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2143
diff changeset
  3558
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2310
diff changeset
  3559
2966
afd174546057 Post-merge fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2965
diff changeset
  3560
JavaClass initialize!
2965
bac7022ca26a Merged 7c3b2a89f173 and 80a1a085a982 (branch performance-optimizations)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2957 2618
diff changeset
  3561
JavaClass::Attributes initialize!