author | Jan Vrany <jan.vrany@labware.com> |
Sun, 09 Aug 2020 13:00:09 +0100 | |
changeset 4004 | 794e6f425fa8 |
parent 3860 | e87f2f1439e9 |
permissions | -rw-r--r-- |
3860
e87f2f1439e9
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
3553
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
e87f2f1439e9
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
3553
diff
changeset
|
2 |
|
749 | 3 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
4 |
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:
2231
diff
changeset
|
5 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
6 |
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:
2231
diff
changeset
|
7 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
8 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 9 |
SWING Research Group, Czech Technical University in Prague |
10 |
||
11 |
This software is furnished under a license and may be used |
|
12 |
only in accordance with the terms of that license and with the |
|
13 |
inclusion of the above copyright notice. This software may not |
|
14 |
be provided or otherwise made available to, or used by, any |
|
15 |
other person. No title to or ownership of the software is |
|
16 |
hereby transferred. |
|
17 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
18 |
[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:
2231
diff
changeset
|
19 |
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:
2231
diff
changeset
|
20 |
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:
2231
diff
changeset
|
21 |
as of 1.9.2010 |
749 | 22 |
" |
23 |
"{ Package: 'stx:libjava' }" |
|
24 |
||
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
25 |
"{ NameSpace: Smalltalk }" |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
26 |
|
749 | 27 |
Object subclass:#JavaResolver |
28 |
instanceVariableNames:'exceptionThrower' |
|
29 |
classVariableNames:'uniqueInstance' |
|
30 |
poolDictionaries:'' |
|
31 |
category:'Languages-Java-Reader-Support-new' |
|
32 |
! |
|
33 |
||
34 |
!JavaResolver class methodsFor:'documentation'! |
|
35 |
||
36 |
copyright |
|
37 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
38 |
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:
2231
diff
changeset
|
39 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
40 |
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:
2231
diff
changeset
|
41 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
42 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 43 |
SWING Research Group, Czech Technical University in Prague |
44 |
||
45 |
This software is furnished under a license and may be used |
|
46 |
only in accordance with the terms of that license and with the |
|
47 |
inclusion of the above copyright notice. This software may not |
|
48 |
be provided or otherwise made available to, or used by, any |
|
49 |
other person. No title to or ownership of the software is |
|
50 |
hereby transferred. |
|
51 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
52 |
[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:
2231
diff
changeset
|
53 |
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:
2231
diff
changeset
|
54 |
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:
2231
diff
changeset
|
55 |
as of 1.9.2010 |
749 | 56 |
|
57 |
" |
|
58 |
! ! |
|
59 |
||
60 |
!JavaResolver class methodsFor:'initialization'! |
|
61 |
||
62 |
initialize |
|
63 |
uniqueInstance := JavaResolver new. |
|
64 |
uniqueInstance exceptionThrower: JavaVM. |
|
65 |
||
66 |
"/has methods at: and at: put: |
|
67 |
"/uniqueInstance resolvedClasses: Java. |
|
68 |
||
69 |
"Modified: / 10-04-2011 / 10:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
70 |
"Modified: / 13-04-2011 / 14:07:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
71 |
! ! |
|
72 |
||
73 |
!JavaResolver class methodsFor:'instance creation'! |
|
74 |
||
75 |
uniqueInstance |
|
76 |
^uniqueInstance. |
|
77 |
||
78 |
"Created: / 08-04-2011 / 17:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
79 |
"Modified: / 11-04-2011 / 19:06:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
80 |
! ! |
|
81 |
||
82 |
!JavaResolver methodsFor:'accessing'! |
|
83 |
||
84 |
exceptionThrower |
|
85 |
^ exceptionThrower |
|
86 |
! |
|
87 |
||
88 |
exceptionThrower:something |
|
89 |
exceptionThrower := something. |
|
90 |
! ! |
|
91 |
||
92 |
!JavaResolver methodsFor:'class resolving'! |
|
93 |
||
94 |
checkIfPrimitiveArrayRef: aJavaClassRef andWrap: result |
|
95 |
||
96 |
^ (JavaDescriptor readFromString: aJavaClassRef name) javaClass. |
|
97 |
||
98 |
"Created: / 23-05-2011 / 21:12:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
99 |
! |
|
100 |
||
101 |
resolveClassIndentifiedByRef: aJavaClassRef init: doInit |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
102 |
"marcel is back working harder then ever :)" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
103 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
104 |
| result | |
749 | 105 |
self validateClassRef: aJavaClassRef. |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
106 |
result := self |
2794
cec025d0f359
Oops, fix for resolving.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
107 |
lookupClassIfAlreadyResolved: aJavaClassRef javaClassNameOrPrimitiveTypeId |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
108 |
definedBy: aJavaClassRef classLoader. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
109 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
110 |
"/ result notNil ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
111 |
"/ "/wrap result with array(s) if needed and return it |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
112 |
"/ "/FIXME: Marcel, can you have a look? Is that correct? |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
113 |
"/ ^self checkIfArrayRef: aJavaClassRef andWrap: result. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
114 |
"/ ]. |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
115 |
" |
749 | 116 |
To resolve an unresolved symbolic reference from D to a class or interface C denoted by N, |
117 |
the following steps are performed: |
|
118 |
The defining class loader of D is used to create a class or interface denoted by N. |
|
119 |
This class or interface is C. Any exception that can be thrown as a result of failure |
|
120 |
of class or interface creation can thus be thrown as a result of failure of class and |
|
121 |
interface resolution. The details of the process are given in Section 5.3. |
|
122 |
" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
123 |
result isNil ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
124 |
JavaClassReader classLoaderQuerySignal answer: (aJavaClassRef classLoader) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
125 |
do: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
126 |
"#loadUnresolvedClass: wraps the class!!!!!!" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
127 |
result := self loadUnresolvedClass: aJavaClassRef. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
128 |
((aJavaClassRef name first == $[) and: [ result isJavaArrayClass not ]) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
129 |
self breakPoint: #jv. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
130 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
131 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
132 |
] ifFalse: [ result := self checkIfArrayRef: aJavaClassRef andWrap: result. ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
133 |
result isNil ifTrue: [ self breakPoint: #mh ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
134 |
result isJavaPrimitiveType ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
135 |
^ self checkIfPrimitiveArrayRef: aJavaClassRef andWrap: result |
749 | 136 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
137 |
(doInit and: [ result isJavaClass and: [ result isJavaArrayClass not ] ]) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
138 |
result classInit |
749 | 139 |
]. |
140 |
" |
|
141 |
If C is an array class and its element type is a reference type, then the symbolic reference |
|
142 |
to the class or interface representing the element type is resolved by invoking the algorithm |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
143 |
in Section 5.4.3.1 recursively.""Finally, access permissions to C are checked: |
749 | 144 |
If C is not accessible (5.4.4) to D, class or interface resolution throws an IllegalAccessError. |
145 |
This condition can occur, for example, if C is a class that was originally declared to be |
|
146 |
public but was changed to be non-public after D was compiled. |
|
147 |
||
148 |
If steps 1 and 2 succeed but step 3 fails, C is still valid and usable. Nevertheless, resolution |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
149 |
fails, and D is prohibited from accessing C." |
749 | 150 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
151 |
(self checkPermissionsFrom: aJavaClassRef owner to: result) ifFalse: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
152 |
self throwIllegalAccessError. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
153 |
^nil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
154 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
155 |
^result |
749 | 156 |
|
157 |
"Created: / 11-04-2011 / 19:07:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
158 |
"Created: / 12-08-2011 / 22:19:51 / 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:
2231
diff
changeset
|
159 |
"Modified (comment): / 03-10-2011 / 23:03:01 / m" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
160 |
"Modified: / 01-12-2012 / 13:44:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2794
cec025d0f359
Oops, fix for resolving.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
161 |
"Modified: / 05-10-2013 / 01:05:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 162 |
! ! |
163 |
||
164 |
!JavaResolver methodsFor:'class resolving helpers'! |
|
165 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
166 |
checkIfArrayRef: aJavaClassRef andWrap: nonArrayClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
167 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
168 |
"/wrap result with array(s) if needed and return it |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
169 |
| class| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
170 |
class := nonArrayClass. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
171 |
aJavaClassRef name do:[:c| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
172 |
c ~~ $[ ifTrue:[ ^ class ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
173 |
class := class javaArrayClass. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
174 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
175 |
^class |
749 | 176 |
|
177 |
"Modified: / 11-04-2011 / 19:31:43 / 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:
2231
diff
changeset
|
178 |
"Modified: / 23-10-2011 / 23:46:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 179 |
! |
180 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
181 |
checkPermissionsFrom: refOwner to: resolvedClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
182 |
refOwner hasMagicAccessRights ifTrue: [ ^ true ]. |
2942
c39cbf09ea3d
Fixes for Java reflection on Smalltalk classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2908
diff
changeset
|
183 |
resolvedClass isJavaClass ifFalse:[ ^ true ]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
184 |
(JavaDescriptor isJavaPrimitiveArrayName: resolvedClass javaName) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
185 |
^ true |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
186 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
187 |
resolvedClass isPublic ifTrue: [ ^ true ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
188 |
resolvedClass classLoader = refOwner classLoader ifFalse: [ ^ false. ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
189 |
refOwner javaPackage = resolvedClass javaPackage ifTrue: [ ^ true ]. |
749 | 190 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
191 |
"/a little bit too verbose here just so it's clear what's in query |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
192 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
193 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ] ifFalse: [ ^ false ]. |
749 | 194 |
|
195 |
"Created: / 11-04-2011 / 19:35:21 / 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:
2231
diff
changeset
|
196 |
"Modified (comment): / 09-10-2011 / 23:11:54 / Marcel Hlopko <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
197 |
"Modified: / 23-08-2012 / 20:21:40 / m" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
198 |
"Modified: / 30-11-2012 / 20:34:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2942
c39cbf09ea3d
Fixes for Java reflection on Smalltalk classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2908
diff
changeset
|
199 |
"Modified: / 20-11-2013 / 16:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 200 |
! |
201 |
||
202 |
loadUnresolvedClass: aJavaClassRef |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
203 |
| nm cls i | |
749 | 204 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
205 |
nm := aJavaClassRef name. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
206 |
nm size == 1 ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
207 |
JavaDescriptor baseTypes at: nm first ifPresent: [:cls | ^ cls ] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
208 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
209 |
"Note, that JavaVM>>classForName: itself deals with class loaders. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
210 |
The caller of me should set one using code like: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
211 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
212 |
JavaClassReader classLoaderQuerySignal answer: loader do:[call me] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
213 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
214 |
cls := JavaVM classForName: nm. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
215 |
(nm startsWith:$[) ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
216 |
i := 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
217 |
[ (nm at:i) == $[ ] whileTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
218 |
cls := cls javaArrayClass. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
219 |
i := i + 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
220 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
221 |
self assert: (nm at:i) == $L. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
222 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
223 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
224 |
^cls. |
749 | 225 |
|
226 |
"Created: / 11-04-2011 / 19:27:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
227 |
"Modified: / 23-05-2011 / 21:06:25 / 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:
2231
diff
changeset
|
228 |
"Modified: / 29-02-2012 / 09:20:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 229 |
! |
230 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
231 |
lookupClassIfAlreadyResolved: javaClassName definedBy: classLoader |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
232 |
^ JavaVM classNamed: javaClassName definedBy: classLoader |
749 | 233 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
234 |
"Created: / 02-05-2013 / 01:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 235 |
! |
236 |
||
237 |
validateClassRef: aJavaClassRef |
|
238 |
self assert: aJavaClassRef isJavaRef. |
|
239 |
self assert: aJavaClassRef isJavaClassRef . |
|
240 |
||
241 |
"Modified: / 23-05-2011 / 21:04:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
242 |
! ! |
|
243 |
||
244 |
!JavaResolver methodsFor:'common helpers'! |
|
245 |
||
246 |
checkPermissionsForMethodOrField: aJavaMethodOrField from: accessingJavaClass to: resolvedJavaClass |
|
247 |
"A class or interface C is accessible to a class or interface D if |
|
248 |
and only if either of the following conditions are true: |
|
249 |
C is public. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
250 |
C and D are members of the same runtime package (§5.3). |
749 | 251 |
A field or method R is accessible to a class or interface D if and only |
252 |
if any of the following conditions is true: |
|
253 |
R is public. |
|
254 |
R is protected and is declared in a class C, and D is either a subclass |
|
255 |
of C or C itself. |
|
256 |
R is either protected or package private (that is, neither public nor |
|
257 |
protected nor private), and is declared by a class in the same runtime |
|
258 |
package as D. |
|
259 |
R is private and is declared in D. |
|
260 |
This discussion of access control omits a related restriction on the target |
|
261 |
of a protected field access or method invocation (the target must be of class |
|
262 |
D or a subtype of D). That requirement is checked as part of the verification |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
263 |
process (§5.4.1); it is not part of link-time access control." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
264 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
265 |
accessingJavaClass hasMagicAccessRights ifTrue: [ ^true ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
266 |
|
749 | 267 |
(self checkPermissionsFrom: accessingJavaClass to: resolvedJavaClass) ifFalse: [ |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
268 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ]. |
749 | 269 |
^ false |
270 |
]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
271 |
aJavaMethodOrField isPublic ifTrue: [ ^ true ]. |
749 | 272 |
((aJavaMethodOrField isProtected |
273 |
and: [ |
|
274 |
resolvedJavaClass javaComponentClass |
|
275 |
equalsOrIsSubclassOf: aJavaMethodOrField javaClass |
|
276 |
]) |
|
277 |
and: [ |
|
278 |
accessingJavaClass javaComponentClass |
|
279 |
equalsOrIsSubclassOf: aJavaMethodOrField javaClass |
|
280 |
]) |
|
281 |
ifTrue: [ ^ true ]. |
|
2730
272689c14005
Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2578
diff
changeset
|
282 |
(( |
272689c14005
Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2578
diff
changeset
|
283 |
aJavaMethodOrField isPrivate not |
749 | 284 |
and: [ resolvedJavaClass javaPackage = accessingJavaClass javaPackage ]) |
285 |
and: [ resolvedJavaClass classLoader = accessingJavaClass classLoader ]) |
|
286 |
ifTrue: [ ^ true ]. |
|
287 |
(aJavaMethodOrField isPrivate |
|
288 |
and: [ aJavaMethodOrField javaClass name = accessingJavaClass name ]) |
|
289 |
ifTrue: [ ^ true ]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
290 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
291 |
"/a little bit too verbose here just so it's clear what's in query |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
292 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
293 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ] ifFalse: [ ^ false ]. |
749 | 294 |
|
295 |
"Created: / 14-04-2011 / 14:19:33 / 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:
2231
diff
changeset
|
296 |
"Modified (comment): / 09-10-2011 / 23:12:48 / Marcel Hlopko <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
297 |
"Modified: / 18-11-2012 / 16:24:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2730
272689c14005
Fixed removing of Java classes (issue #40)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2578
diff
changeset
|
298 |
"Modified (format): / 15-09-2013 / 00:09:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 299 |
! ! |
300 |
||
301 |
!JavaResolver methodsFor:'exceptions'! |
|
302 |
||
303 |
throwAbstractMethodError |
|
304 |
exceptionThrower throwAbstractMethodError. |
|
305 |
||
306 |
"Created: / 11-04-2011 / 20:19:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
307 |
"Modified: / 13-04-2011 / 14:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
308 |
! |
|
309 |
||
310 |
throwIllegalAccessError |
|
311 |
exceptionThrower throwIllegalAccessError. |
|
312 |
||
313 |
"Created: / 11-04-2011 / 19:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
314 |
"Modified: / 13-04-2011 / 23:06:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
315 |
! |
|
316 |
||
317 |
throwIncompatibleClassChangeError |
|
318 |
exceptionThrower throwIncompatibleClassChangeError. |
|
319 |
||
320 |
"Created: / 11-04-2011 / 20:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
321 |
"Modified: / 13-04-2011 / 14:07:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
322 |
! |
|
323 |
||
324 |
throwNoSuchFieldException |
|
325 |
exceptionThrower throwNoSuchFieldException. |
|
326 |
||
327 |
"Created: / 11-04-2011 / 21:35:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
328 |
"Modified: / 13-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
329 |
! |
|
330 |
||
331 |
throwNoSuchMethodError |
|
332 |
exceptionThrower throwNoSuchMethodError. |
|
333 |
||
334 |
"Created: / 11-04-2011 / 20:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
335 |
"Modified: / 13-04-2011 / 14:08:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
336 |
! ! |
|
337 |
||
338 |
!JavaResolver methodsFor:'field resolving'! |
|
339 |
||
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
340 |
resolveFieldIndentifiedByRef:aJavaFieldRef |
749 | 341 |
| result class | |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
342 |
|
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
343 |
self validateFieldRef:aJavaFieldRef. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
344 |
result := self lookupFieldIfAlreadyResolved:aJavaFieldRef. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
345 |
result notNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
346 |
^ result |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
347 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
348 |
class := aJavaFieldRef classRef resolve:false. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
349 |
class isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
350 |
self error:'should not happen - tell mh' |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
351 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
352 |
result := class lookupFieldByNameAndType:aJavaFieldRef nameAndType. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
353 |
result isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
354 |
self throwNoSuchFieldException |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
355 |
]. |
749 | 356 |
(self |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
357 |
checkPermissionsForField:result |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
358 |
from:aJavaFieldRef classRef owner |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
359 |
to:class) ifFalse:[ self throwIllegalAccessError ]. |
749 | 360 |
^ result. |
361 |
||
362 |
" |
|
363 |
To resolve an unresolved symbolic reference from D to a field in a class |
|
364 |
or interface C, the symbolic reference to C given by the field reference |
|
365 |
must first be resolved (§5.4.3.1). Therefore, any exception that can be |
|
366 |
thrown as a result of failure of resolution of a class or interface reference |
|
367 |
can be thrown as a result of failure of field resolution. If the reference |
|
368 |
to C can be successfully resolved, an exception relating to the failure of |
|
369 |
resolution of the field reference itself can be thrown. |
|
370 |
When resolving a field reference, field resolution first attempts to look |
|
371 |
up the referenced field in C and its superclasses: |
|
372 |
||
373 |
If C declares a field with the name and descriptor specified by the field |
|
374 |
reference, field lookup succeeds. The declared field is the result of the |
|
375 |
field lookup. |
|
376 |
||
377 |
Otherwise, field lookup is applied recursively to the direct superinterfaces |
|
378 |
of the specified class or interface C. |
|
379 |
||
380 |
Otherwise, if C has a superclass S, field lookup is applied recursively to S. |
|
381 |
||
382 |
Otherwise, field lookup fails. |
|
383 |
If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise, |
|
384 |
if field lookup succeeds but the referenced field is not accessible (§5.4.4) |
|
385 |
to D, field resolution throws an IllegalAccessError. |
|
386 |
Otherwise, let <E, L1> be the class or interface in which the referenced |
|
387 |
field is actually declared and let L2 be the defining loader of D. Let T be |
|
388 |
the name of the type of the referenced field. The Java virtual machine must |
|
389 |
impose the loading constraint that TL1=TL2(§5.3.4)." |
|
390 |
||
391 |
"Created: / 11-04-2011 / 21:15:20 / 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:
2231
diff
changeset
|
392 |
"Modified: / 01-12-2012 / 13:45:41 / 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:
2942
diff
changeset
|
393 |
"Modified: / 04-08-2014 / 15:52:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 394 |
! |
395 |
||
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
396 |
resolveStaticFieldIndentifiedByRef:aJavaFieldRef |
749 | 397 |
| result class | |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
398 |
|
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
399 |
self validateFieldRef:aJavaFieldRef. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
400 |
result := self lookupFieldIfAlreadyResolved:aJavaFieldRef. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
401 |
result notNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
402 |
^ result |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
403 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
404 |
class := aJavaFieldRef classRef resolve:false. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
405 |
class isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
406 |
self error:'should not happen - tell mh' |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
407 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
408 |
result := class lookupStaticFieldByNameAndType:aJavaFieldRef nameAndType. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
409 |
result isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
410 |
self throwNoSuchFieldException |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
411 |
]. |
749 | 412 |
(self |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
413 |
checkPermissionsForField:result |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
414 |
from:aJavaFieldRef classRef owner |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
415 |
to:class) ifFalse:[ self throwIllegalAccessError ]. |
749 | 416 |
^ result. |
417 |
||
418 |
" |
|
419 |
To resolve an unresolved symbolic reference from D to a field in a class |
|
420 |
or interface C, the symbolic reference to C given by the field reference |
|
421 |
must first be resolved (§5.4.3.1). Therefore, any exception that can be |
|
422 |
thrown as a result of failure of resolution of a class or interface reference |
|
423 |
can be thrown as a result of failure of field resolution. If the reference |
|
424 |
to C can be successfully resolved, an exception relating to the failure of |
|
425 |
resolution of the field reference itself can be thrown. |
|
426 |
When resolving a field reference, field resolution first attempts to look |
|
427 |
up the referenced field in C and its superclasses: |
|
428 |
||
429 |
If C declares a field with the name and descriptor specified by the field |
|
430 |
reference, field lookup succeeds. The declared field is the result of the |
|
431 |
field lookup. |
|
432 |
||
433 |
Otherwise, field lookup is applied recursively to the direct superinterfaces |
|
434 |
of the specified class or interface C. |
|
435 |
||
436 |
Otherwise, if C has a superclass S, field lookup is applied recursively to S. |
|
437 |
||
438 |
Otherwise, field lookup fails. |
|
439 |
If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise, |
|
440 |
if field lookup succeeds but the referenced field is not accessible (§5.4.4) |
|
441 |
to D, field resolution throws an IllegalAccessError. |
|
442 |
Otherwise, let <E, L1> be the class or interface in which the referenced |
|
443 |
field is actually declared and let L2 be the defining loader of D. Let T be |
|
444 |
the name of the type of the referenced field. The Java virtual machine must |
|
445 |
impose the loading constraint that TL1=TL2(§5.3.4)." |
|
446 |
||
447 |
"Created: / 28-04-2011 / 22:31:34 / 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:
2231
diff
changeset
|
448 |
"Modified: / 01-12-2012 / 13:45:45 / 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:
2942
diff
changeset
|
449 |
"Modified: / 04-08-2014 / 15:52:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 450 |
! ! |
451 |
||
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
452 |
!JavaResolver methodsFor:'field resolving-helpers'! |
749 | 453 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
454 |
checkPermissionsForField: aJavaField from: accessingJavaClass to: resolvedJavaClass |
749 | 455 |
^ self |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
456 |
checkPermissionsForMethodOrField: aJavaField |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
457 |
from: accessingJavaClass |
749 | 458 |
to: resolvedJavaClass. |
459 |
||
460 |
"Created: / 11-04-2011 / 21:46:29 / 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:
2231
diff
changeset
|
461 |
"Modified: / 01-12-2012 / 13:45:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 462 |
! |
463 |
||
464 |
lookupFieldIfAlreadyResolved: aJavaFieldRef |
|
465 |
^ nil. |
|
466 |
||
467 |
"Created: / 11-04-2011 / 21:16:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
468 |
"Modified: / 13-04-2011 / 11:57:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
469 |
! |
|
470 |
||
471 |
validateFieldRef: aJavaFieldRef |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
472 |
aJavaFieldRef isJavaRef ifFalse: [ self halt: 'I expected Java Ref' ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
473 |
aJavaFieldRef isJavaFieldRef ifFalse: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
474 |
self error: 'I expected Java Field Ref' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
475 |
]. |
749 | 476 |
|
477 |
"Created: / 11-04-2011 / 21:16:44 / 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:
2231
diff
changeset
|
478 |
"Modified: / 01-12-2012 / 13:46:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 479 |
! ! |
480 |
||
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
481 |
!JavaResolver methodsFor:'method resolving'! |
749 | 482 |
|
483 |
resolveInterfaceMethodIdentifiedByRef: aJavaInterfaceMethodRef |
|
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
484 |
| result class search selector | |
749 | 485 |
self validateInterfaceMethodRef: aJavaInterfaceMethodRef. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
486 |
class := aJavaInterfaceMethodRef classRef resolve: false. |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
487 |
class isNil ifTrue: [ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
488 |
self error: 'should not happen - tell mh' |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
489 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
490 |
"Array types responds to all method of class java.lang.Object" |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
491 |
class isJavaArrayClass ifTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
492 |
class := JavaVM classForName:'java.lang.Object'. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
493 |
]. |
749 | 494 |
class isInterface ifFalse: [ self throwIncompatibleClassChangeError ]. |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
495 |
|
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
496 |
search := class. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
497 |
selector := aJavaInterfaceMethodRef nameAndType selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
498 |
[ search notNil and:[result isNil] ] whileTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
499 |
result := search compiledMethodAt: selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
500 |
search := search superclass. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
501 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
502 |
result isNil ifTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
503 |
| queue | |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
504 |
|
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
505 |
queue := OrderedCollection withAll: class allInterfaces. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
506 |
[ result isNil and:[queue notEmpty ] ] whileTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
507 |
search := queue removeFirst. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
508 |
result := search compiledMethodAt: selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
509 |
result isNil ifTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
510 |
search interfaces do:[:interface | |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
511 |
(queue includes: interface) ifFalse:[ queue add: interface ]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
512 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
513 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
514 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
515 |
]. |
2908
064418faa2e3
Another pass over Mauve tests.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2794
diff
changeset
|
516 |
result isNil ifTrue: [ self throwNoSuchMethodError ]. |
749 | 517 |
(self |
518 |
checkPermissionsForMethod: result |
|
519 |
from: aJavaInterfaceMethodRef classRef owner |
|
520 |
to: class) ifFalse: [ self throwIllegalAccessError ]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
521 |
^ result. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
522 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
523 |
" |
749 | 524 |
To resolve an unresolved symbolic reference from D to an interface method in an |
525 |
interface C, the symbolic reference to C given by the interface method reference is |
|
526 |
first resolved (§5.4.3.1). Therefore, any exceptions that can be thrown as a result |
|
527 |
of failure of resolution of an interface reference can be thrown as a result of |
|
528 |
failure of interface method resolution. If the reference to C can be successfully |
|
529 |
resolved, exceptions relating to the resolution of the interface method reference |
|
530 |
itself can be thrown. |
|
531 |
When resolving an interface method reference: |
|
532 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
533 |
If C is not an interface, interface method resolution throws an IncompatibleClassChangeError." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
534 |
"Otherwise, if the referenced method does not have the same name and descriptor as |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
535 |
a method in C or in one of the superinterfaces of C, or in class Object, interface |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
536 |
method resolution throws a NoSuchMethodError. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
537 |
Otherwise, let <E, L1> be the interface in which the referenced interface method is |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
538 |
actually declared and let L2 be the defining loader of D. Let T0 be the name of |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
539 |
the type returned by the referenced method, and let T1, ..., Tn be the names of the |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
540 |
argument types of the referenced method. The Java virtual machine must impose the |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
541 |
loading constraints TiL1 = TiL2 for i = 0 to n (§5.3.4)." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
542 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
543 |
"Modified: / 01-12-2012 / 13:46:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
544 |
"Modified: / 27-03-2016 / 22:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 545 |
! |
546 |
||
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
547 |
resolveMethodIndentifiedByRef:aJavaMethodRef |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
548 |
| result class selector search | |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
549 |
|
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
550 |
self validateMethodRef:aJavaMethodRef. |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
551 |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
552 |
class := aJavaMethodRef classRef resolve:false. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
553 |
class isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
554 |
self error:'should not happen - tell mh' |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
555 |
]. |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
556 |
"Array types responds to all method of class java.lang.Object" |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
557 |
class isJavaArrayClass ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
558 |
class := JavaVM classForName:'java.lang.Object'. |
749 | 559 |
]. |
560 |
" |
|
561 |
To resolve an unresolved symbolic reference from D to a method in |
|
562 |
a class C, the symbolic reference to C given by the method reference |
|
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
563 |
is first resolved (5.4.3.1). Therefore, any exceptions that can be |
749 | 564 |
thrown due to resolution of a class reference can be thrown as a result |
565 |
of method resolution. If the reference to C can be successfully resolved, |
|
566 |
exceptions relating to the resolution of the method reference itself |
|
567 |
can be thrown. |
|
568 |
When resolving a method reference: |
|
569 |
||
570 |
Method resolution checks whether C is a class or an interface. |
|
571 |
If C is an interface, method resolution throws an IncompatibleClassChangeError." |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
572 |
class isInterface ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
573 |
self throwIncompatibleClassChangeError |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
574 |
]. |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
575 |
"Method resolution attempts to look up the referenced method in C and its |
749 | 576 |
superclasses: |
577 |
If C declares a method with the name and descriptor specified by the method |
|
578 |
reference, method lookup succeeds. |
|
579 |
Otherwise, if C has a superclass, step 2 of method lookup is recursively |
|
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
580 |
invoked on the direct superclass of C." |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
581 |
search := class. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
582 |
selector := aJavaMethodRef nameAndType selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
583 |
[ search notNil and:[result isNil] ] whileTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
584 |
result := search compiledMethodAt: selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
585 |
search := search superclass. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
586 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
587 |
"Otherwise, method lookup attempts to locate the referenced method in any of |
749 | 588 |
the superinterfaces of the specified class C. |
589 |
If any superinterface of C declares a method with the name and descriptor |
|
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
590 |
specified by the method reference, method lookup succeeds." |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
591 |
result isNil ifTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
592 |
| queue | |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
593 |
|
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
594 |
queue := OrderedCollection withAll: class allInterfaces. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
595 |
[ result isNil and:[queue notEmpty ] ] whileTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
596 |
search := queue removeFirst. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
597 |
result := search compiledMethodAt: selector. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
598 |
result isNil ifTrue:[ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
599 |
search interfaces do:[:interface | |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
600 |
(queue includes: interface) ifFalse:[ queue add: interface ]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
601 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
602 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
603 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
604 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
605 |
"Otherwise, method lookup fails. |
749 | 606 |
If method lookup fails, method resolution throws a NoSuchMethodError. If method |
607 |
lookup succeeds and the method is abstract, but C is not abstract, method resolution |
|
608 |
throws an AbstractMethodError. Otherwise, if the referenced method is not accessible |
|
3860
e87f2f1439e9
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
3553
diff
changeset
|
609 |
(�5.4.4) to D, method resolution throws an IllegalAccessError." |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
610 |
result isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
611 |
self throwNoSuchMethodError |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
612 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
613 |
(result isAbstract |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
614 |
and:[ result javaClass isInterface not and:[ class isAbstract not ] ]) |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
615 |
ifTrue:[ self throwAbstractMethodError ]. |
749 | 616 |
(self |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
617 |
checkPermissionsForMethod:result |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
618 |
from:aJavaMethodRef classRef owner |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2942
diff
changeset
|
619 |
to:class) ifFalse:[ self throwIllegalAccessError ]. |
749 | 620 |
^ result. |
621 |
||
622 |
"Otherwise, let <E, L1> be the class or interface in which the referenced method is |
|
623 |
actually declared and let L2 be the defining loader of D. Let T0 be the name of |
|
624 |
the type returned by the referenced method, and let T1, ..., Tn be the names of |
|
625 |
the argument types of the referenced method. The Java virtual machine must impose |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
626 |
the loading constraints TiL1=TiL2 for i = 0 to n (§5.3.4)." |
749 | 627 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
628 |
"Created: / 11-04-2011 / 19:45:34 / 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:
2231
diff
changeset
|
629 |
"Modified: / 14-04-2011 / 00:01:34 / 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:
2231
diff
changeset
|
630 |
"Modified (format): / 01-12-2012 / 13:46:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
631 |
"Modified: / 27-03-2016 / 22:19:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 632 |
! ! |
633 |
||
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
634 |
!JavaResolver methodsFor:'method resolving-helpers'! |
749 | 635 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
636 |
checkPermissionsForMethod: aJavaMethod from: accessingJavaClass to: resolvedJavaClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
637 |
^ self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
638 |
checkPermissionsForMethodOrField: aJavaMethod |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
639 |
from: accessingJavaClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
640 |
to: resolvedJavaClass. |
749 | 641 |
|
642 |
"Created: / 11-04-2011 / 20:20:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
643 |
"Modified: / 24-05-2011 / 14:06:09 / 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:
2231
diff
changeset
|
644 |
"Modified: / 09-02-2012 / 23:15:48 / mh <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
645 |
"Modified: / 01-12-2012 / 13:46:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 646 |
! |
647 |
||
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
648 |
validateInterfaceMethodRef: aJavaInterfaceMethodRef |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
649 |
aJavaInterfaceMethodRef isJavaRef ifFalse: [ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
650 |
self error: 'I expected JavaRef instance as an argument' |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
651 |
]. |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
652 |
aJavaInterfaceMethodRef isJavaInterfaceMethodRef ifFalse: [ |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
653 |
self error: 'I expected JavaMethodRef instance as an argument' |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
654 |
]. |
749 | 655 |
|
3553
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
656 |
"Created: / 13-04-2011 / 11:53:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5329fb7027e8
JavaLookup: Make JavaResolver not to use JavaClass>>lookupMethodFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3412
diff
changeset
|
657 |
"Modified: / 01-12-2012 / 13:46:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 658 |
! |
659 |
||
660 |
validateMethodRef: aJavaMethodRef |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
661 |
aJavaMethodRef isJavaRef ifFalse: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
662 |
self error: 'I expected JavaRef instance as an argument' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
663 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
664 |
aJavaMethodRef isJavaMethodRef ifFalse: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
665 |
self error: 'I expected JavaMethodRef instance as an argument' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
666 |
]. |
749 | 667 |
|
668 |
"Created: / 11-04-2011 / 19:47:25 / 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:
2231
diff
changeset
|
669 |
"Modified: / 01-12-2012 / 13:47:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 670 |
! ! |
671 |
||
672 |
!JavaResolver class methodsFor:'documentation'! |
|
673 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
674 |
version_CVS |
3412
df11bb428463
Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3360
diff
changeset
|
675 |
^ '$Header: /cvs/stx/stx/libjava/JavaResolver.st,v 1.8 2015-03-20 12:08:00 vrany Exp $' |
2156
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
676 |
! |
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
677 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
678 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
679 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
680 |
^ '$Changeset: <not expanded> $' |
2156
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
681 |
! |
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
682 |
|
749 | 683 |
version_SVN |
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
684 |
^ 'Id' |
749 | 685 |
! ! |
686 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
687 |
|
2152 | 688 |
JavaResolver initialize! |