Community
Participate
Working Groups
Using: Eclipse: Mars Release (4.5.0), Build id: 20150621-1200 Java: JDK 1.8.0_60 Eclipse produces context visibility errors on the following code. The same code compiles and runs in 4.4.2: // ----------/test/subpackage/A.java package test.subpackage; interface A<I> { String invoke(I input); } // ----------/test/subpackage/B.java package test.subpackage; public interface B extends A<Integer> {} // ----------/test/BugDemonstrator.java package test; import test.subpackage.B; public class BugDemonstrator { public static void main(String[] args) { // OK invoke(new B() { public String invoke(Integer input) { return null; } }); // ERROR invoke((Integer i) -> { // Error is here: The type A<Object,Integer> from the descriptor computed for the target context is not visible here. return null; }); } private static String invoke(B b) { return b.invoke(1); } }
FunctionalExpression.kosherDescriptor checks for the visibility of sam.declaringclass, but according to the spec, It is a compile-time error if any class or interface mentioned by either U or the function type of U is not accessible from the class or interface in which the lambda expression appears. So the check should probably be for the visibility of expected type and not declaring class
New Gerrit change created: https://git.eclipse.org/r/58554
(In reply to comment #2) > New Gerrit change created: https://git.eclipse.org/r/58554 That change was based on wrong branch resulting in test failures and hence abandoned. Will create another one shortly
New Gerrit change created: https://git.eclipse.org/r/58570
Gerrit change https://git.eclipse.org/r/58570 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=9fd78e48eab6bcdf5d18fc102f8f6374923c9c96
Released for M4
Verified for Eclipse Neon Version: Neon 4.6M4 Build id: I20151207-0800
*** Bug 468122 has been marked as a duplicate of this bug. ***