Skip to content
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

The annotation attribute cannot be resolved when nullable annotation analysis is enabled #2743

Open
testforstephen opened this issue Oct 17, 2022 · 2 comments

Comments

@testforstephen
Copy link
Collaborator

Originally posted by @ChrisVesters in microsoft/vscode-java-debug#1230

[provide a description of the issue]

Environment
  • Operating System: Windows 10
  • JDK version: 17.0.4.1
  • Visual Studio Code version: 1.71.2
  • Java extension version: v1.11.0 (language support extension)
  • Java Debugger extension version: v0.44.0
Steps To Reproduce
  1. Open the attached project.

Screenshot 2022-10-06 083906 test.zip

Current Result

You see there is a compile error as shown in the screenshot.

Expected Result

The value is recognized as a consant expression and simply works.

Additional Informations

The problem is that the compiler somehow does not identify the CTL_ENDPOINT to be a contant value. If the superclass does not use generics this works, so the generics make determination wrong. This would make sense if the ENDPOINT in the superclass would somehow use information from the generic type T, but that is not the case.

Note: I believe this actually used to work in the past as well, so maybe some update must have broken this.

When compile with maven, everything works fine. Also tried this code in IntelliJ, and there it works as well.

@testforstephen
Copy link
Collaborator Author

This should be a bug on the upstream jdt core. When disable the nullable analysis on VS Code settings, the sample project above works well.

    "java.compile.nullAnalysis.nonnull": [
    ],
    "java.compile.nullAnalysis.nullable": [
    ]

@testforstephen
Copy link
Collaborator Author

Opened an issue on upstream eclipse-jdt/eclipse.jdt.core#476

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

No branches or pull requests

2 participants