TargetType68.java revision 2868:816bd88d33a8
1/*
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24/*
25 * @test
26 * @bug 8010303 8062373
27 * @summary Graph inference: missing incorporation step causes spurious inference error
28 * @compile/fail/ref=TargetType68.out -XDrawDiagnostics TargetType68.java
29 */
30import java.util.*;
31
32class TargetType68 {
33
34    //derived from FX 2.2 API
35    static class XYChart<X,Y> {
36        static final class Series<X,Y> {
37            Series(java.lang.String name, ObservableList<XYChart.Data<X,Y>> data) { }
38        }
39
40        static final class Data<X,Y> { }
41
42        ObservableList<XYChart.Series<X,Y>> getData() { return null; }
43    }
44
45    //derived from FX 2.2 API
46    interface ObservableList<X> extends List<X> {
47        boolean setAll(Collection<? extends X> col);
48    }
49
50    //derived from FX 2.2 API
51    static class FXCollections {
52        static <E> ObservableList<E> observableList(List<E> l) { return null; }
53    }
54
55    private void testMethod() {
56            XYChart<Number, Number> numberChart = null;
57            List<XYChart.Data<Number, Number>> data_1 = new ArrayList<>();
58            List<XYChart.Data<Number, Number>> data_2 = new ArrayList<>();
59            numberChart.getData().setAll(
60                    Arrays.asList(new XYChart.Series<>("Data", FXCollections.observableList(data_1)),
61                    new XYChart.Series<>("Data", FXCollections.observableList(data_2)) {}));
62    }
63}
64