private static AssignmentExprent findResourceDef(VarExprent var, Statement prevStatement) {
    for (Exprent exp : prevStatement.getExprents()) {
      if (exp instanceof AssignmentExprent) {
        AssignmentExprent ass = (AssignmentExprent)exp;
        if (ass.getLeft() instanceof VarExprent) { // cannot use equals as var's varType may be unknown and not match
          VarExprent left = (VarExprent)ass.getLeft();
          if (left.getVarVersionPair().equals(var.getVarVersionPair())) {
            return ass;
          }
        }
      }
    }

    return null;
  }
Processes try catch statements to turns them into try-with-resources statements wherever possible.
Including the entire classpath is generally needed for this to work as it needs to know which classes implement AutoCloseable.

@author ForgeFlower devs, SuperCoder79
src/org/jetbrains/java/decompiler/modules/decompiler/TryWithResourcesProcessor.java