Keyword- and Default- Parameters in JAVA
By: Joseph (Yossi) Gil, Keren Lenza
Overloading is a highly controversial programming language mechanism by which different methods of the same class are allowed to bear the same name. Despite the criticism, Java programmers make extensive use of this mechanism---not just because it is available, but also because the language does not provide an alternative for defining multiple constructors, and because it is useful for expressing similarity of services provided by a class. In a previous paper we argued that more than 60% of the overloading cases are "justifiable" and that in 35% of the cases overloading is used for emulating a default arguments mechanism. Based on these results, this paper argues that most "justifiable" uses of overloading are better done with a combination of keyword parameters and default parameters parameter definition mechanisms, and describes our extension of the Java compiler which adds these two features to the language.
Java, overloading, compiler extension, default parameters, keyword parameters