author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 18 Apr 2013 17:46:56 +0200 | |
branch | development |
changeset 2522 | 88de19714cfb |
parent 2429 | ebece4dcaab9 |
child 2578 | fc6186a4961f |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 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
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
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:
2231
diff
changeset
|
5 |
|
749 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
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
|
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:
2231
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:
2231
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:
2231
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaResolver |
|
24 |
instanceVariableNames:'exceptionThrower' |
|
25 |
classVariableNames:'uniqueInstance' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Reader-Support-new' |
|
28 |
! |
|
29 |
||
30 |
!JavaResolver class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 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
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
36 |
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
|
37 |
|
749 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
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
|
48 |
[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
|
49 |
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
|
50 |
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
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
56 |
|
749 | 57 |
!JavaResolver class methodsFor:'initialization'! |
58 |
||
59 |
initialize |
|
60 |
uniqueInstance := JavaResolver new. |
|
61 |
uniqueInstance exceptionThrower: JavaVM. |
|
62 |
||
63 |
"/has methods at: and at: put: |
|
64 |
"/uniqueInstance resolvedClasses: Java. |
|
65 |
||
66 |
"Modified: / 10-04-2011 / 10:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
67 |
"Modified: / 13-04-2011 / 14:07:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
68 |
! ! |
|
69 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
70 |
|
749 | 71 |
!JavaResolver class methodsFor:'instance creation'! |
72 |
||
73 |
uniqueInstance |
|
74 |
^uniqueInstance. |
|
75 |
||
76 |
"Created: / 08-04-2011 / 17:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
77 |
"Modified: / 11-04-2011 / 19:06:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
78 |
! ! |
|
79 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
80 |
|
749 | 81 |
!JavaResolver methodsFor:'accessing'! |
82 |
||
83 |
exceptionThrower |
|
84 |
^ exceptionThrower |
|
85 |
! |
|
86 |
||
87 |
exceptionThrower:something |
|
88 |
exceptionThrower := something. |
|
89 |
! ! |
|
90 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
91 |
|
749 | 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. |
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
|
106 |
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
|
107 |
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
|
108 |
result := self lookupClassIfAlreadyResolved: aJavaClassRef javaClassName. |
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 |
"/ ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
115 |
]. |
749 | 116 |
" |
117 |
To resolve an unresolved symbolic reference from D to a class or interface C denoted by N, |
|
118 |
the following steps are performed: |
|
119 |
The defining class loader of D is used to create a class or interface denoted by N. |
|
120 |
This class or interface is C. Any exception that can be thrown as a result of failure |
|
121 |
of class or interface creation can thus be thrown as a result of failure of class and |
|
122 |
interface resolution. The details of the process are given in Section 5.3. |
|
123 |
" |
|
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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
"#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
|
128 |
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
|
129 |
((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
|
130 |
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
|
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 |
]. |
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 |
] 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
|
134 |
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
|
135 |
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
|
136 |
^ self checkIfPrimitiveArrayRef: aJavaClassRef andWrap: result |
749 | 137 |
]. |
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
|
138 |
(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
|
139 |
result classInit |
749 | 140 |
]. |
141 |
" |
|
142 |
If C is an array class and its element type is a reference type, then the symbolic reference |
|
143 |
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
|
144 |
in Section 5.4.3.1 recursively.""Finally, access permissions to C are checked: |
749 | 145 |
If C is not accessible (5.4.4) to D, class or interface resolution throws an IllegalAccessError. |
146 |
This condition can occur, for example, if C is a class that was originally declared to be |
|
147 |
public but was changed to be non-public after D was compiled. |
|
148 |
||
149 |
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
|
150 |
fails, and D is prohibited from accessing C." |
749 | 151 |
|
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
|
152 |
(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
|
153 |
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
|
154 |
^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
|
155 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
156 |
^result |
749 | 157 |
|
158 |
"Created: / 11-04-2011 / 19:07:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
159 |
"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
|
160 |
"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
|
161 |
"Modified: / 01-12-2012 / 13:44:54 / 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
|
162 |
"Modified: / 23-01-2013 / 15:29:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 163 |
! ! |
164 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
165 |
|
749 | 166 |
!JavaResolver methodsFor:'class resolving helpers'! |
167 |
||
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
|
168 |
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
|
169 |
|
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 |
"/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
|
171 |
| 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
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
177 |
^class |
749 | 178 |
|
179 |
"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
|
180 |
"Modified: / 23-10-2011 / 23:46:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 181 |
! |
182 |
||
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
|
183 |
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
|
184 |
refOwner 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
|
185 |
(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
|
186 |
^ 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
|
187 |
]. |
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 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
|
189 |
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
|
190 |
refOwner javaPackage = resolvedClass javaPackage ifTrue: [ ^ true ]. |
749 | 191 |
|
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
|
192 |
"/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
|
193 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
194 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ] ifFalse: [ ^ false ]. |
749 | 195 |
|
196 |
"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
|
197 |
"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
|
198 |
"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
|
199 |
"Modified: / 30-11-2012 / 20:34:26 / Marcel Hlopko <hlopkmar@fel.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 |
||
231 |
lookupClassIfAlreadyResolved: javaClassName |
|
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
|
232 |
^ JavaVM classNamed: javaClassName |
749 | 233 |
|
234 |
"Modified: / 06-08-2011 / 16:44: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:
2231
diff
changeset
|
235 |
"Modified: / 21-10-2011 / 13:40:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 236 |
! |
237 |
||
238 |
validateClassRef: aJavaClassRef |
|
239 |
self assert: aJavaClassRef isJavaRef. |
|
240 |
self assert: aJavaClassRef isJavaClassRef . |
|
241 |
||
242 |
"Modified: / 23-05-2011 / 21:04:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
243 |
! ! |
|
244 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
245 |
|
749 | 246 |
!JavaResolver methodsFor:'common helpers'! |
247 |
||
248 |
checkPermissionsForMethodOrField: aJavaMethodOrField from: accessingJavaClass to: resolvedJavaClass |
|
249 |
"A class or interface C is accessible to a class or interface D if |
|
250 |
and only if either of the following conditions are true: |
|
251 |
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
|
252 |
C and D are members of the same runtime package (§5.3). |
749 | 253 |
A field or method R is accessible to a class or interface D if and only |
254 |
if any of the following conditions is true: |
|
255 |
R is public. |
|
256 |
R is protected and is declared in a class C, and D is either a subclass |
|
257 |
of C or C itself. |
|
258 |
R is either protected or package private (that is, neither public nor |
|
259 |
protected nor private), and is declared by a class in the same runtime |
|
260 |
package as D. |
|
261 |
R is private and is declared in D. |
|
262 |
This discussion of access control omits a related restriction on the target |
|
263 |
of a protected field access or method invocation (the target must be of class |
|
264 |
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
|
265 |
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
|
266 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
267 |
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
|
268 |
|
749 | 269 |
(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
|
270 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ]. |
749 | 271 |
^ false |
272 |
]. |
|
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
|
273 |
aJavaMethodOrField isPublic ifTrue: [ ^ true ]. |
749 | 274 |
((aJavaMethodOrField isProtected |
275 |
and: [ |
|
276 |
resolvedJavaClass javaComponentClass |
|
277 |
equalsOrIsSubclassOf: aJavaMethodOrField javaClass |
|
278 |
]) |
|
279 |
and: [ |
|
280 |
accessingJavaClass javaComponentClass |
|
281 |
equalsOrIsSubclassOf: aJavaMethodOrField javaClass |
|
282 |
]) |
|
283 |
ifTrue: [ ^ true ]. |
|
284 |
((aJavaMethodOrField isPrivate not |
|
285 |
and: [ resolvedJavaClass javaPackage = accessingJavaClass javaPackage ]) |
|
286 |
and: [ resolvedJavaClass classLoader = accessingJavaClass classLoader ]) |
|
287 |
ifTrue: [ ^ true ]. |
|
288 |
(aJavaMethodOrField isPrivate |
|
289 |
and: [ aJavaMethodOrField javaClass name = accessingJavaClass name ]) |
|
290 |
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
|
291 |
|
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 |
"/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
|
293 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
294 |
JavaVM privilegedAccessQuery query ifTrue: [ ^ true ] ifFalse: [ ^ false ]. |
749 | 295 |
|
296 |
"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
|
297 |
"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
|
298 |
"Modified: / 18-11-2012 / 16:24:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 299 |
! ! |
300 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
301 |
|
749 | 302 |
!JavaResolver methodsFor:'exceptions'! |
303 |
||
304 |
throwAbstractMethodError |
|
305 |
exceptionThrower throwAbstractMethodError. |
|
306 |
||
307 |
"Created: / 11-04-2011 / 20:19:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
308 |
"Modified: / 13-04-2011 / 14:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
309 |
! |
|
310 |
||
311 |
throwIllegalAccessError |
|
312 |
exceptionThrower throwIllegalAccessError. |
|
313 |
||
314 |
"Created: / 11-04-2011 / 19:39:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
315 |
"Modified: / 13-04-2011 / 23:06:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
316 |
! |
|
317 |
||
318 |
throwIncompatibleClassChangeError |
|
319 |
exceptionThrower throwIncompatibleClassChangeError. |
|
320 |
||
321 |
"Created: / 11-04-2011 / 20:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
322 |
"Modified: / 13-04-2011 / 14:07:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
323 |
! |
|
324 |
||
325 |
throwNoSuchFieldException |
|
326 |
exceptionThrower throwNoSuchFieldException. |
|
327 |
||
328 |
"Created: / 11-04-2011 / 21:35:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
329 |
"Modified: / 13-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
330 |
! |
|
331 |
||
332 |
throwNoSuchMethodError |
|
333 |
exceptionThrower throwNoSuchMethodError. |
|
334 |
||
335 |
"Created: / 11-04-2011 / 20:19:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
336 |
"Modified: / 13-04-2011 / 14:08:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
337 |
! ! |
|
338 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
339 |
|
749 | 340 |
!JavaResolver methodsFor:'field resolving'! |
341 |
||
342 |
resolveFieldIndentifiedByRef: aJavaFieldRef |
|
343 |
| result class | |
|
344 |
self validateFieldRef: aJavaFieldRef. |
|
345 |
result := self lookupFieldIfAlreadyResolved: aJavaFieldRef. |
|
346 |
result ifNotNil: [ ^ result ]. |
|
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
|
347 |
class := aJavaFieldRef classRef resolve: 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
|
348 |
class ifNil: [ self error: 'should not happen - tell mh' ]. |
749 | 349 |
result := class lookupFieldByNameAndType: aJavaFieldRef nameAndType. |
350 |
result ifNil: [ self throwNoSuchFieldException ]. |
|
351 |
(self |
|
352 |
checkPermissionsForField: result |
|
353 |
from: aJavaFieldRef classRef owner |
|
354 |
to: class) ifFalse: [ self throwIllegalAccessError ]. |
|
355 |
^ result. |
|
356 |
||
357 |
" |
|
358 |
To resolve an unresolved symbolic reference from D to a field in a class |
|
359 |
or interface C, the symbolic reference to C given by the field reference |
|
360 |
must first be resolved (§5.4.3.1). Therefore, any exception that can be |
|
361 |
thrown as a result of failure of resolution of a class or interface reference |
|
362 |
can be thrown as a result of failure of field resolution. If the reference |
|
363 |
to C can be successfully resolved, an exception relating to the failure of |
|
364 |
resolution of the field reference itself can be thrown. |
|
365 |
When resolving a field reference, field resolution first attempts to look |
|
366 |
up the referenced field in C and its superclasses: |
|
367 |
||
368 |
If C declares a field with the name and descriptor specified by the field |
|
369 |
reference, field lookup succeeds. The declared field is the result of the |
|
370 |
field lookup. |
|
371 |
||
372 |
Otherwise, field lookup is applied recursively to the direct superinterfaces |
|
373 |
of the specified class or interface C. |
|
374 |
||
375 |
Otherwise, if C has a superclass S, field lookup is applied recursively to S. |
|
376 |
||
377 |
Otherwise, field lookup fails. |
|
378 |
If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise, |
|
379 |
if field lookup succeeds but the referenced field is not accessible (§5.4.4) |
|
380 |
to D, field resolution throws an IllegalAccessError. |
|
381 |
Otherwise, let <E, L1> be the class or interface in which the referenced |
|
382 |
field is actually declared and let L2 be the defining loader of D. Let T be |
|
383 |
the name of the type of the referenced field. The Java virtual machine must |
|
384 |
impose the loading constraint that TL1=TL2(§5.3.4)." |
|
385 |
||
386 |
"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
|
387 |
"Modified: / 01-12-2012 / 13:45:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 388 |
! |
389 |
||
390 |
resolveStaticFieldIndentifiedByRef: aJavaFieldRef |
|
391 |
| result class | |
|
392 |
self validateFieldRef: aJavaFieldRef. |
|
393 |
result := self lookupFieldIfAlreadyResolved: aJavaFieldRef. |
|
394 |
result ifNotNil: [ ^ result ]. |
|
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
|
395 |
class := aJavaFieldRef classRef resolve: 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
|
396 |
class ifNil: [ self error: 'should not happen - tell mh' ]. |
749 | 397 |
result := class lookupStaticFieldByNameAndType: aJavaFieldRef nameAndType. |
398 |
result ifNil: [ self throwNoSuchFieldException ]. |
|
399 |
(self |
|
400 |
checkPermissionsForField: result |
|
401 |
from: aJavaFieldRef classRef owner |
|
402 |
to: class) ifFalse: [ self throwIllegalAccessError ]. |
|
403 |
^ result. |
|
404 |
||
405 |
" |
|
406 |
To resolve an unresolved symbolic reference from D to a field in a class |
|
407 |
or interface C, the symbolic reference to C given by the field reference |
|
408 |
must first be resolved (§5.4.3.1). Therefore, any exception that can be |
|
409 |
thrown as a result of failure of resolution of a class or interface reference |
|
410 |
can be thrown as a result of failure of field resolution. If the reference |
|
411 |
to C can be successfully resolved, an exception relating to the failure of |
|
412 |
resolution of the field reference itself can be thrown. |
|
413 |
When resolving a field reference, field resolution first attempts to look |
|
414 |
up the referenced field in C and its superclasses: |
|
415 |
||
416 |
If C declares a field with the name and descriptor specified by the field |
|
417 |
reference, field lookup succeeds. The declared field is the result of the |
|
418 |
field lookup. |
|
419 |
||
420 |
Otherwise, field lookup is applied recursively to the direct superinterfaces |
|
421 |
of the specified class or interface C. |
|
422 |
||
423 |
Otherwise, if C has a superclass S, field lookup is applied recursively to S. |
|
424 |
||
425 |
Otherwise, field lookup fails. |
|
426 |
If field lookup fails, field resolution throws a NoSuchFieldError. Otherwise, |
|
427 |
if field lookup succeeds but the referenced field is not accessible (§5.4.4) |
|
428 |
to D, field resolution throws an IllegalAccessError. |
|
429 |
Otherwise, let <E, L1> be the class or interface in which the referenced |
|
430 |
field is actually declared and let L2 be the defining loader of D. Let T be |
|
431 |
the name of the type of the referenced field. The Java virtual machine must |
|
432 |
impose the loading constraint that TL1=TL2(§5.3.4)." |
|
433 |
||
434 |
"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
|
435 |
"Modified: / 01-12-2012 / 13:45:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 436 |
! ! |
437 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
438 |
|
749 | 439 |
!JavaResolver methodsFor:'field resolving helpers'! |
440 |
||
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
|
441 |
checkPermissionsForField: aJavaField from: accessingJavaClass to: resolvedJavaClass |
749 | 442 |
^ 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
|
443 |
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
|
444 |
from: accessingJavaClass |
749 | 445 |
to: resolvedJavaClass. |
446 |
||
447 |
"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
|
448 |
"Modified: / 01-12-2012 / 13:45:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 449 |
! |
450 |
||
451 |
lookupFieldIfAlreadyResolved: aJavaFieldRef |
|
452 |
^ nil. |
|
453 |
||
454 |
"Created: / 11-04-2011 / 21:16:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
455 |
"Modified: / 13-04-2011 / 11:57:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
456 |
! |
|
457 |
||
458 |
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
]. |
749 | 463 |
|
464 |
"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
|
465 |
"Modified: / 01-12-2012 / 13:46:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 466 |
! ! |
467 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
468 |
|
749 | 469 |
!JavaResolver methodsFor:'interface method resolving'! |
470 |
||
471 |
resolveInterfaceMethodIdentifiedByRef: aJavaInterfaceMethodRef |
|
472 |
| result class | |
|
473 |
self validateInterfaceMethodRef: aJavaInterfaceMethodRef. |
|
474 |
result := 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
|
475 |
lookupInterfaceMethodIfAlreadyResolved: aJavaInterfaceMethodRef. |
749 | 476 |
result ifNotNil: [ ^ result ]. |
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
|
477 |
class := aJavaInterfaceMethodRef classRef resolve: 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
|
478 |
class ifNil: [ self error: 'should not happen - tell mh' ]. |
749 | 479 |
class isInterface ifFalse: [ self throwIncompatibleClassChangeError ]. |
480 |
result := class |
|
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
|
481 |
lookupMethodByNameAndType: aJavaInterfaceMethodRef nameAndType. |
749 | 482 |
result ifNil: [ self throwNoSuchMethodError ]. |
483 |
(self |
|
484 |
checkPermissionsForMethod: result |
|
485 |
from: aJavaInterfaceMethodRef classRef owner |
|
486 |
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
|
487 |
^ 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
|
488 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
489 |
" |
749 | 490 |
To resolve an unresolved symbolic reference from D to an interface method in an |
491 |
interface C, the symbolic reference to C given by the interface method reference is |
|
492 |
first resolved (§5.4.3.1). Therefore, any exceptions that can be thrown as a result |
|
493 |
of failure of resolution of an interface reference can be thrown as a result of |
|
494 |
failure of interface method resolution. If the reference to C can be successfully |
|
495 |
resolved, exceptions relating to the resolution of the interface method reference |
|
496 |
itself can be thrown. |
|
497 |
When resolving an interface method reference: |
|
498 |
||
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
|
499 |
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
|
500 |
"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
|
501 |
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
|
502 |
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
|
503 |
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
|
504 |
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
|
505 |
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
|
506 |
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
|
507 |
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
|
508 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
509 |
"Modified: / 01-12-2012 / 13:46:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 510 |
! ! |
511 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
512 |
|
749 | 513 |
!JavaResolver methodsFor:'interface method resolving helpers'! |
514 |
||
515 |
lookupInterfaceMethodIfAlreadyResolved: aJavaInterfaceMethodRef |
|
516 |
^ nil. |
|
517 |
||
518 |
"Created: / 13-04-2011 / 11:53:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
519 |
! |
|
520 |
||
521 |
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
|
522 |
aJavaInterfaceMethodRef 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
|
523 |
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
|
524 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
525 |
aJavaInterfaceMethodRef isJavaInterfaceMethodRef 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
|
526 |
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
|
527 |
]. |
749 | 528 |
|
529 |
"Created: / 13-04-2011 / 11:53: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
|
530 |
"Modified: / 01-12-2012 / 13:46:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 531 |
! ! |
532 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
533 |
|
749 | 534 |
!JavaResolver methodsFor:'method resolving'! |
535 |
||
536 |
resolveMethodIndentifiedByRef: aJavaMethodRef |
|
537 |
| result class | |
|
538 |
self validateMethodRef: aJavaMethodRef. |
|
539 |
result := self lookupMethodIfAlreadyResolved: aJavaMethodRef. |
|
540 |
result ifNotNil: [ ^ result ]. |
|
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
|
541 |
class := aJavaMethodRef classRef resolve: false. |
749 | 542 |
class ifNil: [ self error: 'should not happen - tell mh' ]. |
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
|
543 |
"Array types responds to all method of class java.lang.Object" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
544 |
class isJavaArrayClass 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
|
545 |
class := JavaVM classForName: 'java.lang.Object'. |
749 | 546 |
]. |
547 |
" |
|
548 |
To resolve an unresolved symbolic reference from D to a method in |
|
549 |
a class C, the symbolic reference to C given by the method reference |
|
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
|
550 |
is first resolved (§5.4.3.1). Therefore, any exceptions that can be |
749 | 551 |
thrown due to resolution of a class reference can be thrown as a result |
552 |
of method resolution. If the reference to C can be successfully resolved, |
|
553 |
exceptions relating to the resolution of the method reference itself |
|
554 |
can be thrown. |
|
555 |
When resolving a method reference: |
|
556 |
||
557 |
Method resolution checks whether C is a class or an interface. |
|
558 |
If C is an interface, method resolution throws an IncompatibleClassChangeError." |
|
559 |
class isInterface ifTrue: [ self throwIncompatibleClassChangeError ]. |
|
560 |
"Method resolution attempts to look up the referenced method in C and its |
|
561 |
superclasses: |
|
562 |
If C declares a method with the name and descriptor specified by the method |
|
563 |
reference, method lookup succeeds. |
|
564 |
Otherwise, if C has a superclass, step 2 of method lookup is recursively |
|
565 |
invoked on the direct superclass of C. |
|
566 |
||
567 |
Otherwise, method lookup attempts to locate the referenced method in any of |
|
568 |
the superinterfaces of the specified class C. |
|
569 |
If any superinterface of C declares a method with the name and descriptor |
|
570 |
specified by the method reference, method lookup succeeds. |
|
571 |
Otherwise, method lookup fails. |
|
572 |
If method lookup fails, method resolution throws a NoSuchMethodError. If method |
|
573 |
lookup succeeds and the method is abstract, but C is not abstract, method resolution |
|
574 |
throws an AbstractMethodError. Otherwise, if the referenced method is not accessible |
|
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
|
575 |
(§5.4.4) to D, method resolution throws an IllegalAccessError." |
749 | 576 |
result := class lookupMethodByNameAndType: aJavaMethodRef nameAndType. |
577 |
result ifNil: [ self throwNoSuchMethodError ]. |
|
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
|
578 |
(result isAbstract |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
579 |
and: [ result javaClass isInterface not and: [ class isAbstract not ] ]) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
580 |
ifTrue: [ self throwAbstractMethodError ]. |
749 | 581 |
(self |
582 |
checkPermissionsForMethod: result |
|
583 |
from: aJavaMethodRef classRef owner |
|
584 |
to: class) ifFalse: [ self throwIllegalAccessError ]. |
|
585 |
^ result. |
|
586 |
||
587 |
"Otherwise, let <E, L1> be the class or interface in which the referenced method is |
|
588 |
actually declared and let L2 be the defining loader of D. Let T0 be the name of |
|
589 |
the type returned by the referenced method, and let T1, ..., Tn be the names of |
|
590 |
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
|
591 |
the loading constraints TiL1=TiL2 for i = 0 to n (§5.3.4)." |
749 | 592 |
|
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
|
593 |
"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
|
594 |
"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
|
595 |
"Modified: / 10-08-2011 / 22:44:14 / 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:
2231
diff
changeset
|
596 |
"Modified (format): / 01-12-2012 / 13:46:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 597 |
! ! |
598 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
599 |
|
749 | 600 |
!JavaResolver methodsFor:'method resolving helpers'! |
601 |
||
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
|
602 |
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
|
603 |
^ 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
|
604 |
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
|
605 |
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
|
606 |
to: resolvedJavaClass. |
749 | 607 |
|
608 |
"Created: / 11-04-2011 / 20:20:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
609 |
"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
|
610 |
"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
|
611 |
"Modified: / 01-12-2012 / 13:46:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 612 |
! |
613 |
||
614 |
lookupMethodIfAlreadyResolved: aJavaMethodRef |
|
615 |
^ nil. |
|
616 |
||
617 |
"Created: / 11-04-2011 / 19:50:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
618 |
"Modified: / 13-04-2011 / 11:57:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
619 |
! |
|
620 |
||
621 |
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
|
622 |
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
|
623 |
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
|
624 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
625 |
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
|
626 |
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
|
627 |
]. |
749 | 628 |
|
629 |
"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
|
630 |
"Modified: / 01-12-2012 / 13:47:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 631 |
! ! |
632 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
633 |
|
749 | 634 |
!JavaResolver class methodsFor:'documentation'! |
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 |
version_CVS |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
637 |
^ '$Header: /cvs/stx/stx/libjava/JavaResolver.st,v 1.5 2013-02-25 11:15:31 vrany Exp $' |
2156
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
638 |
! |
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
639 |
|
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
|
640 |
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
|
641 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2231
diff
changeset
|
642 |
^ '$Changeset: <not expanded> $' |
2156
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
643 |
! |
a8c5720d1d05
changed: #resolveMethodIndentifiedByRef:
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
644 |
|
749 | 645 |
version_SVN |
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
|
646 |
^ '§Id§' |
749 | 647 |
! ! |
648 |
||
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
|
649 |
|
2152 | 650 |
JavaResolver initialize! |