Bug 562526

Summary: Exception occurred during compilation unit conversion
Product: [Eclipse Project] JDT Reporter: Pierre-Yves Bigourdan <pyvesdev>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: NEW --- QA Contact: Sarika Sinha <sarika.sinha>
Severity: normal    
Priority: P3 CC: manoj.palat
Version: 4.16Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: Mac OS X   
Whiteboard: stalebug

Description Pierre-Yves Bigourdan CLA 2020-04-27 10:53:41 EDT
I noticed the following error pop up in my error log:

Exception occurred during compilation unit conversion:
----------------------------------- SOURCE BEGIN -------------------------------------

/**
 */
public class Main {
    public Main() {}
    public Map<String, String> subscribe() {
    public Map<String, String> subscribe() {
----------------------------------- SOURCE END -------------------------------------

And the associated stack trace:
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:3105)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:737)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:207)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3223)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1512)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:449)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:200)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:268)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1138)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:173)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1315)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:113)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:94)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210)


The above code is obviously wrong, but I ended up with something along those lines after applying stashed changes that resulted in conflicts. Given that the file I was working on contains confidential code, I've only attached a stripped down version that allows to reproduce the issue (hence why the ">>>>>>> stash" and similar Git conflict texts are missing).

Not sure if there's actually any problem with JDT Core here (apart from the spam in the error log, as two org.eclipse.jdt.ui and one org.eclipse.jdt.core messages appeared repeatedly until I managed to get some of the conflicts resolved), but I thought I would report it anyway in case there's anything interesting to get out of it. One observation is that removing any line from the above snippet, *including the first empty line*, makes the problem go away.

Note that I'm using the latest JDT nightly build from April 26th.
Comment 1 Manoj N Palat CLA 2020-05-14 06:09:03 EDT
I could reproduce this issue - thanks Pierre-Yves for a self contained reproducible code snippet.
@Sarika: Can you please take a look?
Comment 2 Manoj N Palat CLA 2021-01-07 00:10:32 EST
Bulk move out of 4.19 M1
Comment 3 Sarika Sinha CLA 2021-08-19 01:27:56 EDT
Will set the target if someone takes this up.
Comment 4 Eclipse Genie CLA 2023-08-13 07:39:11 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.