From 365b81989333e76915976206073a34c759386e2d Mon Sep 17 00:00:00 2001 From: Esko Luontola Date: Sun, 10 Jan 2016 20:50:43 +0200 Subject: [PATCH] Test for a bug with pull request #83 --- .../net/orfjackal/retrolambda/test/LambdaTest.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/end-to-end-tests/src/test/java/net/orfjackal/retrolambda/test/LambdaTest.java b/end-to-end-tests/src/test/java/net/orfjackal/retrolambda/test/LambdaTest.java index e1f91d34..0f0f19c9 100644 --- a/end-to-end-tests/src/test/java/net/orfjackal/retrolambda/test/LambdaTest.java +++ b/end-to-end-tests/src/test/java/net/orfjackal/retrolambda/test/LambdaTest.java @@ -1,4 +1,4 @@ -// Copyright © 2013-2015 Esko Luontola +// Copyright © 2013-2016 Esko Luontola // This software is released under the Apache License 2.0. // The license text is at http://www.apache.org/licenses/LICENSE-2.0 @@ -110,13 +110,23 @@ public void lambdas_with_marker_interfaces_due_to_intersection_types() throws Ex } @Test - public void method_references_to_virtual_methods() throws Exception { + public void method_references_to_virtual_methods_on_local_variables() throws Exception { String foo = "foo"; Callable ref = foo::toUpperCase; assertThat(ref.call(), is("FOO")); } + @Test + public void method_references_to_virtual_methods_on_instance_variables() throws Exception { + Callable ref = instanceVarFoo::toUpperCase; + + assertThat(ref.call(), is("FOO")); + } + + @SuppressWarnings("FieldCanBeLocal") + private String instanceVarFoo = "foo"; + @Test public void method_references_to_interface_methods() throws Exception { List foos = Arrays.asList("foo");