-
Notifications
You must be signed in to change notification settings - Fork 35
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
"<method name> is never used" hint, despite being used in generated source #327
Comments
I also noticed that right-clicking on |
I thought perhaps the extension relies on all sources being in a Gradle source set, and maybe the generated sources don't belong to any source set. # build.gradle.kt
tasks.register("sourceSets") {
doLast {
sourceSets.forEach {
println(it)
it.allSource.forEach {
println(it)
}
}
}
} $ gradle sourceSets
> Task :app:sourceSets
source set 'main'
/Users/kal/Code/incorrect-unused-hint/app/src/main/java/org/example/App.java
/Users/kal/Code/incorrect-unused-hint/app/src/main/java/org/example/FooController.java
source set 'test'
/Users/kal/Code/incorrect-unused-hint/app/src/test/java/org/example/AppTest.java
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed Note there is no reference to However, that doesn't seem to be the issue. Even when I add to // This doesn't seem to have any affect.
sourceSets["main"].java.srcDir(file("build/generated/sources/annotationProcessor/java/main")) and confirm that the generated source is now in the main source set: $ gradle sourceSets
> Task :app:sourceSets
source set 'main'
/Users/kal/Code/incorrect-unused-hint/app/src/main/java/org/example/App.java
/Users/kal/Code/incorrect-unused-hint/app/src/main/java/org/example/FooController.java
/Users/kal/Code/incorrect-unused-hint/app/build/generated/sources/annotationProcessor/java/main/org/example/FooController$Route.java
source set 'test'
/Users/kal/Code/incorrect-unused-hint/app/src/test/java/org/example/AppTest.java
BUILD SUCCESSFUL in 966ms
1 actionable task: 1 executed the "post is never used" hint is still present. |
Hi @kalaracey. Thank you for reaching out and bringing this issue to our notice. Using your reproducer example, I was able to confirm that:
Based on this assessment, I am labelling this as a bug that may be targeted in a future release. |
In my project, I have a method of a class that is only invoked by generated source code, and this extension appears to think the method is unused. I have attempted to create a minimum-reproducible example in https://github.com/kalaracey/oracle-vscode-incorrect-unused-hint:
VSCode 1.94.2
Oracle.oracle-java
v23.0.0The text was updated successfully, but these errors were encountered: