You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2005/03/09 09:37:40 UTC

Re: Java 5 - '(String) null'

On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
> antonio@apache.org wrote:
>
>> +        this.addItem(c.getTime(), (String)null);
>
> I guess Java 5 needs this strange casts "(String) null". What's the reason
> for this?

Not only java 5. The build was broken even using 1.4.2. I just did a quick
fix hoping somebody else will note it.

Seems like there are to methods for addItem(c.getTime(), null):

protected void addItem(Object value, String label)
protected void addItem(Object value, XMLizable label)

See:

src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java

Please fix it. ;-)

Best regards,

Antonio Gallardo.


Re: Java 5 - '(String) null'

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Antonio Gallardo wrote:
> See:
> src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java
> 
> In the buld method() there where originally 3 nulls instead of the "fast
> fixed" (String)null.
> 
> Without the casting of the null the compiler in 1.4.2_07 said it was not
> able to decide wich of this 2 methods use:
> 
> protected void addItem(Object value, String label)
> protected void addItem(Object value, XMLizable label)

Yep.


> This is why I casted them to (String). I don't carefully checked the code,
> I just wanted the code to compile and test other things. Since we are near
> to a release I am doing full builds now (Sorry, my fault).
> 
> All in all, Since the class is under the o.a.c.forms.samples package, then
> I don't think it is an important one. Hence I thought will be OK a quick
> fix here.
> 
> If someone know better where is used this code and why, please review the
> fix and change it as the best it can be.

(String) null is the proper fix, so all is ok now.

Vadim

Re: Java 5 - '(String) null'

Posted by Antonio Gallardo <ag...@agssa.net>.
On Mie, 9 de Marzo de 2005, 7:43, Vadim Gritsenko dijo:
> Antonio Gallardo wrote:
>> On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
>>
>>>antonio@apache.org wrote:
>>>
>>>
>>>>+        this.addItem(c.getTime(), (String)null);
>>>
>>>I guess Java 5 needs this strange casts "(String) null". What's the
>>> reason
>>>for this?
>>
>>
>> Not only java 5. The build was broken even using 1.4.2. I just did a
>> quick
>> fix hoping somebody else will note it.
>>
>> Seems like there are to methods for addItem(c.getTime(), null):
>>
>> protected void addItem(Object value, String label)
>> protected void addItem(Object value, XMLizable label)
>>
>> See:
>>
>> src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
>>
>> Please fix it. ;-)
>
> I'm not following you. What should be fixed now?

See:
src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java

In the buld method() there where originally 3 nulls instead of the "fast
fixed" (String)null.

Without the casting of the null the compiler in 1.4.2_07 said it was not
able to decide wich of this 2 methods use:

protected void addItem(Object value, String label)
protected void addItem(Object value, XMLizable label)

This is why I casted them to (String). I don't carefully checked the code,
I just wanted the code to compile and test other things. Since we are near
to a release I am doing full builds now (Sorry, my fault).

All in all, Since the class is under the o.a.c.forms.samples package, then
I don't think it is an important one. Hence I thought will be OK a quick
fix here.

If someone know better where is used this code and why, please review the
fix and change it as the best it can be.

Best Regards,

Antonio Gallardo.



Re: Java 5 - '(String) null'

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Antonio Gallardo wrote:
> On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
> 
>>antonio@apache.org wrote:
>>
>>
>>>+        this.addItem(c.getTime(), (String)null);
>>
>>I guess Java 5 needs this strange casts "(String) null". What's the reason
>>for this?
> 
> 
> Not only java 5. The build was broken even using 1.4.2. I just did a quick
> fix hoping somebody else will note it.
> 
> Seems like there are to methods for addItem(c.getTime(), null):
> 
> protected void addItem(Object value, String label)
> protected void addItem(Object value, XMLizable label)
> 
> See:
> 
> src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
> 
> Please fix it. ;-)

I'm not following you. What should be fixed now?

Vadim