Example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation

List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation.

Prototype

String OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation

To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation.

Click Source Link

Usage

From source file:org.eclipse.objectteams.jdt.nullity.tests.NullAnnotationTest.java

License:Open Source License

protected Map getCompilerOptions() {
    Map defaultOptions = super.getCompilerOptions();
    if (setNullRelatedOptions) {
        defaultOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
        defaultOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR);
        defaultOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR);
        defaultOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
        defaultOptions.put(CompilerOptions.OPTION_IncludeNullInfoFromAsserts, CompilerOptions.ENABLED);

        defaultOptions.put(/*from  w ww  . j av  a 2  s .co m*/
                CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
                CompilerOptions.DISABLED);

        // enable null annotations:
        defaultOptions.put(NullCompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
        // leave other new options at these defaults:
        //      defaultOptions.put(CompilerOptions.OPTION_ReportNullSpecViolation, CompilerOptions.ERROR);
        //      defaultOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, CompilerOptions.ERROR);
        //      defaultOptions.put(CompilerOptions.OPTION_ReportNullSpecInsufficientInfo, CompilerOptions.WARNING);
        //      defaultOptions.put(CompilerOptions.OPTION_ReportRedundantNullAnnotation, CompilerOptions.WARNING);

        //      defaultOptions.put(CompilerOptions.OPTION_NullableAnnotationName, "org.eclipse.jdt.annotation.Nullable");
        //      defaultOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "org.eclipse.jdt.annotation.NonNull");
    }
    return defaultOptions;
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.calloutbinding.CalloutMethodBinding.java

License:Open Source License

