Review request for java.text.** warning cleanup (original) (raw)
John Rose john.r.rose at oracle.com
Fri Dec 2 14:19:48 PST 2011
- Previous message: Review request for java.text.** warning cleanup
- Next message: Review request for java.text.** warning cleanup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Dec 2, 2011, at 11:20 AM, Rémi Forax wrote:
It seems you still use clone, you can't replace a call to clone with a call to a copy constructor because if Stack is subclassed, clone will work but not the copy constructor.
That's true in general, but this is private code with locally created Stack instances.
../../../src/share/classes/java/text/AttributedString.java:420: error: incompatible types Vector newRunAttributes[] = new Vector<?>[ARRAYSIZEINCREMENT]; ^ required: Vector[] found: Vector<?>[] Yes, you need to add a cast, Vector[] newRunAttributes = (Vector[])new Vector<?>[ARRAYSIZEINCREMENT];
Yes. As far as I can see, that's the "best practices" way to deal with array-of-generic.
but if Java is reified in 1.9 as state the current plan, we will be in trouble.
If the best practices have to change, then we'll have to change that code again. Or maybe the retrofit strategy will have to take account of the existing code idioms. In any case, we'll cross that bridge when we get to it. (Coping with reification in this case is a decision to make tomorrow, not today.)
-- John
- Previous message: Review request for java.text.** warning cleanup
- Next message: Review request for java.text.** warning cleanup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]