You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Ja...@rzf.fin-nrw.de on 2005/03/14 08:13:59 UTC

AW: cvs commit: ant/src/main/org/apache/tools/ant AntClassLoader. java

>   Removed superfluous cast
>   
>   Revision  Changes    Path
>   1.91      +1 -1      
> ant/src/main/org/apache/tools/ant/AntClassLoader.java
>   
>   Index: AntClassLoader.java
>                if (cons.length > 0 && cons[0] != null) {
>                    final String[] strs = new String[NUMBER_OF_STRINGS];
>                    try {
>   -                    cons[0].newInstance((Object[])strs);
>   +                    cons[0].newInstance(strs);
>                        // Expecting an exception to be thrown by this
call:
>                        // IllegalArgumentException: wrong number of
Arguments
>                    } catch (Exception e) {


Mmh - but why it´s introduces just before?
Revision 1.91 "Removed superfluous cast" by jkf 
Revision 1.90 "deal with javac1.5 whinings" by stevel 

Log messages
http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/AntClass
Loader.java?rev=1.91&view=log

only cast added in 1.90
http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/AntClass
Loader.java?r1=1.89&r2=1.90&diff_format=h



Jan

Re: AW: cvs commit: ant/src/main/org/apache/tools/ant AntClassLoader. java

Posted by Steve Loughran <st...@apache.org>.
Jan.Materne@rzf.fin-nrw.de wrote:
>>  Removed superfluous cast
>>  
>>  Revision  Changes    Path
>>  1.91      +1 -1      
>>ant/src/main/org/apache/tools/ant/AntClassLoader.java
>>  
>>  Index: AntClassLoader.java
>>               if (cons.length > 0 && cons[0] != null) {
>>                   final String[] strs = new String[NUMBER_OF_STRINGS];
>>                   try {
>>  -                    cons[0].newInstance((Object[])strs);
>>  +                    cons[0].newInstance(strs);


This is not superfluous on Java1.5, as things need to be of type 
Object[]. If you call newInstance(String[]), then you may be calling 
new(String[]) on the class, not new(String, String, ...).

I should have put a comment above the line to emphasise this.

-steve

(who doesnt know whether the 1.5 changes are wondrous or evil)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org