How am I going to use this? I tried searching this but cannot find one. -Xlint:deprecation
When doing a gradlew lint this is what it shown to me
Task :app:compileDebugJavaWithJavac
Note: [1] Wrote GeneratedAppGlideModule with:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
This is Android which also use Android Gradle Plugin so i assumed this is under Plugin Portal topic.
This doesn’t actually have anything to do with the Android plugin or Android itself. This is just an option for the Java compiler to provide more details about which classes/methods you’re using that are marked as @Deprecated in code that is not also marked as @Deprecated. If you’ve marked something @Deprecated in your code that you plan to remove usage of soon, this would be expected. If it’s in a library, you would generally want to try to reduce your dependencies on the deprecated library code as that will usually prevent you from upgrading to the next major version.
If you’re interested in these details, you can set a flag on all the JavaCompile tasks:
Generally the second example with compilerArgs is what’s shown in the docs. The text normally just says to reference JavaCompile, which includes CompileOptions, for the comprehensive list.
If the project code is Kotlin, you won’t be using JavaCompile. The Kotlin plugin is provided by JetBrains and you’d have to reference their plugin docs rather than the Gradle docs to determine what options are available on a specific version. As of now, you’d need to use the compiler arguments directly rather than a property like you can for Java.
Yes, you can add multiple compilerArgs in the same line, i.e.: options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked']
This works well, thanks.
But it shows deprecated API only for java code but not unit test code.
> Task :compileTestJava
> Task :processTestResources
> Task :testClasses
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.