JDK-4881253 : JavaCompiler not easily extensible
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2003-06-19
  • Updated: 2006-03-29
  • Resolved: 2006-03-29
Related Reports
Duplicate :  
Description
Date: Tue, 17 Jun 2003 15:31:29 -0500
From: Zoran Budimlic <###@###.###>
Subject: Still having problems with JSR14 prototype
To: Neal M Gafter <###@###.###>

Hi Neal!

After a week or so of playing with your prototype compiler, we still 
have a couple of issues.

We firmly believe that there should at least be a setter method for 
sun.tools.javac.main.Main.options.

Right now, this is a private field that is being initialized within 
javac.main.Main.compile() method.

This field is being directly used in some private methods in 
javac.main.Main.

There is no way to override javac.main.Main.compile() as it is now, 
because we have no way to set the
javac.main.Main.options to a correct value. If we don't set it, then the 
compiler crashes later on when trying
to acces this uninitialized private field.

We can GET the options from Context, but that's useless since nobody 
SETS the options if we override javac.main.Main.compile().


Also, is there a particular reason why the constructors in the 
individual phases of the compiler
(for example Flow and TransTypes) are private? This makes it impossible 
to extend these phases
since our phase constructor cannot make a call to super(...) as 
described in Context.java documentation.
We believe that these constructors should be lifted to protected to 
enable the kind of extensibility that
Context.java talks about.

Thanks a lot for your help, we immensely appretiate all your assistance 
on these issues.

Zoran.

Comments
EVALUATION This was addressed in 4164450 or 4813736.
29-03-2006

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-07-2004

PUBLIC COMMENTS ...
17-07-2004

EVALUATION You're right on both counts. JavaCompiler should make sure it initializes options wherever it is needed. The other construcors should be protected. -Neal ###@###.### 2003-06-19
19-06-2003