Example usage for org.eclipse.jdt.core.compiler CategorizedProblem CAT_MEMBER

List of usage examples for org.eclipse.jdt.core.compiler CategorizedProblem CAT_MEMBER

Introduction

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

Prototype

int CAT_MEMBER

To view the source code for org.eclipse.jdt.core.compiler CategorizedProblem CAT_MEMBER.

Click Source Link

Document

Category for fatal problems related to type members, could be addressed by some field or method change

Usage

From source file:astview.ProblemNode.java

License:Open Source License

private String getCategoryCode() {
    CategorizedProblem categorized = (CategorizedProblem) fProblem;
    int categoryID = categorized.getCategoryID();
    StringBuffer buf = new StringBuffer();

    switch (categoryID) {
    case CategorizedProblem.CAT_UNSPECIFIED:
        buf.append("Unspecified");
        break;// w  w w .  jav a 2s .c  o  m

    case CategorizedProblem.CAT_BUILDPATH:
        buf.append("Buildpath");
        break;
    case CategorizedProblem.CAT_SYNTAX:
        buf.append("Syntax");
        break;
    case CategorizedProblem.CAT_IMPORT:
        buf.append("Import");
        break;
    case CategorizedProblem.CAT_TYPE:
        buf.append("Type");
        break;
    case CategorizedProblem.CAT_MEMBER:
        buf.append("Member");
        break;
    case CategorizedProblem.CAT_INTERNAL:
        buf.append("Internal");
        break;
    case CategorizedProblem.CAT_JAVADOC:
        buf.append("Javadoc");
        break;
    case CategorizedProblem.CAT_CODE_STYLE:
        buf.append("Code Style");
        break;
    case CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM:
        buf.append("Potential Programming Problem");
        break;
    case CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT:
        buf.append("Name Shadowing Conflict");
        break;
    case CategorizedProblem.CAT_DEPRECATION:
        buf.append("Deprecation");
        break;
    case CategorizedProblem.CAT_UNNECESSARY_CODE:
        buf.append("Unnecessary Code");
        break;
    case CategorizedProblem.CAT_UNCHECKED_RAW:
        buf.append("Unchecked Raw");
        break;
    case CategorizedProblem.CAT_NLS:
        buf.append("NLS");
        break;
    case CategorizedProblem.CAT_RESTRICTION:
        buf.append("Restriction");
        break;
    default:
        buf.append("<UNKNOWN CATEGORY>");
        break;
    }

    buf.append(" = ").append(categoryID);

    return buf.toString();
}

From source file:fromastview.ProblemNode.java

License:Open Source License

private String getCategoryCode() {
    CategorizedProblem categorized = (CategorizedProblem) fProblem;
    int categoryID = categorized.getCategoryID();
    StringBuffer buf = new StringBuffer();

    switch (categoryID) {
    case CategorizedProblem.CAT_UNSPECIFIED:
        buf.append("Unspecified");
        break;/*from  ww w  . j ava 2 s  .c  o m*/
    case CategorizedProblem.CAT_BUILDPATH:
        buf.append("Buildpath");
        break;
    case CategorizedProblem.CAT_SYNTAX:
        buf.append("Syntax");
        break;
    case CategorizedProblem.CAT_IMPORT:
        buf.append("Import");
        break;
    case CategorizedProblem.CAT_TYPE:
        buf.append("Type");
        break;
    case CategorizedProblem.CAT_MEMBER:
        buf.append("Member");
        break;
    case CategorizedProblem.CAT_INTERNAL:
        buf.append("Internal");
        break;
    case CategorizedProblem.CAT_JAVADOC:
        buf.append("Javadoc");
        break;
    case CategorizedProblem.CAT_CODE_STYLE:
        buf.append("Code Style");
        break;
    case CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM:
        buf.append("Potential Programming Problem");
        break;
    case CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT:
        buf.append("Name Shadowing Conflict");
        break;
    case CategorizedProblem.CAT_DEPRECATION:
        buf.append("Deprecation");
        break;
    case CategorizedProblem.CAT_UNNECESSARY_CODE:
        buf.append("Unnecessary Code");
        break;
    case CategorizedProblem.CAT_UNCHECKED_RAW:
        buf.append("Unchecked Raw");
        break;
    case CategorizedProblem.CAT_NLS:
        buf.append("NLS");
        break;
    case CategorizedProblem.CAT_RESTRICTION:
        buf.append("Restriction");
        break;
    default:
        buf.append("<UNKNOWN CATEGORY>");
        break;
    }

    buf.append(" = ").append(categoryID);

    return buf.toString();
}

