Skip to content

Commit

Permalink
Restrict the inheritance of Fix.
Browse files Browse the repository at this point in the history
I believe we meant to do this after removing MinimalFix, then forgot.

PiperOrigin-RevId: 565481056
  • Loading branch information
graememorgan authored and Error Prone Team committed Sep 15, 2023
1 parent 5c391b4 commit 02c0c29
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions check_api/src/main/java/com/google/errorprone/fixes/Fix.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.errorprone.fixes;

import com.google.errorprone.annotations.RestrictedInheritance;
import com.sun.tools.javac.tree.EndPosTable;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import java.util.Collection;
Expand All @@ -26,6 +27,11 @@
*
* @author eaftan@google.com (Eddie Aftandilian)
*/
@RestrictedInheritance(
explanation = "This should only be subclassed within ErrorProne.",
allowedOnPath =
".*/third_party/java_src/error_prone/project/check_api/src/main/java/com/google/errorprone/fixes/.*"
+ "|.*third_party/java_src/error_prone/project/check_api/src/main/java/com/google/errorprone/_javac/check_api/libcheck_api-class_sources/com/google/errorprone/fixes/.*")
public interface Fix {

String toString(JCCompilationUnit compilationUnit);
Expand All @@ -36,9 +42,7 @@ public interface Fix {
*
* <p>Empty string generates the default description.
*/
default String getShortDescription() {
return "";
}
String getShortDescription();

Set<Replacement> getReplacements(EndPosTable endPositions);

Expand Down

0 comments on commit 02c0c29

Please sign in to comment.