Skip to content

Commit fd9b826

Browse files
graememorganError Prone Team
authored and
Error Prone Team
committed
Remove a very literal change-detector test, and move the comment to the production code (which seems more discoverable).
PiperOrigin-RevId: 627693317
1 parent f289d9e commit fd9b826

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

annotations/src/main/java/com/google/errorprone/annotations/CompileTimeConstant.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,8 @@
130130
*/
131131
@Documented
132132
@Retention(CLASS)
133+
// TODO(xtof): We'd like to eventually support other cases, but I first need to determine with
134+
// confidence that the checker can ensure all initializations and assignments to such variables are
135+
// compile-time-constant.
133136
@Target({ElementType.PARAMETER, ElementType.FIELD})
134137
public @interface CompileTimeConstant {}

core/src/test/java/com/google/errorprone/matchers/CompileTimeConstantExpressionMatcherTest.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@
1616

1717
package com.google.errorprone.matchers;
1818

19-
import static com.google.common.truth.Truth.assertThat;
2019
import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
2120
import static com.google.errorprone.util.ASTHelpers.getSymbol;
2221

2322
import com.google.errorprone.BugPattern;
2423
import com.google.errorprone.CompilationTestHelper;
2524
import com.google.errorprone.VisitorState;
26-
import com.google.errorprone.annotations.CompileTimeConstant;
2725
import com.google.errorprone.bugpatterns.BugChecker;
2826
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
2927
import com.sun.source.tree.VariableTree;
30-
import java.lang.annotation.ElementType;
31-
import java.lang.annotation.Target;
3228
import javax.lang.model.element.ElementKind;
3329
import org.junit.Test;
3430
import org.junit.runner.RunWith;
@@ -170,16 +166,6 @@ public void finalCompileTimeConstantConstructorParameters() {
170166
.doTest();
171167
}
172168

173-
// TODO(xtof): We'd like to eventually support other cases, but I first need
174-
// to determine with confidence that the checker can ensure all initializations
175-
// and assignments to such variables are compile-time-constant.
176-
// For now, the annotation's target is restricted to ElementType.PARAMETER.
177-
@Test
178-
public void compileTimeConstantAnnotationOnlyAllowedOnParameterOrField() {
179-
assertThat(CompileTimeConstant.class.getAnnotation(Target.class).value())
180-
.isEqualTo(new ElementType[] {ElementType.PARAMETER, ElementType.FIELD});
181-
}
182-
183169
@Test
184170
public void conditionalExpression() {
185171
testHelper

0 commit comments

Comments
 (0)