Implicit declaration of resources in try statement

Jan Lahoda jan.lahoda at oracle.com
Thu Mar 26 13:24:17 UTC 2015


Hello Konstantin,

When the statement looks like this:
try (variable) {}

then it is automatically expanded to:
try (<type> #r = variable) {}

The "<type> #r = variable" declaration is the implicit declaration.

Jan

On 25.3.2015 15:44, konstantin barzilovich wrote:
> Hello, Jan
>
> Would you please clarify, what does it mean to declare resource of try
> statement implicitly.
> As I understand, explicit declaration is:
>
> try (AutoCloseable ac = new AutoCloseable()) {}
>
> Thanks,
> Konstantin.


More information about the compiler-dev mailing list