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

Bug 514547

Summary: Syntax error within Java 8 lambda crashes JDT parser
Product: [Eclipse Project] JDT Reporter: Dennis Wagelaar <dwagelaar>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug
Attachments:
Description Flags
Eclipse configuration details
none
Eclipse Error Log none

Description Dennis Wagelaar CLA 2017-03-31 10:01:40 EDT
Syntax error within Java 8 lambda crashes JDT parser instead of providing error markers in the editor.

What steps will reproduce the problem?
1. Create a Java project containing the code below
2. Build the project


-- Error Details --
Date: Fri Mar 31 15:54:01 CEST 2017
Message: Exception occurred during problem detection:
----------------------------------- SOURCE BEGIN -------------------------------------
/*
 * (C) 2017 HealthConnect NV. All rights reserved.
 */
package be.healthconnect.test;

import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

/**
 * Java 8 compile error test class.
 * 
 * @author <a href="mailto:dennis.wagelaar@healthconnect.be">Dennis Wagelaar</a>
 */
public class CompileErrorTest {

	public void test() {
		new CompletableFuture<>().handle((Object result, Throwable exception) -> {
			return Collections.singletonList("test").stream().collect(Collectors.toList(str -> str.hashCode()));
		});
	}

}

----------------------------------- SOURCE END -------------------------------------
Severity: Error
Product: Eclipse 4.6.2.20161208-0625 (org.eclipse.epp.package.jee.product)
Plugin: org.eclipse.jdt.core
Session Data:
eclipse.buildId=4.6.2.M20161124-1400
java.version=1.8.0_121
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=nl_BE
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

This is a continuation of log file C:\Users\dwage\workspace-cc\.metadata\.bak_0.log
Created Time: 2017-03-31 15:54:01.183

Exception Stack Trace:
java.lang.ArrayIndexOutOfBoundsException
Comment 1 Dennis Wagelaar CLA 2017-03-31 10:03:34 EDT
Created attachment 267575 [details]
Eclipse configuration details
Comment 2 Dennis Wagelaar CLA 2017-03-31 10:05:00 EDT
Java Model Exception: java.lang.ArrayIndexOutOfBoundsException
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:249)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:271)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:191)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:90)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:724)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:790)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1250)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:128)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:110)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:90)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:154)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:89)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:104)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:73)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:207)
Caused by: java.lang.ArrayIndexOutOfBoundsException
Caused by: java.lang.ArrayIndexOutOfBoundsException
Comment 3 Dennis Wagelaar CLA 2017-03-31 10:06:37 EDT
Created attachment 267576 [details]
Eclipse Error Log
Comment 4 Jay Arthanareeswaran CLA 2017-04-03 01:32:23 EDT
I don't see the problem on master. 

Interestingly, I see the eclipse build as 4.6.2, but I don't see the line numbers matching in the repo with the stack trace.

Anyway, Denis, can you give one of our more recent builds a try? Either the latest I build or M build from here:

http://download.eclipse.org/eclipse/downloads/
Comment 5 Dennis Wagelaar CLA 2017-04-04 03:39:15 EDT
The bug does not occur on Eclipse Oxygen M7.
Comment 6 Eclipse Genie CLA 2020-04-06 04:05:32 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.