Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
36070
Description
The Eclipse compiler won't process classes even if only warnings occur. This
isn't correct and can lead to some very frustrating debugging All you need to
do is change the ICompilerRequestor anonymous class to (note the new "errors"
boolean):
public void acceptResult(CompilationResult result) {
try {
boolean errors = false;
if (result.hasProblems()) {
if (problemHandler != null) {
final IProblem[] problems = result.getProblems();
for (int i = 0; i < problems.length; i++) {
final IProblem problem = problems[i];
boolean error = problem.isError();
if (error)
problemHandler.handle(
new CompilationProblem(
problem.getID(),
new
String(problem.getOriginatingFileName()),
problem.getMessage(),
problem.getSourceLineNumber(),
problem.getSourceLineNumber(),
error
));
}
}
}
if (!errors) {
final ClassFile[] clazzFiles = result.getClassFiles();
for (int i = 0; i < clazzFiles.length; i++) {
final ClassFile clazzFile = clazzFiles[i];
final char[][] compoundName =
clazzFile.getCompoundName();
final StringBuffer clazzName = new StringBuffer();
for (int j = 0; j < compoundName.length; j++) {
if (j != 0)
clazzName.append(compoundName[j]);
}
store.write(clazzName.toString(), clazzFile.getBytes());
}
}
} catch (Exception exc)
}