Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 573589

Summary: Cannot evaluate expression which has lambda statements where there are static imports
Product: [Eclipse Project] JDT Reporter: Gayan Perera <gayanper>
Component: DebugAssignee: Gayan Perera <gayanper>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sarika.sinha
Version: 4.19   
Target Milestone: 4.21 M1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180745
https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/180746
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=9fc7d75b55627a59392f4124bb4fb5df982ac14a
https://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=e058e5a5a1f22f0358b4f46400c69491a993d792
Whiteboard:
Bug Depends on:    
Bug Blocks: 574681    

Description Gayan Perera CLA 2021-05-17 14:33:57 EDT
Take the following code

package app;

import static java.lang.Math.max;

import java.util.stream.Stream;

public class LambdaIssues {

	public static void main(String[] args) {
		max(10, 11);
		Stream.of(1,2,3).filter(i -> i > 2).map(i -> i * 2).toArray();
	}
	
}

Try to debug and evaluate Stream.of(1,2,3).filter(i -> i > 2).map(i -> i * 2).toArray()

The evaluation fails with 

	Evaluation failed. Reason(s):
		[The import java.lang.Math.max cannot be resolved]
		[The import java.lang.Math.max cannot be resolved]
Comment 1 Gayan Perera CLA 2021-05-17 14:34:30 EDT
I will provide a fix for this :)
Comment 2 Eclipse Genie CLA 2021-05-18 14:09:19 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180745
Comment 3 Eclipse Genie CLA 2021-05-18 14:10:31 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/180746
Comment 4 Gayan Perera CLA 2021-05-18 14:11:19 EDT
Added this to 4.21-M1 since this is not a regression in 4.20.
Comment 7 Sarika Sinha CLA 2021-06-29 06:14:55 EDT
Thanks Gayan!
Comment 8 Sarika Sinha CLA 2021-07-06 08:30:05 EDT
I20210704-1800