aboutsummaryrefslogtreecommitdiff
path: root/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java
diff options
context:
space:
mode:
Diffstat (limited to 'value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java')
-rw-r--r--value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java
index d05ed43c..d73c1c29 100644
--- a/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java
+++ b/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java
@@ -72,7 +72,9 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
void processType(TypeElement autoOneOfType) {
if (autoOneOfType.getKind() != ElementKind.CLASS) {
errorReporter()
- .abortWithError(autoOneOfType, "@" + AUTO_ONE_OF_NAME + " only applies to classes");
+ .abortWithError(
+ autoOneOfType,
+ "[AutoOneOfNotClass] @" + AUTO_ONE_OF_NAME + " only applies to classes");
}
checkModifiersIfNested(autoOneOfType);
DeclaredType kindMirror = mirrorForKindType(autoOneOfType);
@@ -129,7 +131,7 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
errorReporter()
.abortWithError(
autoOneOfType,
- "annotation processor for @AutoOneOf was invoked with a type"
+ "[AutoOneOfCompilerBug] annotation processor for @AutoOneOf was invoked with a type"
+ " that does not have that annotation; this is probably a compiler bug");
}
AnnotationValue kindValue =
@@ -184,7 +186,8 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
errorReporter()
.reportError(
kindElement,
- "Enum has no constant with name corresponding to property '%s'",
+ "[AutoOneOfNoEnumConstant] Enum has no constant with name corresponding to"
+ + " property '%s'",
property);
}
});
@@ -195,7 +198,8 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
errorReporter()
.reportError(
constant,
- "Name of enum constant '%s' does not correspond to any property name",
+ "[AutoOneOfBadEnumConstant] Name of enum constant '%s' does not correspond to"
+ + " any property name",
constant.getSimpleName());
}
});
@@ -221,7 +225,7 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
errorReporter()
.reportError(
autoOneOfType,
- "%s must have a no-arg abstract method returning %s",
+ "[AutoOneOfNoKindGetter] %s must have a no-arg abstract method returning %s",
autoOneOfType,
kindMirror);
break;
@@ -230,7 +234,10 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
default:
for (ExecutableElement getter : kindGetters) {
errorReporter()
- .reportError(getter, "More than one abstract method returns %s", kindMirror);
+ .reportError(
+ getter,
+ "[AutoOneOfTwoKindGetters] More than one abstract method returns %s",
+ kindMirror);
}
}
throw new AbortProcessingException();
@@ -254,7 +261,8 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
// implement this alien method.
errorReporter()
.reportWarning(
- method, "Abstract methods in @AutoOneOf classes must have no parameters");
+ method,
+ "[AutoOneOfParams] Abstract methods in @AutoOneOf classes must have no parameters");
}
}
errorReporter().abortIfAnyError();
@@ -278,7 +286,9 @@ public class AutoOneOfProcessor extends AutoValueOrOneOfProcessor {
@Override
Optional<String> nullableAnnotationForMethod(ExecutableElement propertyMethod) {
if (nullableAnnotationFor(propertyMethod, propertyMethod.getReturnType()).isPresent()) {
- errorReporter().reportError(propertyMethod, "@AutoOneOf properties cannot be @Nullable");
+ errorReporter()
+ .reportError(
+ propertyMethod, "[AutoOneOfNullable] @AutoOneOf properties cannot be @Nullable");
}
return Optional.empty();
}