From source file:org.eclipse.objectteams.otdt.test.builder.CompilationOrderTests.java

License:Open Source License

@SuppressWarnings("nls")
public void testMissingOTRE() throws JavaModelException {
    System.out.println("***** testMissingOTRE() *****");
    IPath projectPath = env.addProject("Project", "1.5");
    // don't abort when detecting the build path error
    // (otherwise other errors would be expunged).
    env.getJavaProject(projectPath).setOption(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.ERROR);
    env.addExternalJars(projectPath, Util.getJavaClassLibs());
    // don't: env.addExternalJar(projectPath, OTRE_JAR_PATH);

    // remove old package fragment root so that names don't collide
    env.removePackageFragmentRoot(projectPath, "");

    IPath root = env.addPackageFragmentRoot(projectPath, "src");
    env.setOutputFolder(projectPath, "bin");

    IPath ateam = env.addClass(root, "p", "ATeam",
            "package p;   \n" + "public team class ATeam {   ATeam() { super(); } }");

    fullBuild(projectPath);/*from  w  ww  .  j  a va  2  s  . co m*/

    expectingProblemsFor(ateam);
    expectingOnlySpecificProblemsFor(ateam, new Problem[] { new Problem("",
            "The type org.objectteams.Team cannot be resolved. It is indirectly referenced from required .class files",
            ateam, 30, 35, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),
            new Problem("", "The constructor Team() is undefined", ateam, 48, 56, CategorizedProblem.CAT_MEMBER,
                    IMarker.SEVERITY_ERROR) });
}

From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java

License:Open Source License

public void testRemoveRoleMethod() throws JavaModelException {
    System.out.println("***** testRemoveRoleMethod() *****");
    IPath projectPath = env.addProject("Project", "1.5");
    env.addExternalJars(projectPath, Util.getJavaClassLibs());
    env.addExternalJar(projectPath, getOTREPath(this.weavingScheme));

    // remove old package fragment root so that names don't collide
    env.removePackageFragmentRoot(projectPath, "");

    IPath root = env.addPackageFragmentRoot(projectPath, "src");
    env.setOutputFolder(projectPath, "bin");

    env.addClass(root, "p", "AA", "package p;   \n" + "public team class AA {   \n" + "   public class RA { \n"
            + "       public void foo() {}\n" + "}}");

    env.addClass(root, "p", "AB",
            "package p;   \n" + "public team class AB extends AA {" + "   protected class RB extends RA {} }");

    fullBuild(projectPath);//from w  w  w  .  ja  v a2 s .  c o  m
    expectingNoProblems();

    /* Remove role method AA.RA.foo */
    env.addClass(root, "p", "AA", "package p;   \n" + "public team class AA {   \n" + "   public class RA {}}");

    /* add a class referencing AB.RA */
    IPath pathToM = env.addClass(root, "p", "M", "package p;   \n" + "public class M {   \n"
            + "   void test() {\n" + "   new AB().new RA().foo();\n" + "}}");

    /* build must detect, that the use of AB - although AB is unchanged - becomes invalid. */
    incrementalBuild(projectPath);
    expectingProblemsFor(pathToM);
    expectingSpecificProblemFor(pathToM,
            new Problem("", "The method foo() is undefined for the type RA<@tthis[AB]>", pathToM, 68, 71,
                    CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));

    /* Restore method AA.RA.foo */
    env.addClass(root, "p", "AA", "package p;   \n" + "public team class AA {   \n" + "   public class RA { \n"
            + "       public void foo() {}\n" + "}}");

    incrementalBuild(projectPath);
    expectingNoProblems();
}

