Skip to content

Commit

Permalink
Merge pull request element-hq#7885 from vector-im/feature/bma/fixLint
Browse files Browse the repository at this point in the history
Fix lint false positive
  • Loading branch information
bmarty authored Jan 6, 2023
2 parents 93021a6 + 0d2fb8e commit baa4663
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.matrix.android.sdk.internal.di

import androidx.annotation.Nullable
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonQualifier
import com.squareup.moshi.Moshi
Expand All @@ -28,7 +27,6 @@ import java.lang.reflect.Type
internal annotation class SerializeNulls {
companion object {
val JSON_ADAPTER_FACTORY: JsonAdapter.Factory = object : JsonAdapter.Factory {
@Nullable
override fun create(type: Type, annotations: Set<Annotation>, moshi: Moshi): JsonAdapter<*>? {
val nextAnnotations = Types.nextAnnotations(annotations, SerializeNulls::class.java)
?: return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.matrix.android.sdk.internal.network.interceptors

import androidx.annotation.NonNull
import okhttp3.logging.HttpLoggingInterceptor
import org.json.JSONArray
import org.json.JSONException
Expand All @@ -38,7 +37,7 @@ internal class FormattedJsonHttpLogger(
* @param message
*/
@Synchronized
override fun log(@NonNull message: String) {
override fun log(message: String) {
Timber.v(message)

// Try to log formatted Json only if there is a chance that [message] contains Json.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.matrix.android.sdk.internal.network.parsing

import androidx.annotation.Nullable
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
Expand All @@ -32,14 +31,12 @@ internal interface CheckNumberType {

companion object {
val JSON_ADAPTER_FACTORY = object : JsonAdapter.Factory {
@Nullable
override fun create(type: Type, annotations: Set<Annotation>, moshi: Moshi): JsonAdapter<*>? {
if (type !== Any::class.java) {
return null
}
val delegate: JsonAdapter<Any> = moshi.nextAdapter(this, Any::class.java, emptySet())
return object : JsonAdapter<Any?>() {
@Nullable
@Throws(IOException::class)
override fun fromJson(reader: JsonReader): Any? {
return if (reader.peek() !== JsonReader.Token.NUMBER) {
Expand Down
1 change: 1 addition & 0 deletions tools/lint/lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<issue id="UseValueOf" severity="error" />
<issue id="ObsoleteSdkInt" severity="error" />
<issue id="Recycle" severity="error" />
<issue id="KotlinNullnessAnnotation" severity="error" />
<issue id="KotlinPropertyAccess" severity="error" />
<issue id="DefaultLocale" severity="error" />
<issue id="CheckResult" severity="error" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package im.vector.app.core.resources

import android.content.res.Resources
import androidx.annotation.ArrayRes
import androidx.annotation.NonNull
import javax.inject.Inject

class StringArrayProvider @Inject constructor(private val resources: Resources) {
Expand All @@ -31,7 +30,6 @@ class StringArrayProvider @Inject constructor(private val resources: Resources)
* @return The string array associated with the resource, stripped of styled
* text information.
*/
@NonNull
fun getStringArray(@ArrayRes resId: Int): Array<String> {
return resources.getStringArray(resId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package im.vector.app.core.resources

import android.content.res.Resources
import androidx.annotation.NonNull
import androidx.annotation.PluralsRes
import androidx.annotation.StringRes
import javax.inject.Inject
Expand All @@ -32,7 +31,6 @@ class StringProvider @Inject constructor(private val resources: Resources) {
* @return The string data associated with the resource, stripped of styled
* text information.
*/
@NonNull
fun getString(@StringRes resId: Int): String {
return resources.getString(resId)
}
Expand All @@ -48,12 +46,10 @@ class StringProvider @Inject constructor(private val resources: Resources) {
* @return The string data associated with the resource, formatted and
* stripped of styled text information.
*/
@NonNull
fun getString(@StringRes resId: Int, vararg formatArgs: Any?): String {
return resources.getString(resId, *formatArgs)
}

@NonNull
fun getQuantityString(@PluralsRes resId: Int, quantity: Int, vararg formatArgs: Any?): String {
return resources.getQuantityString(resId, quantity, *formatArgs)
}
Expand Down

0 comments on commit baa4663

Please sign in to comment.