An attribute-grammar framework for specifying the accessibility in Java programs

The three access modifiers-public, protected, and private-control the accessibility of the members of a type in the Java programming language. Furthermore, the accessibility may be transmitted along the two structures-package structure and inheritance structure. It is difficult to identify the weaknesses of the access modifiers from the informal semantics stated in the language manual. We develop a formal framework for specifying the accessibility in Java programs based on attribute grammars. With the help of this framework, we found several situations in the language specification that are irregular or counter-intuitive or ambiguous. These situations may confuse the programmers and hence may create weaknesses in Java programs.

[1]  Ranga Vemuri,et al.  Performance Specification Using Attributed Grammars , 1993, 30th ACM/IEEE Design Automation Conference.

[2]  Uwe Kastens Lifetime analysis for attributes , 2004, Acta Informatica.

[3]  Takuya Katayama,et al.  Translation of attribute grammars into procedures , 1984, TOPL.

[4]  Viljem Zumer,et al.  Incremental language design , 1998, IEE Proc. Softw..

[5]  Valdis Berzins,et al.  Generating displays for specifications using attribute grammars , 1989, [1989] Proceedings of the Thirteenth Annual International Computer Software & Applications Conference.

[6]  Uwe Kastens,et al.  GAG: A Practical Compiler Generator , 1982, Lecture Notes in Computer Science.

[7]  Joost Engelfriet,et al.  Attribute storage optimization by stacks , 2004, Acta Informatica.

[8]  Jukka Paakki,et al.  Attribute grammar paradigms—a high-level methodology in language implementation , 1995, CSUR.

[9]  Pierre Deransart,et al.  Attribute Grammars: Definitions, Systems and Bibliography , 1988 .

[10]  Gordon V. Cormack,et al.  Modular Attribute Grammars , 1990, Comput. J..

[11]  W Yang Discovering anomalies in access modifiers in Java with a formal specification , 2001 .

[12]  PaakkiJukka Attribute grammar paradigmsa high-level methodology in language implementation , 1995 .

[13]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[14]  Sying-Syang Liu,et al.  A tool specification language for software maintenance , 1990, Proceedings., Fourteenth Annual International Computer Software and Applications Conference.

[15]  Anthony M. Sloane,et al.  Eli: a complete, flexible compiler construction system , 1992, CACM.

[16]  Uwe Kastens,et al.  Ordered attributed grammars , 1980, Acta Informatica.

[17]  Daniel M. Yellin,et al.  Composable attribute grammars: support for modularity in translator design and implementation , 1992, POPL '92.

[18]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[19]  John Tang Boyland,et al.  Conditional attribute grammars , 1996, TOPL.