Qualified constructor classes
Industrial application of JJForester has revealed a design flaw. Currently, the tool puts the generated constructor classes A..Z for a particular sort S in a subpackage S. Like:
package/sorts/S S/A ... Z
If Java would allow import statements like:
import package/*;
then the constructor classes could be accessed with:
S.A ... S.Z
But, .... Java does not allow the import of packages, only of specific classes, or (with *) of all classes in a package. Consequently, one must either import all packages for all sorts separately (leading to name ambiguities if some sorts have constructors with the same name), or one must fully qualify each usage of a constructor class (potentially leading to very long qualifications).
As a solution, I propose not to generate the constructor classes in separate packages per sort anymore, but to generate constructor class names with the sort name as prefix. As in:
package/sorts/S S_A ... S_Z
Consequences:
Questions:
Thanks!
--JoostVisser
LeonMoonen? suggested to provide the option between subpackages per sort and underscores via a command line switch.
Of course, instead of importing a package you can add it to your class path, thus making it a root package. Then, ambiguitiy resolution with S.X works!
--JoostVisser