Escalate to error for code annotated with @Disabled, @EnabledAfter. am: aea7db0888
am: e9f29977ff
Change-Id: Ib4a6dd1bfd9c0a50680670bf64eef2798d812311
diff --git a/annotation/processors/changeid/src/java/com/android/compat/annotation/ChangeIdProcessor.java b/annotation/processors/changeid/src/java/com/android/compat/annotation/ChangeIdProcessor.java
index 5c64edf..4ba284a 100644
--- a/annotation/processors/changeid/src/java/com/android/compat/annotation/ChangeIdProcessor.java
+++ b/annotation/processors/changeid/src/java/com/android/compat/annotation/ChangeIdProcessor.java
@@ -17,8 +17,6 @@
package com.android.compat.annotation;
import static javax.tools.Diagnostic.Kind.ERROR;
-import static javax.tools.Diagnostic.Kind.WARNING;
-
import com.google.common.collect.ImmutableSet;
@@ -196,9 +194,8 @@
if (disabled && enabledAfter != null) {
messager.printMessage(
- WARNING,
- "ChangeId is annotated with both @Disabled and @EnabledAfter. @EnabledAfter "
- + "will have no effect.",
+ ERROR,
+ "ChangeId cannot be annotated with both @Disabled and @EnabledAfter.",
e);
}
return new Change(id, name, disabled, enabledAfter);
diff --git a/annotation/processors/changeid/test/src/com/android/compat/annotation/ChangeIdProcessorTest.java b/annotation/processors/changeid/test/src/com/android/compat/annotation/ChangeIdProcessorTest.java
index bec0e6f..faa89b1 100644
--- a/annotation/processors/changeid/test/src/com/android/compat/annotation/ChangeIdProcessorTest.java
+++ b/annotation/processors/changeid/test/src/com/android/compat/annotation/ChangeIdProcessorTest.java
@@ -130,13 +130,9 @@
Compilation compilation =
Compiler.javac()
.withProcessors(new ChangeIdProcessor())
- .compile(ObjectArrays.concat(mAnnotations,source, JavaFileObject.class));
- CompilationSubject.assertThat(compilation).succeeded();
- CompilationSubject.assertThat(compilation).generatedFile(CLASS_OUTPUT, "compat",
- "compat_config.xml").hasContents(ByteSource.wrap(expectedFile.getBytes(UTF_8)));
- CompilationSubject.assertThat(compilation).hadWarningContaining(
- "ChangeId is annotated with both @Disabled and @EnabledAfter. @EnabledAfter will "
- + "have no effect.");
+ .compile(ObjectArrays.concat(mAnnotations, source, JavaFileObject.class));
+ CompilationSubject.assertThat(compilation).hadErrorContaining(
+ "ChangeId cannot be annotated with both @Disabled and @EnabledAfter.");
}
@Test