6
|
1 |
JavaRef subclass:#JavaField
|
|
2 |
instanceVariableNames:'accessFlags name signature constantValue'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Java-Reader-Support'
|
|
6 |
!
|
|
7 |
|
|
8 |
|
7
|
9 |
!JavaField methodsFor:'error handling'!
|
|
10 |
|
|
11 |
doesNotUnderstand:aMessage
|
|
12 |
"this message is sent by the runtime system (VM) when
|
|
13 |
a message is not understood by some object (i.e. there
|
|
14 |
is no method for that selector). The original message has
|
|
15 |
been packed into aMessage (i.e. the receiver, selector and
|
|
16 |
any arguments) and the original receiver is then sent the
|
|
17 |
#doesNotUnderstand: message.
|
|
18 |
Here, we raise another signal which usually enters the debugger.
|
|
19 |
You can of course redefine #doesNotUnderstand: in your classes
|
|
20 |
to implement message delegation."
|
|
21 |
|
|
22 |
|sel errorString cls sender|
|
|
23 |
|
|
24 |
"/ handle the case of an error during early startup
|
|
25 |
"/ (output streams not yet initialized)
|
|
26 |
"/
|
|
27 |
Stdout isNil ifTrue:[
|
|
28 |
Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
|
|
29 |
].
|
|
30 |
|
|
31 |
(sel := aMessage selector) isNil ifTrue:[
|
|
32 |
"/
|
|
33 |
"/ happens when things go mad, or a method has been
|
|
34 |
"/ called by valueWithReceiver: with a wrong receiver
|
|
35 |
"/ to avoud later trouble (when concatenating strings),
|
|
36 |
"/ replace the selector by some (nonNil) string
|
|
37 |
"/
|
|
38 |
sel := '(nil)'
|
|
39 |
].
|
|
40 |
|
|
41 |
"/
|
|
42 |
"/ extract the class that should have implemented the message.
|
|
43 |
"/ (in case of a super-send, this is not the receivers class)
|
|
44 |
"/
|
|
45 |
sender := thisContext sender.
|
|
46 |
cls := sender searchClass.
|
|
47 |
cls isNil ifTrue:[
|
|
48 |
"it was NOT a super or directed send ..."
|
|
49 |
cls := self class
|
|
50 |
].
|
|
51 |
|
|
52 |
cls notNil ifTrue:[
|
|
53 |
"/
|
|
54 |
"/ displayString is better than 'cls name',
|
|
55 |
"/ since it appends (obsolete) for outdated classes.
|
|
56 |
"/ (this happens if you send messages to old instances
|
|
57 |
"/ after changing a classes definition)
|
|
58 |
"/
|
|
59 |
errorString := cls displayString.
|
|
60 |
] ifFalse:[
|
|
61 |
errorString := '(** nil-class **)'
|
|
62 |
].
|
|
63 |
errorString := errorString , ' does not understand: ' , sel.
|
|
64 |
|
|
65 |
"/
|
|
66 |
"/ this only happens, when YOU play around with my classvars ...
|
|
67 |
"/ (or an error occurs during early startup, when signals are not yet set)
|
|
68 |
"/
|
|
69 |
MessageNotUnderstoodSignal isNil ifTrue:[
|
|
70 |
^ self enterDebuggerWith:nil
|
|
71 |
message:'oops - MessageNotUnderstoodSignal is gone'.
|
|
72 |
].
|
|
73 |
|
|
74 |
"/
|
|
75 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
|
|
76 |
"/
|
|
77 |
^ MessageNotUnderstoodSignal
|
|
78 |
raiseRequestWith:aMessage
|
|
79 |
errorString:errorString
|
|
80 |
in:sender
|
|
81 |
|
|
82 |
"Modified: 9.12.1995 / 17:25:37 / cg"
|
|
83 |
|
|
84 |
"
|
|
85 |
*** WARNING
|
|
86 |
***
|
|
87 |
*** this method has been automatically created,
|
|
88 |
*** since all nil-subclasses should respond to some minimum required
|
|
89 |
*** protocol.
|
|
90 |
***
|
|
91 |
*** Inspection and/or debugging of instances may not be possible,
|
|
92 |
*** if you remove/change this method.
|
|
93 |
"
|
|
94 |
! !
|
|
95 |
|
6
|
96 |
!JavaField methodsFor:'private accessing'!
|
|
97 |
|
|
98 |
setAccessFlags:flags
|
|
99 |
accessFlags := flags.
|
|
100 |
|
|
101 |
"Created: 16.4.1996 / 13:04:25 / cg"
|
|
102 |
!
|
|
103 |
|
|
104 |
setConstantValue:something
|
|
105 |
constantValue := something.
|
|
106 |
|
|
107 |
"Created: 16.4.1996 / 13:04:58 / cg"
|
|
108 |
!
|
|
109 |
|
|
110 |
setName:aString
|
|
111 |
name := aString.
|
|
112 |
|
|
113 |
"Created: 16.4.1996 / 13:04:35 / cg"
|
|
114 |
!
|
|
115 |
|
|
116 |
setSignature:aString
|
|
117 |
signature := aString.
|
|
118 |
|
|
119 |
"Created: 16.4.1996 / 13:04:43 / cg"
|
|
120 |
! !
|
|
121 |
|
7
|
122 |
!JavaField methodsFor:'queries'!
|
|
123 |
|
|
124 |
class
|
|
125 |
"return the receivers class"
|
|
126 |
|
|
127 |
%{ /* NOCONTEXT */
|
|
128 |
|
|
129 |
RETURN ( __Class(self) );
|
|
130 |
%}
|
|
131 |
|
|
132 |
"
|
|
133 |
*** WARNING
|
|
134 |
***
|
|
135 |
*** this method has been automatically created,
|
|
136 |
*** since all nil-subclasses should respond to some minimum required
|
|
137 |
*** protocol.
|
|
138 |
***
|
|
139 |
*** Inspection and/or debugging of instances may not be possible,
|
|
140 |
*** if you remove/change this method.
|
|
141 |
"
|
|
142 |
!
|
|
143 |
|
|
144 |
isBehavior
|
|
145 |
"return true, if the receiver is some kind of class (i.e. behavior);
|
|
146 |
false is returned here - the method is only redefined in Behavior."
|
|
147 |
|
|
148 |
^ false
|
|
149 |
|
|
150 |
"
|
|
151 |
*** WARNING
|
|
152 |
***
|
|
153 |
*** this method has been automatically created,
|
|
154 |
*** since all nil-subclasses should respond to some minimum required
|
|
155 |
*** protocol.
|
|
156 |
***
|
|
157 |
*** Inspection and/or debugging of instances may not be possible,
|
|
158 |
*** if you remove/change this method.
|
|
159 |
"
|
|
160 |
! !
|
|
161 |
|
6
|
162 |
!JavaField class methodsFor:'documentation'!
|
|
163 |
|
|
164 |
version
|
7
|
165 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.2 1996/04/16 14:41:33 cg Exp $'
|
6
|
166 |
! !
|