Using Annotations to Check Structural Properties of Classes

The specification of meta-information, by using attributes in .NET or annotations in Java, along with the source code is gaining widespread use. Meta-information is used for different purposes such as code generation or configuration of the environment in which a class is deployed. However, in most cases using an annotation also implies that constraints, beyond those defined by the language's semantics, have to be followed. E.g., a class must define a no-arguments constructor or the parameters of a method must have specific types. Currently, these constraints are not checked at all or only to a very limited extend. Hence, a violation can remain undetected and result in deployment-time or even subtle run-time errors. In this paper, we present a user-extensible framework that enables the definition of constraints to check the properties of annotated elements. Further, we demonstrate the application of the framework to check the constraints defined in the EJB 3.0 specification, and an evaluation of the approach based on checking the xPetstore-EJB3.0 project from within Eclipse to test the performance.

[1]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[2]  Jeffrey S. Foster,et al.  A comparison of bug finding tools for Java , 2004, 15th International Symposium on Software Reliability Engineering.

[3]  Mira Mezini,et al.  Declaring and Enforcing Dependencies Between .NET Custom Attributes , 2004, GPCE.

[4]  Andrew Whitechapel,et al.  Inside C , 2001 .

[5]  Amiram Yehudai,et al.  Obvious or not?: regulating architectural decisions using aspect-oriented programming , 2002, AOSD '02.

[6]  Michael Eichberg,et al.  XIRC: a kernel for cross-artifact information engineering in software development environments , 2004, 11th Working Conference on Reverse Engineering.

[7]  Scott Boag,et al.  XQuery 1.0 : An XML Query Language , 2007 .

[8]  Steven J. DeRose,et al.  XML Path Language (XPath) Version 1.0 , 1999 .

[9]  David Jordan,et al.  Java data objects , 2003 .

[10]  Cyrille Artho Finding faults in multi-threaded programs , 2001 .

[11]  Jørgen Lindskov Knudsen ECOOP 2001 — Object-Oriented Programming , 2001, Lecture Notes in Computer Science.

[12]  Heather Kreger Java Management Extensions for application management , 2001, IBM Syst. J..

[13]  David Evans,et al.  Improving Security Using Extensible Lightweight Static Analysis , 2002, IEEE Softw..

[14]  Microsystems Sun,et al.  Enterprise JavaBeans^ Specification Version 2.1 , 2002 .

[15]  Michael Eichberg,et al.  Enforcing system-wide properties , 2004, 2004 Australian Software Engineering Conference. Proceedings..

[16]  Christopher G. Lasater,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.