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

Remi Forax forax at univ-mlv.fr
Sun Jan 13 15:11:10 UTC 2013


On 01/13/2013 02:26 PM, Ulf Zibis wrote:
> 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?

because it's unclear in readNString() that you can have a 
ClassCastException,
there is no cast in readNString.

>
> -Ulf
>

Rémi




More information about the core-libs-dev mailing list