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

Bug 572449

Summary: NPE when inspecting scrapbook expression that uses Java 8 features
Product: [Eclipse Project] JDT Reporter: Thorsten Möller <thorstenmoeller>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: loskutov, manoj.palat, sarika.sinha
Version: 4.19   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Thorsten Möller CLA 2021-03-30 05:47:07 EDT
From time to time, I'm using Eclipse's scrapbook pages (*.jpage). Today I tried to inspect the following expression:

return java.time.format.DateTimeFormatter
	.ofPattern("yyyyMMddHHmmss.SSS000")
	.format(java.time.format.DateTimeFormatter.ofPattern("dd.MM.yyyy").parse("30.03.2021", java.time.LocalDateTime::from));


This results in the following error:

Internal compiler error: java.lang.NullPointerException: Cannot read field "parameters" because "this.descriptor" is null at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.analyseCode(ReferenceExpression.java:516)
Comment 1 Thorsten Möller CLA 2021-03-30 06:08:42 EDT
The example actually doesn't work. This one works but causes the same error:

return java.time.format.DateTimeFormatter
	.ofPattern("yyyyMMddHHmmss.SSS000")
	.format(java.time.format.DateTimeFormatter.ofPattern("dd.MM.yyyy HHmmss").parse("30.03.2021 112430", java.time.LocalDateTime::from));
Comment 2 Sarika Sinha CLA 2021-03-30 09:16:25 EDT
@Manoj,
I see that this.descriptor is null in this scenario. If I add a != null check it proceeds and lands up to another NPE:
Exception in thread "Thread-19" java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.FunctionalExpression$1BridgeCollector.<init>(FunctionalExpression.java:331)


Any suggestion ?
Comment 3 Eclipse Genie CLA 2023-05-01 20:22:17 EDT
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 4 Thorsten Möller CLA 2023-05-02 05:49:18 EDT
As of today, using Eclipse 2023-03 (4.27.0), this error still exists. I have just tried the line again and still get the exact same exception:

Internal compiler error: java.lang.NullPointerException: Cannot read field "parameters" because "this.descriptor" is null at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.analyseCode(ReferenceExpression.java:516)
Comment 5 Andrey Loskutov CLA 2023-05-02 05:53:27 EDT
(In reply to Thorsten  Möller from comment #4)
> As of today, using Eclipse 2023-03 (4.27.0), this error still exists. I have
> just tried the line again and still get the exact same exception:
> 
> Internal compiler error: java.lang.NullPointerException: Cannot read field
> "parameters" because "this.descriptor" is null at
> org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.
> analyseCode(ReferenceExpression.java:516)

The project bug tracker moved to github: https://github.com/eclipse-jdt/eclipse.jdt.core/issues

If you are interested in the fix, please report bug there.