Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356070 - [patch] Step into selection does not work for generic types
Summary: [patch] Step into selection does not work for generic types
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.8   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-29 09:03 EDT by Rob van der Leek CLA
Modified: 2012-07-04 17:13 EDT (History)
2 users (show)

See Also:


Attachments
Stripping the parameter information (2.78 KB, patch)
2012-05-27 17:14 EDT, Samrat Dhillon CLA
no flags Details | Diff
updated patch (13.38 KB, patch)
2012-07-04 17:11 EDT, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.