[KT-84822] added java annotations libraries for tests that use them#5895
Open
[KT-84822] added java annotations libraries for tests that use them#5895
Conversation
Code Owners
|
ce92638 to
d60cce1
Compare
d60cce1 to
4e0866f
Compare
zardilior
commented
Apr 29, 2026
| javaFiles.forEach { testServices.sourceFileProvider.getOrCreateRealFileForSourceFile(it) } | ||
|
|
||
| val javaDir = testServices.sourceFileProvider.getJavaSourceDirectoryForModule(module) | ||
| val java8AnnotationsDir = File(JavaForeignAnnotationType.Java8Annotations.path) |
Collaborator
Author
There was a problem hiding this comment.
Contains @NotNull and @nullable annotations
from org.jetbrains.annotations.* as well as JSR-305 annotations
like javax.annotation.Nonnull
javax.annotation.Nullable
and has to be compiled before use.
This is also done for jvm tests through
JvmForeignAnnotationsConfigurator.kt
4e0866f to
8687206
Compare
8687206 to
0b77511
Compare
demiurg906
requested changes
Apr 29, 2026
|
|
||
| val javaDir = testServices.sourceFileProvider.getJavaSourceDirectoryForModule(module) | ||
| val java8AnnotationsDir = File(JavaForeignAnnotationType.Java8Annotations.path) | ||
| val java8AnnotationsJar = MockLibraryUtil.compileJavaFilesLibraryToJar( |
Contributor
There was a problem hiding this comment.
Same as in JvmForeignAnnotationsConfigurator, please execute this code only if there is a ENABLE_FOREIGN_ANNOTATIONS directive enabled.
Otherwise you'll invoke the javac for each test, which would significantly slow tests down.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests with java sources that used
with org.jetbrains.annotations or @null @NotNull would crash with IllegalState.
Adding these dependencies fixes the issue