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

Strict mode #243

Merged
merged 9 commits into from
Dec 5, 2024
Merged

Strict mode #243

merged 9 commits into from
Dec 5, 2024

Conversation

Mr3zee
Copy link
Collaborator

@Mr3zee Mr3zee commented Dec 2, 2024

Subsystem
Core, Compiler Plugin

Problem Description
We are about to deprecate some features in @Rpc services, namely:

  • StateFlow support
  • SharedFlow support
  • Fields
  • Nested Flows
  • suspend functions with server-side streaming

Solution
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 and error. By default, all of them are now warning expect for suspend 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.

@Mr3zee Mr3zee added feature New feature or request deprecation Contains derecations labels Dec 2, 2024
@Mr3zee Mr3zee requested a review from e5l December 2, 2024 18:41
@Mr3zee Mr3zee self-assigned this Dec 2, 2024
@Mr3zee Mr3zee marked this pull request as ready for review December 4, 2024 14:18
@Mr3zee Mr3zee requested a review from e5l December 4, 2024 15:03
Copy link
Member

@e5l e5l left a 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

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.
*/
Copy link
Collaborator Author

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

@Mr3zee Mr3zee merged commit da5f363 into main Dec 5, 2024
1 check passed
@Mr3zee Mr3zee deleted the strict-mode branch December 5, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Contains derecations feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants