GithubHelp home page GithubHelp logo

Comments (12)

uvery9 avatar uvery9 commented on June 28, 2024 10

Convert Java File to Kotlin File can easily solve the problem.
image

from timber.

gmk57 avatar gmk57 commented on June 28, 2024 5

This only happens when calling from Java.

from timber.

niklasdahlheimer avatar niklasdahlheimer commented on June 28, 2024 2

This issue has also been discussed here.

@gmk57 has mentioned a ticket in the Android Studio bugtracker. The Google engineer noted that it could be an issue that Timber.plant() and Timber.DebugTree() resolve to different files:
Timber.plant get resolved to a binary .class while new Timber.DebugTree - to the sources, even if these 2 methods are in the same file. So it may be caused by the plugin itself or a way Android Studio attaches .aar libraries.

Probably also related to this bug in the kotlin plugin

Maybe this helps to find the cause of this issue?

from timber.

Chivorns avatar Chivorns commented on June 28, 2024 2

For workaround solution to avoid annoying warning message every time we stay on our Java class and to avoid the class appear in red color as it might confused with the error, I think you can try with my answer here: https://stackoverflow.com/a/75388643/7257373

from timber.

killvetrov avatar killvetrov commented on June 28, 2024 1

The issue is related to IDEA Kotlin plugin: https://youtrack.jetbrains.com/issue/KTIJ-19699/IDE-False-positive-type-mismatch-in-Java-code-for-Kotlin-nested-class-non-direct-inheritor-from-external-library

So recently this issue had been marked as fixed, stating that compiling libraries with Kotlin compiler 1.8 resolves this (properly writes InnerClasses attribute, details in recent issue comments). It is discussed whether Idea may get a workaround for highlighting of libraries compiled with earlier versions.

Again, to reiterate, this only concerns usage of Kotlin libraries in Java code, and is not Timber-specific issue. So I think this issue can be closed.

from timber.

gmk57 avatar gmk57 commented on June 28, 2024

If anybody could try to reproduce it in Intellij IDEA, that might me helpful. The issue may be neither in Timber nor in AS, but in Kotlin plugin, and in that case should be reported to JetBrains.

from timber.

JakeWharton avatar JakeWharton commented on June 28, 2024

Are you calling from a Java or Kotlin source file?

from timber.

NizarETH avatar NizarETH commented on June 28, 2024

Same issue too

Capture dโ€™eฬcran 2022-02-22 aฬ€ 16 39 00

from timber.

findyourexit avatar findyourexit commented on June 28, 2024

Convert Java File to Kotlin File can easily solve the problem. image

This is not a solution, this is a workaround.

from timber.

killvetrov avatar killvetrov commented on June 28, 2024

Let's be clear that this is just false positive highlighting in IDEA, code compiles fine. Title/comments of this issue make it look like a more severe problem. It is not specific to Timber, it manifests with many other Kotlin-first libraries consumed in Java code.

The issue is related to IDEA Kotlin plugin:
https://youtrack.jetbrains.com/issue/KTIJ-19699/IDE-False-positive-type-mismatch-in-Java-code-for-Kotlin-nested-class-non-direct-inheritor-from-external-library

Currently in backlog for next IDEA release 2022.2.

from timber.

Quyunshuo avatar Quyunshuo commented on June 28, 2024

Same problem, but we can wrap the initialization code with a Kotlin class.

from timber.

androidacy-user avatar androidacy-user commented on June 28, 2024

The issue is related to IDEA Kotlin plugin: https://youtrack.jetbrains.com/issue/KTIJ-19699/IDE-False-positive-type-mismatch-in-Java-code-for-Kotlin-nested-class-non-direct-inheritor-from-external-library

So recently this issue had been marked as fixed, stating that compiling libraries with Kotlin compiler 1.8 resolves this (properly writes InnerClasses attribute, details in recent issue comments). It is discussed whether Idea may get a workaround for highlighting of libraries compiled with earlier versions.

Again, to reiterate, this only concerns usage of Kotlin libraries in Java code, and is not Timber-specific issue. So I think this issue can be closed.

still would be awesome for timber to fix the issue - as stated in the google issue tracker, it needs compiled with a newer compiler to fix the issue. IntelliJ is hardly going to work around it themeselves.

from timber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.