What are the plans to represent a Java throws signature element in a UML method signature and how should I represent a Java throws signature element in a UML method signature?

jim conallen

As far as official plans, you'll have to get word directly from someone on the UML 2.0 committee at the OMG - of which I am not (said with a sign of relief :-)

Looking at Grady's book (UML User's Guide pg 285) I see that exceptions are modeled as classes (because in Java they really are defined by classes). What you are really looking for is a way to visually represent a particular operation in an arbitrary class throwing that exception. In the user's guide it says that a <<send>> stereotyped dependency is drawn directly from the operation in the class compartment to a <<exception>> stereotyped class. Note that the depenency is drawn from the operation itself, not the boundary of the class (really hard to see in this ascii rendering i know).

|            <<interface>>                |
|             MyInterface                 |
| --------------------------------------- |                   |-----------------|
|                                         |  <<send>>         |  <<exception>>  |
| +myMethod(myParam:Object) : Object - - -+- - - - - - - - - >|   MyException   |
|                                         |                   -------------------

On a side note, I was unable to find any references to the modeling of exceptions in the UML specification from the OMG. So this particular use of the stereotypes and notation might not be cleared with the OMG committee so far.

Unfortunately I don't know of any UML modeling tool (real tools not just free form drawing programs) that allow you to draw dependencies directly from an operation. So I think that the practical way to model especially important exception throwing is with a dependency from the class to the exception class, but with either tag values of the operations that throw it, or by naming the dependency with the list of operations that throw the exception.