14
14
import java .io .PrintWriter ;
15
15
import java .util .ArrayList ;
16
16
import java .util .List ;
17
+ import java .util .Map ;
17
18
18
19
import net .sf .j2s .core .builder .ClasspathDirectory ;
19
20
import net .sf .j2s .core .builder .ClasspathDirectoryProxy ;
22
23
import net .sf .j2s .core .builder .NameEnvironmentProxy ;
23
24
24
25
import org .eclipse .core .resources .IContainer ;
26
+ import org .eclipse .jdt .core .compiler .CompilationProgress ;
25
27
import org .eclipse .jdt .internal .compiler .Compiler ;
26
28
import org .eclipse .jdt .internal .compiler .ICompilerRequestor ;
27
29
import org .eclipse .jdt .internal .compiler .IErrorHandlingPolicy ;
@@ -41,14 +43,33 @@ public class Java2ScriptImageCompiler extends Compiler {
41
43
protected List sourceUnits ;
42
44
protected IContainer binaryFolder ;
43
45
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
+
44
67
public Java2ScriptImageCompiler (INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions options , ICompilerRequestor requestor , IProblemFactory problemFactory , PrintWriter out ) {
45
68
super (environment , policy , options , requestor , problemFactory , out );
46
- // TODO Auto-generated constructor stub
47
69
}
48
70
49
71
public Java2ScriptImageCompiler (INameEnvironment environment , IErrorHandlingPolicy policy , CompilerOptions options , ICompilerRequestor requestor , IProblemFactory problemFactory ) {
50
72
super (environment , policy , options , requestor , problemFactory );
51
- // TODO Auto-generated constructor stub
52
73
}
53
74
54
75
/* (non-Javadoc)
@@ -90,32 +111,47 @@ public void process(CompilationUnitDeclaration unit, int i) {
90
111
}
91
112
92
113
this .lookupEnvironment .unitBeingCompleted = unit ;
114
+ long parseStart = System .currentTimeMillis ();
93
115
94
116
this .parser .getMethodBodies (unit );
95
117
118
+ long resolveStart = System .currentTimeMillis ();
119
+ this .stats .parseTime += resolveStart - parseStart ;
120
+
96
121
// fault in fields & methods
97
122
if (unit .scope != null )
98
123
unit .scope .faultInTypes ();
99
124
100
125
// verify inherited methods
101
126
if (unit .scope != null )
102
- unit .scope .verifyMethods (lookupEnvironment .methodVerifier ());
127
+ unit .scope .verifyMethods (this . lookupEnvironment .methodVerifier ());
103
128
104
129
// type checking
105
130
unit .resolve ();
106
131
132
+ long analyzeStart = System .currentTimeMillis ();
133
+ this .stats .resolveTime += analyzeStart - resolveStart ;
134
+
107
135
// flow analysis
108
136
unit .analyseCode ();
109
137
138
+ long generateStart = System .currentTimeMillis ();
139
+ this .stats .analyzeTime += generateStart - analyzeStart ;
140
+
110
141
// code generation
111
142
unit .generateCode ();
112
143
113
144
// reference info
114
- if (options .produceReferenceInfo && unit .scope != null )
145
+ if (this . options .produceReferenceInfo && unit .scope != null )
115
146
unit .scope .storeDependencyInfo ();
116
147
148
+ // finalize problems (suppressWarnings)
149
+ unit .finalizeProblems ();
150
+
151
+ this .stats .generateTime += System .currentTimeMillis () - generateStart ;
152
+
117
153
// refresh the total number of units known at this stage
118
- unit .compilationResult .totalUnitsKnown = totalUnits ;
154
+ unit .compilationResult .totalUnitsKnown = this . totalUnits ;
119
155
120
156
this .lookupEnvironment .unitBeingCompleted = null ;
121
157
}
0 commit comments