Skip to content

"<method name> is never used" hint, despite being used in generated source #327

Open
@kalaracey

Description

@kalaracey

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:

Steps to reproduce:

  • Run gradle build.
  • Open the project in VSCode with the Oracle.oracle-java extension enabled and other Java extensions disabled.
  • Open the file app/src/main/java/org/example/FooController.java.
  • Note the squiggle under the post method and the warning (on hover) "post is never used":
    FooController-warning

This is despite the fact that FooController#post is used in the generated file app/build/generated/sources/annotationProcessor/java/main/org/example/FooController$Route.java:

      var result = controller.post();

Note that right-clicking on that invocation of post in FooController$Route.java and clicking Go To Definition works - it navigates back to FooController.java.

VSCode 1.94.2
Oracle.oracle-java v23.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions