Skip to content

Instantly share code, notes, and snippets.

Avatar

Zac Sweers ZacSweers

View GitHub Profile
@ZacSweers
ZacSweers / MoshiBugReport.java
Last active Oct 7, 2020
Sample bug report for Moshi
View MoshiBugReport.java
package test;
import static com.google.common.truth.Truth.assertThat;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import org.junit.Test;
import java.io.IOException;
public class MoshiBugReport {
@ZacSweers
ZacSweers / 1-Before.txt
Last active Jun 21, 2020
Dagger new error messages output comparison
View 1-Before.txt
/Users/zsweers/dev/android/personal/CatchUp/app/build/generated/source/kapt/debug/io/sweers/catchup/app/CatchUpApplication_HiltComponents.java:188: error: [Dagger/DuplicateBindings] androidx.activity.ComponentActivity is bound multiple times:
public abstract static class ApplicationC implements ApplicationComponent,
^
@org.jetbrains.annotations.NotNull @io.sweers.catchup.injection.scopes.PerActivity @Binds androidx.activity.ComponentActivity io.sweers.catchup.injection.ActivityModule.provideComponentActivity(T)
@org.jetbrains.annotations.NotNull @io.sweers.catchup.injection.scopes.PerActivity @Binds androidx.activity.ComponentActivity io.sweers.catchup.ui.about.AboutActivity.Module.provideComponentActivity(io.sweers.catchup.ui.about.AboutActivity)
@org.jetbrains.annotations.NotNull @io.sweers.catchup.injection.scopes.PerActivity @Binds androidx.activity.ComponentActivity io.sweers.catchup.ui.activity.MainActivity.ServiceIntegrationModule.provideComponentActivity(io
@ZacSweers
ZacSweers / WeakMutableSet.kt
Created Oct 25, 2019
A weak Set & MutableSet implementation in Kotlin.
View WeakMutableSet.kt
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* glassfish/bootstrap/legal/CDDLv1.0.txt or
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
View InlineMask.kt
// Code generated by moshi-kotlin-codegen. Do not edit.
package com.squareup.moshi.kotlin.codgen
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.internal.Util
import java.lang.NullPointerException
@ZacSweers
ZacSweers / After.kt
Created Sep 8, 2019
Missing/null property before/after
View After.kt
// Code generated by moshi-kotlin-codegen. Do not edit.
package com.squareup.moshi.kotlin.codgen
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.internal.Util
import java.lang.NullPointerException
View SmokeTestTypeJsonAdapter.kt
// Code generated by moshi-kotlin-codegen. Do not edit.
package com.squareup.moshi.kotlin.codgen
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.internal.Util
View KotlinTypes.kt
fun String.extension(): String = removePrefix("hello")
val lambda: (String) -> String = { it.removePrefix("hello") }
val lambdaWithReceiver: String.() -> String = { removePrefix("hello") }
fun function(arg: (String) -> String) {
}
fun function2(arg: String.() -> String) {
}
@ZacSweers
ZacSweers / BlurrinessDetection.kt
Last active Oct 12, 2020
Demo implementation of client-side image blurriness detection on Android using renderscript.
View BlurrinessDetection.kt
/*
* Copyright (c) 2018. Uber Technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View RxJavaErrors (with nullaway)
> Task :compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
warning: [options] source value 1.6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/Users/zsweers/dev/java/contributing/RxJava/src/main/java/io/reactivex/Single.java:135: error: [NullAway] passing @Nullable parameter 'null' where @NonNull is required
return RxJavaPlugins.onAssembly(new SingleAmb<T>(null, sources));
^
(see http://t.uber.com/nullaway )
/Users/zsweers/dev/java/contributing/RxJava/src/main/java/io/reactivex/Single.java:163: error: [NullAway] passing @Nullable parameter 'null' where @NonNull is required
You can’t perform that action at this time.