ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Endriss <Frank.Endr...@bancos.com>
Subject Re: Multiple classes in a single file (was: Re: Can someone tell me what is so great about Ant?)
Date Wed, 07 Feb 2001 12:36:51 GMT
"Richard S. Hall" wrote:
> 
> Frank Endriss wrote:
> 
> > You can reproduce the fault by
> > -compiling Foo.java
> > -removing Bar.class
> > -run ant: It wont compile Foo.java again, since Foo.class is up to date
> 
> Yes, I know we can produce the problem in an artificial way, but I am seeing it in
> real usage.
> 
> > All in all it is bad style to place more that one class in one java
> > source.
> > The most java-compilers do the simple check of file names. Obviously the
> > name Bar.class has nothing to do with the name Foo.java.
> > However, you can use the "depends" Property to make ant know about this
> > dependency.
> 
> Sorry, I don't agree with you at all on this point.  If I have non-public classes
> that are only used by the public class in the file, then it makes perfect sense to
> have more than one class in a Java source file; especially when these classes are
> simple.  

Given these facts, why not make those classes inner classes of class Foo
?
If you would, everything would work, and from view of OO design it would
be "nicer".

If you dont make them inner classes, they have package access, what you
dont
want and and dont need, as you describe above.

However, you are right in doing what you do since javac compiles it.
BUT: Not every compilable source is good source.


> Granted, I could make them all inner classes of the public class and that
> may (or may not) solve the problem, but that seems like bad design since there is no
> reason for them to be inner classes.
> 
> > Note that the problem is not "really" ant related.
> 
> It is an Ant problem if somehow Ant is causing the situation where only the public
> class is being generated.  If Ant is not causing these circumstances and it is the
> fault of javac, then I agree.

Obviously it is javac. Ant calls javac telling it: compile Foo.java
Javac does this, and produces parts of the expected results.
Maybe there is some lack of definition what should happen if one .java
produces more than one .class.
This leads us back to the beginning: It is bad style to....


mfg Frank
 
> 
> -> richard

Mime
View raw message