Skip to content

How to identify the usage of com.sun.source.* packages in a project #4262

Closed

Description

@liuhaoduoduo

My project is a legacy Java 8 application that relies on com.sun.source.* packages. Although I have configured the language extension to use JDK 25, the code referencing com.sun.source.* still shows red squiggly lines (errors) when I open the source files. I have already applied the following configuration:

Image "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m --add-exports=jdk.compiler/com.sun.source.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.source.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"

Activity

  1. datho7561 commented on Jun 17, 2026

    @datho7561
    Contributor

    What build tool does the legacy application use? Maven/Gradle/Ant/something else? Nothing? My understanding is that you're able to target an older release with a newer JDK, but you should configure the project's build tool so that it knows to treat the code as Java 8 code. vscode-java should pick up the version of Java to use from the build tool if you use Maven or Gradle, but if you use something else, it'll require more effort to get that configured.

  2. github-actions commented on Jul 18, 2026

    @github-actions

    This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions