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

Bug 356070

Summary: [patch] Step into selection does not work for generic types
Product: [Eclipse Project] JDT Reporter: Rob van der Leek <robvanderleek>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, samrat.dhillon
Version: 3.8   
Target Milestone: 4.3 M1   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Stripping the parameter information
none
updated patch none

Description Rob van der Leek CLA 2011-08-29 09:03:04 EDT
Build Identifier: 20100917-0705

For generic types (e.g. Foo<T>) the "step into selection" functionality of the Java debugger does not work.

Reproducible: Always

Steps to Reproduce:
1. Example code:
public class Foo<T> {
    private void sayHello() {
        System.out.println("Hello!");
    }

    public static void main(String[] args) {
        new Foo<String>().sayHello();
    }
}
2. Place a breakpoint in the main method
3. When the breakpoint hits, put the cursor on the call tio sayHello and choose step into selection from the context menu. The bug is that this does *not* steps into the sayHello method. Note that this functionality works fine for the non-generic case.
Comment 1 Samrat Dhillon CLA 2012-05-27 17:14:02 EDT
Created attachment 216339 [details]
Stripping the parameter information

Stripping the parameter information for a generic class during comparison
Comment 2 Samrat Dhillon CLA 2012-05-27 17:17:22 EDT
Submitting a patch with a relatively simple fix. Basically ignoring the parametrized information for a class name( as it is type erasure). Let me know if this is the right place to fix this, otherwise I will try to find another fix. I think this bug is applicable to all platforms.
Comment 3 Michael Rennie CLA 2012-06-05 10:49:34 EDT
Thanks for the patch Samrat, I will look at it once 4.3 starts
Comment 4 Michael Rennie CLA 2012-07-04 17:11:42 EDT
Created attachment 218303 [details]
updated patch

I updated the original patch with the following:

1. added some regression tests
2. We did not need the extra checks for the end '>', once we take off the sub-type names the only remaining parts of the type name are name + erasure so we can simply take the substring up to the '<' (if one exists).
3. Also we shouldn't be assigning substring values to the method parameter.