-
Notifications
You must be signed in to change notification settings - Fork 18
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
Strict mode #243
Merged
Merged
Strict mode #243
Conversation
This file contains 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
e5l
approved these changes
Dec 3, 2024
compiler-plugin/compiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/StrictMode.kt
Outdated
Show resolved
Hide resolved
e5l
approved these changes
Dec 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please check the comments before merging
...ompiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/checkers/FirRpcStrictModeClassChecker.kt
Outdated
Show resolved
Hide resolved
compiler-plugin/compiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/StrictMode.kt
Outdated
Show resolved
Hide resolved
Mr3zee
commented
Dec 5, 2024
Comment on lines
+17
to
+41
/* | ||
This is a hack to solve the next problem: | ||
|
||
There is PsiElement class that is used in compiler and plugin. | ||
|
||
If we use kotlin-compiler-embeddable.jar to compile the module, | ||
PsiElement is org.jetbrains.kotlin.com.jetbrains.intellij.PsiElement. | ||
And it works ok in the user projects! | ||
|
||
But. | ||
|
||
If we run tests, which use kotlin-compiler.jar, we run into ClassNotFoundException. | ||
Because the class it has in th classpath is com.jetbrains.intellij.PsiElement | ||
|
||
- Alright, we can use kotlin-compiler.jar to compile the plugin. | ||
- No, because the same error now will occur in the user projects, | ||
but it is com.jetbrains.intellij.PsiElement that is not found. | ||
|
||
- Ok, we can use kotlin-compiler-embeddable.jar to compile tests. | ||
- Then we ran into java.lang.VerifyError: Bad type on operand stack, which I have no idea how to fix. | ||
|
||
This solution replaces org.jetbrains.kotlin.com.jetbrains.intellij.PsiElement usages in plugin | ||
with com.jetbrains.intellij.PsiElement only for the tests, fixing both use cases. | ||
It is basically a reverse engineering of what Kotlin does for the embedded jar. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for the shadow jar
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.
Subsystem
Core, Compiler Plugin
Problem Description
We are about to deprecate some features in
@Rpc
services, namely:suspend
functions with server-side streamingSolution
We want to provide provide migration tools for users, as some of the declarations are harder to replace. That is why strict mode is introduced. For each deprecation there will be three levels of warnings:
none
,warning
anderror
. By default, all of them are now warning expect forsuspend functions with server-side streaming
, as we are not yet ready to provide an alternative.Deprecation level will shift to error in the following releases.
Then features will be considered obsolete, strict mode will become the default without the ability to switch if off.