Bug 545817 - java.lang.IndexOutOfBoundsException during reconcile on code complete
Summary: java.lang.IndexOutOfBoundsException during reconcile on code complete
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.12   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-26 18:17 EDT by Gunnar Wagenknecht CLA
Modified: 2023-08-16 15:03 EDT (History)
2 users (show)

See Also:


Attachments
sample source which produced the problem (843 bytes, text/plain)
2019-03-26 18:21 EDT, Gunnar Wagenknecht CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2019-03-26 18:17:20 EDT
I have an enum that triggers an IOOBE whenever I try to invoke content assist on it.

java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at org.eclipse.jdt.core.dom.ASTNode$NodeList.get(ASTNode.java:1432)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:443)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:269)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToEnumDeclaration(ASTConverter.java:3274)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2972)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1393)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:367)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:202)
	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:1145)
	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:1322)
	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:92)
	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)
Comment 1 Gunnar Wagenknecht CLA 2019-03-26 18:21:08 EDT
Created attachment 278026 [details]
sample source which produced the problem

This source produced the problem initially. I'm unable to reproduce the exceptions a second time.

However, code completion in the cursor position produces no proposals. Something is off here.
Comment 2 Jay Arthanareeswaran CLA 2019-05-29 02:50:01 EDT
I can't reproduce the exception either. But if I change the code slightly, I see completion being proposed:

LOG_EVENT((byte) 0, (new OtherClassInSamePackage<Str>()).SOME_STRING_CONSTANT_A),

Without the instantiation, statically accessing the class with type argument will result in a compilation error. So, I don't think there need to be any proposal.

Am I missing something?
Comment 3 Eclipse Genie CLA 2021-05-19 18:30:55 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 Kenneth Styrberg CLA 2021-08-24 03:02:46 EDT
Still occurs in Eclipse RCP 2021-06, Windows 10, Java 11, with exact same stack trace as in comment0
Comment 5 Eclipse Genie CLA 2023-08-16 15:03:27 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.