1.1 --- a/test/tools/javac/lambda/MostSpecific04.java Fri Aug 30 17:36:47 2013 -0700 1.2 +++ b/test/tools/javac/lambda/MostSpecific04.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,17 +26,10 @@ 1.11 * @bug 8003280 1.12 * @summary Add lambda tests 1.13 * Structural most specific doesn't handle cases with wildcards in functional interfaces 1.14 + * @compile/fail/ref=MostSpecific04.out -XDrawDiagnostics MostSpecific04.java 1.15 */ 1.16 public class MostSpecific04 { 1.17 1.18 - static int assertionCount = 0; 1.19 - 1.20 - static void assertTrue(boolean cond) { 1.21 - assertionCount++; 1.22 - if (!cond) 1.23 - throw new AssertionError(); 1.24 - } 1.25 - 1.26 interface DoubleMapper<T> { 1.27 double map(T t); 1.28 } 1.29 @@ -46,13 +39,13 @@ 1.30 } 1.31 1.32 static class MyList<E> { 1.33 - void map(DoubleMapper<? super E> m) { assertTrue(false); } 1.34 - void map(LongMapper<? super E> m) { assertTrue(true); } 1.35 + void map(DoubleMapper<? super E> m) { } 1.36 + void map(LongMapper<? super E> m) { } 1.37 } 1.38 1.39 public static void main(String[] args) { 1.40 MyList<String> ls = new MyList<String>(); 1.41 - ls.map(e->e.length()); 1.42 - assertTrue(assertionCount == 1); 1.43 + ls.map(e->e.length()); //ambiguous - implicit 1.44 + ls.map((String e)->e.length()); //ok 1.45 } 1.46 }