dcsimg
feature request: use packages throughout ANTLR for JDK1.4 support
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andy_Tripp
Posted On:   Monday, August 12, 2002 10:24 AM

The javac in JDK1.4 no longer allows you to import individual non-packaged classes. You now get a compile error when you say: import MyClass; In Sun's bug report on this problem Sun says that the Java spec was never clear as to whether this was valid or not, and they've updated the spec to specifically disallow it. And, of course, they have no intent to take this check out of the compiler. This means that if your code that uses ANTLR uses packages, you have no way to pull in the various classes and examples that come with ANTLR without altering them. I see from this FAQ that you can tell ANTLR to hav   More>>

The javac in JDK1.4 no longer allows you to import individual non-packaged classes.
You now get a compile error when you say:

import MyClass;

In
Sun's bug report on this problem

Sun says that the Java spec was never clear as to whether this was valid or not,
and they've updated the spec to specifically disallow it. And, of course, they have
no intent to take this check out of the compiler.


This means that if your code that uses ANTLR uses packages, you have no
way to pull in the various classes and examples that come with ANTLR without
altering them.


I see from
this
FAQ that you can tell ANTLR to have the code that it produces
be in packages. But of course you need to go make this change to each of the .g files
that comes with ANTLR that you use. And of course now you've got to make sure
that the generated .java files are in an appropriate named directory.


Anyway, I suggest that ANTLR be enhanced so that the default is to have the
generated code be in packages. I also suggest that all the "examples" that come
with ANTLR (e.g. examples/java/java/*) be put into packages. It would also
be nice if add-ons like "cgram" use packages.


I know this would break a lot of existing code - lots of "imports" would need to be added.
But I would think that most everyone who uses ANTLR would have a "meaty" enough
application to want to use packages, and with JDK1.4 (unless I'm missing something),
it's just not easy to get at any classes in the default package.


Andy

   <<Less
About | Sitemap | Contact