From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java

License:Open Source License

public void testModifyTSuperRole1() throws JavaModelException {
    System.out.println("***** testModifyTSuperRole1() *****");
    IPath projectPath = env.addProject("Project", "1.5");
    env.addExternalJars(projectPath, Util.getJavaClassLibs());
    env.addExternalJar(projectPath, getOTREPath(this.weavingScheme));

    // remove old package fragment root so that names don't collide
    env.removePackageFragmentRoot(projectPath, "");

    IPath root = env.addPackageFragmentRoot(projectPath, "src");
    env.setOutputFolder(projectPath, "bin");

    env.addClass(root, "p", "AA", "package p;   \n" + "public team class AA {   \n" + "   protected class R {\n"
            + "       void bar() { }\n" + "}}");

    IPath pathToAB = env.addClass(root, "p", "AB", "package p;   \n" + "public team class AB extends AA {\n"
            + "   protected class R {\n" + "       void foo() { this.bar(); }\n" + "} }");

    fullBuild(projectPath);//  ww  w.j  ava2 s  .c o  m
    expectingNoProblems();

    /* Remove method AA.R.bar() */
    env.addClass(root, "p", "AA",
            "package p;   \n" + "public team class AA {\n" + "   protected class R {}\n" + "}");

    /* build must detect, that AB - although unchanged - becomes invalid through a self-call. */
    incrementalBuild(projectPath);
    expectingProblemsFor(pathToAB);
    expectingSpecificProblemFor(pathToAB, new Problem("", "The method bar() is undefined for the type AB.R",
            pathToAB, 94, 97, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));

    /* Restore method AA.R.bar */
    env.addClass(root, "p", "AA", "package p;   \n" + "public team class AA {   \n" + "   protected class R {\n"
            + "       void bar() { }\n" + "}}");

    incrementalBuild(projectPath);
    expectingNoProblems();
}

From source file:org.eclipse.objectteams.otdt.test.builder.IncrementalTests.java

License:Open Source License

public void testRemoveBoundBaseMethod() throws JavaModelException {
    System.out.println("***** testRemoveBoundBaseMethod() *****");
    IPath projectPath = env.addProject("Project", "1.5");
    env.addExternalJars(projectPath, Util.getJavaClassLibs());
    env.addExternalJar(projectPath, getOTREPath(this.weavingScheme));

    // remove old package fragment root so that names don't collide 
    env.removePackageFragmentRoot(projectPath, "");

    IPath root = env.addPackageFragmentRoot(projectPath, "src");
    env.setOutputFolder(projectPath, "bin");

    env.addClass(root, "p0", "Base",
            "package p0;   \n" + "public class Base {   \n" + "   public void foo() {}\n" + "}");
    IPath pathToT1 = env.addClass(root, "p", "T1",
            "package p;   \n" + "import base p0.Base;\n" + "public team class T1 {   \n"
                    + "   protected class R playedBy Base {\n" + "       void bar() { } \n"
                    + "       bar <- after foo;\n" + "   }\n" + "}");

    fullBuild(projectPath);//from   w w w. j  a v  a 2  s  . c o  m
    expectingNoProblems();

    // remove foo():
    env.addClass(root, "p0", "Base", "package p0;   \n" + "public class Base {   \n" + "}");

    env.addClass(root, "p", "T2", "package p;   \n" + "public team class T2 extends T1 {}");

    // must detect, that callin binding in T1 is now invalid
    incrementalBuild(projectPath);
    expectingProblemsFor(pathToT1);
    expectingSpecificProblemFor(pathToT1,
            new Problem("", "No method foo found in type p0.Base to resolve method designator (OTJLD 4.1(c)).",
                    pathToT1, 137, 140, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR));

    // restore:
    env.addClass(root, "p0", "Base",
            "package p0;   \n" + "public class Base {   \n" + "   public void foo() {}\n" + "}");
    fullBuild(projectPath);
    expectingNoProblems();
}