Summary: | Error setting method breakpoint in 1.5 project | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Christof Marti <christof_marti> | ||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P2 | CC: | eclipse | ||||
Version: | 3.1 | ||||||
Target Milestone: | 3.1 RC1 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Christof Marti
2005-05-12 04:04:04 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. 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;
}
Looks like this API should work just fine, and answer a resolved element. *** Bug 94212 has been marked as a duplicate of this bug. *** Changed SelectionEngine#selectType(...) to take the erasure of the given type name. Added regression test TypeResolvedTests#testResolveParameterizedType(). Verified in i20050527-0010 |