private String simpleNameForType(TypeMirror type) {
      return type.accept(
          new SimpleTypeVisitor8<String, Void>() {
            @Override
            public String visitPrimitive(PrimitiveType primitiveType, Void v) {
              return types.boxedClass(primitiveType).getSimpleName().toString();
            }

            @Override
            public String visitArray(ArrayType arrayType, Void v) {
              return arrayType.getComponentType().accept(this, null) + "Array";
            }

            @Override
            public String visitDeclared(DeclaredType declaredType, Void v) {
              return declaredType.asElement().getSimpleName().toString();
            }

            @Override
            protected String defaultAction(TypeMirror typeMirror, Void v) {
              throw new AssertionError(typeMirror);
            }
          },
          null);
    }
Returns a valid Java identifier for method or variable of type {@code type}.
value/src/main/java/com/google/auto/value/extension/toprettystring/processor/ToPrettyStringExtension.java