Source:
<code>@Override public boolean applicable(Context context) { TypeElement type = context.autoValueClass(); ParameterizedTypeName jsonAdapterType = ParameterizedTypeName.get( ADAPTER_CLASS_NAME, TypeName.get(type.asType())); TypeName returnedJsonAdapter = null; for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) { <START> if (method.getModifiers().contains(Modifier.STATIC)) { <END> TypeMirror rType = method.getReturnType(); TypeName returnType = TypeName.get(rType); if (returnType.equals(jsonAdapterType)) { return true; } if (returnType.equals(jsonAdapterType.rawType) || (returnType instanceof ParameterizedTypeName && ((ParameterizedTypeName) returnType).rawType.equals(jsonAdapterType.rawType))) { returnedJsonAdapter = returnType; } } } if (returnedJsonAdapter == null) { return false; } Messager messager = context.processingEnvironment().getMessager(); if (returnedJsonAdapter instanceof ParameterizedTypeName) { ParameterizedTypeName paramReturnType = (ParameterizedTypeName) returnedJsonAdapter; if (paramReturnType.typeArguments.get(0) instanceof ParameterizedTypeName) { return true; } else { TypeName argument = paramReturnType.typeArguments.get(0); messager.printMessage(Diagnostic.Kind.WARNING, String.format("Found static method returning JsonAdapter<%s> on %s class. " + "Skipping MoshiJsonAdapter generation.", argument, type)); } } else { messager.printMessage(Diagnostic.Kind.WARNING, "Found static method returning " + "JsonAdapter with no type arguments, skipping MoshiJsonAdapter generation."); } return false; }</code><technical_language>Minor: check non-private</technical_language>

Target:
@Override public boolean applicable(Context context) { TypeElement type = context.autoValueClass(); ParameterizedTypeName jsonAdapterType = ParameterizedTypeName.get( ADAPTER_CLASS_NAME, TypeName.get(type.asType())); TypeName returnedJsonAdapter = null; for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) { if (method.getModifiers().contains(Modifier.STATIC) && !method.getModifiers().contains(Modifier.PRIVATE)) { TypeMirror rType = method.getReturnType(); TypeName returnType = TypeName.get(rType); if (returnType.equals(jsonAdapterType)) { return true; } if (returnType.equals(jsonAdapterType.rawType) || (returnType instanceof ParameterizedTypeName && ((ParameterizedTypeName) returnType).rawType.equals(jsonAdapterType.rawType))) { returnedJsonAdapter = returnType; } } } if (returnedJsonAdapter == null) { return false; } Messager messager = context.processingEnvironment().getMessager(); if (returnedJsonAdapter instanceof ParameterizedTypeName) { ParameterizedTypeName paramReturnType = (ParameterizedTypeName) returnedJsonAdapter; if (paramReturnType.typeArguments.get(0) instanceof ParameterizedTypeName) { return true; } else { TypeName argument = paramReturnType.typeArguments.get(0); messager.printMessage(Diagnostic.Kind.WARNING, String.format("Found static method returning JsonAdapter<%s> on %s class. " + "Skipping MoshiJsonAdapter generation.", argument, type)); } } else { messager.printMessage(Diagnostic.Kind.WARNING, "Found static method returning " + "JsonAdapter with no type arguments, skipping MoshiJsonAdapter generation."); } return false; }