Uploaded image for project: 'Commons JCI'
  1. Commons JCI
  2. JCI-20

JCI: Eclipse compiler doesn't handling warnings correctly

    XMLWordPrintableJSON

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)

      { errors = 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('.'); }

      clazzName.append(compoundName[j]);
      }

      store.write(clazzName.toString(), clazzFile.getBytes());
      }
      }
      } catch (Exception exc)

      { exc.printStackTrace(); }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            plightbo@gmail.com Patrick Lightbody
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: