Type Inference in Java: Characteristics and Limitations

2021 
With the introduction of parametric types in Java, the type system becomes more complex to handle. The Java generics requires more programming efforts to instantiate appropriate types. In such a situation, a sound type inference algorithm may reduce programming load and ensure safety. Java type inference algorithm has eased programming efforts by reducing explicit instantiation of types. The Java type inference algorithm is being expanded. Still, the impact of inference in mainstream programming is limited. Moreover, the unsound approach for inference causes unpredictable behavior in program code. The limitations and unsoundness of Java type inference need to be discussed to avoid the failure of codes. In this paper, we discuss limitations and issues of type inference algorithm, such as the incapability to infer wildcards as return type in generic methods, and limitations of local variable type inference. Further, we discuss how the machine learning approaches can help to develop a safe type inference algorithm.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    11
    References
    0
    Citations
    NaN
    KQI
    []