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

Bug 367621

Summary: ICodeAssist.codeSelect(int, int) returns incorrect result for inner class varargs (was: "Open Declaration" doesn't work correctly for inner class varargs)
Product: [Eclipse Project] JDT Reporter: Philippe Marschall <philippe.marschall>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: amj87.iitr, daniel_megert, deepakazad
Version: 3.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
sample code to reproduce the issue none

Description Philippe Marschall CLA 2011-12-29 07:48:05 EST
Build Identifier: I20110915-1308

If you have an argument type that is an inner class then "Open Declaration" opens the type declaration, as you would expect. However if it's a vararg array of inner classes then "Open Declaration" does either nothing or takes you to a "normal" class declaration with the same name. Consider the attached Class

String → "Open Declaration" takes you to java.lang.String
String... → "Open Declaration" takes you to java.lang.String

Entry → "Open Declaration" takes you to java.util.Map.Entry<?, ?>
Entry... → "Open Declaration" does nothing

Modifier → "Open Declaration" takes you to java.nio.file.WatchEvent.Modifier (Java 1.7)
Modifier... → "Open Declaration" offers you a choice between java.lang.reflect.Modifier and javax.lang.model.element.Modifier 

Reproducible: Always
Comment 1 Philippe Marschall CLA 2011-12-29 07:49:36 EST
Created attachment 208843 [details]
sample code to reproduce the issue
Comment 2 Deepak Azad CLA 2011-12-30 02:47:54 EST
Essentially org.eclipse.jdt.core.ICodeAssist.codeSelect(int, int) calls in the following 2 methods return the incorrect result

org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(IJavaElement, ITextSelection)
org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(ITextViewer, IRegion, boolean)

Note that the type binding in the AST is correct. Moving to JDT/Core.
Comment 3 Ayushman Jain CLA 2012-01-03 04:25:32 EST
I will take a look.
Comment 4 Dani Megert CLA 2012-01-03 05:58:59 EST
See also bug 291040.
Comment 5 Eclipse Genie CLA 2019-09-09 14:15:29 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.