|
15 | 15 | */
|
16 | 16 | package org.jmolecules.eclipse.plugin.explorer;
|
17 | 17 |
|
18 |
| -import static java.util.Arrays.stream; |
19 |
| -import static java.util.Collections.emptyList; |
20 |
| -import static java.util.Collections.unmodifiableList; |
| 18 | +import static java.util.Arrays.*; |
| 19 | +import static java.util.Collections.*; |
21 | 20 | import static java.util.Optional.empty;
|
22 | 21 | import static java.util.Optional.of;
|
23 |
| -import static java.util.stream.Collectors.toList; |
24 |
| -import static java.util.stream.Collectors.toSet; |
25 |
| -import static java.util.stream.Stream.concat; |
26 |
| - |
27 |
| -import static org.apache.commons.lang.builder.EqualsBuilder.reflectionEquals; |
28 |
| -import static org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode; |
29 |
| -import static org.jmolecules.eclipse.plugin.explorer.JavaModelUtils.getChildren; |
30 |
| -import static org.jmolecules.eclipse.plugin.explorer.JavaModelUtils.getFields; |
31 |
| -import static org.jmolecules.eclipse.plugin.explorer.JavaModelUtils.getMethods; |
32 |
| -import static org.jmolecules.eclipse.plugin.explorer.JavaModelUtils.isPackageInfo; |
| 22 | +import static java.util.stream.Collectors.*; |
| 23 | +import static java.util.stream.Stream.*; |
| 24 | +import static org.jmolecules.eclipse.plugin.explorer.JavaModelUtils.*; |
33 | 25 |
|
34 | 26 | import java.util.ArrayList;
|
35 | 27 | import java.util.List;
|
| 28 | +import java.util.Objects; |
36 | 29 | import java.util.Optional;
|
37 | 30 | import java.util.stream.Stream;
|
38 | 31 |
|
@@ -176,12 +169,23 @@ class TreeNode {
|
176 | 169 |
|
177 | 170 | @Override
|
178 | 171 | public int hashCode() {
|
179 |
| - return reflectionHashCode(this, new String[] { "parent" }); |
| 172 | + return Objects.hash(children, source, concepts); |
180 | 173 | }
|
181 | 174 |
|
182 | 175 | @Override
|
183 | 176 | public boolean equals(Object obj) {
|
184 |
| - return reflectionEquals(this, obj, new String[] { "parent" }); |
| 177 | + |
| 178 | + if (this == obj) { |
| 179 | + return true; |
| 180 | + } |
| 181 | + |
| 182 | + if (!(obj instanceof TreeNode that)) { |
| 183 | + return false; |
| 184 | + } |
| 185 | + |
| 186 | + return this.children.equals(that.children) |
| 187 | + && this.source.equals(that.source) |
| 188 | + && this.concepts.equals(that.concepts); |
185 | 189 | }
|
186 | 190 |
|
187 | 191 | Optional<TreeNode> findNode(IJavaElement source) {
|
|
0 commit comments