-
Bug
-
Resolution: Fixed
-
P4
-
7
FULL PRODUCT VERSION :
> java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b135)
Java HotSpot(TM) Client VM (build 21.0-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
> uname -a
Linux riedquat 2.6.22.19-0.4-default #1 SMP 2009-08-14 02:09:16 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
javac -Xlint:all complains about a flush() on an auto-closeable resource in the corresponding try-block.
Additional information about this bug can also be found at:
http://www.riedquat.de/blog/2011-03-30-03
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile sample source:
javac -Xlint:all Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compiles w/o warnings.
ACTUAL -
> javac -Xlint:all Test.java
Test.java:8: warning: [try] explicit call to close() on an auto-closeable resource
out.flush();
^
1 warning
ERROR MESSAGES/STACK TRACES THAT OCCUR :
> javac -Xlint:all Test.java
Test.java:8: warning: [try] explicit call to close() on an auto-closeable resource
out.flush();
^
1 warning
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.io.OutputStream;
public class Test {
public static void main(final String... args) throws IOException {
try (final OutputStream out = System.out;) {
out.write("foo\n".getBytes());
out.flush();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround found.
> java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b135)
Java HotSpot(TM) Client VM (build 21.0-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
> uname -a
Linux riedquat 2.6.22.19-0.4-default #1 SMP 2009-08-14 02:09:16 +0200 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
javac -Xlint:all complains about a flush() on an auto-closeable resource in the corresponding try-block.
Additional information about this bug can also be found at:
http://www.riedquat.de/blog/2011-03-30-03
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile sample source:
javac -Xlint:all Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compiles w/o warnings.
ACTUAL -
> javac -Xlint:all Test.java
Test.java:8: warning: [try] explicit call to close() on an auto-closeable resource
out.flush();
^
1 warning
ERROR MESSAGES/STACK TRACES THAT OCCUR :
> javac -Xlint:all Test.java
Test.java:8: warning: [try] explicit call to close() on an auto-closeable resource
out.flush();
^
1 warning
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.io.OutputStream;
public class Test {
public static void main(final String... args) throws IOException {
try (final OutputStream out = System.out;) {
out.write("foo\n".getBytes());
out.flush();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround found.