Abstract
In Java, type resolution is a function that takes a reference to a type occurring in a given context as input and returns the canonical name of that type. This information is fundamental to static analysis—a “must have” function underlying virtually all forms of semantic-based analysis. In the case of Java, this function is also complex and it is quite common to encounter tools where it is implemented incorrectly. This paper presents a novel approach for certifying the correctness of a given type resolution function with respect to an arbitrary Java source code base. The approach uses program transformation to instrument a subject code base in such a way that reflection can then be used to certify the correctness of the type resolution function against the function used by the Java compiler. In this form of certification, the type resolution function of the Java compiler serves as the test oracle.









Similar content being viewed by others
Notes
This bug has been fixed in Java 1.7.0_03.
In practice, local class declarations are extremely rare.
In JUnit, a test case is a class derived from TestCase which contains test methods.
References
Perry, J. T., Winter, V., Siy, H., Srinivasan, S., Farkas, B. D., & McCoy, J. A. (2010). The difficulties of type resolution algorithms. Technical Report SAND2010-8745, Sandia National Laboratories.
McCoy, J.A. (2000). An embedded system for safe, secure and reliable execution of high consequence software. In Proceedings of the 5th IEEE International Symposium on High Assurance Systems Engineering (HASE), (pp. 107–114). IEEE.
Wickstrom, G. L., Davis, J., Morrison, S. E., Roach, S., & Winter, V. L. (2004). The SSP: An example of high-assurance system engineering. In HASE 2004: The 8th IEEE International Symposium on High Assurance Systems Engineering, (pp. 167–177). IEEE, Tampa, Florida, United States.
Lindholm, T., & Yellin, F. (Eds.). (1999). The Java virtual machine (2nd ed.). Boston: Addison-Wesley.
Winter, V. L., Siy, H., McCoy, J., Farkas, B., Wickstrom, G., Demming, D., et al. (2011). Incorporating standard Java libraries into the design of embedded systems. In K. Cai (Ed.), Java in academia and research. Brisbane: iConcept Press.
Winter, V., Guerrero, J., Reinke, C., & Perry, J. (2011). Monarch: A High-Assurance Java-to-java (J2j) Source code Migrator. In Proceedings of the 13th IEEE International Symposium on High Assurance Systems Engineering (HASE).
Winter, V., Guerrero, J., Reinke, C., & Perry, J. T. (2014). Java core API migration: Challenges and techniques. In Proceedings of the 2014 International Conference on Software Engineering Research and Practice (SERP).
Gosling, J., Joy, B., Steele, G., Bracha, G., & Buckley, A. (2011). The Java language specification (Java SE 7 Edition). Oracle.
Flanagan, D. (2005). Java in a Nutshell (5th ed.). Sebastopol: O’Reilly Media, Inc.
Winter, V., Guerrero, J., James, A., & Reinke, C. (2012). Linking syntactic and semantic models of Java source code within a program transformation system. In Proceedings of the 14th IEEE International Symposium on High Assurance Systems Engineering (HASE).
Winter, V. L. (2007). Stack-based strategic control. In: Preproceedings of the Seventh International Workshop on Reduction Strategies in Rewriting and Programming.
The TL System. (2010). http://faculty.ist.unomaha.edu/winter/ShiftLab/TL_web/TL_index.html
Winter, V., & Subramaniam, M. (2004). The transient combinator, higher-order strategies, and the distributed data problem. Science of Computer Programming (Special Issue on Program Transformation), 52, 165–212.
Mametjanov, A., Winter, V., & Lämmel, R. (2011). More precise typing of rewrite strategies. In Eleventh International Workshop on Language Descriptions, Tools, and Applications (LDTA 2011).
Milner, R., Tofte, M., Harper, R., & MacQueen, D. (1997). The definition of standard ML (revised). Cambridge: MIT Press.
Winter, V., & Beranek, J. (2006). Program transformation using HATS 1.84. In R. Lämmel, J. Saraiva, J. Visser (Eds.), Generative and transformational techniques in Software Engineering (GTTSE), LNCS (Vol. 4143, pp. 378–396). New York: Springer-Verlag Berlin Heidelberg.
Winter, V., Reinke, C., & Guerrero, J. (2013). Sextant: A tool to specify and visualize software metrics for Java source code. In Proceedings of the 4th International Workshop on Emerging Trends in Software Metrics (WETSoM). (to appear).
Proulx, V. K., & Jossey, W. (2009). Unit test support for Java via reflection and annotations. In Proceedings of the 7th International Conference on Principles and Practice of Programming in Java, PPPJ ’09, (pp. 49–56). ACM, New York, NY, USA. doi:10.1145/1596655.1596663
Martins, M., & Rosa, A. (2000). A fault injection approach based on reflective programming. In Proceedings of the International Conferenceon Dependable Systems and Networks, 2000 (pp. 407–416). doi:10.1109/ICDSN.2000.857569
McCaffrey, J. (2006). Reflection-based UI testing. In NET Test Automation Recipes, (pp. 33–63). Apress. doi:10.1007/978-1-4302-0163-2_2
Baxter, I. D., Pidgeon, C., & Mehlich, M. (2004). DMS: Program transformations for practical scalable software evolution. In Proceedings of the 26th International Conference on Software Engineering, ICSE ’04 (pp. 625–634). IEEE Computer Society, Washington, DC, USA. http://dl.acm.org/citation.cfm?id=998675.999466
Baxter, I. (2002). Branch coverage for aribtrary languages made easy. Technical Report DMS-2002, Semantic Designs.
Roychoudhury, S., Gray, J., Zhang, J., Bangalore, P., & Skjellum, A. (2010). A program transformation technique to support AOP within C++ templates. Journal of Object Technology 9(1), 143–160. doi:10.5381/jot.2010.9.1.a3. http://www.jot.fm/contents/issue_2010_01/article3.html
ai Sun, C. (2008). A transformation-based approach to generating scenario-oriented test cases from UML activity diagrams for concurrent applications. In 32nd Annual IEEE International Conferenceon Computer Software and Applications (COMPSAC ’08), 2008 (pp. 160–167). doi:10.1109/COMPSAC.2008.74
Winter, V. (2007). Model-driven transformation-based generation of Java stress tests. Electronic Notes in Theoretical Computer Science (ENTCS), 174(1), 99–114.
Havelund, K., & Roşu, G. (2004). An overview of the runtime verification tool Java PathExplorer. Formal Methods in System Design, 24(2), 189–215. doi:10.1023/B:FORM.0000017721.39909.4b.
Havelund, K., & Rosu, G. (2001). Monitoring programs using rewriting. In Proceedings of the 16th IEEE international conference on Automated software engineering, ASE ’01 (pp. 135–). IEEE Computer Society, Washington, DC, USA. http://dl.acm.org/citation.cfm?id=872023.872572
Acknowledgments
This work was in part supported by the United States Department of Energy under Contract DE-AC04-94AL85000. Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Winter, V., Reinke, C. & Guerrero, J. Certifying a java type resolution function using program transformation, annotation, and reflection. Software Qual J 24, 115–135 (2016). https://doi.org/10.1007/s11219-014-9262-2
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11219-014-9262-2