Javac语法糖之TryCatchFinally

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Javac语法糖之TryCatchFinally相关的知识,希望对你有一定的参考价值。

 

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的主要内容,如果未能解决你的问题,请参考以下文章

Javac语法糖之EnumSwitch

Javac语法糖之增强for循环

解语法糖之私有构造函数

Java语法糖之泛型与类型擦除

vue3-setup语法糖之组件传参(definePropsdefineEmitsdefineExpose)

Netbeans报错:org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP PWC6199: