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

False positive on DeprecatedCall for WebView constructor #268

Open
edenman opened this issue Apr 29, 2024 · 10 comments
Open

False positive on DeprecatedCall for WebView constructor #268

edenman opened this issue Apr 29, 2024 · 10 comments

Comments

@edenman
Copy link

edenman commented Apr 29, 2024

As far as I can tell, WebView is not actually deprecated, but slack-lint is claiming that it is. Maybe something wrong with the annotation detector?

Lint found 6 errors, 0 warnings (10 errors filtered by baseline lint-baseline.xml). First failure:

/Users/edenman/workspace/doggifs/src/main/java/org/coffeetrain/doggifs/SetAvailableGifsScreenView.kt:23: Error: android.webkit.WebView.WebView is deprecated; consider using an alternative. [DeprecatedCall from slack-lint]
    val foo = WebView(context).apply {

Repro project: https://github.com/edenman/doggifs/compare/edenman/webview-deprecated?expand=1

@edenman
Copy link
Author

edenman commented Apr 29, 2024

Maybe it's confused because there is a different constructor that is deprecated?

@Deprecated
    public WebView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
            boolean privateBrowsing)

@ZacSweers
Copy link
Collaborator

ah, thanks for the report. Maybe we're not resolving the correct constructor from the callsite

@edenman
Copy link
Author

edenman commented May 24, 2024

Also getting similar stuff in media3

Error: androidx.media3.common.MediaItem.fromUri is deprecated; consider using an alternative. [DeprecatedCall from slack-lint]
            HlsMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(newVariant.url))
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We're using latest on both: media3 1.3.1 and slack lint 0.7.3

@ZacSweers
Copy link
Collaborator

I think this is a bug in lint, we're just using their AbstractAnnotationDetector() and it's handing us these symbols. It seems it's resolving the wrong one when resolving overloads. Do you see it in Lint 8.7+?

@edenman
Copy link
Author

edenman commented Oct 3, 2024

We're not ready to update to agp 8.7 yet, Ladybug is too unstable. I'll try again in a couple months and report back

@ZacSweers
Copy link
Collaborator

You can update lint separately from agp fwiw

@ZacSweers
Copy link
Collaborator

@kozaxinan
Copy link

kozaxinan commented Oct 4, 2024

I updated repro repo with new agp. https://github.com/kozaxinan/lint-investigation
the issue still exists on new agp and lint.

@ZacSweers
Copy link
Collaborator

Could you file an issue on the Android lint issue tracker? At this point it's not really something we can control, it appears lint is reporting the wrong overload

@kozaxinan
Copy link

I reported to Google. https://issuetracker.google.com/issues/371686443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants