Package com.google.gwt.dev.javac.testing.impl

Examples of com.google.gwt.dev.javac.testing.impl.MockJavaResource


          "Referencing field 'CC.f': unable to resolve field in class 'some.A.B.CC'");
    }
  }

  public void testSuperFieldAccess() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
        "class Buggy extends Super {",
        "  native void jsniMeth() /*-{",
        "    this.@Buggy::x; ",
        "   }-*/;",
        "}");

    MockJavaResource extra = JavaResourceBase.createMockJavaResource("Super",
        "class Super {",
        "  public long x = -1;",
        "}");

    shouldGenerateError(buggy, extra,
View Full Code Here


        3,
        "Referencing field 'Buggy.x': unable to resolve field in class 'Buggy'");
  }

  public void testUnresolvedClass() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy {",
       "  native void jsniMethod() /*-{",
       "    @Foo::x;",
       "  }-*/;",
       "}");
View Full Code Here

    shouldGenerateError(buggy, 3,
        "Referencing class 'Foo': unable to resolve class");
  }

  public void testUnresolvedField() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy {",
       "  native void jsniMethod() /*-{",
       "    @Buggy::x;",
       "  }-*/;",
       "}");
View Full Code Here

    shouldGenerateError(buggy, 3,
        "Referencing field 'Buggy.x': unable to resolve field in class 'Buggy'");
  }

  public void testUnresolvedMethod() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy {",
       "  native void jsniMethod() /*-{",
       "    @Buggy::x(Ljava/lang/String);",
       "  }-*/;",
       "}");
View Full Code Here

        + "unable to resolve method in class 'Buggy'");
  }

  public void testUnsafeAnnotation() {
    {
      MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
         "import com.google.gwt.core.client.UnsafeNativeLong;",
         "class Buggy {",
         "  void print(long x) { }",
         "  @UnsafeNativeLong",
         "  native void jsniMeth() /*-{ this.@Buggy::print(J)(0); }-*/;",
 
View Full Code Here

    }
  }

  public void testViolator() {
    {
      MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
         "class Buggy {",
         "  native void jsniMeth() /*-{",
         "    $wnd.alert(@Extra.Inner::x);",
         "  }-*/;",
         "}");

      MockJavaResource extra = JavaResourceBase.createMockJavaResource("Extra",
          "class Extra {",
          "  private static class Inner { ",
          "    private static int x = 3;",
          "  }",
          "}");

      shouldGenerateNoError(buggy, extra);
    }

    {
      MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
          "class Buggy {",
          "  native void jsniMeth() /*-{",
          "    $wnd.alert(@Extra.Inner::x);",
          "  }-*/;",
          "}");

      MockJavaResource extra = JavaResourceBase.createMockJavaResource("Extra",
          "class Extra {",
          "  private static class Inner { ",
          "    private static long x = 3;",
          "  }",
          "}");
View Full Code Here

          "Referencing field 'Extra.Inner.x': type 'long' is not safe to access in JSNI code");
    }
  }

  public void testWildcardMethodAccess() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy {",
       "  int m(String x) { return -1; }",
       "  native void jsniMeth() /*-{",
       "    this.@Buggy::m(*)(\"hello\"); }-*/;",
       "}");
View Full Code Here

    shouldGenerateNoError(buggy);
  }

  public void testWilcardMethodAccess_Ambiguous_withinClass() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy {",
       "  int m(String x) { return -1; }",
       "  int m(Integer x) { return -1; }",
       "  native void jsniMeth() /*-{",
       "    this.@Buggy::m(*)(\"hello\"); }-*/;",
 
View Full Code Here

            + "both 'Buggy.m(Ljava/lang/String;)' and "
            + "'Buggy.m(Ljava/lang/Integer;)' match");
  }

  public void testWildcardMethodAccess_Ambiguous_withSuperClass() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy extends Extra{",
       "  public int m(String x) { return -1; }",
       "  native void jsniMeth() /*-{",
       "    this.@Buggy::m(*)(\"hello\"); }-*/;",
       "}");

    MockJavaResource extra = JavaResourceBase.createMockJavaResource("Extra",
        "class Extra {",
        "  public int m(Integer x) { return -1; }",
        "}");

    shouldGenerateError(
View Full Code Here

          + "both 'public Buggy.m(Ljava/lang/String;)' and "
          + "'public Extra.m(Ljava/lang/Integer;)' match");
  }

  public void testWildcardMethodAccess_NoConflict_OverrideFromSuperclass() {
    MockJavaResource buggy = JavaResourceBase.createMockJavaResource("Buggy",
       "class Buggy extends Extra {",
       "  public int m(String x) { return -1; }",
       "  native void jsniMeth() /*-{",
       "    this.@Buggy::m(*)(\"hello\"); }-*/;",
       "}");

    MockJavaResource extra = JavaResourceBase.createMockJavaResource("Extra",
        "class Extra {",
        "  public int m(String x) { return -1; }",
        "}");

    shouldGenerateNoError(buggy, extra);
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.testing.impl.MockJavaResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.