Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #13345: enable EqualsHashCodeCheckExamplesTest
- Loading branch information
Showing
5 changed files
with
98 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ples/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalshashcode/Example1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*xml | ||
<module name="Checker"> | ||
<module name="TreeWalker"> | ||
<module name="EqualsHashCode"/> | ||
</module> | ||
</module> | ||
*/ | ||
package com.puppycrawl.tools.checkstyle.checks.coding.equalshashcode; | ||
// xdoc section -- start | ||
class Example1 { | ||
public int hashCode() { // violation, no valid 'equals' | ||
return 0; | ||
} | ||
public boolean equals(String o) { return false; } | ||
} | ||
|
||
class ExampleNoHashCode { | ||
public boolean equals(Object o) { // violation, no 'hashCode' | ||
return false; | ||
} | ||
public boolean equals(String o) { return false; } | ||
} | ||
|
||
class ExampleBothMethods1 { | ||
public int hashCode() { return 0; } | ||
public boolean equals(Object o) { // ok, both methods exist | ||
return false; | ||
} | ||
public boolean equals(String o) { return false; } | ||
} | ||
|
||
class ExampleBothMethods2 { | ||
public int hashCode() { return 0; } | ||
public boolean equals(java.lang.Object o) { // ok, both methods exist | ||
return false; | ||
} | ||
} | ||
|
||
class ExampleNoValidHashCode { | ||
public static int hashCode(int i) { return 0; } | ||
public boolean equals(Object o) { // violation, no valid 'hashCode' | ||
return false; | ||
} | ||
} | ||
|
||
class ExampleNoValidEquals { | ||
public int hashCode() { // violation, no valid 'equals' | ||
return 0; | ||
} | ||
public static boolean equals(Object o, Object o2) { return false; } | ||
} | ||
// xdoc section -- end |
61 changes: 0 additions & 61 deletions
61
...mples/resources/com/puppycrawl/tools/checkstyle/checks/coding/equalshashcode/Example1.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters