Example usage for org.eclipse.jdt.core.compiler IProblem Unclassified

List of usage examples for org.eclipse.jdt.core.compiler IProblem Unclassified

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.compiler IProblem Unclassified.

Prototype

int Unclassified

To view the source code for org.eclipse.jdt.core.compiler IProblem Unclassified.

Click Source Link

Document

ID reserved for referencing an internal error inside the JavaCore implementation which may be surfaced as a problem associated with the compilation unit which caused it to occur.

Usage

From source file:org.ant4eclipse.ant.jdt.ecj.JavacCompilerAdapter.java

License:Open Source License

/**
 * Creates the problem instances which can be used to report some issues.
 * //from   w w w .j a va 2s . c  om
 * @param problems
 *          The receiving list for the problems. Not <code>null</code>.
 * @param sourcefilename
 *          The filename these problems are related to. Not <code>null</code>.
 * @param text
 *          The content of the javac outcome. Not <code>null</code>.
 */
private void createProblems(List<CategorizedProblem> problems, String sourcefilename, String text) {
    List<String> lines = Utilities.splitText(text);
    Collections.reverse(lines);
    for (int i = 0; i < lines.size() - 2; i++) {
        int col = lines.get(i).indexOf('^');
        if (col != -1) {
            // we've got a marker for the issue which usually looks like in the following example
            //
            // mysource.java:12 : there's an error
            // public class mysource- {
            // ^
            //
            String line = lines.get(i + 2);
            int suffix = line.indexOf(SUFFIX_JAVA);
            if (suffix != -1) {
                line = line.substring(suffix + SUFFIX_JAVA.length() + 1); // +1 to skip a ':' before the line number
                int colon = line.indexOf(':');
                if (colon != -1) {
                    int lineno = Integer.parseInt(line.substring(0, colon));
                    String error = line.substring(colon + 1).trim();
                    problems.add(this._problemfactory.createProblem(sourcefilename.toCharArray(),
                            IProblem.Unclassified, new String[] { error }, new String[] { error },
                            ProblemSeverities.Error, -1, -1, lineno, problems.size()));
                }
            }
        }
    }
}

From source file:org.eclipse.objectteams.otdt.tests.compiler.TestBase.java

License:Open Source License

private void printAllProblems() {
    for (Iterator iter = _compiler.logger.globalProblems.iterator(); iter.hasNext();) {
        IProblem prob = (IProblem) iter.next();
        System.err.println(prob.toString());
        if (prob.getID() == IProblem.Unclassified) // it was an exception.
            throw new InternalError(prob.toString());
    }/* w  ww .j  a v a2  s  .  c om*/
}