-
Bug
-
Resolution: Unresolved
-
P3
-
None
-
None
As discussed in JDK-8346471, a compatibility impact of javac reading type annotations from the classpath is that it may load additional class files referenced by type annotations. This can cause compilation errors for compilations with incomplete classpaths, but which previously compiled because the missing classes were never loaded.
JDK-8337998 added handling for these completion failures, and introduced a new error diagnostic cant.attach.type.annotations.
There have been some reports of these cant.attach.type.annotations diagnostics where transitive dependencies were deliberately being excluded from classpaths, for example:
* https://github.com/spring-projects/spring-data-build/issues/2579
* https://github.com/spring-projects/spring-framework/commit/79795c8e092e74102d45a8455d4948aa77ee7608
These diagnostics have some similarities to other diagnostics for incomplete or inconsistent information in class files:
* unknown.enum.constant is a warning
* annotation.method.not.found is a lint 'classfile' warning
To reduce the compatibility impact of the cant.attach.type.annotations diagnostics, it may be worth considering downgrading them to warnings, or potentially xlint warnings (as part of 'classfile', or potentially a different xlint category).
There have been some reports of these cant.attach.type.annotations diagnostics where transitive dependencies were deliberately being excluded from classpaths, for example:
* https://github.com/spring-projects/spring-data-build/issues/2579
* https://github.com/spring-projects/spring-framework/commit/79795c8e092e74102d45a8455d4948aa77ee7608
These diagnostics have some similarities to other diagnostics for incomplete or inconsistent information in class files:
* unknown.enum.constant is a warning
* annotation.method.not.found is a lint 'classfile' warning
To reduce the compatibility impact of the cant.attach.type.annotations diagnostics, it may be worth considering downgrading them to warnings, or potentially xlint warnings (as part of 'classfile', or potentially a different xlint category).
- relates to
-
JDK-8337998 CompletionFailure in getEnclosingType attaching type annotations
-
- Resolved
-
- links to
-
Review(master)
openjdk/jdk/28018