27 May 2004 17:20
Re: [groovy-dev] groovy-465: casting to primitives
On 24 May 2004, at 09:47, bing ran wrote: > http://jira.codehaus.org/browse/GROOVY-465 > > Since the Jira is not notifying observers, I'll post my comment here > for > feedback: > > > Comment by Bing Ran [24/May/04 04:42 AM] Delete [ Permlink ] > > currently the AsmClasGen does nothing when it detects a casting to a > primitive type. > > a quick fix would allow casting to a primitive to be equal to casting > to the > primitive wrapper object, so that: > > d = 1.2 > i1 = (Integer)d > i2 = (int)d > > assert i1 instanceof Integer > assert i2 instanceof Integer > > Incidentally, the code in Groovy-467 would look slightly better: > > > void paintComponent(Graphics g) { > r = this.getBounds() > g.setColor(Color.black) > > // TODO remove the Integer! > g.fillRect(0, 0, (int) r.width, (int) r.height) > g.setColor(Color.white) > g.drawString(text, (float)50, (float)50) > } > > Do you think making (int) == (Integer) acceptable for now? Absolutely. Sounds great to me. James ------- http://radio.weblogs.com/0112098/
RSS Feed