commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <>
Subject Re: [io] 2.0 Moving to minimum of JDK 1.5
Date Thu, 07 Feb 2008 08:10:31 GMT
Niall Pemberton wrote:
>>> [Note CharSequence replaces String and/or StringBuffer flavours]
> OK for the above I added new methods, rather than changing the method
> signature - so still compatbile atm:

Although, the API is now bigger. If we decide to break binary 
compatibility later, we need to remember to delete duplicates like this.

>> All the other changes are binary compatible. Except for the problem that
>> the bytecode format for Java 5 is different as well, so you'd need
>> retrotranslator to help you out as well.
> Anything that depends on a JDK 1.5 IO version will have to also be
> minimum JDK 1.5  and therefore direct or indirect users must be
> running on JDK 1.5 - so I don't see any need for retrotranslator or
> issues for users. Have I missed something?

Hmm, yes we should be OK.

>> In addition to the changes above, you will probably want to change most
>> APIs that take in a Collection to take an Iterable instead.
> OK I just had a quick scan and it looks we have the following methods
> where we could do this:
>     FilenameUtils.isExtension()
>     FileUtils.convertFileCollectionToFileArray()
>     FileUtils.writeLines()
>     IOUtils.writeLines()
> but this could also be done by just adding new flavours with an
> Iterable, rather than changing the existing methods.

Agreed, additional method can be added. Its certainly not as neat as 
just one method, and deprecation won't help (as any code linking to [io] 
will always pick the method taking a Collection, until the method is 
removed - hence removing the deprecation will never really be possible).

>> We should probably remove all references to arrays in the public API, as
>> generics and arrays work badly together, and I would strongly recommend
>> treating arrays as a type not to be exposed on any public API post-Java5.
> Perhaps you could expand more on this because I don't see a big issue
> for IO. - are you thinking along the following lines:

Kind of. Arrays and Generics do not work well together. One example is 
passing a generified list to a vararge method:
  public void process(List<String>... values)
This will always generate a warning, as the list gets converted to an array.

In general, arrays work poorly with generics, to the point that you 
can't avoid the warnings. My recommendation would be to replace arrays 
in the API with Collection/Iterable/List as appropriate. Existing API 
users can easily adapt, and they will thank us for the lack of warnings.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message