码迷,mamicode.com
首页 > 编程语言 > 详细

Javac语法糖之TryCatchFinally

时间:2017-08-19 12:38:24      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:class   trycatch   des   ble   sse   ecif   ring   语法   row   

 

Optionally replace a try statement with the desugaring of a try-with-resources statement.  The canonical desugaring of
 try ResourceSpecification
   Block
 is
 {
   final VariableModifiers_minus_final R #resource = Expression;
   Throwable #primaryException = null;

   try ResourceSpecificationtail
     Block
   catch (Throwable #t) {
     #primaryException = t;
     throw #t;
   } finally {
     if (#resource != null) {
       if (#primaryException != null) {
         try {
           #resource.close();
         } catch(Throwable #suppressedException) {
           #primaryException.addSuppressed(#suppressedException);
         }
       } else {
         #resource.close();
       }
     }
   }

 

 

 

 

 

  

 

Javac语法糖之TryCatchFinally

标签:class   trycatch   des   ble   sse   ecif   ring   语法   row   

原文地址:http://www.cnblogs.com/extjs4/p/7395704.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!