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

Bug 526697

Summary: Strange error in Dagger caused by ExecutableElement.getParameters()
Product: [Eclipse Project] JDT Reporter: Stanislav Spiridonov <stas>
Component: APTAssignee: Generic inbox for the JDT-APT component <jdt-apt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.7.1a   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard: stalebug

Description Stanislav Spiridonov CLA 2017-10-31 15:22:15 EDT
I see the following error in Eclipse log while Dagger code generation 

Caused by: java.lang.IndexOutOfBoundsException: index (-1) must not be negative
	at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1177)
	at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1159)
	at dagger.internal.codegen.Formatter.formatArgumentInList(Formatter.java:91)
	at dagger.internal.codegen.DependencyRequestFormatter$1.visitVariableAsParameter(DependencyRequestFormatter.java:153)

If you look at Dagger sources you will see the following code

ExecutableElement methodOrConstructor = asExecutable(variable.getEnclosingElement());
List<? extends VariableElement> parameters = methodOrConstructor.getParameters();
int parameterIndex = parameters.indexOf(variable);

Looks like the parameter index is -1 that very strange.

Eclipse is
eclipse.buildId=3.9.1.201710111105-RELEASE-e47
java.version=9
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.springsource.sts.ide
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.springsource.sts.ide
Comment 1 Eclipse Genie CLA 2020-04-30 12:51: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. 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.