I have used JRefactorys Prettyr printer (on sourcefortge) a fair bit and was
relatively impressed. It needs a bit of tweaking to avoid breaking some code
in some situations but overall it is relatively good.
On Tue, 15 Jan 2002 10:58, Paul Cody wrote:
> Importscrubber is nice, but is doesn't really work. I cannot recommend it
> for anything other than the simplest code.
>
> Importscrubber uses the BCEL library to figure out what classes are needed
> by a particular source file, eliminates unneeded import statements, and
> sorts the result. So far so good. However, due to the fact that constants
> are folded into the bytecode by ${build.compiler}, it removes some import
> statements that are required to compile but not included in the classfile.
> For example:
>
> import org.example.Constants;
>
> switch (val) {
> case (Constants.A):
>
> If you run importscrubber against this, the import statement will be
> removed since the switch constants were folded into the bytecode and there
> is no need to put the class reference in the classfile constant pool. So
> the next time you try to compile it from source, it fails.
>
> Anyway, the solution requires a more sophisticated approach that basically
> boils down to writing part of a java compiler. I'm interested if other
> people know if (open) tools that do this correctly...
>
> Paul
>
> > -----Original Message-----
> > From: Ylan Segal [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 14, 2002 4:00 PM
> > To: Ant Users List
> > Subject: RE: Code format validation
> >
> >
> > Take a lok at:
> >
> > http://jakarta.apache.org/ant/external.html
> >
> > There is a link there for Importscrubber.. it is just what you want.
> >
> > I tried it myself and found it to be a nice tool. It does
> > clean up import
> > statements, but sometimes sources will fail to compile
> > afterwards. In my
> > case it happened in classes where I was using objects with
> > same name like
> > java.util.Date and java.sql.Date. importscrubber thought I
> > should import
> > both, which caused ambiguity and the compiler complained. Easily fixed
> > though.
> >
> > I suggest running it against a copy of your sources to be
> > safe and decide
> > for yourself if you like what you see.
> >
> >
> > Ylan.
> >
> > > -----Original Message-----
> > > From: Matthew Pullen [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, January 14, 2002 5:49 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Code format validation
> > >
> > > Hello,
> > > As with all projects, they tend to change a bit over
> >
> > time. This leaves
> > you with unused import statments all over the place. I don't
> > like the import
> > blah.* format either. I was curious if there is an automated
> > way to check
> > this in particular using ant, or an add in to ant? I have tried using
> > checkstyle, but it doesn't appear to work with 1.4.
> >
> > > Matthew Pullen << File: ATT00013.txt >>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
--
Cheers,
Pete
-------------------------------------------------------------
| Egoism is the drug that soothes the pain of stupidity. |
-------------------------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>