public void test3115_calloutCalledWithinLocaltype2() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*  w  w w.  jav a  2s  . co  m*/
    runNegativeTest(
            new String[] { "Team3115ccwl2.java", "\n" + "public team class Team3115ccwl2 {\n"
                    + "    protected class R playedBy T3115ccwl2 {\n" + "        R() {\n"
                    + "            base();\n" + "        }\n" + "        void test() -> void test();\n"
                    + "        void broken() -> void inexistent();\n" + "        void runit() { \n"
                    + "            new Runnable() {\n" + "                public void run() {\n"
                    + "                    test();\n" + "                }\n" + "            }.run();\n"
                    + "            System.out.print(\"K\");\n" + "        }\n" + "    }\n" + "}\n" + "    \n",
                    "T3115ccwl2.java",
                    "\n" + "public class T3115ccwl2 {\n" + "    void test() { System.out.print(\"O\"); }\n"
                            + "}\n" + "    \n" },
            "----------\n" + "1. ERROR in Team3115ccwl2.java (at line 8)\n"
                    + "   void broken() -> void inexistent();\n" + "                    ^^^^^^^^^^^^^^^^^\n"
                    + "No method inexistent() found in type T3115ccwl2 to resolve method designator (OTJLD 3.1(c)).\n"
                    + "----------\n",
            null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java

License:Open Source License

public void testB11_sh47() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*ww w  .java 2s  .  c  o  m*/
    runNegativeTest(new String[] { "TeamB11sh47.java", "\n" + "import base javax.swing.JFrame;\n"
            + "import base java.lang.String;\n" + "@SuppressWarnings(\"bindingtosystemclass\")\n"
            + "public team class TeamB11sh47 {\n" + "    protected class R1 playedBy JFrame {\n"
            + "        callin void correct(int i) {\n" + "            System.out.print(i);\n"
            + "            base.correct(i);\n" + "        }\n" + "        correct <- replace show;\n"
            + "        void unshow() -> void hide();\n" + "    }\n"
            + "    protected class Unfinished playedBy\n" + "    protected class R3 playedBy String {\n"
            + "        callin void shouldBeOK() {\n" + "            class Runner implements Runnable {\n"
            + "                public void run() {\n" + "                    System.out.print(\"running\");\n"
            + "                }\n" + "            }\n" + "            new Thread(new Runner()).run();\n"
            + "        }\n" + "        shouldBeOK <- replace length;\n" + "    }\n" + "}\n" + "    \n" },
            (this.weavingScheme == WeavingScheme.OTRE && IS_JRE_8 ? "----------\n"
                    + "1. WARNING in TeamB11sh47.java (at line 6)\n"
                    + "   protected class R1 playedBy JFrame {\n" + "                               ^^^^^^\n"
                    + "Base class javax.swing.JFrame has class file version 52 which cannot be handled by the traditional OTRE based on BCEL. Please consider using the ASM based OTDRE instead.\n"
                    + "----------\n" + "2. ERROR in TeamB11sh47.java (at line 11)\n"
                    + "   correct <- replace show;\n" + "                      ^^^^\n"
                    + "Method specifier \"show\" is ambiguous for the type javax.swing.JFrame. Please use the exact method signature to disambiguate (OTJLD 4.1(c)).\n"
                    + "----------\n" + "3. ERROR in TeamB11sh47.java (at line 14)\n"
                    + "   protected class Unfinished playedBy\n" + "   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
                    + "Syntax error on token(s), misplaced construct(s)\n" + "----------\n"
                    + "4. ERROR in TeamB11sh47.java (at line 15)\n"
                    + "   protected class R3 playedBy String {\n" + "                   ^^\n"
                    + "Member types not allowed in regular roles. Mark class TeamB11sh47.Unfinished as a team if R3 should be its role (OTJLD 1.5(a,b)). \n"
                    + "----------\n" + "5. WARNING in TeamB11sh47.java (at line 15)\n"
                    + "   protected class R3 playedBy String {\n" + "                               ^^^^^^\n"
                    + "PlayedBy binding overrides finalness of base class java.lang.String (OTJLD 2.1.2(c)).\n"
                    + "----------\n" + "6. WARNING in TeamB11sh47.java (at line 15)\n"
                    + "   protected class R3 playedBy String {\n" + "                               ^^^^^^\n"
                    + "Base class java.lang.String has class file version 52 which cannot be handled by the traditional OTRE based on BCEL. Please consider using the ASM based OTDRE instead.\n"
                    + "----------\n"
                    : "----------\n" + "1. ERROR in TeamB11sh47.java (at line 11)\n"
                            + "   correct <- replace show;\n" + "                      ^^^^\n"
                            + "Method specifier \"show\" is ambiguous for the type javax.swing.JFrame. Please use the exact method signature to disambiguate (OTJLD 4.1(c)).\n"
                            + "----------\n" + "2. ERROR in TeamB11sh47.java (at line 14)\n"
                            + "   protected class Unfinished playedBy\n"
                            + "   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
                            + "Syntax error on token(s), misplaced construct(s)\n" + "----------\n"
                            + "3. ERROR in TeamB11sh47.java (at line 15)\n"
                            + "   protected class R3 playedBy String {\n" + "                   ^^\n"
                            + "Member types not allowed in regular roles. Mark class TeamB11sh47.Unfinished as a team if R3 should be its role (OTJLD 1.5(a,b)). \n"
                            + "----------\n" + "4. WARNING in TeamB11sh47.java (at line 15)\n"
                            + "   protected class R3 playedBy String {\n"
                            + "                               ^^^^^^\n"
                            + "PlayedBy binding overrides finalness of base class java.lang.String (OTJLD 2.1.2(c)).\n"
                            + "----------\n"),
            null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java

License:Open Source License

public void testB11_sh84() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*from w w w . ja  v  a2 s .c om*/
    runNegativeTest(new String[] { "TeamB11sh84_2.java",
            "\n" + "public team class TeamB11sh84_2 extends TeamB11sh84_1 {\n" + "    \n" + "}\n" + "    \n",
            "TeamB11sh84_1.java",
            "\n" + "public team class TeamB11sh84_1 {\n" + "    protected class R {\n"
                    + "        void test() {\n" + "            unresolved();\n"
                    + "            new Runnable() { public void run() { System.out.println(\"would be ok\"); } }.run();\n"
                    + "        }\n" + "    }\n" + "}\n" + "    \n" },
            "----------\n" + "1. ERROR in TeamB11sh84_1.java (at line 5)\n" + "   unresolved();\n"
                    + "   ^^^^^^^^^^\n" + "The method unresolved() is undefined for the type TeamB11sh84_1.R\n"
                    + "----------\n",
            null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java

License:Open Source License

public void testB11_sh85() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);//from w ww.  j a  v a  2  s.  co m
    runNegativeTest(new String[] { "TeamB11sh85_2.java",
            "\n" + "public team class TeamB11sh85_2 extends TeamB11sh85_1 {\n" + "\n" + "}\n" + "    \n",
            "TeamB11sh85_1.java",
            "\n" + "import not.existing.Import;\n" + "public team class TeamB11sh85_1 {\n"
                    + "    protected class R {\n" + "        void test() {\n"
                    + "            new Runnable() { public void run() { System.out.println(\"would be ok\"); } }.run();\n"
                    + "        }\n" + "    }\n" + "}\n" + "    \n" },
            "----------\n" + "1. ERROR in TeamB11sh85_1.java (at line 2)\n" + "   import not.existing.Import;\n"
                    + "          ^^^\n" + "The import not cannot be resolved\n" + "----------\n",
            null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java

License:Open Source License

public void testB11_sh86() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);//w w w.j  av  a2 s .c om
    runConformTest(new String[] { "TeamB11sh86_3.java",
            "\n" + "public team class TeamB11sh86_3 extends TeamB11sh86_2 { }\n" + "    \n",
            "p1/TB11sh86_1.java", "\n" + "package p1;\n" + "public class TB11sh86_1 {\n" + "}\n" + "    \n",
            "TB11sh86_2.java", "\n" + "public class TB11sh86_2 {\n"
                    + "    public p1.TB11sh86_1 bm(Object o) { return null; }\n" + "}\n" + "    \n",
            "TeamB11sh86_1.java",
            "\n" + "import p1.TB11sh86_1; // the BUG\n" + "public team class TeamB11sh86_1 {\n"
                    + "    abstract protected class R {\n"
                    + "        public abstract TB11sh86_1 getBase(Object o);\n" + "    }\n" + "}\n" + "    \n",
            "TeamB11sh86_2.java",
            "\n" + "import p1.TB11sh86_1;\n" + "public team class TeamB11sh86_2 extends TeamB11sh86_1 {\n"
                    + "    @Override\n" + "    protected class R playedBy TB11sh86_2 {\n"
                    + "        getBase -> bm;\n" + "    }\n" + "}\n" + "    \n" },
            null, null/*classLibraries*/, false/*shouldFlushOutputDirectory*/, null/*vmArguments*/,
            customOptions, null/*requestor*/);
    runNegativeTest(
            new String[] { "TeamB11sh86_1.java",
                    "\n" + "//import p1.TB11sh86_1; // the BUG\n" + "public team class TeamB11sh86_1 {\n"
                            + "    abstract protected class R {\n"
                            + "        public abstract TB11sh86_1 getBase(Object o);\n" + "    }\n" + "}\n"
                            + "    \n" },
            "----------\n" + "1. ERROR in TeamB11sh86_1.java (at line 5)\n"
                    + "   public abstract TB11sh86_1 getBase(Object o);\n" + "                   ^^^^^^^^^^\n"
                    + "TB11sh86_1 cannot be resolved to a type\n" + "----------\n",
            null/*classLibraries*/, false/*shouldFlushOutputDirectory*/, customOptions, true/*generateOutput*/,
            false/*showCategory*/, false/*showWarningToken*/);
    runNegativeTest(new String[] {
            // same as above
            "TeamB11sh86_2.java",
            "\n" + "import p1.TB11sh86_1;\n" + "public team class TeamB11sh86_2 extends TeamB11sh86_1 {\n"
                    + "    @Override\n" + "    protected class R playedBy TB11sh86_2 {\n"
                    + "        getBase -> bm;\n" + "    }\n" + "}\n" + "    \n" },
            // FIXME(SH): why these errors:?
            (this.weavingScheme == WeavingScheme.OTRE && this.complianceLevel >= ClassFileConstants.JDK1_8
                    ? "----------\n" + "1. WARNING in TeamB11sh86_2.java (at line 5)\n"
                            + "   protected class R playedBy TB11sh86_2 {\n"
                            + "                              ^^^^^^^^^^\n"
                            + "Base class TB11sh86_2 has class file version 52 which cannot be handled by the traditional OTRE based on BCEL. Please consider using the ASM based OTDRE instead.\n"
                            + "----------\n" + "2. ERROR in TeamB11sh86_2.java (at line 6)\n"
                            + "   getBase -> bm;\n" + "   ^^^^^^^\n"
                            + "A non-abstract role method exists for this callout-binding. Use callout-override (\'=>\') if you want to override it (OTJLD 3.1(e)).\n"
                            + "----------\n" + "3. ERROR in TeamB11sh86_2.java (at line 6)\n"
                            + "   getBase -> bm;\n" + "   ^^^^^^^\n"
                            + "The return type is incompatible with TeamB11sh86_1.R.getBase(Object)\n"
                            + "----------\n"
                    : "----------\n" + "1. ERROR in TeamB11sh86_2.java (at line 6)\n" + "   getBase -> bm;\n"
                            + "   ^^^^^^^\n"
                            + "A non-abstract role method exists for this callout-binding. Use callout-override (\'=>\') if you want to override it (OTJLD 3.1(e)).\n"
                            + "----------\n" + "2. ERROR in TeamB11sh86_2.java (at line 6)\n"
                            + "   getBase -> bm;\n" + "   ^^^^^^^\n"
                            + "The return type is incompatible with TeamB11sh86_1.R.getBase(Object)\n"
                            + "----------\n"),
            null/*classLibraries*/, false/*shouldFlushOutputDirectory*/, customOptions, true/*generateOutput*/,
            false/*showCategory*/, false/*showWarningToken*/);
    runNegativeTest(new String[] {
            // same as above
            "TeamB11sh86_3.java",
            "\n" + "public team class TeamB11sh86_3 extends TeamB11sh86_2 { }\n" + "    \n" },
            "----------\n" + "1. ERROR in TeamB11sh86_3.java (at line 1)\n" + "   \n"
                    + "public team class TeamB11sh86_3 extends TeamB11sh86_2 { }\n" + "   ^\n"
                    + "The type TB11sh86_1 cannot be resolved. It is indirectly referenced from required .class files\n"
                    + "----------\n",
            null/*classLibraries*/, false/*shouldFlushOutputDirectory*/, customOptions);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.regression.ReportedBugs.java

License:Open Source License

public void testB11_sh95() {
    compileOrder = new String[][] { { "Visitor.java" }, { "Caller.java" } };
    Map options = getCompilerOptions();
    options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*  w w w. java  2 s .co m*/
    runTestExpectingWarnings(new String[] { "Caller.java", "\n" + "public class Caller {\n"
            + "   private static class VisitorImpl extends VisitorAdapter<Object> {\n" + "      \n"
            + "      @Override\n" + "      public Parameter1 visit(Long r, Object a) {\n"
            + "         return null;\n" + "      }\n" + "      \n" + "      @Override\n"
            + "      public Parameter1 visit(Integer r, Object a) {\n" + "         return null;\n" + "      }\n"
            + "      \n" + "      @Override\n" + "      public Parameter1 visit(Number r, Object a) {\n"
            + "         return null;\n" + "      }\n" + "   }\n" + "\n"
            + "   private void accept(Visitor<Parameter1, Parameter2> v) {\n"
            + "      v.visit(1, new Parameter2());\n" + "   }\n" + "   \n" + "   public void start() {\n"
            + "   }\n" + "}\n", "Visitor.java",
            "public interface Visitor<R, A> {\n" + "\n" + "   R visit(Long r, A a);\n" + "\n"
                    + "   R visit(Integer r, A a);\n" + "\n" + "   R visit(Number r, A a);\n" + "}\n"
                    + "class Parameter1 {\n" + "   \n" + "}\n" + "class Parameter2 {\n" + "   \n" + "}\n"
                    + "abstract class VisitorAdapter<A> implements Visitor<Parameter1, A> {\n" + "\n"
                    + "   public Parameter1 visit(Long r, A a) {\n" + "      return null;\n" + "   }\n" + "\n"
                    + "   public Parameter1 visit(Integer r, A a) {\n" + "      return null;\n" + "   }\n"
                    + "\n" + "   public Parameter1 visit(Number r, A a) {\n" + "      return null;\n" + "   }\n"
                    + "   \n" + "}\n" },
            "----------\n" + "1. WARNING in Caller.java (at line 3)\n"
                    + "   private static class VisitorImpl extends VisitorAdapter<Object> {\n"
                    + "                        ^^^^^^^^^^^\n"
                    + "The type Caller.VisitorImpl is never used locally\n" + "----------\n"
                    + "2. WARNING in Caller.java (at line 21)\n"
                    + "   private void accept(Visitor<Parameter1, Parameter2> v) {\n"
                    + "                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
                    + "The method accept(Visitor<Parameter1,Parameter2>) from the type Caller is never used locally\n"
                    + "----------\n",
            options);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.roleplaying.LiftingAndLowering.java

License:Open Source License

public void test2236_liftingParticipant1() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*from  w ww .  j av a  2  s.  c  o  m*/
    runConformTest(new String[] { "Team2236lp1.java",
            "\n" + "public team class Team2236lp1 {\n" + "    protected class R playedBy T2236lp1_1 {\n"
                    + "        int n;\n" + "        public R(T2236lp1_1 b, int n) {\n"
                    + "            this(b);\n" + "            this.n = n;\n" + "        }\n"
                    + "        public void identify() {\n" + "            System.out.print(this.n);\n"
                    + "        }\n" + "    }\n" + "    protected class R2 extends R playedBy T2236lp1_2 {\n"
                    + "    }\n" + "    void test(T2236lp1_1 as R o) {\n" + "        o.identify();\n" + "    }\n"
                    + "    public static void main(String[] args) {\n"
                    + "        Team2236lp1 t = new Team2236lp1();\n" + "        t.test(new T2236lp1_1());\n"
                    + "        t.test(new T2236lp1_1());\n" + "        T2236lp1_1 b = new T2236lp1_1();\n"
                    + "        t.test(b);\n" + "        t.test(b);\n" + "        t.test(new T2236lp1_1());\n"
                    + "        t.test(new T2236lp1_2());\n" + "    }\n" + "}\n" + "    \n",
            "T2236lp1_1.java", "\n" + "public class T2236lp1_1 {\n" + "}\n" + "    \n", "T2236lp1_2.java",
            "\n" + "public class T2236lp1_2 extends T2236lp1_1 {\n" + "}\n" + "    \n",
            "lifter/T2236lp1Lifter.java",
            "\n" + "package lifter;\n" + "import org.objectteams.ITeam;\n"
                    + "import java.lang.reflect.Constructor;\n"
                    + "public class T2236lp1Lifter implements org.objectteams.ILiftingParticipant {\n"
                    + "    int count = 1;\n"
                    + "    public Object createRole(ITeam teamInstance, Object base, String roleClassName) {\n"
                    + "        try {\n" + "            Class<?> rc = Class.forName(roleClassName);\n"
                    + "            Constructor<?>[] ctors = rc.getDeclaredConstructors();\n"
                    + "            for (Constructor<?> ctor : ctors)\n"
                    + "                if (ctor.getParameterTypes().length == 3)\n"
                    + "                    return ctor.newInstance(new Object[]{teamInstance, base, count++});\n"
                    + "\n" + "        } catch (Exception e) {\n" + "            e.printStackTrace();\n"
                    + "        }\n" + "        return null;\n" + "    }\n" + "}\n" + "    \n" },
            "123340", null/*classLibraries*/, true/*shouldFlushOutputDirectory*/,
            new String[] { "-Dot.lifting.participant=lifter.T2236lp1Lifter" }/*vmArguments*/, customOptions,
            null/*no custom requestor*/);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.roleplaying.LiftingAndLowering.java

License:Open Source License

public void test2236_liftingParticipant2() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);/*  w  w  w. j  av  a  2  s.co  m*/
    runConformTest(new String[] { "Team2236lp2_2.java", "\n" + "public team class Team2236lp2_2 {\n"
            + "    final Team2236lp2_1 otherTeam = new Team2236lp2_1();\n" + "    \n"
            + "    protected class R playedBy RLower1<@otherTeam> {\n" + "        int n;\n"
            + "        public R(RLower1<@otherTeam> b, int n) {\n" + "            this(b);\n"
            + "            this.n = n;\n" + "        }\n" + "        public void identify() {\n"
            + "            System.out.print(this.n);\n" + "        }\n" + "        identify <- after bm;\n"
            + "    }\n" + "    protected class R2 extends R playedBy RLower2<@otherTeam> {\n" + "    }\n"
            + "    protected void test(RLower1<@otherTeam> as R o) {\n" + "        o.identify();\n" + "    }\n"
            + "    public static void main(String[] args) {\n" + "        new Team2236lp2_2().runTests();\n"
            + "    }\n" + "    public void runTests() {\n" + "        test(new RLower1<@otherTeam>());\n"
            + "        test(new RLower1<@otherTeam>());\n"
            + "        RLower1<@otherTeam> b = new RLower1<@otherTeam>();\n" + "        test(b);\n"
            + "        test(b);\n" + "        test(new RLower1<@otherTeam>());\n"
            + "        test(new RLower2<@otherTeam>());\n" + "        this.activate();\n"
            + "        new Team2236lp2_1().new RLower1().bm(); // LiftingVetoException prevents callin\n"
            + "    }\n" + "}\n" + "    \n", "Team2236lp2_1.java",
            "\n" + "public team class Team2236lp2_1 {\n" + "    public class RLower1 { public void bm() {} }\n"
                    + "    public class RLower2 extends RLower1 {}\n" + "}\n" + "    \n",
            "lifter/T2236lp2Lifter.java",
            "\n" + "package lifter;\n" + "import org.objectteams.ITeam;\n"
                    + "import java.lang.reflect.Constructor;\n"
                    + "public class T2236lp2Lifter implements org.objectteams.ILiftingParticipant {\n"
                    + "    int count = 1;\n"
                    + "    public Object createRole(ITeam teamInstance, Object base, String roleClassName) {\n"
                    + "        if (!roleClassName.startsWith(\"Team2236lp2_2$__OT__R\"))\n"
                    + "            System.err.println(\"wrong role class name \"+roleClassName);\n"
                    + "        try {\n" + "            Class<?> rc = Class.forName(roleClassName);\n"
                    + "            Constructor<?>[] ctors = rc.getDeclaredConstructors();\n"
                    + "            for (Constructor<?> ctor : ctors)\n"
                    + "                if (ctor.getParameterTypes().length == 3)\n"
                    + "                    return ctor.newInstance(new Object[]{teamInstance, base, count++});\n"
                    + "\n" + "        } catch (Exception e) {\n" + "            e.printStackTrace();\n"
                    + "        }\n" + "        return null;\n" + "    }\n" + "}\n" + "    \n" },
            "123340", null/*classLibraries*/, true/*shouldFlushOutputDirectory*/,
            new String[] { "-Dot.lifting.participant=lifter.T2236lp2Lifter" }/*vmArguments*/, customOptions,
            null/*no custom requestor*/);
}

From source file:org.eclipse.objectteams.otdt.tests.otjld.roleplaying.PlayedByRelation.java

License:Open Source License

public void test213_boundToInterface_1() {
    Map customOptions = getCompilerOptions();
    customOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation,
            CompilerOptions.DISABLED);//from w  ww.j a  v  a2  s.  co  m
    runNegativeTest(new String[] { "Team213bti1.java",
            "\n" + "public team class Team213bti1 {\n" + "    public class Role213bti1 playedBy I213bti1 {\n"
                    + "        public abstract String getValue();\n"
                    + "        String getValue() -> String getValueInternal();\n" + "    }\n"
                    + "    public String getValue(T213bti1 as Role213bti1 obj) {\n"
                    + "        return obj.getValue();\n" + "    }\n" + "}\n",
            "I213bti1.java",
            "\n" + "public interface I213bti1 {\n" + "    String getValueInternal();\n" + "}\n" + "    \n",
            "T213bti1.java",
            "\n" + "public class T213bti1 implements I213bti1 {\n" + "    public String getValueInternal() {\n"
                    + "        return \"OK\";\n" + "    }\n" + "}\n" },
            "----------\n" + "1. WARNING in Team213bti1.java (at line 3)\n"
                    + "   public class Role213bti1 playedBy I213bti1 {\n"
                    + "                                     ^^^^^^^^\n"
                    + "When binding interface I213bti1 as base of Role213bti1:\n"
                    + "Note that some features like callin bindings are not yet supported in this situation (OTJLD 2.1.1).\n"
                    + "----------\n",
            null/*classLibraries*/, true/*shouldFlushOutputDirectory*/, customOptions);
}