1414import java .io .PrintWriter ;
1515import java .util .ArrayList ;
1616import java .util .List ;
17+ import java .util .Map ;
1718
1819import net .sf .j2s .core .builder .ClasspathDirectory ;
1920import net .sf .j2s .core .builder .ClasspathDirectoryProxy ;
2223import net .sf .j2s .core .builder .NameEnvironmentProxy ;
2324
2425import org .eclipse .core .resources .IContainer ;
26+ import org .eclipse .jdt .core .compiler .CompilationProgress ;
2527import org .eclipse .jdt .internal .compiler .Compiler ;
2628import org .eclipse .jdt .internal .compiler .ICompilerRequestor ;
2729import org .eclipse .jdt .internal .compiler .IErrorHandlingPolicy ;
@@ -41,14 +43,33 @@ public class Java2ScriptImageCompiler extends Compiler {
4143 protected List sourceUnits ;
4244 protected IContainer binaryFolder ;
4345
46+ public Java2ScriptImageCompiler (INameEnvironment environment ,
47+ IErrorHandlingPolicy policy , Map settings ,
48+ ICompilerRequestor requestor , IProblemFactory problemFactory ,
49+ boolean parseLiteralExpressionsAsConstants ) {
50+ super (environment , policy , settings , requestor , problemFactory ,
51+ parseLiteralExpressionsAsConstants );
52+ }
53+
54+ public Java2ScriptImageCompiler (INameEnvironment environment ,
55+ IErrorHandlingPolicy policy , Map settings ,
56+ ICompilerRequestor requestor , IProblemFactory problemFactory ) {
57+ super (environment , policy , settings , requestor , problemFactory );
58+ }
59+
60+ public Java2ScriptImageCompiler (INameEnvironment environment ,
61+ IErrorHandlingPolicy policy , CompilerOptions options ,
62+ ICompilerRequestor requestor , IProblemFactory problemFactory ,
63+ PrintWriter out , CompilationProgress progress ) {
64+ super (environment , policy , options , requestor , problemFactory , out , progress );
65+ }
66+
4467 public Java2ScriptImageCompiler (INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions options , ICompilerRequestor requestor , IProblemFactory problemFactory , PrintWriter out ) {
4568 super (environment , policy , options , requestor , problemFactory , out );
46- // TODO Auto-generated constructor stub
4769 }
4870
4971 public Java2ScriptImageCompiler (INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions options , ICompilerRequestor requestor , IProblemFactory problemFactory ) {
5072 super (environment , policy , options , requestor , problemFactory );
51- // TODO Auto-generated constructor stub
5273 }
5374
5475 /* (non-Javadoc)
@@ -90,32 +111,47 @@ public void process(CompilationUnitDeclaration unit, int i) {
90111 }
91112
92113 this .lookupEnvironment .unitBeingCompleted = unit ;
114+ long parseStart = System .currentTimeMillis ();
93115
94116 this .parser .getMethodBodies (unit );
95117
118+ long resolveStart = System .currentTimeMillis ();
119+ this .stats .parseTime += resolveStart - parseStart ;
120+
96121 // fault in fields & methods
97122 if (unit .scope != null )
98123 unit .scope .faultInTypes ();
99124
100125 // verify inherited methods
101126 if (unit .scope != null )
102- unit .scope .verifyMethods (lookupEnvironment .methodVerifier ());
127+ unit .scope .verifyMethods (this . lookupEnvironment .methodVerifier ());
103128
104129 // type checking
105130 unit .resolve ();
106131
132+ long analyzeStart = System .currentTimeMillis ();
133+ this .stats .resolveTime += analyzeStart - resolveStart ;
134+
107135 // flow analysis
108136 unit .analyseCode ();
109137
138+ long generateStart = System .currentTimeMillis ();
139+ this .stats .analyzeTime += generateStart - analyzeStart ;
140+
110141 // code generation
111142 unit .generateCode ();
112143
113144 // reference info
114- if (options .produceReferenceInfo && unit .scope != null )
145+ if (this . options .produceReferenceInfo && unit .scope != null )
115146 unit .scope .storeDependencyInfo ();
116147
148+ // finalize problems (suppressWarnings)
149+ unit .finalizeProblems ();
150+
151+ this .stats .generateTime += System .currentTimeMillis () - generateStart ;
152+
117153 // refresh the total number of units known at this stage
118- unit .compilationResult .totalUnitsKnown = totalUnits ;
154+ unit .compilationResult .totalUnitsKnown = this . totalUnits ;
119155
120156 this .lookupEnvironment .unitBeingCompleted = null ;
121157 }
0 commit comments