goog.module('trycatch.TryCatch$impl');

const j_l_Object = goog.require('java.lang.Object$impl');
const $Util = goog.require('nativebootstrap.Util$impl');

let ClassCastException = goog.forwardDeclare('java.lang.ClassCastException$impl');
let Exception = goog.forwardDeclare('java.lang.Exception$impl');
let NullPointerException = goog.forwardDeclare('java.lang.NullPointerException$impl');
let RuntimeException = goog.forwardDeclare('java.lang.RuntimeException$impl');
let Throwable = goog.forwardDeclare('java.lang.Throwable$impl');
let $Equality = goog.forwardDeclare('nativebootstrap.Equality$impl');
let ClosableThing = goog.forwardDeclare('trycatch.TryCatch.ClosableThing$impl');
let Exception1 = goog.forwardDeclare('trycatch.TryCatch.Exception1$impl');
let Exception2 = goog.forwardDeclare('trycatch.TryCatch.Exception2$impl');
let GenericInterface = goog.forwardDeclare('trycatch.TryCatch.GenericInterface$impl');
let $Asserts = goog.forwardDeclare('vmbootstrap.Asserts$impl');
let $Casts = goog.forwardDeclare('vmbootstrap.Casts$impl');
let $Exceptions = goog.forwardDeclare('vmbootstrap.Exceptions$impl');

