Community
Participate
Working Groups
I20070501-0010 * Using the following source * Debug to a breakpoint in deal() * evaluate "deck.subList(deckSize-n, deckSize)" > error: Evaluations must contain either an expression or a block of well formed statements public class Deal { public static void main(String args[]) { int numHands = Integer.parseInt(args[0]); int cardsPerHand = Integer.parseInt(args[1]); List<Card> deck = Card.newDeck(); Collections.shuffle(deck); 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; } } and import java.util.*; public class Card { public enum Rank { DEUCE, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE } public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES } private final Rank rank; private final Suit suit; private Card(Rank rank, Suit suit) { this.rank = rank; this.suit = suit; } public Rank rank() { return rank; } public Suit suit() { return suit; } public String toString() { return rank + " of " + suit; } private static final List<Card> protoDeck = new ArrayList<Card>(); // Initialize prototype deck static { for (Suit suit : Suit.values()) for (Rank rank : Rank.values()) protoDeck.add(new Card(rank, suit)); } public static ArrayList<Card> newDeck() { return new ArrayList<Card>(protoDeck); // Return copy of prototype deck } }
unable to reproduce on Windows or Mac
Re-opening. Found a case where this dose not work.
In the following example, set a breakpoint on last sysout. Try to eval "list.get(0)" > error. We should only be adding type parameters for wild card types, not parameterized types like <Integer>. public class Eval { public static void main(String[] args) { ArrayList<Integer> list = new ArrayList<Integer>(); list.add(1024); int x = 1; for (int j = 0; j <= 10; j++) { list.add(x); x *= 2; } for (int i : list) { System.out.print(i + "\t"); } System.out.println(); boolean b = list.get(0) != list.get(list.size() - 1); // Breakpoint the next line: copy the right side of // the previous line (list.get(0) ... ) into the Display // view and evaluate it System.out.println("Test says " + b); // Display tab evaluation yields false; value of b is true } }
Created attachment 65770 [details] patch
Created attachment 65783 [details] improved patch Accounts for types like <T extends Comparable<T>>.
*** Bug 176648 has been marked as a duplicate of this bug. ***
*** Bug 156370 has been marked as a duplicate of this bug. ***
Released to HEAD.
Please verify, Curtis.
Verified
Changing OS from Mac OS to Mac OS X as per bug 185991
I'm using eclipse 3.5.1 for 64bit computers and the fix does not work
(In reply to comment #12) > I'm using eclipse 3.5.1 for 64bit computers and the fix does not work Please open a new bug with steps to reproduce.
(In reply to comment #13) > (In reply to comment #12) > > I'm using eclipse 3.5.1 for 64bit computers and the fix does not work > > Please open a new bug with steps to reproduce. I found that this bug for 64bit eclipse's version is not fixed yet, too. Eclipse Platform Version: 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY Build id: I20100608-0911 Windows 7 Enterprise 64-bit Actually, its difficult to reproduce - some time its working correctly, some time even expressions like 1+1 not evaluated! Maybe you should fix it by not searching reproducing steps, but another way... its found from 2007 year and not yet fixed for today!...