Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new pull request by comparing changes across two branches #202

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ private MethodAndStaticVar generateStaticMethodEquivalentForRequestOptionsStatic
return new MethodAndStaticVar(methodSpecBuilder.build(), requiredStaticField);
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
private static boolean memoizeStaticMethodFromArguments(ExecutableElement staticMethod) {
return staticMethod.getParameters().isEmpty()
|| (staticMethod.getParameters().size() == 1
Expand Down
6 changes: 6 additions & 0 deletions annotation/ksp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ dependencies {
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
10 changes: 10 additions & 0 deletions annotation/ksp/integrationtest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ android {
targetSdk libs.versions.target.sdk.version.get() as int
versionName VERSION_NAME as String
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

dependencies {
Expand Down
10 changes: 10 additions & 0 deletions annotation/ksp/test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ android {
targetSdk libs.versions.target.sdk.version.get() as int
versionName VERSION_NAME as String
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

dependencies {
Expand Down
3 changes: 3 additions & 0 deletions benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {
versionName "1.0"

testInstrumentationRunner 'androidx.benchmark.junit4.AndroidBenchmarkRunner'
multiDexEnabled true
}

buildTypes {
Expand All @@ -33,6 +34,8 @@ android {
}

dependencies {
implementation libs.androidx.multidex

androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.junit
Expand Down
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ subprojects { project ->
}
}

afterEvaluate {
if (project.plugins.hasPlugin("com.android.application")) {
project.dependencies {
// Hack around some version mismatches: https://stackoverflow.com/questions/75263047/duplicate-class-in-kotlin-android
implementation(platform(libs.kotlin.bom))
}
}
}

tasks.withType(JavaCompile) {
// gifencoder is a legacy project that has a ton of warnings and is basically never
// modified, so we're not going to worry about cleaning it up.
Expand Down Expand Up @@ -160,7 +169,7 @@ subprojects { project ->
apply plugin: 'checkstyle'

checkstyle {
toolVersion = '8.5'
toolVersion = '8.45.1'
}

checkstyle {
Expand Down
4 changes: 3 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
<property name="message" value="Space needed around ':' character."/>
</module>

<module name="SuppressWarningsFilter" />
<module name="TreeWalker">
<module name="SuppressWarningsHolder" />

<!-- Checks for uncommented main() methods (debugging leftovers). -->
<!-- Checks that long constants are defined with an upper ell. -->
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UpperEll -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public ByteBuffer getFirstBuffer(UrlResponseInfo info) {
return ByteBuffer.allocateDirect((int) Math.min(bufferSizeHeuristic(info), 524288));
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
private static long bufferSizeHeuristic(UrlResponseInfo info) {
final Map<String, List<String>> headers = info.getAllHeaders();
if (headers.containsKey(CONTENT_LENGTH)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private static Looper getBackgroundLooper() {
return workThread.getLooper();
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
private void openIfNotOpen() {
if (!isOpen) {
synchronized (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public boolean isDataCacheable(DataSource dataSource) {
return dataSource == DataSource.REMOTE;
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
@Override
public boolean isResourceCacheable(
boolean isFromAlternateCacheKey, DataSource dataSource, EncodeStrategy encodeStrategy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private boolean mayFillRequest(int requestedSize, Integer actualSize) {
}

private boolean isNoMoreThanHalfFull() {
return currentSize == 0 || (maxSize / currentSize >= 2);
return currentSize == 0 || maxSize / currentSize >= 2;
}

@Override
Expand All @@ -135,7 +135,7 @@ public synchronized void clearMemory() {
}

@Override
public synchronized void trimMemory(int level) {
public synchronized void trimMemory(int level){
if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_BACKGROUND) {
clearMemory();
} else if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,19 @@ public void clearMemory() {
trimToSize(0);
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
@SuppressLint("InlinedApi")
@Override
public void trimMemory(int level) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "trimMemory, level=" + level);
}
if ((level >= ComponentCallbacks2.TRIM_MEMORY_BACKGROUND)
|| ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
&& (level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN))) {
if (level >= ComponentCallbacks2.TRIM_MEMORY_BACKGROUND
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN)) {
clearMemory();
} else if ((level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN)
|| (level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL)) {
} else if (level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN
|| level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
trimToSize(getMaxSize() / 2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public File getCacheDirectory() {

// Already used internal cache, so keep using that one,
// thus avoiding using both external and internal with transient errors.
if ((null != internalCacheDirectory) && internalCacheDirectory.exists()) {
if (internalCacheDirectory != null && internalCacheDirectory.exists()) {
return internalCacheDirectory;
}

File cacheDirectory = context.getExternalCacheDir();

// Shared storage is not available.
if ((cacheDirectory == null) || (!cacheDirectory.canWrite())) {
if (cacheDirectory == null || !cacheDirectory.canWrite()) {
return internalCacheDirectory;
}
if (diskCacheName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public int read(byte[] buffer, int byteCount) throws IOException {
int numBytesRead = 0;
int lastReadResult = 0;
while (numBytesRead < byteCount
&& ((lastReadResult = is.read(buffer, numBytesRead, byteCount - numBytesRead)) != -1)) {
&& (lastReadResult = is.read(buffer, numBytesRead, byteCount - numBytesRead)) != -1) {
numBytesRead += lastReadResult;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ boolean handles(InputStream is) throws IOException {
return isHandled(ImageHeaderParserUtils.getType(imageHeaderParsers, is, arrayPool));
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
private boolean isHandled(ImageType imageType) {
return imageType == ImageType.ANIMATED_WEBP
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && imageType == ImageType.ANIMATED_AVIF);
Expand Down
4 changes: 0 additions & 4 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true,
"automergeType": "branch"
},
{
"matchPackageNames": ["androidx.fragment:fragment"],
"allowedVersions": "1.4.1"
}
]
}
20 changes: 11 additions & 9 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,22 @@ dependencyResolutionManagement {
version('okhttp-min-sdk-version', '21')
version('target-sdk-version', '32')
version('pmd', '6.0.0')
version('kotlin-compiler-extension', '1.2.0')
// 1.5.3 requires Kotlin 1.9.x, which doesn't seem to be supported by the coroutines
// libraries: https://github.com/Kotlin/kotlinx.coroutines/issues/3812
version('kotlin-compiler-extension', '1.4.8')

// Versions for dependencies
version('compose', '1.5.0')
version('compose', '1.5.1')
version('coroutines', '1.7.3')
version('dagger', '2.47')
version('errorprone', '2.18.0')
version('kotlin', '1.7.0')
version('kotlin', '1.8.22')
version('mockito', '5.3.1')
version('retrofit', '2.3.0')
version('androidx-benchmark', '1.2.0-beta05')
version('androidx-espresso', '3.5.1')
// Newer versions depend on different kotlin versions causing duplicate class paths:
version('androidx-fragment', '1.4.1')
version('ksp', '1.7.0-1.0.6')
version('androidx-fragment', '1.6.1')
version('ksp', '1.8.22-1.0.11')

library('androidx-multidex', "androidx.multidex:multidex:2.0.1")
library('autoservice', 'com.google.auto.service:auto-service:1.0-rc3')
Expand All @@ -74,10 +75,10 @@ dependencyResolutionManagement {
library('androidx-cardview', 'androidx.cardview:cardview:1.0.0')
library('androidx-core', 'androidx.core:core:1.6.0')
library('androidx-annotation', 'androidx.annotation:annotation:1.6.0')
library('androidx-appcompat', 'androidx.appcompat:appcompat:1.4.0')
library('androidx-appcompat', 'androidx.appcompat:appcompat:1.6.1')
library('androidx-benchmark.gradle', 'androidx.benchmark', 'benchmark-gradle-plugin').versionRef('androidx-benchmark')
library('androidx-benchmark.junit', 'androidx.benchmark', 'benchmark-junit4').versionRef('androidx-benchmark')
library('androidx-core.ktx', 'androidx.core:core-ktx:1.8.0')
library('androidx-core.ktx', 'androidx.core:core-ktx:1.12.0')
library('androidx-espresso', 'androidx.test.espresso', 'espresso-core').versionRef('androidx-espresso')
library('androidx-espresso.idling', 'androidx.test.espresso.idling', 'idling-concurrent').versionRef('androidx-espresso')
library('androidx-exifinterface', 'androidx.exifinterface:exifinterface:1.3.6')
Expand Down Expand Up @@ -121,7 +122,8 @@ dependencyResolutionManagement {
library('kotlin-junit', 'org.jetbrains.kotlin', 'kotlin-test-junit').versionRef('kotlin')
library('kotlin-jdk7', 'org.jetbrains.kotlin', 'kotlin-stdlib-jdk7').versionRef('kotlin')
library('kotlin-gradle', 'org.jetbrains.kotlin', 'kotlin-gradle-plugin').versionRef('kotlin')
library('kotlin-test', 'org.jetbrains.kotlin:kotlin-test:1.7.0')
library('kotlin-test', 'org.jetbrains.kotlin', 'kotlin-test').versionRef('kotlin')
library('kotlin-bom', 'org.jetbrains.kotlin', 'kotlin-bom').versionRef('kotlin')
library('kotlinpoet', 'com.squareup:kotlinpoet:1.12.0')
library('ksp', 'com.google.devtools.ksp', 'symbol-processing-api').versionRef('ksp')
library('ksp-autoservice', 'dev.zacsweers.autoservice:auto-service-ksp:1.0.0')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private void readNetscapeExt() {
int b2 = ((int) block[2]) & MASK_INT_LOWEST_BYTE;
header.loopCount = (b2 << 8) | b1;
}
} while ((blockSize > 0) && !err());
} while (blockSize > 0 && !err());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void advance() {
@Override
public int getDelay(int n) {
int delay = -1;
if ((n >= 0) && (n < header.frameCount)) {
if (n >= 0 && n < header.frameCount) {
delay = header.frames.get(n).delay;
}
return delay;
Expand Down Expand Up @@ -499,6 +499,7 @@ private Bitmap setPixels(GifFrame currentFrame, GifFrame previousFrame) {
return result;
}

@SuppressWarnings("checkstyle:UnnecessaryParentheses") // Readability
private void copyIntoScratchFast(GifFrame currentFrame) {
int[] dest = mainScratch;
int downsampledIH = currentFrame.ih;
Expand Down Expand Up @@ -807,7 +808,7 @@ private void decodeBitmapData(GifFrame frame) {
prefix[available] = (short) oldCode;
suffix[available] = (byte) first;
++available;
if (((available & codeMask) == 0) && (available < MAX_STACK_SIZE)) {
if ((available & codeMask) == 0 && available < MAX_STACK_SIZE) {
++codeSize;
codeMask += available;
}
Expand Down
Loading