diff --git a/build.gradle b/build.gradle index f5a9444c..d4bf36e7 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.2.1' } } @@ -16,6 +16,6 @@ allprojects { } ext { - compileSdkVersion = 28 - targetSdkVersion = 28 + compileSdkVersion = 29 + targetSdkVersion = 29 } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 81cad747..946d06f1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/stetho-js-rhino/README.md b/stetho-js-rhino/README.md index c2c07608..2b3ef9ab 100644 --- a/stetho-js-rhino/README.md +++ b/stetho-js-rhino/README.md @@ -7,7 +7,7 @@ This [Stetho](https://facebook.github.io/stetho) plugin adds a JavaScript consol ### Download Download [the latest JARs](https://github.com/facebook/stetho/releases/latest) or grab via Gradle: ```groovy -compile 'com.facebook.stetho:stetho-js-rhino:1.4.2' +implementation 'com.facebook.stetho:stetho-js-rhino:1.4.2' ``` or Maven: ```xml diff --git a/stetho-js-rhino/build.gradle b/stetho-js-rhino/build.gradle index 7a4d3c40..f5912415 100644 --- a/stetho-js-rhino/build.gradle +++ b/stetho-js-rhino/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - minSdkVersion 9 + minSdkVersion 14 targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" @@ -19,9 +19,9 @@ android { dependencies { implementation project(':stetho') - implementation 'com.google.code.findbugs:jsr305:2.0.1' + implementation 'com.google.code.findbugs:jsr305:2.0.3' implementation 'org.mozilla:rhino:1.7.6' - implementation 'com.android.support:support-annotations:28.0.0' + implementation 'androidx.annotation:annotation:1.1.0' testImplementation 'junit:junit:4.12' } diff --git a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsFormat.java b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsFormat.java index 83a82ff5..0321efab 100644 --- a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsFormat.java +++ b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsFormat.java @@ -7,12 +7,12 @@ package com.facebook.stetho.rhino; -import android.support.annotation.NonNull; - import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; +import androidx.annotation.NonNull; + /** *
Formatter that tries to mimic
console.log()'s format as close as possible. * @@ -64,6 +64,7 @@ public char charAt(int index) { return array[start + index]; } + @NonNull @Override public CharSequence subSequence(int start, int end) { return new ArrayCharSequence(array, this.start + start, this.start + end); @@ -124,7 +125,7 @@ public CharSequence subSequence(int start, int end) { } // Analyze the format. We don't have named captures in android yet so we will inspect - // the groups. They are each optional but we can find out which one is whic easily. + // the groups. They are each optional but we can find out which one is which easily. // Remember that we want to parse: %[argument_index$][flags][width][.precision]conversion // // - `index` ends with '$' diff --git a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeRepl.java b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeRepl.java index 4dbe33dc..b8512ee7 100644 --- a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeRepl.java +++ b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeRepl.java @@ -7,12 +7,15 @@ package com.facebook.stetho.rhino; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + import com.facebook.stetho.inspector.console.RuntimeRepl; + import org.mozilla.javascript.Context; import org.mozilla.javascript.ScriptableObject; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + class JsRuntimeRepl implements RuntimeRepl { private final @NonNull ScriptableObject mJsScope; @@ -22,7 +25,8 @@ class JsRuntimeRepl implements RuntimeRepl { } @Override - public @Nullable Object evaluate(@NonNull String expression) throws Throwable { + public @Nullable + Object evaluate(@NonNull String expression) throws Throwable { Object result; final Context jsContext = enterJsContext(); try { diff --git a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeReplFactoryBuilder.java b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeReplFactoryBuilder.java index 655677f6..5af647d4 100644 --- a/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeReplFactoryBuilder.java +++ b/stetho-js-rhino/src/main/java/com/facebook/stetho/rhino/JsRuntimeReplFactoryBuilder.java @@ -7,13 +7,14 @@ package com.facebook.stetho.rhino; -import android.support.annotation.NonNull; import android.util.Log; + import com.facebook.stetho.common.LogUtil; import com.facebook.stetho.inspector.console.CLog; import com.facebook.stetho.inspector.console.RuntimeRepl; import com.facebook.stetho.inspector.console.RuntimeReplFactory; import com.facebook.stetho.inspector.protocol.module.Console; + import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.ImporterTopLevel; @@ -26,6 +27,8 @@ import java.util.Map; import java.util.Set; +import androidx.annotation.NonNull; + /** *
Builder used to setup the javascript runtime to be used by stetho.
* diff --git a/stetho-okhttp/build.gradle b/stetho-okhttp/build.gradle index 87050b99..1e635eca 100644 --- a/stetho-okhttp/build.gradle +++ b/stetho-okhttp/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - minSdkVersion 9 + minSdkVersion 14 targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" @@ -21,7 +21,7 @@ android { dependencies { implementation project(':stetho') - implementation 'com.google.code.findbugs:jsr305:2.0.1' + implementation 'com.google.code.findbugs:jsr305:2.0.3' implementation 'com.squareup.okhttp:okhttp:2.7.2' testImplementation 'junit:junit:4.12' @@ -29,12 +29,12 @@ dependencies { exclude module: 'commons-logging' exclude module: 'httpclient' } - testImplementation 'org.powermock:powermock-api-mockito:1.6.1' - testImplementation 'org.powermock:powermock-module-junit4:1.6.1' + testImplementation 'org.powermock:powermock-api-mockito:1.6.6' + testImplementation 'org.powermock:powermock-module-junit4:1.6.6' // Needed for Robolectric and PowerMock to be combined in a single test. - testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1' - testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1' + testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6' + testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6' testImplementation 'com.squareup.okhttp:mockwebserver:2.7.2' } diff --git a/stetho-okhttp3/build.gradle b/stetho-okhttp3/build.gradle index f9ab526c..653e073b 100644 --- a/stetho-okhttp3/build.gradle +++ b/stetho-okhttp3/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { - minSdkVersion 9 + minSdkVersion 14 targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" @@ -21,7 +21,7 @@ android { dependencies { implementation project(':stetho') - implementation 'com.google.code.findbugs:jsr305:2.0.1' + implementation 'com.google.code.findbugs:jsr305:2.0.3' implementation 'com.squareup.okhttp3:okhttp:3.4.2' testImplementation 'junit:junit:4.12' @@ -29,12 +29,12 @@ dependencies { exclude module: 'commons-logging' exclude module: 'httpclient' } - testImplementation 'org.powermock:powermock-api-mockito:1.6.1' - testImplementation 'org.powermock:powermock-module-junit4:1.6.1' + testImplementation 'org.powermock:powermock-api-mockito:1.6.6' + testImplementation 'org.powermock:powermock-module-junit4:1.6.6' // Needed for Robolectric and PowerMock to be combined in a single test. - testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1' - testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1' + testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6' + testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6' testImplementation 'com.squareup.okhttp3:mockwebserver:3.4.2' } diff --git a/stetho-sample/build.gradle b/stetho-sample/build.gradle index 25a3f966..5056ae45 100644 --- a/stetho-sample/build.gradle +++ b/stetho-sample/build.gradle @@ -10,7 +10,7 @@ android { defaultConfig { applicationId "com.facebook.stetho.sample" - minSdkVersion 11 + minSdkVersion 14 targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" @@ -43,8 +43,8 @@ dependencies { // way to express this is: // // dependencies { - // debugCompile 'com.facebook.stetho:stetho:
diff --git a/stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java b/stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java
index 60f39867..1c20ff78 100644
--- a/stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java
+++ b/stetho/src/main/java/com/facebook/stetho/inspector/helper/IntegerFormatter.java
@@ -9,9 +9,10 @@
import android.annotation.TargetApi;
import android.os.Build;
-import android.support.annotation.Nullable;
import android.view.ViewDebug;
+import androidx.annotation.Nullable;
+
public class IntegerFormatter {
private static IntegerFormatter cachedFormatter;
diff --git a/stetho/src/main/java/com/facebook/stetho/inspector/network/CountingOutputStream.java b/stetho/src/main/java/com/facebook/stetho/inspector/network/CountingOutputStream.java
index 3266bf61..32abcde4 100644
--- a/stetho/src/main/java/com/facebook/stetho/inspector/network/CountingOutputStream.java
+++ b/stetho/src/main/java/com/facebook/stetho/inspector/network/CountingOutputStream.java
@@ -11,6 +11,8 @@
import java.io.IOException;
import java.io.OutputStream;
+import androidx.annotation.NonNull;
+
class CountingOutputStream extends FilterOutputStream {
private long mCount;
@@ -29,12 +31,12 @@ public void write(int oneByte) throws IOException {
}
@Override
- public void write(byte[] buffer) throws IOException {
+ public void write(@NonNull byte[] buffer) throws IOException {
write(buffer, 0, buffer.length);
}
@Override
- public void write(byte[] buffer, int offset, int length) throws IOException {
+ public void write(@NonNull byte[] buffer, int offset, int length) throws IOException {
out.write(buffer, offset, length);
mCount += length;
}
diff --git a/stetho/src/main/java/com/facebook/stetho/inspector/network/DecompressionHelper.java b/stetho/src/main/java/com/facebook/stetho/inspector/network/DecompressionHelper.java
index 45d0a1e4..83193a32 100644
--- a/stetho/src/main/java/com/facebook/stetho/inspector/network/DecompressionHelper.java
+++ b/stetho/src/main/java/com/facebook/stetho/inspector/network/DecompressionHelper.java
@@ -10,12 +10,13 @@
import com.facebook.stetho.inspector.console.CLog;
import com.facebook.stetho.inspector.protocol.module.Console;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.InflaterOutputStream;
+import javax.annotation.Nullable;
+
// @VisibleForTest
public class DecompressionHelper {
static final String GZIP_ENCODING = "gzip";
@@ -39,7 +40,7 @@ public static InputStream teeInputWithDecompression(
decompressedCounter = new CountingOutputStream(decompressedOutput);
if (gzipEncoding) {
output = GunzippingOutputStream.create(decompressedCounter);
- } else if (deflateEncoding) {
+ } else {
output = new InflaterOutputStream(decompressedCounter);
}
} else {
diff --git a/stetho/src/main/java/com/facebook/stetho/inspector/network/ResponseHandlingInputStream.java b/stetho/src/main/java/com/facebook/stetho/inspector/network/ResponseHandlingInputStream.java
index 1da3a291..7abb7880 100644
--- a/stetho/src/main/java/com/facebook/stetho/inspector/network/ResponseHandlingInputStream.java
+++ b/stetho/src/main/java/com/facebook/stetho/inspector/network/ResponseHandlingInputStream.java
@@ -11,14 +11,15 @@
import com.facebook.stetho.inspector.helper.ChromePeerManager;
import com.facebook.stetho.inspector.protocol.module.Console;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.GuardedBy;
+
/**
* {@link InputStream} that caches the data as the data is read, and writes them to the given
* {@link OutputStream}. This also guarantees that we will attempt to reach EOF on the
@@ -105,12 +106,12 @@ public int read() throws IOException {
}
@Override
- public int read(byte[] b) throws IOException {
+ public int read(@Nonnull byte[] b) throws IOException {
return this.read(b, 0, b.length);
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(@Nonnull byte[] b, int off, int len) throws IOException {
try {
int result = checkEOF(in.read(b, off, len));
if (result != -1) {
diff --git a/stetho/src/main/java/com/facebook/stetho/inspector/protocol/module/DOMStorage.java b/stetho/src/main/java/com/facebook/stetho/inspector/protocol/module/DOMStorage.java
index 19845c25..246d6596 100644
--- a/stetho/src/main/java/com/facebook/stetho/inspector/protocol/module/DOMStorage.java
+++ b/stetho/src/main/java/com/facebook/stetho/inspector/protocol/module/DOMStorage.java
@@ -7,10 +7,9 @@
package com.facebook.stetho.inspector.protocol.module;
-import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
-import android.os.Build;
+
import com.facebook.stetho.inspector.console.CLog;
import com.facebook.stetho.inspector.domstorage.DOMStoragePeerManager;
import com.facebook.stetho.inspector.domstorage.SharedPreferencesHelper;
@@ -21,6 +20,7 @@
import com.facebook.stetho.inspector.protocol.ChromeDevtoolsMethod;
import com.facebook.stetho.json.ObjectMapper;
import com.facebook.stetho.json.annotation.JsonProperty;
+
import org.json.JSONException;
import org.json.JSONObject;
@@ -160,17 +160,12 @@ private static void assignByType(
} else if (value instanceof String) {
editor.putString(key, (String)value);
} else if (value instanceof Set) {
- putStringSet(editor, key, (Set