Abstract
Pluggable types enable users to enforce multiple type systems in one programming language. We have developed a suite of tools, called the JavaCOP framework, that allows developers to create pluggable type systems for Java. JavaCOP provides a simple declarative language in which program constraints are defined over a program's abstract syntax tree. The JavaCOP compiler automatically enforces these constraints on programs during compilation. The JavaCOP framework also includes a dataflow analysis API in order to support type systems which depend on flow-sensitive information. Finally, JavaCOP includes a novel test framework which helps users gain confidence in the correctness of their pluggable type systems. We demonstrate the framework by discussing a number of pluggable type systems which have been implemented in JavaCOP in order to detect errors and enforce strong invariants in programs. These type systems range from general-purpose checkers, such as a type system for nonnull references, to domain-specific ones, such as a checker for conformance to a library's usage rules.
- Aldrich, J., Kostadinov, V., and Chambers, C. 2002. Alias annotations for program understanding. In Proceedings of the 17th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'02). M. Ibrahim and S. Matsuoka, Eds. ACM Press, New York, 311--330. Google Scholar
Digital Library
- Andreae, C., Coady, Y., Gibba, C., Noble, J., Vitek, J., and Zhao, T. 2006a. Scoped types and aspects for real-time systems. In Proceedings of the 20th European Conference on Object-Oriented Programming (ECOOP'06). Lecture Notes in Computer Science, vol. 4067. Springer,124--147. Google Scholar
Digital Library
- Andreae, C., Noble, J., Markstrum, S., and Millstein, T. 2006b. A framework for implementing pluggable type systems. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'06). ACM Press, New York, 57--74. Google Scholar
Digital Library
- Arnold, K., Gosling, J., and Holmes, D. 2000. The Java Programming Language, 3rd ed. Addison-Wesley, Reading, MA. Google Scholar
Digital Library
- Bloch, J. 2002. A metadata facility for the Java programming language. Tech. rep. JSR 175. http://www.jcp.org.Google Scholar
- Boyapati, C., Khurshid, S., and Marinov, D. 2002. Korat: Automated testing based on Java predicates. In Proceedings of the ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA'02). P. G. Frankl, Ed. ACM Press, New York, 123--133. Google Scholar
Digital Library
- Boyland, J. 2001. Alias burying: Unique variables without destructive reads. Softw. Pract. Exper. 31, 6, 533--553. Google Scholar
Digital Library
- Boyland, J., Noble, J., and Retert, W. 2001. Capabilities for sharing: A generalisation of uniqueness and read-only. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP'01). J. L. Knudsen, Ed. Lecture Notes in Computer Science, vol. 2072. Springer, 2--27. Google Scholar
Digital Library
- Bracha, G. 2004. Pluggable type systems. OOPSLA Workshop on Revival of Dynamic Languages. http://pico.vub.ac.be/~wdmeuter/RDL04/papers/Bracha.pdf.Google Scholar
- Bruneton, E., Lenglet, R., and Coupaye, T. 2002. ASM: A Java bytecode manipulation and analysis framework. In Proceedings of the Adaptable and Extensible Component Systems Conference. http://asm.objectweb.org.Google Scholar
- Chalin, P. and James, P. R. 2007. Non-Null references by default in Java: Alleviating the nullity annotation burden. In Proceedings of the 21st European Conference on Object-Oriented Programming (ECOOP'07). E. Ernst, Ed. Lecture Notes in Computer Science, vol. 4609. Springer, 227--247. Google Scholar
Digital Library
- Charles, P., Grothoff, C., Saraswat, V., Donawa, C., Kielstra, A., Ebcioglu, K., von Praun, C., and Sarkar, V. 2005. X10: An object-oriented approach to non-uniform cluster computing. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'05). R. E. Johnson and R. P. Gabriel, Eds. ACM Press, New York, 519--538. Google Scholar
Digital Library
- Chin, B., Markstrum, S., and Millstein, T. 2005. Semantic type qualifiers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'05). V. Sarkar and M. W. Hall, Eds. ACM Press, New York, 85--95. Google Scholar
Digital Library
- Chin, B., Markstrum, S., Millstein, T., and Palsberg, J. 2006. Inference of user-defined type qualifiers and qualifier rules. In Proceedings of the 15th European Symposium on Programming Languages and Systems (ESOP'06), P. Sestoft, Ed. Lecture Notes in Computer Science, vol. 3924, Springer, 264--278. Google Scholar
Digital Library
- Cohen, T., Gil, J. Y., and Maman, I. 2006. JTL — The Java tools language. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'06). ACM Press, New York, 89--108. Google Scholar
Digital Library
- Crew, R. F. 1997. ASTLOG: A language for examining abstract syntax trees. In Proceedings of the Conference on Domain-Specific Languages. C. Ramming, Ed. USENIX Association, 229--243. Google Scholar
Digital Library
- Daniel, B., Dig, D., Garcia, K., and Marinov, D. 2007. Automated testing of refactoring engines. In Proceedings of the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT International Symposium on Foundations of Software Engineering (ESEC/SIGSOFT FSE'07). I. Crnkovic and A. Bertolino, Eds. ACM Press, New York, 185--194. Google Scholar
Digital Library
- Duby, C. K., Meyers, S., and Reiss, S. P. 1992. CCEL: A metalanguage for C++. In Proceedings of the USENIX C++ Conference. USENIX Association, 99--116.Google Scholar
- Eichberg, M., Schäfer, T., and Mezini, M. 2005. Using annotations to check structural properties of classes. In Proceedings of the 8th International Conference on Fundamental Approaches to Software Engineering (FASE'05). M. Cerioli, Ed. Lecture Notes in Computer Science, vol. 3442, Springer, 237--252. Google Scholar
Digital Library
- Ekman, T. and Hedin, G. 2004. Rewritable reference attributed grammars. In Proceedings of the 18th European Conference on Object-Oriented Programming (ECOOP'04). M. Odersky, Ed. Lecture Notes in Computer Science, vol. 3086, Springer, 144--169.Google Scholar
- Ernst, M. 2007. Java annotations on types. Tech. rep. JSR 308. http://www.jcp.org.Google Scholar
- Fähndrich, M. and Leino, K. R. M. 2003. Declaring and checking non-null types in an object-oriented language. In Proceedings of the 18th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'03), R. Crocker and G. L. Steele, Jr., Eds. ACM Press, New York, 302--312. Google Scholar
Digital Library
- Fischer, J., Marino, D., Majumdar, R., and Millstein, T. 2009. Fine-Grained access control with object-sensitive roles. In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP'09). S. Drossopoulou, Ed. Lecture Notes in Computer Science, vol. 5653. Springer, 173--194. Google Scholar
Digital Library
- Flanagan, C. and Freund, S. N. 2000. Type-Based race detection for Java. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (PLDI'00). J. Larus and M. Lam, Eds. ACM Press, New York, 219--232. Google Scholar
Digital Library
- Foster, J. S., Fähndrich, M., and Aiken, A. 1999. A theory of type qualifiers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'99). B. G. Ryder and B. Zorn, Eds. ACM Press, New York, 192--203. Google Scholar
Digital Library
- Foster, J. S. and Ma, K. 2007. Inferring aliasing and encapsulation properties for Java. In Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'07). ACM Press, New York, 423--440. Google Scholar
Digital Library
- Gabriel, R. P., Bacon, D. F., Lopes, C. V., and Steele Jr., G. L., Eds. 2007. Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'07). ACM Press, New York. Google Scholar
Cross Ref
- Gamma, E., Helm, R., Johnson, R. E., and Vlissides, J. 1995. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Boston, MA. Google Scholar
Digital Library
- Gosling, J., Joy, B., Steele, G., and Bracha, G. 2000. The Java Language Specification, 2nd ed. The Java Series. Addison-Wesley, Boston, MA. Google Scholar
Digital Library
- Greenffieldboyce, D. and Foster, J. S. 2007. Type qualifier inference for Java. In Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'07). 321--336. Google Scholar
Digital Library
- Hajiyev, E., Verbaere, M., and de Moor, O. 2006. CodeQuest: Scalable source code queries with data-log. In Proceedings of the 20th European Conference on Object-Oriented Programming (ECOOP'06). Lecture Notes in Computer Science, vol. 4067, Springer, 2--27. Google Scholar
Digital Library
- Hou, D. and Hoover, H. J. 2006. Using SCL to specify and check design intent in source code. IEEE Trans. Softw. Engin. 32, 6, 404--423. Google Scholar
Digital Library
- Hovemeyer, D. and Pugh, W. 2004. Finding bugs is easy. OOPSLA Companion 2004: Companion to the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. J. M. Vlissides and D. C. Schmidt, Eds. ACM Press, New York, 132--136. Google Scholar
Digital Library
- Igarashi, A., Pierce, B. C., and Wadler, P. 2001. Featherweight Java: A minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23, 3, 396--450. Google Scholar
Digital Library
- Janzen, D. and Volder, K. D. 2003. Navigating and querying code without getting lost. In Proceedings of the 2nd International Conference on Aspect-Oriented Software Development (AOSD'03). W. G. Griswold and M. Aksit, Eds. ACM Press, New York, 178--187. Google Scholar
Digital Library
- JSR 302. 2006. JSR 302: Safety critical java technology. http://jcp.org/en/jsr/detail?id=302.Google Scholar
- JUnit. 2000. JUnit homepage. http://junit.org.Google Scholar
- Markstrum, S. 2009. Enforcing and validating user-defined programming disciplines. Ph.D. thesis, University of California, Los Angeles, CA. Google Scholar
Digital Library
- Milicevic, A., Misailovic, S., Marinov, D., and Khurshid, S. 2007. Korat: A tool for generating structurally complex test inputs. In Proceedings of the 29th International Conference on Software Engineering (ICSE'07). J. Knight and M. Cohen, Eds. IEEE Computer Society, 771--774. Google Scholar
Digital Library
- Millstein, T. D., Frost, C., Ryder, J., and Warth, A. 2009. Expressive and modular predicate dispatch for java. ACM Trans. Program. Lang. Syst. 31, 2. Google Scholar
Digital Library
- Myers, A. C. 1999. JFlow: Practical mostly-static information flow control. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (PoPL'99). A. W. Appel and A. Aiken, Eds. ACM Press, New York, 228--241. Google Scholar
Digital Library
- Nystrom, N., Clarkson, M. R., and Myers, A. C. 2003. Polyglot: An extensible compiler framework for Java. In Proceedings of the 12th International Conference on Compiler Construction (CC'03). G. Hedin, Ed. Lecture Notes in Computer Science, vol. 2622. Springer, 138--152. Google Scholar
Digital Library
- Nystrom, N., Qi, X., and Myers, A. C. 2006. J&: Software composition with nested intersection. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'06). G. E. Harris, Ed. ACM Press, New York, 21--36. Google Scholar
Digital Library
- Papi, M. M., Ali, M., Correa Jr., T. L., Perkins, J. H., and Ernst, M. D. 2008. Practical pluggable types for Java. In Proceedings of the ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA'08). B. G. Ryder and A. Zeller, Eds. ACM Press, New York, 201--212. Google Scholar
Digital Library
- Pierce, B. C. 2002. Types and Programming Languages. MIT Press, Cambridge, MA. Google Scholar
Digital Library
- Polyglot. 2004. Polyglot extensible compiler framework. http://www.cs.cornell.edu/Projects/polyglot.Google Scholar
- Polyglot5. 2007. Polyglot for Java 5. http://www.cs.ucla.edu/~milanst/projects/polyglot5.Google Scholar
- Roberson, M., Harries, M., Darga, P. T., and Boyapati, C. 2008. Efficient software model checking of soundness of type systems. In Proceedings of the 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'08). G. E. Harris, Ed. ACM Press, New York, 493--504. Google Scholar
Digital Library
- Tarr, P. L. and Cook, W. R., Eds. 2006. Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'06). ACM Press, New York. Google Scholar
- Thomas, D., Ed. 2006. Proceedings of the 20th European Conference on Object-Oriented Programming (ECOOP'06). Lecture Notes in Computer Science, vol. 4067. Springer.Google Scholar
- Vallèe-Rai, R., Hendren, L., Sundaresan, V., Lam, P., Gagnon, E., and Co, P. 1999. Soot - A Java optimization framework. In Proceedings of the Conference of the Centre for Advanced Studies on Collaborative Research (CASCON'99). S. A. MacKay and J. H. Johnson, Eds. IBM, 125--135. Google Scholar
Digital Library
- Vitek, J. and Bokowski, B. 1999. Confined types. In Proceedings of the 14th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'99). B. Hailpern, L. Northrop, and A. M. Berman, Eds. ACM Press, New York, 82--96. Google Scholar
Digital Library
- Warth, A., Stanojevic, M., and Millstein, T. 2006. Statically scoped object adaptation with expanders. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'06). P. L. Tarr and W. R. Cook, Eds. ACM Press, New York, 37--56. Google Scholar
Digital Library
- WAL, A. 2007. T.J. Watson libraries for analysis (WALA). http://wala.sf.net.Google Scholar
Index Terms
JavaCOP: Declarative pluggable types for java
Recommendations
Scalability and precision by combining expressive type systems and deductive verification
Type systems and modern type checkers can be used very successfully to obtain formal correctness guarantees with little specification overhead. However, type systems in practical scenarios have to trade precision for decidability and scalability. Tools ...
A framework for implementing pluggable type systems
OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applicationsPluggable types have been proposed to support multiple type systems in the same programming language. We have designed and implemented JavaCOP, a program constraint system for implementing practical pluggable type systems for Java. JavaCOP enforces user-...
A framework for implementing pluggable type systems
Proceedings of the 2006 OOPSLA ConferencePluggable types have been proposed to support multiple type systems in the same programming language. We have designed and implemented JavaCOP, a program constraint system for implementing practical pluggable type systems for Java. JavaCOP enforces user-...






Comments