Skip to main content

Precise Constraint-Based Type Inference for Java

  • Conference paper
  • First Online:
ECOOP 2001 — Object-Oriented Programming (ECOOP 2001)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2072))

Included in the following conference series:

Abstract

Precise type information is invaluable for analysis and optimization of object-oriented programs. Some forms of polymorphism found in object-oriented languages pose significant difficulty for type inference, in particular data polymorphism. Agesen’s Cartesian Product Algorithm (CPA) can analyze programs with parametric polymorphism in a reasonably precise and efficient manner, but CPAl oses precision for programs with data polymorphism. This paper presents a precise constraintbased type inference system for Java. It uses Data-Polymorphic CPA (DCPA), a novel constraint-based type inference algorithm which extends CPA with the ability to accurately and efficiently analyze data polymorphic programs. The system is implemented for the full Java language, and is used to statically verify the correctness of Java downcasts. Benchmark results are given which show that DCPAi s significantly more accurate than CPAan d the efficiency of DCPAis close to CPA.

Partial funding provided by NSF grants CCR-9619843 and CCR-9988491

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alexander Aiken, Manuel Fhndrich, Jeffrey S. Foster, and Zhendong Su. Partial online cycle elimination in inclusion constraint graphs. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 1998.

    Google Scholar 

  2. Ole Agesen. The cartesian product algorithm. In Proceedings ECOOP’95, volume 952 of Lecture notes in Computer Science, 1995.

    Google Scholar 

  3. Ole Agesen. Concrete Type Inference: Delivering Object-Oriented Applications. PhD thesis, Stanford University, 1996. Available as Sun Labs Technical Report SMLI TR-96-52.

    Google Scholar 

  4. A. Aiken and E. L. Wimmers. Type inclusion constraints and type inference. In Proceedings of the International Conference on Functional Programming Languages and Computer Architecture, pages 31–41, 1993.

    Google Scholar 

  5. Robert O’ Callahan. Optimizing a solver of polymorphism constraints: SEMI. Technical Report CMU-CS-99-136, CMU, June 1999.

    Google Scholar 

  6. Dominic Duggan. Modular type-based reverse engineering of parameterized types in java code. In ACM SIGPLAN Symposium on Object-Oriented Programming: Systems, Languages and Applications (OOPSLA), 1999.

    Google Scholar 

  7. Jonathan Eifrig, Scott Smith, and Çois Pottier. A framework for type inference with subtyping. In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP’98), September 1998.

    Google Scholar 

  8. Jens Palsberg and Christina Pavlopoulou. From polyvariant flow information to intersection and union types. In POPL, 1998.

    Google Scholar 

  9. Olin Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University, 1991. Available as CMU Technical Report CMU-CS-91-145.

    Google Scholar 

  10. V. Sundaresan, L. Hendren, C. Razafimahefa, R. Valee-Rai, P. Lam, E. Gagnon, and C. Godin. Practical virtual method call resolution for java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 2000.

    Google Scholar 

  11. Scott Smith and Tiejun Wang. Polyvariant flow analysis with constrained types. In Gert Smolka, editor, Proceedings of the 2000 European Symposium on Programming (ESOP’00), volume 1782 of Lecture Notes in Computer Science, pages 382–396. Springer Verlag, March 2000.

    Google Scholar 

  12. F. Tip, C. Laffra, P. Sweeney, and D. Streeter. Practical experience with an application extractor for java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 1999.

    Google Scholar 

  13. F. Tip and J. Palsberg. Scalable propagation-based call graph construction. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 2000.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2001 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Wang, T., Smith, S.F. (2001). Precise Constraint-Based Type Inference for Java. In: Knudsen, J.L. (eds) ECOOP 2001 — Object-Oriented Programming. ECOOP 2001. Lecture Notes in Computer Science, vol 2072. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45337-7_6

Download citation

  • DOI: https://doi.org/10.1007/3-540-45337-7_6

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-42206-8

  • Online ISBN: 978-3-540-45337-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics