You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (JIRA)" <ji...@apache.org> on 2019/08/18 10:29:00 UTC

[jira] [Commented] (IO-623) IOUtils.lineIterator updating incompatible issue

    [ https://issues.apache.org/jira/browse/IO-623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16909932#comment-16909932 ] 

Bruno P. Kinoshita commented on IO-623:
---------------------------------------

I am not sure if that's a backward incompatibility.

The issue is that the second argument getting a `null` could be for the method `IOUtils.lineIterator(Reader, String)` that was available in 2.1.

Or it could be for the method `IOUtils.lineIterator(Reader, Charset)`. The JVM has no way to tell which of these two methods you are invoking.

As far as I remember, adding methods is fine, regarding binary backward compatibility. But I am not sure if there is any rule regarding overloaded methods.

But in case you just need a quick fix, that would be to cast your null to either (String) null, or (Charset) null.

Bruno

> IOUtils.lineIterator updating incompatible issue
> ------------------------------------------------
>
>                 Key: IO-623
>                 URL: https://issues.apache.org/jira/browse/IO-623
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.6
>            Reporter: xia0c
>            Priority: Major
>              Labels: performance
>
> Hi,
> The following code snippets throw an incompatible issue when I try to rolling update Commons-io from 2.1 to 2.6.
> {code:java}
> // Some comments here
> @Test
> public void Test() throws IOException{
> 	LineIterator iter = IOUtils.lineIterator (getClass ().getResourceAsStream ("/tmp/test.txt"), null);
> }
> {code}
> It throws an error:
> {code:java}
> reference to lineIterator is ambiguous
> [ERROR] both method lineIterator(java.io.InputStream,java.nio.charset.Charset) in org.apache.commons.io.IOUtils and method lineIterator(java.io.InputStream,java.lang.String) in org.apache.commons.io.IOUtils match
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)