Download AVal: an extensible attribute-oriented programming validator for Java

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Declaring and enforcing dependencies between .NET custom
attributes
The principle of this paper is similar to that of Smart Annotations, that is to
enforce certain constraints on the use of meta-data in this case .NET attributes
and Java Annotations. But in this paper the solution, the ADC tool, is limited to
dependency constraints while Smart Annotations supports different kinds of
constraints besides hierarchical ones. For example, a constraint on the type of an
argument can be expressed in Smart Annotations but not ADC.
For using ADC, no other language is needed because .NET attributes are full
status types. An extension to the .NET compiler attribute support is created
which contains custom declarative checks and this is done only by using the
attributes themselves. Unlike with Smart Annotations where the checking of code
is done in VisualWorks and the constraints are written as SOUL queries.
Using annotations to check structural properties of classes
XIRC, the tool presented in this paper, is very similar to the Smart Annotations
plug-in. They both address the same problem that arises when using Java
Annotations: undetected violations of implied constraints on the use of Java
Annotations which results in deployment-time or run-time errors. Both solutions
offer a means to define constraints that are used to check the properties of
annotated elements.
The main difference between Smart Annotations and XIRC is the way these
constraints are expressed and checked. Instead of using SOUL queries, XIRC
uses XQuery to declare the constraints. For this to be possible the Java project
must have an XML representation which is created and kept up-to-date by the
Magellan framework.
To improve the performance and to support a better modularization of the
common parts of queries, XIRC supports the use of context-defining queries
which select the context on which other queries can be executed.
The paper also offers a friendly way to reuse constraint definitions as a plug-in
which can be included in other projects.
Another difference is the time at which these constraints are checked. With the
Smart Annotations plug-in the programmer must trigger the checking manually
while with the use of the XIRC plug-in the checking is triggered automatically
every time a resource or a checker changes.
AVal: an extensible attribute-oriented programming validator for
Java
AVal and Smart Annotations both want more support for the validation of
constraints on the use of Java Annotations. They want a tool that checks these
constraints but in such a way that they are expressive, extensible and give a
meaningful error message to the user.
The paper proposes the tool AVal which is a Spoon processor.
Instead of defining the constraints inside the Java Annotations, like it is done with
Smart Annotations, AVal uses meta-annotations to express the validation. The
validation rules are annotated with these meta-annotations, @Validators. Generic
validators can be used to express a validation rule, but for domain-specific rules
the validation can be implemented in Java class implementing the Validator
interface.
Because AVal uses meta-annotations to express the validation, no other
language or software is needed, unlike with Smart Annotations which requires
VisualWorks to be running and to create the validation rules, knowledge of SOUL
is needed. But using SOUL does have it’s advantages, it allows the developer to
reason about Java code more easily.