JavaField.st
author cg
Tue, 16 Apr 1996 14:44:23 +0000
changeset 7 de8ce26e1f2c
parent 6 b23a6474754f
child 13 7075280c0cee
permissions -rw-r--r--
checkin from browser

JavaRef subclass:#JavaField
	instanceVariableNames:'accessFlags name signature constantValue'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Reader-Support'
!


!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
    accessFlags := flags.

    "Created: 16.4.1996 / 13:04:25 / cg"
!

setConstantValue:something
    constantValue := something.

    "Created: 16.4.1996 / 13:04:58 / cg"
!

setName:aString
    name := aString.

    "Created: 16.4.1996 / 13:04:35 / cg"
!

setSignature:aString
    signature := aString.

    "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.2 1996/04/16 14:41:33 cg Exp $'
! !