@Test public void testIsCastingUnchecked() { TypeElement erasureClass = typeElementOf(Erasure.class); List<VariableElement> fields = ElementFilter.fieldsIn(erasureClass.getEnclosedElements()); assertThat(fields).isNotEmpty(); for (VariableElement field : fields) { String fieldName = field.getSimpleName().toString(); boolean expectUnchecked; if (fieldName.endsWith("Yes")) { expectUnchecked = true; } else if (fieldName.endsWith("No")) { expectUnchecked = false; } else { throw new AssertionError("Fields in Erasure class must end with Yes or No: " + fieldName); } TypeMirror fieldType = field.asType(); boolean actualUnchecked = TypeSimplifier.isCastingUnchecked(fieldType); assertWithMessage("Unchecked-cast status for " + fieldType) .that(actualUnchecked) .isEqualTo(expectUnchecked); } }
static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); }
TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } }
TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
      Elements elementUtils,
      Types typeUtils,
      String packageName,
      Set<TypeMirror> types,
      TypeMirror base); }
TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
      Elements elementUtils,
      Types typeUtils,
      String packageName,
      Set<TypeMirror> types,
      TypeMirror base);  }
TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
      Elements elementUtils,
      Types typeUtils,
      String packageName,
      Set<TypeMirror> types,
      TypeMirror base);   }