review request 8006139, add missing methods to javax.sql.rowset.serial.SQLInput/OutputImpl

Ulf Zibis Ulf.Zibis at CoSoCo.de
Sun Jan 13 13:26:17 UTC 2013


Am 13.01.2013 13:33, schrieb Remi Forax:
>>> Additionally I'm wondering, whether getNextAttribute() could be generified.
>> Yes it probably could however I do no want to do this as part of this change
>
> I disagree, it should not be generified, getNextAttribute() should return Object and be casted at 
> callsite,
> it will more clear if a ClassCastException occurs.
> Relying on inference to ask the compiler to insert the cast is dubious,

I must admit, I do not understand.

What would be wrong with that? :
  xxx     private <T> T readNext() throws SQLException {
  xxx         T attrib = (T)getNextAttribute();
  xxx         lastValueWasNull = attrib == null;
  xxx         return attrib;
  xxx     }

  811     public String readNString() throws SQLException {
  812         return readNext();
  813     }

... so why not generifying getNextAttribute() directly?

-Ulf




More information about the core-libs-dev mailing list