Comments (12)
Convert Java File to Kotlin File can easily solve the problem.
from timber.
This only happens when calling from Java.
from timber.
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.
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.
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.
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.
Are you calling from a Java or Kotlin source file?
from timber.
Same issue too
from timber.
Convert Java File to Kotlin File can easily solve the problem.
This is not a solution, this is a workaround.
from timber.
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.
Same problem, but we can wrap the initialization code with a Kotlin class.
from timber.
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)
- Using 'Log' instead of 'Timber'
- Lint does not warn if format specifier missing
- ๐ Iโd like to add this to the ReadMe Documentation.
- Is it possible to make isLoggable() function public?
- Escape percent symbol? HOT 2
- Is there an MDC like logback? HOT 1
- Getting a parse error when using file logging
- Timber logs not showing in Android Studio Dolphin 2021.3.1 HOT 3
- Want to bypass Lint warning BinaryOperationInTimber HOT 2
- Could not load custom lint check jar
- Make Tree:tag protected instead of internal HOT 4
- Where are the priority codes? HOT 3
- Activo
- Still `new Timber.DebugTree()` cannot be coded in Java HOT 10
- Distribution as a jar artifact HOT 2
- Gftrlgxsi
- Timber.d with %chinese throw UnknownFormatConversionException HOT 1
- https://jakewharton.github.io/timber/docs/5.x/#-1457074065%2FPackages%2F1218876905
- Anyway to add a ignore Class for tag? HOT 1
- Several lint checks not working in Kotlin files, but working ok in Java files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timber.