Skip to content

Commit

Permalink
change: Disable SyntheticAccessor lint rule (#424)
Browse files Browse the repository at this point in the history
Does not appear to be adding value, and R8 optimises the code to remove
the generated accessors.
  • Loading branch information
nikclayton authored Feb 6, 2024
1 parent 5a51310 commit d01c72b
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 1,807 deletions.
1,595 changes: 0 additions & 1,595 deletions app/lint-baseline.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<!-- Set OldTargetApi back to warning -->
<issue id="OldTargetApi" severity="warning" />

<!-- Disable SyntheticAccessor warnings; R8 handles them effectively, see
https://github.com/google/dagger/issues/635#issuecomment-459110004 -->
<issue id="SyntheticAccessor" severity="ignore" />

<!-- Mark all other lint issues as errors -->
<issue id="all" severity="error" />
</lint>
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class NotificationsFragment :
actionButton?.visible(viewModel.uiState.value.showFabWhileScrolling || dy == 0)
}

@Suppress("SyntheticAccessor")
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
newState != SCROLL_STATE_IDLE && return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package app.pachli.components.trending

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
Expand Down Expand Up @@ -69,7 +68,6 @@ class TrendingActivity : BottomSheetActivity(), AppBarLayoutHost, MenuProvider {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
@SuppressLint("SyntheticAccessor")
override fun handleOnBackPressed() {
if (binding.pager.currentItem != 0) binding.pager.currentItem = 0 else finish()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package app.pachli.components.trending

import android.annotation.SuppressLint
import android.content.res.Configuration
import android.os.Bundle
import android.view.Menu
Expand Down Expand Up @@ -90,7 +89,6 @@ class TrendingTagsFragment :

adapter.registerAdapterDataObserver(
object : RecyclerView.AdapterDataObserver() {
@SuppressLint("SyntheticAccessor")
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
if (positionStart == 0 && adapter.itemCount != itemCount) {
binding.recyclerView.post {
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/app/pachli/fragment/ViewVideoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ViewVideoFragment : ViewMediaFragment() {
}

mediaPlayerListener = object : Player.Listener {
@SuppressLint("ClickableViewAccessibility", "SyntheticAccessor")
@SuppressLint("ClickableViewAccessibility")
@OptIn(UnstableApi::class)
override fun onPlaybackStateChanged(playbackState: Int) {
when (playbackState) {
Expand All @@ -238,7 +238,6 @@ class ViewVideoFragment : ViewMediaFragment() {
}
}

@SuppressLint("SyntheticAccessor")
override fun onPlayerError(error: PlaybackException) {
binding.progressBar.hide()
val message = getString(
Expand Down Expand Up @@ -337,7 +336,6 @@ class ViewVideoFragment : ViewMediaFragment() {
mediaAttachment.previewUrl?.let { url ->
Glide.with(this).load(url).into(
object : CustomTarget<Drawable>() {
@SuppressLint("SyntheticAccessor")
override fun onResourceReady(
resource: Drawable,
transition: Transition<in Drawable>?,
Expand All @@ -346,7 +344,6 @@ class ViewVideoFragment : ViewMediaFragment() {
binding.videoView.defaultArtwork = resource
}

@SuppressLint("SyntheticAccessor")
override fun onLoadCleared(placeholder: Drawable?) {
view ?: return
binding.videoView.defaultArtwork = null
Expand Down Expand Up @@ -408,7 +405,6 @@ class ViewVideoFragment : ViewMediaFragment() {
binding.mediaDescription.animate().alpha(alpha)
.setListener(
object : AnimatorListenerAdapter() {
@SuppressLint("SyntheticAccessor")
override fun onAnimationEnd(animation: Animator) {
view ?: return
binding.mediaDescription.visible(isDescriptionVisible)
Expand Down
11 changes: 0 additions & 11 deletions core/activity/lint-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
column="5"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `textStyle` of class `Companion` requires synthetic accessor"
errorLine1=" textStyle(sharedPreferencesRepository.getString(PrefKeys.STATUS_TEXT_SIZE, &quot;medium&quot;)!!)"
errorLine2=" ~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/activity/BaseActivity.kt"
line="104"
column="13"/>
</issue>

<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
Expand Down
68 changes: 1 addition & 67 deletions core/common/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,70 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.1.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.1.2)" variant="all" version="8.1.2">

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameDate` of class `Companion` requires synthetic accessor"
errorLine1=" isSameDate(time, now, tz) -> sameDaySdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="36"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameDate` of class `Companion` requires synthetic accessor"
errorLine1=" isSameDate(time, now, tz) -> sameDaySdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="36"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameDate` of class `Companion` requires synthetic accessor"
errorLine1=" isSameDate(time, now, tz) -> sameDaySdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="36"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameYear` of class `Companion` requires synthetic accessor"
errorLine1=" isSameYear(time, now, tz) -> sameYearSdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="37"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameYear` of class `Companion` requires synthetic accessor"
errorLine1=" isSameYear(time, now, tz) -> sameYearSdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="37"
column="13"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `isSameYear` of class `Companion` requires synthetic accessor"
errorLine1=" isSameYear(time, now, tz) -> sameYearSdf.format(time)"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/common/util/AbsoluteTimeFormatter.kt"
line="37"
column="13"/>
</issue>
<issues format="6" by="lint 8.2.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.2.2)" variant="all" version="8.2.2">

</issues>
24 changes: 1 addition & 23 deletions core/network/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.2.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.2.0)" variant="all" version="8.2.0">

<issue
id="SyntheticAccessor"
message="Access to `private` method `swapHost` of class `Companion` requires synthetic accessor"
errorLine1=" builder.url(swapHost(originalRequest.url, instanceHeader))"
errorLine2=" ~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/network/retrofit/InstanceSwitchAuthInterceptor.kt"
line="54"
column="29"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `swapHost` of class `Companion` requires synthetic accessor"
errorLine1=" builder.url(swapHost(originalRequest.url, it.domain))"
errorLine2=" ~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/core/network/retrofit/InstanceSwitchAuthInterceptor.kt"
line="59"
column="37"/>
</issue>
<issues format="6" by="lint 8.2.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.2.2)" variant="all" version="8.2.2">

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package app.pachli.feature.about

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.content.res.AppCompatResources
Expand Down Expand Up @@ -67,7 +66,6 @@ class AboutActivity : BottomSheetActivity(), MenuProvider {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
@SuppressLint("SyntheticAccessor")
override fun handleOnBackPressed() {
if (binding.pager.currentItem != 0) binding.pager.currentItem = 0 else finish()
}
Expand Down
99 changes: 0 additions & 99 deletions feature/login/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,105 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.2.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.2.2)" variant="all" version="8.2.2">

<issue
id="SyntheticAccessor"
message="Access to `private` method `canonicalizeDomain` of class `Companion` requires synthetic accessor"
errorLine1=" val domain = canonicalizeDomain(binding.domainEditText.text.toString())"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginActivity.kt"
line="159"
column="22"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `getBinding` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" binding.loginProgress.hide()"
errorLine2=" ~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="144"
column="17"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `getBinding` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" binding.loginProgress.hide()"
errorLine2=" ~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="144"
column="17"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Err(getString(R.string.error_could_not_load_login_page)))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="153"
column="17"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Err(getString(R.string.error_could_not_load_login_page)))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="153"
column="17"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Err(error))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="174"
column="25"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Err(error))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="174"
column="25"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Ok(code))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="177"
column="25"/>
</issue>

<issue
id="SyntheticAccessor"
message="Access to `private` method `sendResult` of class `LoginWebViewActivity` requires synthetic accessor"
errorLine1=" sendResult(LoginResult.Ok(code))"
errorLine2=" ~~~~~~~~~~">
<location
file="src/main/kotlin/app/pachli/feature/login/LoginWebViewActivity.kt"
line="177"
column="25"/>
</issue>

<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
Expand Down

0 comments on commit d01c72b

Please sign in to comment.