Bug 94903 - Error setting method breakpoint in 1.5 project
Summary: Error setting method breakpoint in 1.5 project
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-12 04:04 EDT by Christof Marti CLA
Modified: 2005-05-27 07:45 EDT (History)
1 user (show)

See Also:


Attachments
Screen shot of variables view (14.70 KB, image/png)
2005-05-12 14:40 EDT, Darin Wright CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christof Marti CLA 2005-05-12 04:04:04 EDT
I20050509-2010

When setting a method breakpoint in a 1.5 project an error dialog with "Source method signature could 
not be resolved" shows up. No stacktrace is available.
Comment 1 Darin Wright CLA 2005-05-12 14:37:15 EDT
Not a regression. The problem occurrs when adding a method entry breakpoint to 
a method that has an argument with a generic signature. For example attempt to 
add a method entry breakpoint to the method deal in the following class. We 
ask the Java model to resolve the type "List<Card>" in "Deal", and get a null 
result. Since we cannot resolve the method signature, we bail on creating the 
breakpoint.


import java.util.*;

public class Deal {
    public static void main(String args[]) {
        int numHands = Integer.parseInt(args[0]);
        Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("one", 2);
		List<String> list = new ArrayList<String>(5);
		list.add("one");
		list.add("two");
        int cardsPerHand = Integer.parseInt(args[0]);
        List<Card> deck  = Card.newDeck();
        Collections.shuffle(deck);
        Card.Suit.CLUBS.junk();
        for (int i=0; i < numHands; i++)
            System.out.println(deal(deck, cardsPerHand));
    }

    public static ArrayList<Card> deal(List<Card> deck, int n) {
         int deckSize = deck.size();
         List<Card> handView = deck.subList(deckSize-n, deckSize);
         ArrayList<Card> hand = new ArrayList<Card>(handView);
         handView.clear();
         return hand;
     }
}

Moving to JCORE for investigation.
Comment 2 Darin Wright CLA 2005-05-12 14:40:12 EDT
Created attachment 21060 [details]
Screen shot of variables view

This is the varibles view showing the values used to call the
IType.resolveType(...) method. Our code at this point looks like this. Note
that we get null for "resolvedElementTypeNames".

String elementTypeName = Signature.toString(elementTypeSignature);
String[][] resolvedElementTypeNames = type.resolveType(elementTypeName);
if (resolvedElementTypeNames == null || resolvedElementTypeNames.length != 1) {

    // the type name cannot be resolved
    return null;
}
Comment 3 Philipe Mulet CLA 2005-05-12 14:42:11 EDT
Looks like this API should work just fine, and answer a resolved element.
Comment 4 Darin Wright CLA 2005-05-13 14:08:45 EDT
*** Bug 94212 has been marked as a duplicate of this bug. ***
Comment 5 Jerome Lanneluc CLA 2005-05-23 05:52:28 EDT
Changed SelectionEngine#selectType(...) to take the erasure of the given type name.
Added regression test TypeResolvedTests#testResolveParameterizedType().
Comment 6 David Audel CLA 2005-05-27 07:45:57 EDT
Verified in i20050527-0010