[英]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.