(MappedClass mc1, MappedClass mc2)
| 235 | } |
| 236 | |
| 237 | public static MappedClass findCommonParent(MappedClass mc1, MappedClass mc2) { |
| 238 | // Are they the same? |
| 239 | if (mc1.getNewName().equals(mc2.getNewName())) { |
| 240 | return mc1; |
| 241 | } |
| 242 | // Does m1 extend or implement anything m2 does? |
| 243 | for (String parentNames1 : getParents(mc1)) { |
| 244 | for (String parentNames2 : getParents(mc2)) { |
| 245 | if (parentNames1.equals(parentNames2)) { |
| 246 | return getParent(parentNames1, mc1); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | return null; |
| 251 | } |
| 252 | |
| 253 | private static MappedClass getParent(String n, MappedClass m) { |
| 254 | while (m != null) { |
no test coverage detected