Intersection types in Java

  • Authors:
  • Martin Plümicke

  • Affiliations:
  • University of Cooperative Education Stuttgart, Florianstraße, Horb

  • Venue:
  • Proceedings of the 6th international symposium on Principles and practice of programming in Java
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

In the past we analyzed typeless Java programs. One of our results was, that there may be different correct typings for one method. This means that the principal types of such methods are intersection types. We presented a type-inference algorithm. For typeless Java methods the algorithm infers its principal intersection type. Unfortunately, like Java byte-code, Java does not allow intersection types. In this paper we present an algorithm, which resolves intersection types of Java methods, such that Java programs with standard typings are generated. In the algorithm we have to differentiate two cases of intersection types. On the one hand there are methods with intersection types, where for all types the same code is executed. On the other hand there are methods, which call in dependence to its typings different methods. These two cases have to be treated differently during type resolving. Finally, we will see that this differentiation leads to a refined definition of Java method principal types.