简体   繁体   English

实际参数…无法通过方法调用转换转换为…

[英]actual argument … cannot be converted to … by method invocation conversion

I'm making a mod for the game Minecraft. 我正在为《我的世界》游戏制作模组。 Using Eclipse all work fine, compilation is successfull and I can play the game using my created mod. 使用Eclipse一切正常,编译成功,我可以使用自己创建的mod玩游戏。 However when I compile my code using gradle, I get this error : 但是,当我使用gradle编译代码时,出现此错误:

C:\Users\Alexandre\MCForge\ForgeCreeperHeal\debug\build\sources\main\java\fr\eyzox\dependencygraph\DependencyGraph.java:31: error: method buildIndex in class DataKeyProvider<K> cannot be applied to given types;
                        node.keyProvider.buildIndex(index, node);
                                        ^
  required: Map<KEY,DependencyGraph<KEY,? extends IData<KEY>>.Node>,DependencyGraph<KEY,? extends IData<KEY>>.Node
  found: Map<KEY,DependencyGraph<KEY,DATA>.Node>,DependencyGraph<KEY,DATA>.Node
  reason: actual argument Map<KEY,DependencyGraph<KEY,DATA>.Node> cannot be converted to Map<KEY,DependencyGraph<KEY,? extends IData<KEY>>.Node> by method invocation conversion
  where KEY,DATA,K are type-variables:
    KEY extends Object declared in class DependencyGraph
    DATA extends IData<KEY> declared in class DependencyGraph
    K extends Object declared in class DataKeyProvider

I don't understand why it works on Eclipse but does not with gradle. 我不明白为什么它可以在Eclipse上运行,但不能与gradle一起使用。 Maybe it is pur java's generics missunderstanding, but I doubt it because all works fine in Eclipse. 也许是纯Java的泛型误解,但我对此表示怀疑,因为在Eclipse中一切正常。 Is it the error from my side or should I looking for a gradle plugin bug ? 是我这边的错误还是我应该寻找gradle插件错误? I'm a beginner in gradle. 我是gradle的初学者。

Maybe source code and build.gradle are needed to understand my issue. 也许需要源代码和build.gradle才能理解我的问题。 I've created a repo here : https://github.com/RedRelay/FCH_DEBUG 我在这里创建了一个仓库: https : //github.com/RedRelay/FCH_DEBUG

EDIT : It seems to be an issue related to Eclipse. 编辑:这似乎是与Eclipse相关的问题。 I've just learn Eclipse has its own compiler, and it seems to allow this instead of standard javac. 我刚刚学习了Eclipse有自己的编译器,并且似乎允许使用它而不是标准的javac。

Eclipse has its own compiler which allows it instead of the standard javac compiler. Eclipse有自己的编译器,而不是标准的javac编译器。 I've changed 我变了

protected abstract void buildIndex(final Map<K, DependencyGraph<K, ? extends IData<K>>.Node> index, final DependencyGraph<K, ? extends IData<K>>.Node theNode) throws DuplicateKeyException; to protected abstract <D extends IData<K>> void buildIndex(final Map<K, DependencyGraph<K, D>.Node> index, final DependencyGraph<K, D>.Node theNode) throws DuplicateKeyException; protected abstract <D extends IData<K>> void buildIndex(final Map<K, DependencyGraph<K, D>.Node> index, final DependencyGraph<K, D>.Node theNode) throws DuplicateKeyException; and it works now. 现在就可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实际参数不能通过方法调用转换进行转换 - actual argument cannot be converted by method invocation conversion 实际参数Date无法通过方法调用转换转换为int - actual argument Date cannot be converted to int by method invocation conversion 实际参数long不能通过方法调用转换转换为int - actual argument long cannot be converted to int by method invocation conversion 实际参数int不能通过方法调用转换转换为byte - Actual argument int cannot be converted to byte by method invocation conversion Java泛型:实际参数T不能通过方法调用转换转换为int - Java generics: actual argument T cannot be converted to int by method invocation conversion 原因:实际参数类 <ie_home_com> 无法转换为Class <? extends TestCase> 通过方法调用转换 - reason: actual argument Class<ie_home_com> cannot be converted to Class<? extends TestCase> by method invocation conversion 实际参数列表 <anonymous Callable<String> &gt;&gt;无法转换为列表 <Callable<String> &gt;通过方法调用转换 - actual argument List<<anonymous Callable<String>>> cannot be converted to List<Callable<String>> by method invocation conversion 不能通过方法调用转换将实际参数String转换为int-如何修复它 - Actual argument String cannot be converted to int by method invocation conversion - how to fix it 如何解决“实际争论” <anonymous OnSharedPreferenceChangeListener> 不能通过方法调用转换转换为上下文” - How to fix “actual argument <anonymous OnSharedPreferenceChangeListener> cannot be converted to Context by method invocation conversion” 在方法调用转换时,实际列表不能转换为字符串 - Actual List cannot be converted to String on method invocation conversion
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM