8027220: DefaultMethodsTest: Change test to match spec

Thu, 24 Oct 2013 16:52:27 -0700

author
rfield
date
Thu, 24 Oct 2013 16:52:27 -0700
changeset 2170
860f1d21763a
parent 2169
667843bd2193
child 2171
44e3ba40e00c
child 2234
53dd31d3c5d7

8027220: DefaultMethodsTest: Change test to match spec
Reviewed-by: ksrini

test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java file | annotate | diff | comparison | revisions
test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java file | annotate | diff | comparison | revisions
     1.1 --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java	Thu Oct 24 11:22:50 2013 -0700
     1.2 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java	Thu Oct 24 16:52:27 2013 -0700
     1.3 @@ -300,7 +300,7 @@
     1.4              if (verboseLocal.get() == Boolean.TRUE) {
     1.5                  System.out.println(e.getCause());
     1.6              }
     1.7 -            assertEquals(e.getCause().getClass(), exceptionType);
     1.8 +            assertTrue(exceptionType.isAssignableFrom(e.getCause().getClass()));
     1.9          }
    1.10          compiler.cleanup();
    1.11      }
     2.1 --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Thu Oct 24 11:22:50 2013 -0700
     2.2 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Thu Oct 24 16:52:27 2013 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -255,7 +255,7 @@
    2.11       * interface J { default int m() { return 88; } }
    2.12       * class C implements I, J {}
    2.13       *
    2.14 -     * TEST: C c = new C(); c.m() throws AME
    2.15 +     * TEST: C c = new C(); c.m() throws ICCE
    2.16       */
    2.17      public void testConflict() {
    2.18          // debugTest();
    2.19 @@ -263,7 +263,7 @@
    2.20          Interface J = new Interface("J", DefaultMethod.std("88"));
    2.21          Class C = new Class("C", I, J);
    2.22  
    2.23 -        assertThrows(AbstractMethodError.class, C);
    2.24 +        assertThrows(IncompatibleClassChangeError.class, C);
    2.25      }
    2.26  
    2.27      /**
    2.28 @@ -271,14 +271,14 @@
    2.29       * interface J { default int m() { return 88; } }
    2.30       * class C implements I, J {}
    2.31       *
    2.32 -     * TEST: C c = new C(); c.m() throws AME
    2.33 +     * TEST: C c = new C(); c.m() == 88
    2.34       */
    2.35      public void testAmbiguousReabstract() {
    2.36          Interface I = new Interface("I", AbstractMethod.std());
    2.37          Interface J = new Interface("J", DefaultMethod.std("88"));
    2.38          Class C = new Class("C", I, J);
    2.39  
    2.40 -        assertThrows(AbstractMethodError.class, C);
    2.41 +        assertInvokeVirtualEquals(88, C);
    2.42      }
    2.43  
    2.44      /**
    2.45 @@ -555,8 +555,8 @@
    2.46       * interface I extends J, K { int m() default { J.super.m(); } }
    2.47       * class C implements I {}
    2.48       *
    2.49 -     * TEST: C c = new C(); c.m() throws AME
    2.50 -     * TODO: add case for K k = new C(); k.m() throws AME
    2.51 +     * TEST: C c = new C(); c.m() throws ICCE
    2.52 +     * TODO: add case for K k = new C(); k.m() throws ICCE
    2.53       */
    2.54      public void testSuperConflict() {
    2.55          // debugTest();
    2.56 @@ -571,7 +571,7 @@
    2.57          I.addCompilationDependency(Jstub.findMethod(stdMethodName));
    2.58          Class C = new Class("C", I);
    2.59  
    2.60 -        assertThrows(AbstractMethodError.class, C);
    2.61 +        assertThrows(IncompatibleClassChangeError.class, C);
    2.62      }
    2.63  
    2.64      /**
    2.65 @@ -579,8 +579,8 @@
    2.66       * interface J extends I { default int m() { return 55; } }
    2.67       * class C implements I, J { public int m() { return I.super.m(); } }
    2.68       *
    2.69 -     * TEST: C c = new C(); c.m() throws AME
    2.70 -     * TODO: add case for J j = new C(); j.m() throws AME
    2.71 +     * TEST: C c = new C(); c.m() == 99
    2.72 +     * TODO: add case for J j = new C(); j.m() == ???
    2.73       */
    2.74      public void testSuperDisqual() {
    2.75          Interface I = new Interface("I", DefaultMethod.std("99"));
    2.76 @@ -590,7 +590,7 @@
    2.77                  AccessFlag.PUBLIC));
    2.78          C.addCompilationDependency(I.findMethod(stdMethodName));
    2.79  
    2.80 -        assertThrows(AbstractMethodError.class, C);
    2.81 +        assertInvokeVirtualEquals(99, C);
    2.82      }
    2.83  
    2.84      /**
    2.85 @@ -646,7 +646,7 @@
    2.86       *     public int m(String s) { return I.super.m(s); }
    2.87       * }
    2.88       *
    2.89 -     * TEST: C c = new C(); c.m("string") throws AME
    2.90 +     * TEST: C c = new C(); c.m("string") == 44
    2.91       */
    2.92      public void testSuperGenericDisqual() {
    2.93          MethodParameter t = new MethodParameter("T", "t");
    2.94 @@ -661,7 +661,7 @@
    2.95                  "return I.super.m(s);", AccessFlag.PUBLIC, s));
    2.96          C.addCompilationDependency(I.findMethod(stdMethodName));
    2.97  
    2.98 -        assertThrows(AbstractMethodError.class, C,
    2.99 +        assertInvokeVirtualEquals(44, C,
   2.100              new ConcreteMethod(
   2.101                  "int", stdMethodName, "return -1;", AccessFlag.PUBLIC, s),
   2.102              "-1", "\"string\"");

mercurial