Bug 423122 - [1.8] Missing incremental build dependency from lambda expression to functional interface
Summary: [1.8] Missing incremental build dependency from lambda expression to function...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-03 20:15 EST by Markus Keller CLA
Modified: 2013-12-17 12:15 EST (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 Markus Keller CLA 2013-12-03 20:15:14 EST
The incremental build misses a dependency from a lambda expression to its functional interface: When the signature of the interface method is changed, the Lambda expression must be recompiled, even if there's no explicit reference in source code.

package test1;
public interface I {
    int method(int a); // change argument type to Object
}

package test1;
public class E {
    void take(I i) {
    }
}

package test1;
public class Ref {
    void foo(E e) {
        e.take((x) -> x+2); // not recompiled when I#method signature changed
    }
}
Comment 1 Srikanth Sankaran CLA 2013-12-03 20:21:03 EST
Good one, thanks. 

Do you remember there was some bug fix/feature that was using build dependencies
to solve a search problem ? Can you point me to that ? I am wondering if we can
kill two birds with one stone: i.e https://bugs.eclipse.org/bugs/show_bug.cgi?id=400905

(that one may have a much simpler fix though - we just to have to trigger resolve
if we see a lambda during indexing and get additional entries)
Comment 2 Markus Keller CLA 2013-12-03 20:31:20 EST
(In reply to Srikanth Sankaran from comment #1)
Bug 102279 comment 7 ff. were about using build dependencies to improve search performance. (Found this through your reference to bug 400905, which I also didn't remember any more.)
Comment 3 Markus Keller CLA 2013-12-17 06:25:08 EST
Currently, Ref.java is correctly recompiled when I change the type to Object and save I.java. But when I change it back to int and save again, then the error on Ref.java stays in the Problems view.
Comment 4 Srikanth Sankaran CLA 2013-12-17 08:57:43 EST
Thanks, Fix and tests released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=f4fa1b5b78e764cbc99a897dc3a1af35ead150e3
Comment 5 Markus Keller CLA 2013-12-17 09:44:52 EST
(In reply to Srikanth Sankaran from comment #4)
This commit included incomplete changes in codeassist that caused compile errors.

They don't seem to be related to this fix, so I reverted them: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=30eb2ef8deb6c1a80cc8122027f34a4da5360729
Comment 6 Srikanth Sankaran CLA 2013-12-17 12:15:01 EST
(In reply to Markus Keller from comment #5)
> (In reply to Srikanth Sankaran from comment #4)
> This commit included incomplete changes in codeassist that caused compile
> errors.

Thanks for reverting them. I noticed it just as I was sipping a beer in a close
by joint with no wireless access :)