An Approach for Code Annotation Validation with Metadata Location Transparency

The use of metadata in software development, specially by code annotations, has emerged to complement some limitations of object-oriented programming. A recent study revealed that a lack of validation on the configured metadata can lead to bugs hard to id

  • PDF / 1,032,133 Bytes
  • 17 Pages / 439.37 x 666.142 pts Page_size
  • 16 Downloads / 195 Views

DOWNLOAD

REPORT


ederal University of S˜ ao Paulo – UNIFESP, S˜ ao Jos´e dos Campos, Brazil [email protected], [email protected] 2 National Institute for Space Research, S˜ ao Jos´e dos Campos, Brazil [email protected]

Abstract. The use of metadata in software development, specially by code annotations, has emerged to complement some limitations of objectoriented programming. A recent study revealed that a lack of validation on the configured metadata can lead to bugs hard to identify and correct. There are approaches to optimize metadata configuration that add the annotation out of the target code element, such as its definition on the enclosing code element or indirectly inside other annotations. Annotation validation rules that rely on the presence of other annotations are specially hard to perform when it is possible to configure it out of the target element. Available approaches for annotation validation in the literature consider their presence only in the target element. This paper presents a validation of code annotations approach in object-oriented software with location transparency, whereas definitions can occur in different parts of source code related to the target element. An evaluation with a meta-framework supports our hypothesis that the approach is capable of decoupling the annotation location from the validation rules.

Keywords: Java work

1

· Code annotation · Metadata · Validation · Frame-

Introduction

Object-orientation has several powerful features, which allow us to model an application to increase reuse enabling development of good quality code. However, there are situations where object-orientation has limitations in its application. For example, it can be hard reusing two similar codes in their functionality, considering that both perform the invocation of a method in a class being encapsulated in the middle of their execution. Thus, the reuse of these components is complicated, as it can implement a different interface, even though the functionality is similar. In this scenario, the use of reusable components in Java with reflection and annotations, for instance, becomes an interesting option to address the limitations of object-oriented programming. Code Annotations are c Springer International Publishing Switzerland 2016  O. Gervasi et al. (Eds.): ICCSA 2016, Part IV, LNCS 9789, pp. 422–438, 2016. DOI: 10.1007/978-3-319-42089-9 30

An Approach for Code Annotation Validation with Metadata Location

423

a feature introduced in the Java 5.0 to enable the addition of custom class metadata directly in the source code [1]. Consequently, software that adopted this new feature explores a relatively little-investigated territory. Frameworks that process their logic based on the metadata of the classes whose instances they are working with are called metadata-based frameworks [2]. They can potentially provide a solution in which the developer can add metadata to the existent classes intuitively. According to Guerra e Fernandes [3], the frameworks, in general, regardless traditional or metadata-based