private static boolean removeRedundantThrow(BasicBlockStatement initBlock, CatchStatement catchStat) {
    if (catchStat.getStats().size() > 1) {
      boolean removed = false;
      Statement temp = null;
      int i = 1;
      for (; i < catchStat.getStats().size(); ++i) {
        temp = catchStat.getStats().get(i);

        if (temp instanceof BasicBlockStatement && temp.getExprents() != null) {
          if (temp.getExprents().size() >= 2 && catchStat.getVars().get(i - 1).getVarType().value.equals("java/lang/Throwable")) {
            if (temp.getExprents().get(temp.getExprents().size() - 1) instanceof ExitExprent) {
              ExitExprent exitExprent = (ExitExprent)temp.getExprents().get(temp.getExprents().size() - 1);
              if (exitExprent.getExitType() == ExitExprent.Type.THROW && exitExprent.getValue().equals(catchStat.getVars().get(i - 1))) {

                catchStat.getExctStrings().remove(i - 1);
                catchStat.getVars().remove(i - 1);
                catchStat.getStats().remove(i);

                for (StatEdge edge : temp.getAllSuccessorEdges()) {
                  edge.getSource().removeSuccessor(edge);
                }

                removed = true;
                break;
              }
            }
          }
        }
      }

      if (removed && temp.getExprents().get(temp.getExprents().size() - 2) instanceof AssignmentExprent) {
        AssignmentExprent assignmentExp = (AssignmentExprent)temp.getExprents().get(temp.getExprents().size() - 2);
        if (assignmentExp.getLeft().getExprType().value.equals("java/lang/Throwable")) {
          for (Exprent exprent : initBlock.getExprents()) {
            if (exprent instanceof AssignmentExprent) {
              AssignmentExprent toRemove = (AssignmentExprent)exprent;
              if (toRemove.getLeft().equals(assignmentExp.getLeft())) {
                initBlock.getExprents().remove(toRemove);
                return true;
              }
            }
          }
        }
      }
    }
    return false;
  }
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