WebServerPageConnectionService#fileRequested signature was changed in 2021.2.3
已回答
I'm working with reload on save/change in preview mode. I use:
@Service(Service.Level.APP)
class WebServerPageConnectionService {
fun fileRequested(request: FullHttpRequest, fileSupplier: Supplier<out VirtualFile?>): CharSequence?
}
Is it ok that class which was not marked with one of annotations:
@Experimental
@ScheduledForRemoval
-
@Internal
was changed fileRequested signature in 2021.2.3?
In 2021.2 is:
fun fileRequested(request: FullHttpRequest, fileSupplier: Supplier<out VirtualFile?>): CharSequence?
In 2021.2.3 is:
fun fileRequested(request: FullHttpRequest, onlyIfHtmlFile: Boolean, fileSupplier: Supplier<out VirtualFile?>): CharSequence?
I didn't find anything about it in:
请先登录再写评论。
Sorry for the trouble. WebServerPageConnectionService was added not so long ago, there are no usages of it in plugins uploaded to plugins.jetbrains.com, and so I thought there are no external usages of it. We can add the following code to restore compatibility, but it will be available only in 2021.3
No problem, but it's strange cause AsyncAPI plugin uses it in 1.1.0+idea2021 release. Looks like plugin portal gets usages from
Thanks, but I'm not sure that it helps.
Is current signature final variant in 2021.2.3 and will not change in next releases like 2021.3, 2022.*? If so I will left It on a place.
Anyway I have to fix it for now. Looks like I have two options:
- Figure out how to use reflection for calling right implementation, based on IDEA version, from service in runtime
- Create several releases bind to old signature with stricted IDEA version
> Is current signature final variant in 2021.2.3 and will not change in next releases like 2021.3, 2022.*? If so I will left It on a place.
Yes, it won't be changed, at least backward compatibility won't be broken, so please feel free to use it. Right now as far as I can see the new code which uses WebServerPageConnectionService isn't included in 1.1.0+idea2021 (I've downloaded it from https://plugins.jetbrains.com/plugin/15673-asyncapi and checked /com/asyncapi/plugin/idea/_core/AsyncAPISchemaHtmlRenderer.class). If you want to make plugin compatible with IDEA 2021.2.1 and earlier in addition to 2021.2.2+ and 2021.3, I suggest to build a separate plugin version. Though it's also possible to do via reflection as you suggested, please use com.intellij.openapi.application.ApplicationInfo for this. WebServerPageConnectionService.fileRequested's signature was changed in 2021.2.2 (build 212.5284)
Great, thanks.
Yes, you a right. WebServerPageConnectionService should be published in 1.2.0+idea2021, but before uploading I decided to check it on current IDEA version