langtools/test/tools/javac/lambda/8071432/T8071432.java
changeset 28891 dc7d89f2e25c
child 29052 d1bc1685d7ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8071432/T8071432.java	Thu Feb 12 10:16:19 2015 +0530
@@ -0,0 +1,50 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8071432
+ * @summary structural most specific and stuckness
+ * @compile/fail/ref=T8071432.out -XDrawDiagnostics T8071432.java
+ */
+
+import java.util.Arrays;
+import java.util.Collection;
+
+class T8071432 {
+
+    static class Point {
+
+        private double x, y;
+
+        public Point(double x, double y) {
+            this.x = x;
+            this.y = y;
+        }
+
+        public double getX() {
+            return x;
+        }
+
+        public double getY() {
+            return y;
+        }
+
+        public double distance(Point p) {
+            return Math.sqrt((this.x - p.x) * (this.x - p.x) +
+                             (this.y - p.y) * (this.y - p.y));
+        }
+
+        public double distance() {
+            return Math.sqrt(this.x * this.x + this.y * this.y);
+        }
+
+        public String toString() {
+            return "(" + x + ":" + y + ")";
+        }
+    }
+
+    public static void main(String[] args) {
+        Collection<Point> c = Arrays.asList(new Point(1.0, 0.1));
+        System.out.println("------- 1 ---------------");
+        System.out.println(c.stream().reduce(0.0,
+                                            (s, p) -> s += p.distance(), (d1, d2) -> 0));
+    }
+}