everydayminder
Eclipse에 내장된 기능으로도 특정 객체의 hashCode()와 equals()를 작성할 수 있다. 사용법은, 마우스 오른쪽 클릭하여 나오는 context 메뉴로부터 Source > Generate hashCode() and equals() ... 를 클릭하면 된다. 그러면, 다음과 같은 코드가 생성될 것이다. @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((link == null) ? 0 : link.hashCode()); result = prime * result + ((menuCode == null) ? 0 : menuCode.hashCode()); result = ..
FindBugs - EQ_COMPARETO_USE_OBJECTS_EQUALS 사용자가 compareTo()를 override 했을 경우, 볼 수 있는 warning이다. FindBugs의 code inspection에 따르면, This class defines a `compareTo(...)` method but inherits its `equals()` method from `java.lang.Object`. Generally, the value of compareTo should return zero if and only if equals returns true. If this is violated, weird and unpredictable failures will occur in classes s..