@Override
    public PsiElement @NotNull [] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
      if (!PsiUtil.isAvailable(JavaFeature.TRY_WITH_RESOURCES, file)) return PsiElement.EMPTY_ARRAY;
      PsiElement element = file.findElementAt(endOffset);
      PsiElement target = findExpression(element);
      if (target == null) {
        target = findVariable(element);
      }
      return target != null ? new PsiElement[]{target} : PsiElement.EMPTY_ARRAY;
    }
@Override
    public PsiElement @NotNull [] getElementsToSurround(PsiFile file, int startOffset, int endOffset)