1.1 --- a/test/tools/javac/lambda/TargetType02.java Fri Aug 30 17:36:47 2013 -0700 1.2 +++ b/test/tools/javac/lambda/TargetType02.java Mon Sep 02 22:38:36 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2011, 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 @@ -27,19 +27,11 @@ 1.11 * @summary Add lambda tests 1.12 * check overload resolution and target type inference w.r.t. generic methods 1.13 * @author Maurizio Cimadamore 1.14 - * @run main TargetType02 1.15 + * @compile/fail/ref=TargetType02.out -XDrawDiagnostics TargetType02.java 1.16 */ 1.17 1.18 public class TargetType02 { 1.19 1.20 - static int assertionCount = 0; 1.21 - 1.22 - static void assertTrue(boolean cond) { 1.23 - assertionCount++; 1.24 - if (!cond) 1.25 - throw new AssertionError(); 1.26 - } 1.27 - 1.28 interface S1<X extends Number> { 1.29 X m(Integer x); 1.30 } 1.31 @@ -48,15 +40,16 @@ 1.32 abstract X m(Integer x); 1.33 } 1.34 1.35 - static <Z extends Number> void call(S1<Z> s) { s.m(1); assertTrue(true); } 1.36 - static <Z extends String> void call(S2<Z> s) { s.m(2); assertTrue(false); } 1.37 + static <Z extends Number> void call1(S1<Z> s) { } 1.38 + 1.39 + static <Z extends String> void call2(S2<Z> s) { } 1.40 + 1.41 + static <Z extends Number> void call3(S1<Z> s) { } 1.42 + static <Z extends String> void call3(S2<Z> s) { } 1.43 1.44 void test() { 1.45 - call(i -> { toString(); return i; }); 1.46 - } 1.47 - 1.48 - public static void main(String[] args) { 1.49 - new TargetType02().test(); 1.50 - assertTrue(assertionCount == 1); 1.51 + call1(i -> { toString(); return i; }); 1.52 + call2(i -> { toString(); return i; }); 1.53 + call3(i -> { toString(); return i; }); 1.54 } 1.55 }