MCPcopy Create free account
hub / github.com/google/auto / equal

Method equal

common/src/main/java/com/google/auto/common/MoreTypes.java:321–346  ·  view source on GitHub ↗
(
      @Nullable TypeMirror a, @Nullable TypeMirror b, Set<ComparedElements> visiting)

Source from the content-addressed store, hash-verified

319 }
320
321 @SuppressWarnings("TypeEquals")
322 private static boolean equal(
323 @Nullable TypeMirror a, @Nullable TypeMirror b, Set<ComparedElements> visiting) {
324 if (a == b) {
325 return true;
326 }
327 if (a == null || b == null) {
328 return false;
329 }
330 // TypeMirror.equals is not guaranteed to return true for types that are equal, but we can
331 // assume that if it does return true then the types are equal. This check also avoids getting
332 // stuck in infinite recursion when Eclipse decrees that the upper bound of the second K in
333 // <K extends Comparable<K>> is a distinct but equal K.
334 // The javac implementation of ExecutableType, at least in some versions, does not take thrown
335 // exceptions into account in its equals implementation, so avoid this optimization for
336 // ExecutableType.
337 @SuppressWarnings("TypesEquals")
338 boolean equal = a.equals(b);
339 if (equal && a.getKind() != TypeKind.EXECUTABLE) {
340 return true;
341 }
342 EqualVisitorParam p = new EqualVisitorParam();
343 p.type = b;
344 p.visiting = visiting;
345 return a.accept(EqualVisitor.INSTANCE, p);
346 }
347
348 /**
349 * Returns the type of the innermost enclosing instance, or null if there is none. This is the

Callers 7

doEquivalentMethod · 0.95
equalListsMethod · 0.95
visitArrayMethod · 0.45
visitDeclaredMethod · 0.45
visitExecutableMethod · 0.45
visitTypeVariableMethod · 0.45
visitWildcardMethod · 0.45

Calls 3

equalsMethod · 0.45
getKindMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected