Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 439707 - [1.8][compiler] Lambda can be passed illegally to invisible method argument
Summary: [1.8][compiler] Lambda can be passed illegally to invisible method argument
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: 4.5 M1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-16 08:49 EDT by Lukas Eder CLA
Modified: 2015-05-24 08:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2014-07-16 08:49:02 EDT
Take the following programme:

------------------------------
public class T1 {
    public static void main(String[] args) {
        T2.run(() -> {});
    }
}

public class T2 {

    public static void run(InvisibleInterface i) {
    }

    private interface InvisibleInterface {
        void run();
    }
}
------------------------------

T1 should not compile, and indeed it doesn't with javac:

------------------------------
C:\Users\Lukas\workspace\jOOQ\jOOQ-test\src\main\resources>javac T1.java T2.java
T1.java:45: error: InvisibleInterface has private access in T2
        T2.run(() -> {});
               ^
1 error
------------------------------

Intuitively, this shouldn't compile as there is no way T1 can call T2.run() prior to Java 8
Comment 1 Srikanth Sankaran CLA 2014-07-17 01:18:00 EDT
I'll take this one. Thanks Lukas.
Comment 3 Srikanth Sankaran CLA 2014-07-17 02:28:55 EDT
Resolving.
Comment 4 Lukas Eder CLA 2014-07-17 02:31:26 EDT
Thanks for the quick fix!
Comment 5 Jay Arthanareeswaran CLA 2014-07-31 03:40:01 EDT
Srikanth, a 4.4.1 candidate perhaps?
Comment 6 Sasikanth Bharadwaj CLA 2014-08-06 00:06:32 EDT
Verified for 4.5 M1 using I20140804-2000 build
Comment 7 Jay Arthanareeswaran CLA 2014-08-06 00:09:16 EDT
(In reply to Jayaprakash Arthanareeswaran from comment #5)
> Srikanth, a 4.4.1 candidate perhaps?

Srikanth, I suppose this is not serious enough to be back ported 4.4.1, isn't it?
Comment 8 Srikanth Sankaran CLA 2014-08-06 00:51:40 EDT
(In reply to Jayaprakash Arthanareeswaran from comment #7)
> (In reply to Jayaprakash Arthanareeswaran from comment #5)
> > Srikanth, a 4.4.1 candidate perhaps?
> 
> Srikanth, I suppose this is not serious enough to be back ported 4.4.1,
> isn't it?

Yes, this is not  case of correct program failing. So we can skip for 4.4.1
Comment 9 Lukas Eder CLA 2014-08-06 03:20:54 EDT
> Srikanth, I suppose this is not serious enough to be back ported 4.4.1, isn't it?

I'd agree. It's a rather minor issue. Few people will probably run into this, as few people reduce visibility from public on interfaces
Comment 10 Stephan Herrmann CLA 2015-05-24 08:25:16 EDT
The fix here causes bug 468122. It would be great if we had a JLS reference here, to determine how the fix must be changed. (I do have a guess, but I don't like to base compiler implementation on guess-work).