Oclarity not only checks valid OCL syntax and basic type conformance
but performs a lot of additional semantic checks to make sure that
most avoidable errors are reported. Here is a list of all possible errors
detected by Oclarity.
The messages below are the comments from the according source code file.
The actual error messages look similar but are assembled at run time
to include the contect information (for example, the name of the
identifier whose name could not be resolved). You might find occasional
Doxygen tags (like '@c')
within the comments.
-
A type mismatch was detected. For example, comparing
a boolean value and an integer value for equality is
not allowed in OCL.
-
An attempt was made to retrieve an entity with
an illegal index.
-
An error occured during parsing of an OCL
script.
-
An internal error occured. Use the error message
and context information to gain more information
about the error.
-
A numeric entity could not be parsed.
-
An identifer could not be resolved.
-
A supplied identifier refers to a data attribute
but an association was needed.
An identifier, that does not represents an association
does have qualifiers.
-
The input did not contain any valid OCL expression.
'package', 'endpackage' and context declarations
are not considered valid OCL expressions.
-
A 'package' directive used an unknown package name
or an unknown package was used in an identifier.
-
An unknown type was referenced in an expression.
-
An unknown value was referenced within the context of
an enumeration type.
-
At a place, where a method name like 'Class::Method' is
expected, only the class was specified.
-
A method was referenced in a context, that does
not know this method.
-
An association with the given role name should be
followed, but the role name was not found.
-
A method was called that is not a query or a 'body'
expression was used in a context method that is not
a query.
-
A type should be added to the type registry
but a type with the same name is already
registered.
-
A literal collection contains elements whose type
does not conform to a common subtype.
-
The keyword 'self' was used in an incorrect way,
that is it was used as child of another identifier
(like 'a.self').
-
'not' was applied to an expression that does not
support negation.
-
No valid OCL code has been found in the input.
This can happen, if @c false was passed as
parameter @c withContext in
OCLInterpreter::buildSyntaxTree() but a context specification
is used.
-
In a context declaration, a parameter name
was used that is different than the according
parameter name defined in the model. Both names
must be consistent.
-
An association was referenced but the assocation
is taged as 'not navigable'.
-
A construct was used in a context that was not
a postcondition but the construct can only be used
in a postcondition.
-
A constraint stereotype was used in a context
that does not support this constraint stereotype.
For example 'post' or 'pre' can only be used
if the context is a method.
-
An identifier was syntactically used as instance
member but it is a static member.
-
An identifier was syntactically used as static
member but it is an instance member.
-
A supertype should be added to a type but
the called type already knows this supertype.
-
An attribute with the given name should be added
to a type but the type already has an attribute
with that name.
-
An association with the given role name should be
added to a type but the type already has an association
with that name.
-
A method with the given signature should be
added to a type but the type already has an method
with that signature.
-
The expression of an invariant was not of type
Boolean.
-
A qualifier should be added to an association
but a qualifier with the passed name already
exists at the association in question.
-
An association was used with qualifiers, but the
count of qualifiers does not match the association
definition.
-
An identifier is ambiguous, for example
an attribute is defined in two different
superclasses but is not qualified with a class
name.
-
In a method invocation more iterators have
been used than allowed for this method.
-
A method of a collection class was called,
that is not supported for the given type
of elements.
-
The body of an iterator expression does not
fulfil the requirements for the given type of
iterator expression.
-
In a nested iterator expression, an
iterator/accumulator name was used more than once.
Iterator names have to be unique across all levels
of nested iterator expressions.
-
An iterator expression was used that reuqires
an explicit iterator but no such iterator was
defined.
-
An iterator expression was used that requires
an accumulator but no such accumulator was
defined.
-
An @c endpackage directive was seen without an
according @c package directive.
This error may also be issued, if an according
package directive is present but has a
semantic error (for example, it refers to
an unknown class or method).
-
A type other than a collection type was used in
a context that requires a collection type.
-
A method of class STNodeIterator was called
but in the current iterator state this
method cannot be called.
-
A method was used as static method but is defined
as instance method or vice versa.
-
The argument of a call to oclInState() was not
a valid state of the called object.
-
A new state machine should be added to an
instance of class @c OclAny but a state machine
with the name of the new state machine is already
associated with the called object.
-
A new state should be added but a state with the
passed states name is already known at the called
entity.
-
A qualifier is required but was not specified.
Recursive associations (associations with the same
class at both ends) require a qualifier.
-
A variable declaration was used without initialisation
expression in a context that requires an initialisation
expression.
-
A void method was defined in a context that reuqires
a non void method. This could happen with
'oper'-instructions.
-
A class name has been prepended to a method name
in a definition constraint of type 'oper'.
This is redundant and thus not allowed.
-
A construct has been used that is not allowed in the
given context.
-
An identifier has been used in a way that conflicts
with another usage of this identiifer. For example
an output argument of a method has been named
@c result.
-
An output argument of a method was specified without
name. For output parameters, a name has to be specified.
-
An initialisation expression for a Tuple attribute was
given in a context that does not allow an initialisation
expression.
-
An attribute name was used but an attribute
with this name is not known in the given scope.
-
A classifier was expected but another type
of identifier was found.
-
Access to the type that is the 'self'-object
was required but there is no self-object set
in the context.
-
A sub package should be added to a package
but the called package alreay has a sub package
with the specified name. in the context.
-
A 'package' directive has been used while
another 'package' directive was active.
In OCL, package declarations may not be nested.
-
A 'endpackage' directive has been used although
no 'package' directive was active.
-
The @pre modifier was applied to an
identifier that is not a property of the
contextual instance.