1.1 --- a/test/tools/javac/lambda/MethodReference41.java Fri Aug 30 17:36:47 2013 -0700 1.2 +++ b/test/tools/javac/lambda/MethodReference41.java Mon Sep 02 22:38:36 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -26,18 +26,10 @@ 1.11 * @bug 8003280 1.12 * @summary Add lambda tests 1.13 * check that diamond inference is applied when using raw constructor reference qualifier 1.14 - * @run main MethodReference41 1.15 + * @compile/fail/ref=MethodReference41.out -XDrawDiagnostics MethodReference41.java 1.16 */ 1.17 public class MethodReference41 { 1.18 1.19 - static int assertionCount = 0; 1.20 - 1.21 - static void assertTrue(boolean cond) { 1.22 - assertionCount++; 1.23 - if (!cond) 1.24 - throw new AssertionError(); 1.25 - } 1.26 - 1.27 interface SAM1 { 1.28 void m(String s); 1.29 } 1.30 @@ -54,13 +46,20 @@ 1.31 Foo(X x) { } 1.32 } 1.33 1.34 + static void m1(SAM1 s) { } 1.35 1.36 - static void m(SAM1 s) { assertTrue(false); } 1.37 - static void m(SAM2 s) { assertTrue(true); } 1.38 - static void m(SAM3 s) { assertTrue(false); } 1.39 + static void m2(SAM2 s) { } 1.40 + 1.41 + static void m3(SAM3 s) { } 1.42 + 1.43 + static void m4(SAM1 s) { } 1.44 + static void m4(SAM2 s) { } 1.45 + static void m4(SAM3 s) { } 1.46 1.47 public static void main(String[] args) { 1.48 - m(Foo::new); 1.49 - assertTrue(assertionCount == 1); 1.50 + m1(Foo::new); 1.51 + m2(Foo::new); 1.52 + m3(Foo::new); 1.53 + m4(Foo::new); 1.54 } 1.55 }