Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Commit

Permalink
Remove the @beta annotations from the Lint APIs
Browse files Browse the repository at this point in the history
The API is not guaranteed to be stable, and a large part of lint's API
surface is outside of our control (e.g. UAST, PSI, intellij-core), but
we have bytecode verification of custom lint jars now which pinpoints
incompatible changes, and we strive to not break APIs under our control,
so flagging all API accesses as unstable seems like overkill.

Test: N/A
Bug: None
Change-Id: I2b94ca37985f105ab78cd78b55a9d301f2c4e558
  • Loading branch information
tnorbye committed Feb 1, 2022
1 parent 70c1633 commit 4e4b17e
Show file tree
Hide file tree
Showing 43 changed files with 3 additions and 91 deletions.
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/HtmlReporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import com.android.tools.lint.detector.api.describeCounts
import com.android.utils.HtmlBuilder
import com.android.utils.SdkUtils
import com.android.utils.XmlUtils
import com.google.common.annotations.Beta
import com.google.common.base.Charsets
import com.google.common.base.Joiner
import com.google.common.base.Splitter
Expand All @@ -53,7 +52,6 @@ import kotlin.math.min
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
class HtmlReporter(
client: LintCliClient,
output: File,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ import com.android.tools.lint.helpers.DefaultUastParser
import com.android.tools.lint.model.LintModelModuleType
import com.android.utils.CharSequences
import com.android.utils.StdLogger
import com.google.common.annotations.Beta
import com.google.common.annotations.VisibleForTesting
import com.google.common.base.Splitter
import com.google.common.collect.Sets
Expand Down Expand Up @@ -121,7 +120,6 @@ import kotlin.math.max
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
open class LintCliClient : LintClient {
constructor(clientName: String) : super(clientName) {
flags = LintCliFlags()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.model.LintModelSeverity;
import com.google.common.annotations.Beta;
import com.google.common.collect.Lists;
import java.io.File;
import java.util.ArrayList;
Expand All @@ -40,7 +39,6 @@
* <p><b>NOTE: This is not a public or final API; if you rely on this be prepared to adjust your
* code for the next tools release.</b>
*/
@Beta
public class LintCliFlags {
private final Set<String> suppress = new HashSet<>();
private final Set<String> enabled = new HashSet<>();
Expand Down
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import com.android.tools.lint.model.PathVariables;
import com.android.utils.SdkUtils;
import com.android.utils.XmlUtils;
import com.google.common.annotations.Beta;
import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams;
import com.intellij.pom.java.LanguageLevel;
Expand Down Expand Up @@ -107,7 +106,6 @@
* <p><b>NOTE: This is not a public or final API; if you rely on this be prepared to adjust your
* code for the next tools release.</b>
*/
@Beta
public class Main {
static final int MAX_LINE_WIDTH = 78;
private static final String ARG_ENABLE = "--enable";
Expand Down
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/Reporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ import com.android.tools.lint.detector.api.Incident
import com.android.tools.lint.detector.api.Issue
import com.android.tools.lint.detector.api.Location
import com.android.utils.SdkUtils
import com.google.common.annotations.Beta
import java.io.File
import java.io.IOException
import java.io.UnsupportedEncodingException
Expand All @@ -118,7 +117,6 @@ import java.net.URLEncoder
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class Reporter protected constructor(
@JvmField
protected val client: LintCliClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.android.tools.lint.detector.api.getFileUri
import com.android.tools.lint.detector.api.isParent
import com.android.utils.SdkUtils
import com.android.utils.SdkUtils.isBitmapFile
import com.google.common.annotations.Beta
import com.google.common.hash.Hashing
import com.google.common.io.Files
import java.io.BufferedWriter
Expand Down Expand Up @@ -68,7 +67,6 @@ import kotlin.text.Charsets.UTF_8
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
class SarifReporter

/**
Expand Down
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/TextReporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.TextFormat
import com.android.tools.lint.detector.api.describeCounts
import com.android.utils.SdkUtils
import com.google.common.annotations.Beta
import com.google.common.base.Joiner
import com.google.common.base.Splitter
import java.io.File
Expand All @@ -36,7 +35,6 @@ import java.io.Writer
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
class TextReporter(
client: LintCliClient,
private val flags: LintCliFlags,
Expand Down
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/XmlReporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.android.tools.lint

import com.android.tools.lint.client.api.LintClient
import com.android.tools.lint.detector.api.Incident
import com.google.common.annotations.Beta
import java.io.File
import java.io.IOException

Expand All @@ -28,7 +27,6 @@ import java.io.IOException
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
class XmlReporter constructor(
/** Client handling IO, path normalization and error reporting. */
client: LintCliClient,
Expand Down
2 changes: 0 additions & 2 deletions lint/cli/src/main/java/com/android/tools/lint/XmlWriter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import com.android.tools.lint.detector.api.TargetSdkLessThan
import com.android.tools.lint.detector.api.TextFormat
import com.android.tools.lint.detector.api.assertionsEnabled
import com.android.utils.XmlUtils
import com.google.common.annotations.Beta
import com.google.common.base.Joiner
import com.google.common.io.Files
import com.intellij.psi.PsiMethod
Expand All @@ -71,7 +70,6 @@ import kotlin.text.Charsets.UTF_8
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
open class XmlWriter constructor(
/** Client handling IO, path normalization and error reporting. */
private val client: LintCliClient,
Expand Down
6 changes: 3 additions & 3 deletions lint/docs/api-guide/basics.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

### API Stability

Lint's APIs are still marked as @Beta, and we have made it very clear
all along that this is not a stable API, so custom lint checks may need
to be updated periodically to keep working.
Lint's APIs are not stable, and a large part of Lint's API surface is
not under our control (such as UAST and PSI). Therefore, custom lint
checks may need to be updated periodically to keep working.

However, ”some APIs are more stable than others“. In particular, the
detector API (described below) is much less likely to change than the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.android.tools.lint.detector.api.ClassContext;
import com.android.tools.lint.detector.api.ClassScanner;
import com.android.tools.lint.detector.api.Detector;
import com.google.common.annotations.Beta;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -54,7 +53,6 @@
* <p><b>NOTE: This is not a public or final API; if you rely on this be prepared to adjust your
* code for the next tools release.</b>
*/
@Beta
class AsmVisitor {
/**
* Number of distinct node types specified in {@link AbstractInsnNode}. Sadly there isn't a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.android.annotations.Nullable;
import com.android.tools.lint.detector.api.Location;
import com.android.tools.lint.detector.api.Project;
import com.google.common.annotations.Beta;

/**
* Exception thrown when there is a circular dependency, such as a circular dependency of library
Expand All @@ -29,7 +28,6 @@
* <p><b>NOTE: This is not a public or final API; if you rely on this be prepared to adjust your
* code for the next tools release.</b>
*/
@Beta
public class CircularDependencyException extends RuntimeException {
@Nullable private Project project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.android.tools.lint.detector.api.Project
import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.TextFormat
import com.android.tools.lint.detector.api.guessGradleLocation
import com.google.common.annotations.Beta
import java.io.File

/**
Expand All @@ -38,7 +37,6 @@ import java.io.File
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class Configuration(
val configurations: ConfigurationHierarchy
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ import com.android.SdkConstants.VIEW_STUB
import com.android.SdkConstants.VIEW_SWITCHER
import com.android.SdkConstants.WEB_VIEW
import com.android.SdkConstants.WIDGET_PKG_PREFIX
import com.google.common.annotations.Beta

/**
* Default simple implementation of an [SdkInfo]
*
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
internal class DefaultSdkInfo : SdkInfo() {
override fun getParentViewName(name: String): String? {
val rawType = getRawType(name) ?: return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.android.tools.lint.detector.api.Scope
import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.editDistance
import com.android.tools.lint.detector.api.isApplicableTo
import com.google.common.annotations.Beta
import com.google.common.collect.Maps
import com.google.common.collect.Sets
import java.util.ArrayList
Expand All @@ -42,7 +41,6 @@ import java.util.HashSet
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class IssueRegistry
protected constructor() {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import com.android.utils.CharSequences
import com.android.utils.Pair
import com.android.utils.XmlUtils
import com.android.utils.findGradleBuildFile
import com.google.common.annotations.Beta
import com.google.common.base.Splitter
import com.google.common.collect.Lists
import com.google.common.collect.Maps
Expand Down Expand Up @@ -103,7 +102,6 @@ import kotlin.math.max
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class LintClient {

protected constructor(clientName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import com.android.tools.lint.detector.api.isXmlFile
import com.android.tools.lint.model.PathVariables
import com.android.utils.Pair
import com.android.utils.SdkUtils.isBitmapFile
import com.google.common.annotations.Beta
import com.google.common.annotations.VisibleForTesting
import com.google.common.base.Objects
import com.google.common.base.Splitter
Expand Down Expand Up @@ -156,7 +155,6 @@ import kotlin.system.measureTimeMillis
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
class LintDriver(
/** The [registry] containing issues to be checked. */
var registry: IssueRegistry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ package com.android.tools.lint.client.api

import com.android.tools.lint.detector.api.Context
import com.android.tools.lint.detector.api.Project
import com.google.common.annotations.Beta

/**
* Interface implemented by listeners to be notified of lint events.
*
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
interface LintListener {
/** The various types of events provided to lint listeners. */
enum class EventType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.android.tools.lint.client.api
import com.android.tools.lint.detector.api.Platform
import com.android.tools.lint.detector.api.Project
import com.android.tools.lint.detector.api.Scope
import com.google.common.annotations.Beta
import java.io.File
import java.util.EnumSet

Expand All @@ -29,7 +28,6 @@ import java.util.EnumSet
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
open class LintRequest(
/**
* The lint client requesting the lint check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.StringOption
import com.android.utils.SdkUtils
import com.android.utils.iterator
import com.google.common.annotations.Beta
import com.google.common.base.Splitter
import org.w3c.dom.Element
import org.xmlpull.v1.XmlPullParser
Expand Down Expand Up @@ -136,7 +135,6 @@ import kotlin.math.max
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
open class LintXmlConfiguration protected constructor(
configurations: ConfigurationHierarchy,
val configFile: File,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.android.tools.lint.detector.api.ResourceContext;
import com.android.tools.lint.detector.api.XmlContext;
import com.android.tools.lint.detector.api.XmlScanner;
import com.google.common.annotations.Beta;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -56,7 +55,6 @@
* <p><b>NOTE: This is not a public or final API; if you rely on this be prepared to adjust your
* code for the next tools release.</b>
*/
@Beta
class ResourceVisitor {
private final Map<String, List<XmlScanner>> elementToCheck = new HashMap<>();
private final Map<String, List<XmlScanner>> attributeToCheck = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

package com.android.tools.lint.client.api

import com.google.common.annotations.Beta

/**
* Information about SDKs
*
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class SdkInfo {
/**
* Returns true if the given child view is the same class or a sub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.android.tools.lint.client.api

import com.android.tools.lint.detector.api.JavaContext
import com.android.tools.lint.detector.api.Location
import com.google.common.annotations.Beta
import com.intellij.pom.java.LanguageLevel
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
Expand All @@ -36,7 +35,6 @@ import java.io.File
* **NOTE: This is not public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class UastParser {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.android.resources.ResourceType
import com.android.tools.lint.detector.api.Location
import com.android.tools.lint.detector.api.XmlContext
import com.android.utils.iterator
import com.google.common.annotations.Beta
import org.w3c.dom.Attr
import org.w3c.dom.Document
import org.w3c.dom.Element
Expand All @@ -43,7 +42,6 @@ import javax.xml.parsers.ParserConfigurationException
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
abstract class XmlParser {
/**
* Parse the given XML content and returns as a Document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

package com.android.tools.lint.detector.api

import com.google.common.annotations.Beta

/**
* A category is a container for related issues.
*
* **NOTE: This is not a public or final API; if you rely on this be
* prepared to adjust your code for the next tools release.**
*/
@Beta
data class Category
/**
* Creates a new [Category].
Expand Down
Loading

0 comments on commit 4e4b17e

Please sign in to comment.