--- a/JavaField.st Tue Apr 16 13:34:16 1996 +0000
+++ b/JavaField.st Tue Apr 16 14:44:23 1996 +0000
@@ -6,6 +6,93 @@
!
+!JavaField methodsFor:'error handling'!
+
+doesNotUnderstand:aMessage
+ "this message is sent by the runtime system (VM) when
+ a message is not understood by some object (i.e. there
+ is no method for that selector). The original message has
+ been packed into aMessage (i.e. the receiver, selector and
+ any arguments) and the original receiver is then sent the
+ #doesNotUnderstand: message.
+ Here, we raise another signal which usually enters the debugger.
+ You can of course redefine #doesNotUnderstand: in your classes
+ to implement message delegation."
+
+ |sel errorString cls sender|
+
+ "/ handle the case of an error during early startup
+ "/ (output streams not yet initialized)
+ "/
+ Stdout isNil ifTrue:[
+ Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
+ ].
+
+ (sel := aMessage selector) isNil ifTrue:[
+ "/
+ "/ happens when things go mad, or a method has been
+ "/ called by valueWithReceiver: with a wrong receiver
+ "/ to avoud later trouble (when concatenating strings),
+ "/ replace the selector by some (nonNil) string
+ "/
+ sel := '(nil)'
+ ].
+
+ "/
+ "/ extract the class that should have implemented the message.
+ "/ (in case of a super-send, this is not the receivers class)
+ "/
+ sender := thisContext sender.
+ cls := sender searchClass.
+ cls isNil ifTrue:[
+ "it was NOT a super or directed send ..."
+ cls := self class
+ ].
+
+ cls notNil ifTrue:[
+ "/
+ "/ displayString is better than 'cls name',
+ "/ since it appends (obsolete) for outdated classes.
+ "/ (this happens if you send messages to old instances
+ "/ after changing a classes definition)
+ "/
+ errorString := cls displayString.
+ ] ifFalse:[
+ errorString := '(** nil-class **)'
+ ].
+ errorString := errorString , ' does not understand: ' , sel.
+
+ "/
+ "/ this only happens, when YOU play around with my classvars ...
+ "/ (or an error occurs during early startup, when signals are not yet set)
+ "/
+ MessageNotUnderstoodSignal isNil ifTrue:[
+ ^ self enterDebuggerWith:nil
+ message:'oops - MessageNotUnderstoodSignal is gone'.
+ ].
+
+ "/
+ "/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
+ "/
+ ^ MessageNotUnderstoodSignal
+ raiseRequestWith:aMessage
+ errorString:errorString
+ in:sender
+
+ "Modified: 9.12.1995 / 17:25:37 / cg"
+
+"
+*** WARNING
+***
+*** this method has been automatically created,
+*** since all nil-subclasses should respond to some minimum required
+*** protocol.
+***
+*** Inspection and/or debugging of instances may not be possible,
+*** if you remove/change this method.
+"
+! !
+
!JavaField methodsFor:'private accessing'!
setAccessFlags:flags
@@ -32,8 +119,48 @@
"Created: 16.4.1996 / 13:04:43 / cg"
! !
+!JavaField methodsFor:'queries'!
+
+class
+ "return the receivers class"
+
+%{ /* NOCONTEXT */
+
+ RETURN ( __Class(self) );
+%}
+
+"
+*** WARNING
+***
+*** this method has been automatically created,
+*** since all nil-subclasses should respond to some minimum required
+*** protocol.
+***
+*** Inspection and/or debugging of instances may not be possible,
+*** if you remove/change this method.
+"
+!
+
+isBehavior
+ "return true, if the receiver is some kind of class (i.e. behavior);
+ false is returned here - the method is only redefined in Behavior."
+
+ ^ false
+
+"
+*** WARNING
+***
+*** this method has been automatically created,
+*** since all nil-subclasses should respond to some minimum required
+*** protocol.
+***
+*** Inspection and/or debugging of instances may not be possible,
+*** if you remove/change this method.
+"
+! !
+
!JavaField class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.1 1996/04/16 13:33:45 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.2 1996/04/16 14:41:33 cg Exp $'
! !