class TryCatch extends j_l_Object {
 /** @protected @nodts */
 constructor() {
  super();
 }
 /** @nodts @return {!TryCatch} */
 static $create__() {
  TryCatch.$clinit();
  let $instance = new TryCatch();
  $instance.$ctor__trycatch_TryCatch__void();
  return $instance;
 }
 /** @nodts */
 $ctor__trycatch_TryCatch__void() {
  this.$ctor__java_lang_Object__void();
 }
 /** @nodts */
 m_testMultiCatch__void() {
  try {
   throw $Exceptions.toJs(ClassCastException.$create__());
  } catch (__$jsexc) {
   let __$exc = $Exceptions.toJava(__$jsexc);
   if (NullPointerException.$isInstance(__$exc) || ClassCastException.$isInstance(__$exc)) {
    let e = /**@type {(NullPointerException|ClassCastException)}*/ (__$exc);
    throw $Exceptions.toJs(e);
   } else if (RuntimeException.$isInstance(__$exc)) {
    let r = /**@type {RuntimeException}*/ (__$exc);
    r = null;
   } else {
    throw $Exceptions.toJs(__$exc);
   }
  }
 }
 /** @nodts */
 m_testEmptyThrowableCatch__void() {
  try {
   throw $Exceptions.toJs(ClassCastException.$create__());
  } catch (__$jsexc) {}
  try {
   throw $Exceptions.toJs(ClassCastException.$create__());
  } catch (__$jsexc_1) {
   let __$exc = $Exceptions.toJava(__$jsexc_1);
   if (Exception.$isInstance(__$exc)) {} else {}
  }
 }
 /** @nodts */
 m_testEmptyThrowableRethrow__void() {
  try {
   throw $Exceptions.toJs(ClassCastException.$create__());
  } catch (__$jsexc) {
   let __$exc = $Exceptions.toJava(__$jsexc);
   {
    let e = /**@type {Throwable}*/ (__$exc);
    throw $Exceptions.toJs(e);
   }
  }
 }
 /** @nodts */
 m_testFinally__void() {
  try {
   $Asserts.$assert(true);
  } finally {}
 }
 /** @nodts */
 m_testTryWithResource__void() {
  try {
   let /** Throwable */ $primaryExc = null;
   let /** ClosableThing */ thing = null;
   let /** ClosableThing */ thing2 = null;
   try {
    thing = ClosableThing.$create__();
    thing2 = ClosableThing.$create__();
    throw $Exceptions.toJs(Exception.$create__());
   } catch (__$jsexc) {
    let __$exc = $Exceptions.toJava(__$jsexc);
    {
     let $exceptionFromTry = /**@type {Throwable}*/ (__$exc);
     $primaryExc = $exceptionFromTry;
     throw $Exceptions.toJs($exceptionFromTry);
    }
   } finally {
    $primaryExc = $Exceptions.safeClose(thing2, $primaryExc);
    $primaryExc = $Exceptions.safeClose(thing, $primaryExc);
    if (!$Equality.$same($primaryExc, null)) {
     throw $Exceptions.toJs($primaryExc);
    }
   }
  } catch (__$jsexc_1) {
   let __$exc_1 = $Exceptions.toJava(__$jsexc_1);
   if (Exception.$isInstance(__$exc_1)) {} else {
    throw $Exceptions.toJs(__$exc_1);
   }
  }
 }
 /** @nodts */
 m_testTryWithResourceJava9__void() {
  let thing = ClosableThing.$create__();
  let thing2 = ClosableThing.$create__();
  try {
   let /** Throwable */ $primaryExc = null;
   let /** ClosableThing */ $resource = null;
   let /** ClosableThing */ $resource_1 = null;
   try {
    $resource = thing;
    $resource_1 = thing2;
    throw $Exceptions.toJs(Exception.$create__());
   } catch (__$jsexc) {
    let __$exc = $Exceptions.toJava(__$jsexc);
    {
     let $exceptionFromTry = /**@type {Throwable}*/ (__$exc);
     $primaryExc = $exceptionFromTry;
     throw $Exceptions.toJs($exceptionFromTry);
    }
   } finally {
    $primaryExc = $Exceptions.safeClose($resource_1, $primaryExc);
    $primaryExc = $Exceptions.safeClose($resource, $primaryExc);
    if (!$Equality.$same($primaryExc, null)) {
     throw $Exceptions.toJs($primaryExc);
    }
   }
  } catch (__$jsexc_1) {
   let __$exc_1 = $Exceptions.toJava(__$jsexc_1);
   if (Exception.$isInstance(__$exc_1)) {} else {
    throw $Exceptions.toJs(__$exc_1);
   }
  }
 }
 /** @nodts */
 m_testTryWithResouceOnStaticField__void() {
  try {
   let /** Throwable */ $primaryExc = null;
   let /** ClosableThing */ $resource = null;
   try {
    $resource = TryCatch.f_closableThing__trycatch_TryCatch_;
    throw $Exceptions.toJs(Exception.$create__());
   } catch (__$jsexc) {
    let __$exc = $Exceptions.toJava(__$jsexc);
    {
     let $exceptionFromTry = /**@type {Throwable}*/ (__$exc);
     $primaryExc = $exceptionFromTry;
     throw $Exceptions.toJs($exceptionFromTry);
    }
   } finally {
    $primaryExc = $Exceptions.safeClose($resource, $primaryExc);
    if (!$Equality.$same($primaryExc, null)) {
     throw $Exceptions.toJs($primaryExc);
    }
   }
  } catch (__$jsexc_1) {
   let __$exc_1 = $Exceptions.toJava(__$jsexc_1);
   if (Exception.$isInstance(__$exc_1)) {} else {
    throw $Exceptions.toJs(__$exc_1);
   }
  }
 }
 /** @nodts */
 m_testNestedTryCatch__void() {
  try {
   throw $Exceptions.toJs(Exception.$create__());
  } catch (__$jsexc) {
   let __$exc = $Exceptions.toJava(__$jsexc);
   if (Exception.$isInstance(__$exc)) {
    let ae = /**@type {Exception}*/ (__$exc);
    try {
     throw $Exceptions.toJs(Exception.$create__());
    } catch (__$jsexc_1) {
     let __$exc_1 = $Exceptions.toJava(__$jsexc_1);
     if (Exception.$isInstance(__$exc_1)) {} else {
      throw $Exceptions.toJs(__$exc_1);
     }
    }
   } else {
    throw $Exceptions.toJs(__$exc);
   }
  }
 }
 /** @nodts */
 m_testThrowGenerics__void() {
  throw $Exceptions.toJs(/**@type {Exception}*/ ($Casts.$to(this.m_getT__java_lang_Object__java_lang_Object_$p_trycatch_TryCatch(Exception.$create__()), Exception)));
 }
 /** @nodts @template T @return {T} */
 m_getT__java_lang_Object__java_lang_Object_$p_trycatch_TryCatch(/** T */ t) {
  return t;
 }
 /** @nodts */
 m_testThrowBoundGenerics__void() {
  throw $Exceptions.toJs(this.m_getThrowable__java_lang_Throwable_$p_trycatch_TryCatch());
 }
 /** @nodts @template T @return {T} */
 m_getThrowable__java_lang_Throwable_$p_trycatch_TryCatch() {
  return null;
 }
 /** @nodts @template T */
 m_testThrowsParameterized__java_lang_Throwable__void(/** T */ throwable) {
  throw $Exceptions.toJs(/**@type {!Throwable}*/ (throwable));
 }
 /** @nodts */
 m_testMultiCatchParameterizedException__void() {
  try {
   throw $Exceptions.toJs(Exception1.$create__trycatch_TryCatch(this));
  } catch (__$jsexc) {
   let __$exc = $Exceptions.toJava(__$jsexc);
   if (Exception2.$isInstance(__$exc) || Exception1.$isInstance(__$exc)) {
    let e = /**@type {(Exception2|Exception1)}*/ (__$exc);
    (/**@type {!GenericInterface<?string>}*/ ($Casts.$to(e, /**@type {Function}*/ (GenericInterface)))).m_f__java_lang_Object__void('');
   } else {
    throw $Exceptions.toJs(__$exc);
   }
  }
 }
 /** @nodts */
 static $clinit() {
  TryCatch.$clinit = () =>{};
  TryCatch.$loadModules();
  j_l_Object.$clinit();
  TryCatch.f_closableThing__trycatch_TryCatch_ = ClosableThing.$create__();
 }
 /** @nodts @return {boolean} */
 static $isInstance(/** ? */ instance) {
  return instance instanceof TryCatch;
 }
 
 /** @nodts */
 static $loadModules() {
  ClassCastException = goog.module.get('java.lang.ClassCastException$impl');
  Exception = goog.module.get('java.lang.Exception$impl');
  NullPointerException = goog.module.get('java.lang.NullPointerException$impl');
  RuntimeException = goog.module.get('java.lang.RuntimeException$impl');
  $Equality = goog.module.get('nativebootstrap.Equality$impl');
  ClosableThing = goog.module.get('trycatch.TryCatch.ClosableThing$impl');
  Exception1 = goog.module.get('trycatch.TryCatch.Exception1$impl');
  Exception2 = goog.module.get('trycatch.TryCatch.Exception2$impl');
  GenericInterface = goog.module.get('trycatch.TryCatch.GenericInterface$impl');
  $Asserts = goog.module.get('vmbootstrap.Asserts$impl');
  $Casts = goog.module.get('vmbootstrap.Casts$impl');
  $Exceptions = goog.module.get('vmbootstrap.Exceptions$impl');
 }
}
/**@type {ClosableThing} @nodts*/
TryCatch.f_closableThing__trycatch_TryCatch_;
$Util.$setClassMetadata(TryCatch, 'trycatch.TryCatch');

exports = TryCatch;

//# sourceMappingURL=TryCatch.js.map
