Cross Reference: ImplicitFinal.java
xref
: /
openjdk7
/
langtools
/
test
/
tools
/
javac
/
TryWithResources
/
ImplicitFinal.java
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
608
N/A
/*
608
N/A
* @test /nodynamiccopyright/
839
N/A
* @bug 6911256 6964740 6965277 7013420
608
N/A
* @author Maurizio Cimadamore
608
N/A
* @summary Test that resource variables are implicitly final
608
N/A
* @
compile
/
fail
/
ref
=ImplicitFinal.out -XDrawDiagnostics
ImplicitFinal.java
608
N/A
*/
608
N/A
608
N/A
import
java
.
io
.
IOException
;
608
N/A
608
N/A
class
ImplicitFinal
implements
AutoCloseable
{
608
N/A
public
static
void
main
(
String
...
args
) {
608
N/A
try
(
ImplicitFinal
r =
new
ImplicitFinal
()) {
608
N/A
r =
null
;
//disallowed
608
N/A
}
catch
(
IOException
ioe
) {
// Not reachable
608
N/A
throw
new
AssertionError
(
"Shouldn't reach here"
,
ioe
);
608
N/A
}
608
N/A
839
N/A
try
(@
SuppressWarnings
(
"unchecked"
)
ImplicitFinal
r1
=
new
ImplicitFinal
()) {
839
N/A
r1
=
null
;
//disallowed
839
N/A
}
catch
(
IOException
ioe
) {
// Not reachable
839
N/A
throw
new
AssertionError
(
"Shouldn't reach here"
,
ioe
);
839
N/A
}
608
N/A
839
N/A
try
(
final
ImplicitFinal
r2
=
new
ImplicitFinal
()) {
839
N/A
r2
=
null
;
//disallowed
839
N/A
}
catch
(
IOException
ioe
) {
// Not reachable
839
N/A
throw
new
AssertionError
(
"Shouldn't reach here"
,
ioe
);
839
N/A
}
608
N/A
839
N/A
try
(
final
@
SuppressWarnings
(
"unchecked"
)
ImplicitFinal
r3
=
new
ImplicitFinal
()) {
839
N/A
r3
=
null
;
//disallowed
839
N/A
}
catch
(
IOException
ioe
) {
// Not reachable
839
N/A
throw
new
AssertionError
(
"Shouldn't reach here"
,
ioe
);
839
N/A
}
839
N/A
}
608
N/A
public
void
close
()
throws
IOException
{
608
N/A
throw
new
IOException
();
608
N/A
}
608
N/A
}