SpartanRefactoring / Main

Eclipse plugin that performs automatic refactoring of Java source code, making it shorter, more idiomatic and more readable
https://www.spartan.org.il
100 stars 56 forks source link

Bug in IfCommandsSequencerNoElseSingletonSequencer #1549

Closed yuvalsimon closed 7 years ago

yuvalsimon commented 7 years ago
  static boolean equalsImpl(Set<?> os, @Nullable Object object) {
    if (os == object) {
      return true;
    }
    if (object instanceof Set) {
      Set<?> o = (Set<?>) object;

      try {
        return os.size() == o.size() && os.containsAll(o);
      } catch (NullPointerException ignored) {
        return false;
      } catch (ClassCastException ignored) {
        return false;
      }
    }
    return false;
  }

goes to

  static boolean equalsImpl(Set<?> os, @Nullable Object object) {
    if (os == object)
        return true;
    if (!(object instanceof Set))
        return false;
    Set<?> o = (Set<?>) object;
    try {
        return os.size() == o.size() && os.containsAll(o);
    } catch (NullPointerException ignored) {
        return false;
    } catch (ClassCastException ignored) {
        return false;
    }
    return false;
  }

in guava->Sets. gives unreachable code error