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

Bug 553601

Summary: Compile without errors invalid source code
Product: [Eclipse Project] JDT Reporter: Oleksandr Pedin <alt>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: karbi79, stephan.herrmann
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/367
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481133
Whiteboard: stalebug

Description Oleksandr Pedin CLA 2019-11-28 18:01:37 EST
Eclipse IDE for Enterprise Java Developers
2019-09 (4.13)

This invalid source code does not have markers about compile errors.
When it run then NullPointerException in row with call "supplier.get()".
Number of end parentheses does not matter.


package test;

import java.util.function.Supplier;

public class TestOptional3 {

	public static void main(String[] args) throws Exception {
		supplier.get();  // !!!!!!!!! NullPointerException
	}
	
	public static Supplier<Object> supplier = () -> {
		try {
			Optional.ofNullable(null)
					.orElseThrow(() -> new Exception()))))))))))))))))))))))))))))))))))))))))))))));
					//                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		} catch (Exception ex) { }
		
		return "test";
	};
}
Comment 1 Stephan Herrmann CLA 2019-12-03 14:49:45 EST
Somehow, when we detect the syntax error, we run the resume loop of syntax recovery -- eating one ')' during each iteration -- without ever reporting the error.

I stepped through this business but could not see an immediate reason, how the lambda could trigger such behavior, despite all the magic and voodoo that is necessary to parse lambdas.
Comment 2 Eclipse Genie CLA 2021-11-23 09:50:34 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Stephan Herrmann CLA 2022-09-22 13:23:05 EDT
Newly reported here https://github.com/eclipse-jdt/eclipse.jdt.core/issues/367
Comment 4 Srikanth Sankaran CLA 2023-06-01 05:28:22 EDT
*** Bug 536843 has been marked as a duplicate of this bug. ***