redhat-developer / redhat-developer/vscode-java

vscode-java reports "cannot be resolved" errors in Gradle plugin project with mix of Groovy and Java

Open
#1,417 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Gradle upstream
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

In Gradle plugins implemented with a mix of Java and Groovy, vscode-java reports "cannot be resolved" errors in .java files that reference classes defined in .groovy files. Gradle can compile and build the plugin successfully.

Environment
  • Operating System: macOS 10.15.4
  • JDK version:
    openjdk version "13.0.2" 2020-01-14
    OpenJDK Runtime Environment (build 13.0.2+8)
    OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
    
  • Visual Studio Code version:
    Version: 1.45.0-insider
    Commit: abb4a35cfc26102f93fd00df7b59ce1a19c2017a
    Date: 2020-04-28T05:34:21.109Z (20 hrs ago)
    
  • Java extension version: 0.60.0
Steps To Reproduce
  1. Clone https://github.com/a01fe/gradle-groovy-java-plugin
  2. cd gradle-groovy-java-plugin/test; ./gradlew javaTask
    This builds the plugin and runs a task in the plugin to verify it compiles and builds successfully
  3. Open the project in vscode and open src/main/groovy/foo/task/JavaTask.java, vscode-java reports errors on all the references to JavaTaskSpec.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with cd gradle-groovy-java-plugin/test; ./gradlew javaTask, then open src/main/groovy/foo/task/JavaTask.java in VS Code and inspect the diagnostics on references to JavaTaskSpec. Compare the language-server behavior with the successful Gradle build; done means those false "cannot be resolved" errors no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.