From f45d4248aa1e03f0e04323afdbd4a24bfdb441ef Mon Sep 17 00:00:00 2001 From: Agi Sferro Date: Wed, 8 Dec 2021 23:55:52 +0000 Subject: [PATCH] Bug 1724480 - Upgrade to apilint 0.5.1. r=calu Differential Revision: https://phabricator.services.mozilla.com/D132530 --- build.gradle | 2 +- mobile/android/geckoview/api.txt | 47 ++++++++++--------- mobile/android/geckoview/build.gradle | 5 +- .../java/org/mozilla/geckoview/GeckoView.java | 2 +- .../mozilla/geckoview/doc-files/CHANGELOG.md | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 719001be9971..1a530743e331 100644 --- a/build.gradle +++ b/build.gradle @@ -101,7 +101,7 @@ buildscript { ext.kotlin_version = '1.5.20' dependencies { - classpath 'org.mozilla.apilint:apilint:0.4.4' + classpath 'org.mozilla.apilint:apilint:0.5.1' classpath 'com.android.tools.build:gradle:4.2.0' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2' classpath 'org.apache.commons:commons-exec:1.3' diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt index 06cb33581590..d4d41a513eec 100644 --- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -56,7 +56,9 @@ import java.lang.String; import java.lang.Throwable; import java.lang.Void; import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.net.InetAddress; import java.nio.ByteBuffer; @@ -156,11 +158,11 @@ package org.mozilla.geckoview { method @AnyThread @NonNull public Autocomplete.Address.Builder tel(@Nullable String); } - public static class Autocomplete.AddressSaveOption extends Autocomplete.SaveOption { + public static class Autocomplete.AddressSaveOption extends Autocomplete.SaveOption { ctor public AddressSaveOption(@NonNull Autocomplete.Address); } - public static class Autocomplete.AddressSelectOption extends Autocomplete.SelectOption { + public static class Autocomplete.AddressSelectOption extends Autocomplete.SelectOption { ctor public AddressSelectOption(@NonNull Autocomplete.Address); } @@ -189,11 +191,11 @@ package org.mozilla.geckoview { method @AnyThread @NonNull public Autocomplete.CreditCard.Builder number(@Nullable String); } - public static class Autocomplete.CreditCardSaveOption extends Autocomplete.SaveOption { + public static class Autocomplete.CreditCardSaveOption extends Autocomplete.SaveOption { ctor public CreditCardSaveOption(@NonNull Autocomplete.CreditCard); } - public static class Autocomplete.CreditCardSelectOption extends Autocomplete.SelectOption { + public static class Autocomplete.CreditCardSelectOption extends Autocomplete.SelectOption { ctor public CreditCardSelectOption(@NonNull Autocomplete.CreditCard); } @@ -224,11 +226,11 @@ package org.mozilla.geckoview { method @AnyThread @NonNull public Autocomplete.LoginEntry.Builder username(@NonNull String); } - public static class Autocomplete.LoginSaveOption extends Autocomplete.SaveOption { + public static class Autocomplete.LoginSaveOption extends Autocomplete.SaveOption { ctor public LoginSaveOption(@NonNull Autocomplete.LoginEntry); } - public static class Autocomplete.LoginSelectOption extends Autocomplete.SelectOption { + public static class Autocomplete.LoginSelectOption extends Autocomplete.SelectOption { ctor public LoginSelectOption(@NonNull Autocomplete.LoginEntry); } @@ -238,7 +240,7 @@ package org.mozilla.geckoview { field @NonNull public final T value; } - public abstract static class Autocomplete.SaveOption extends Autocomplete.Option { + public abstract static class Autocomplete.SaveOption extends Autocomplete.Option { ctor public SaveOption(@NonNull T, int); } @@ -249,7 +251,7 @@ package org.mozilla.geckoview { field public static final int NONE = 0; } - public abstract static class Autocomplete.SelectOption extends Autocomplete.Option { + public abstract static class Autocomplete.SelectOption extends Autocomplete.Option { ctor public SelectOption(@NonNull T, int); } @@ -500,7 +502,7 @@ package org.mozilla.geckoview { field public static final Parcelable.Creator CREATOR; } - @AnyThread public static class ContentBlocking.Settings.Builder extends RuntimeSettings.Builder { + @AnyThread public static class ContentBlocking.Settings.Builder extends RuntimeSettings.Builder { ctor public Builder(); method @NonNull public ContentBlocking.Settings.Builder antiTracking(int); method @NonNull public ContentBlocking.Settings.Builder cookieBehavior(int); @@ -567,7 +569,7 @@ package org.mozilla.geckoview { method @AnyThread @NonNull public static GeckoResult sendCrashReport(@NonNull String, @NonNull File, @NonNull JSONObject); } - @Documented @Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME) @Target(value={java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.LOCAL_VARIABLE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PACKAGE, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE}) public interface DeprecationSchedule { + @Documented @Retention(value=RetentionPolicy.RUNTIME) @Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}) public interface DeprecationSchedule { element public String id(); element public int version(); } @@ -602,7 +604,7 @@ package org.mozilla.geckoview { ctor public GeckoResult(GeckoResult); method @NonNull public GeckoResult accept(@Nullable GeckoResult.Consumer); method @NonNull public GeckoResult accept(@Nullable GeckoResult.Consumer, @Nullable GeckoResult.Consumer); - method @NonNull @SafeVarargs public static GeckoResult> allOf(@NonNull GeckoResult); + method @NonNull @SafeVarargs public static GeckoResult> allOf(@NonNull GeckoResult...); method @NonNull public static GeckoResult> allOf(@Nullable List>); method @AnyThread @NonNull public static GeckoResult allow(); method @NonNull public synchronized GeckoResult cancel(); @@ -712,7 +714,7 @@ package org.mozilla.geckoview { method @Nullable public String getConfigFilePath(); method public boolean getConsoleOutputEnabled(); method @NonNull public ContentBlocking.Settings getContentBlocking(); - method @Nullable public Class getCrashHandler(); + method @Nullable public Class getCrashHandler(); method @Nullable public Float getDisplayDensityOverride(); method @Nullable public Integer getDisplayDpiOverride(); method public boolean getDoubleTapZoomingEnabled(); @@ -764,7 +766,7 @@ package org.mozilla.geckoview { field public static final int HTTPS_ONLY_PRIVATE = 1; } - @AnyThread public static final class GeckoRuntimeSettings.Builder extends RuntimeSettings.Builder { + @AnyThread public static final class GeckoRuntimeSettings.Builder extends RuntimeSettings.Builder { ctor public Builder(); method @NonNull public GeckoRuntimeSettings.Builder aboutConfigEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder allowInsecureConnections(int); @@ -773,7 +775,7 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings.Builder configFilePath(@Nullable String); method @NonNull public GeckoRuntimeSettings.Builder consoleOutput(boolean); method @NonNull public GeckoRuntimeSettings.Builder contentBlocking(@NonNull ContentBlocking.Settings); - method @NonNull public GeckoRuntimeSettings.Builder crashHandler(@Nullable Class); + method @NonNull public GeckoRuntimeSettings.Builder crashHandler(@Nullable Class); method @NonNull public GeckoRuntimeSettings.Builder debugLogging(boolean); method @NonNull public GeckoRuntimeSettings.Builder displayDensityOverride(float); method @NonNull public GeckoRuntimeSettings.Builder displayDpiOverride(int); @@ -947,7 +949,7 @@ package org.mozilla.geckoview { method @AnyThread @NonNull default public String getUri(); } - public static interface GeckoSession.HistoryDelegate.HistoryList implements List { + public static interface GeckoSession.HistoryDelegate.HistoryList implements List { method @AnyThread default public int getCurrentIndex(); } @@ -1169,6 +1171,10 @@ package org.mozilla.geckoview { field @Nullable public final String title; } + protected static interface GeckoSession.PromptDelegate.BasePrompt.Observer { + method @AnyThread default public void onPromptCompleted(@NonNull GeckoSession.PromptDelegate.BasePrompt); + } + public static class GeckoSession.PromptDelegate.BeforeUnloadPrompt extends GeckoSession.PromptDelegate.BasePrompt { ctor protected BeforeUnloadPrompt(@NonNull String, @NonNull GeckoSession.PromptDelegate.BasePrompt.Observer); method @NonNull @UiThread public GeckoSession.PromptDelegate.PromptResponse confirm(@Nullable AllowOrDeny); @@ -1347,7 +1353,7 @@ package org.mozilla.geckoview { field @NonNull public final String text; } - @AnyThread public static class GeckoSession.SessionState extends AbstractSequentialList implements GeckoSession.HistoryDelegate.HistoryList Parcelable { + @AnyThread public static class GeckoSession.SessionState extends AbstractSequentialList implements Parcelable GeckoSession.HistoryDelegate.HistoryList { ctor public SessionState(@NonNull GeckoSession.SessionState); method @Nullable public static GeckoSession.SessionState fromString(@Nullable String); method public void readFromParcel(@NonNull Parcel); @@ -1440,9 +1446,12 @@ package org.mozilla.geckoview { ctor public GeckoView(Context, AttributeSet); method @NonNull @UiThread public GeckoResult capturePixels(); method public void coverUntilFirstPaint(int); + method public void dispatchDraw(@Nullable Canvas); method public boolean getAutofillEnabled(); method @NonNull public PanZoomController getPanZoomController(); method @AnyThread @Nullable public GeckoSession getSession(); + method public void onAttachedToWindow(); + method public void onDetachedFromWindow(); method @NonNull public GeckoResult onTouchEventForDetailResult(@NonNull MotionEvent); method @Nullable @UiThread public GeckoSession releaseSession(); method public void setAutofillEnabled(boolean); @@ -1636,7 +1645,7 @@ package org.mozilla.geckoview { method @AnyThread default public void onStringScalar(@NonNull RuntimeTelemetry.Metric); } - public static class RuntimeTelemetry.Histogram extends RuntimeTelemetry.Metric { + public static class RuntimeTelemetry.Histogram extends RuntimeTelemetry.Metric { ctor protected Histogram(); field public final boolean isCategorical; } @@ -2188,9 +2197,5 @@ package org.mozilla.geckoview { method @NonNull public WebResponse.Builder statusCode(int); } - protected static interface GeckoSession.PromptDelegate.BasePrompt.Observer { - method @AnyThread default public void onPromptCompleted(@NonNull GeckoSession.PromptDelegate.BasePrompt); - } - } diff --git a/mobile/android/geckoview/build.gradle b/mobile/android/geckoview/build.gradle index 437dbf3ffa70..1c2a58366202 100644 --- a/mobile/android/geckoview/build.gradle +++ b/mobile/android/geckoview/build.gradle @@ -596,7 +596,10 @@ apiLint { // TODO: Change this to `org` after hiding org.mozilla.gecko packageFilter = 'org.mozilla.geckoview' changelogFileName = 'src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md' - skipClassesRegex = ['^org.mozilla.geckoview.BuildConfig$'] + skipClassesRegex = [ + '^org.mozilla.geckoview.BuildConfig$', + '^org.mozilla.geckoview.R$', + ] lintFilters = ['GV'] deprecationAnnotation = 'org.mozilla.geckoview.DeprecationSchedule' libraryVersion = mozconfig.substs.MOZILLA_VERSION.split('\\.')[0] as Integer diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java index 96ff22e17bc5..3f1dcbe0b920 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java @@ -711,7 +711,7 @@ public class GeckoView extends FrameLayout { } @Override - public void dispatchDraw(final Canvas canvas) { + public void dispatchDraw(final @Nullable Canvas canvas) { super.dispatchDraw(canvas); if (mSession != null) { diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md index ab2a05f2b7d7..a6ad67c0d6d9 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md @@ -1107,4 +1107,4 @@ to allow adding gecko profiler markers. [65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String- [65.25]: {{javadoc_uri}}/GeckoResult.html -[api-version]: f109d55f4da6ba24b94fa8cb8f42fe7e68d11426 +[api-version]: fca366198e2c55035433eb9bc148b1bec846d069