建立一个Quarkus项目。
创建了一个类,该类扩展了一个具有最终方法的第三方。
@ApplicationScoped
public class BotService extends TelegramLongPollingBot {
@Override
public void onUpdateReceived(Update update) {
}
@Override
public String getBotUsername() {
return "something";
}
@Override
public String getBotToken() {
return System.getenv("token");
}
}
明确添加 quarkus.arc.remove-final-for-proxyable-methods=true
到application.properties。
在开发模式下运行时,我在日志中看到很多被忽略的最终方法(包括 execute()
):
2020-04-19 17:44:23,676 WARN [io.qua.arc.pro.Methods] (build-25) Final method org.telegram.telegrambots.meta.bots.AbsSender.getMe() is ignored during proxy generation and should never be invoked upon the proxy instance!
2020-04-19 17:44:23,676 WARN [io.qua.arc.pro.Methods] (build-25) Final method org.telegram.telegrambots.meta.bots.AbsSender.getMeAsync() is ignored during proxy generation and should never be invoked upon the proxy instance!
2020-04-19 17:44:23,676 WARN [io.qua.arc.pro.Methods] (build-25) Final method org.telegram.telegrambots.meta.bots.AbsSender.getWebhookInfo() is ignored during proxy generation and should never be invoked upon the proxy instance!
2020-04-19 17:44:23,676 WARN [io.qua.arc.pro.Methods] (build-25) Final method org.telegram.telegrambots.meta.bots.AbsSender.getWebhookInfoAsync() is ignored during proxy generation and should never be invoked upon the proxy instance!
...
一切看起来都很好,但后来它失败了。
ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:83)
at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:113)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:54)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:408)
... 10 more
Caused by: java.lang.RuntimeException: Failed to initialize Arc
at io.quarkus.arc.Arc.initialize(Arc.java:26)
at io.quarkus.arc.runtime.ArcRecorder.getContainer(ArcRecorder.java:35)
at io.quarkus.deployment.steps.ArcProcessor$generateResources23.deploy_0(ArcProcessor$generateResources23.zig:72)
at io.quarkus.deployment.steps.ArcProcessor$generateResources23.deploy(ArcProcessor$generateResources23.zig:36)
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:370)
... 10 more
Caused by: java.lang.VerifyError: class com.dubilyer.bot_market.telegram.service.BotService_ClientProxy overrides final method execute.(Lorg/telegram/telegrambots/meta/api/methods/send/SendAudio;)Lorg/telegram/telegrambots/meta/api/objects/Message;
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:316)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:275)
at com.dubilyer.bot_market.telegram.service.BotService_Bean.<init>(BotService_Bean.zig:117)
at io.quarkus.arc.setup.Default_ComponentsProvider.addBeans1(Default_ComponentsProvider.zig:142)
at io.quarkus.arc.setup.Default_ComponentsProvider.getComponents(Default_ComponentsProvider.zig:38)
at io.quarkus.arc.impl.ArcContainerImpl.<init>(ArcContainerImpl.java:103)
at io.quarkus.arc.Arc.initialize(Arc.java:20)
... 14 more
有什么办法可以避免这种情况吗?