At 05:02 PM 3/19/01 +0100, [EMAIL PROTECTED] wrote:
>How would you go about the problem of compiling compilation units with
>package level visibility. Would you depend on javac's dependency checking
>or would you have to create a master class in that package?
Hmm, I hadn't thought of that. My current implementation creates a public
compile master (CompileMaster.java) in every package, e.g.,
package root;
public class CompileMaster class {
ClassA f1; // reference to foo.ClassA
ClassB f2; // reference to foo.ClassB
...
root.pkg1.CompileMaster f3;
root.pkg2.CompileMaster f4;
...
}
so the issue does not come up. However, it appears to prevent the idea
of having one CompileMaster for a package and its subpackages.
However, the point that you make
>If this feature is going to be incorporated in jde without using the javac
>command line tool it would probably also be quite easy to write a custom
>wrapper class for the compiler which would make the use of master classes
>transparent, i.e. not creating any actual source file. I guess the adding
>of sources could be simplified aswell, otherwise jde would have to add a
>reference to every new class in the master class. Or am I misinterpreting
>the implementation of this new feature?
>
My proposal is to implement this in stages, first using javac and
ultimately using a custom wrapper class. My current build process works
like this:
1. Delete all CompileMaster.class files in the class hierarchy in case any are
left over from previous builds.
2. Generate a hierarchy of CompileMaster source files, where the root
source file
references the CompileMaster files in the child package and each child
CompileMaster
references its children, etc.
Generating the compile masters is very fast on my machine so I create
them fresh
for every build. This could be an option. Further, in a makefile
implementation,
the compile masters could be targets so that they get regenerated
whenever a
source file is edited or added to the hiearchy.
3. Compile root level CompileMaster class. This triggers recompile of all
out-of-date
classes in the hierarchy.
4. Delete all CompileMaster.class files in the class hierarchy.
5. Delete all CompileMaster.java source files in the source hierarchy.
- Paul