identifying Exception classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

identifying Exception classes

Nicolas Anquetil
It seems there is no way to identify classes (java) that are Exceptions.
Even the one that are used.

There are ThrownException / DeclaredException / CaughtException , all
pointing to the exceptionClass, but there is no opposite property in the
exception class that one could use to test whether a given class is used
as an exception.

So the only way is to test whether Exception is an ancestor of a given
class ?


nicolas
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: identifying Exception classes

Tudor Girba-2
Indeed. It would be cool to get opposites for the exceptionClass
properties. So, we would have FAMIXClass>>thrownAsException,
FAMIXClass>>declaredAsException, FAMIXClass>>caughtAsException. This
would also imply that we would define the implementation of
exceptionClass in all subclasses of Exception.

Cheers,
Doru

On Tue, Aug 21, 2012 at 1:34 PM, Nicolas Anquetil
<[hidden email]> wrote:

> It seems there is no way to identify classes (java) that are Exceptions.
> Even the one that are used.
>
> There are ThrownException / DeclaredException / CaughtException , all
> pointing to the exceptionClass, but there is no opposite property in the
> exception class that one could use to test whether a given class is used as
> an exception.
>
> So the only way is to test whether Exception is an ancestor of a given class
> ?
>
>
> nicolas
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
www.tudorgirba.com

"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: identifying Exception classes

Stéphane Ducasse
>  This
> would also imply that we would define the implementation of
> exceptionClass in all subclasses of Exception.

what do you mean by that sentence because I could not get it clear enough.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: identifying Exception classes

Tudor Girba-2
Right now, we have

FAMIXException>>exceptionClass
  <MSEProperty: #exceptionClass type: #FAMIXClass>
  ^ exceptionClass

And then we have three subclasses: FAMIXCaughtException,
FAMIXDeclaredException, FAMIXThrownException.

At the moment, exceptionClass does not have an opposite, but we should
add one. Like this we would know if a class is caught, declared or
thrown. But, to know that we would need define three properties in
FAMIXClass, and to redefine the exceptionClass in the three subclasses
of FAMIXException such that the declaration points the opposite to the
right FAMIXClass property.

So something like:

FAMIXDeclaredException>>exceptionClass
  <MSEProperty: #exceptionClass type: #FAMIXClass opposite:
#exceptionsWithClassAsDeclared>
  ...

FAMIXClass>>exceptionsWithDeclaredClass
  <MSEProperty: #exceptionsWithClassAsDeclared type:
#FAMIXDeclaredException opposite: #exceptionClass>
  ...

Cheers,
Doru


On Wed, Aug 22, 2012 at 12:57 PM, Stéphane Ducasse
<[hidden email]> wrote:
>>  This
>> would also imply that we would define the implementation of
>> exceptionClass in all subclasses of Exception.
>
> what do you mean by that sentence because I could not get it clear enough.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--
www.tudorgirba.com

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev