繁体   English   中英

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

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

我正在为《我的世界》游戏制作模组。 使用Eclipse一切正常,编译成功,我可以使用自己创建的mod玩游戏。 但是,当我使用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

我不明白为什么它可以在Eclipse上运行,但不能与gradle一起使用。 也许是纯Java的泛型误解,但我对此表示怀疑,因为在Eclipse中一切正常。 是我这边的错误还是我应该寻找gradle插件错误? 我是gradle的初学者。

也许需要源代码和build.gradle才能理解我的问题。 我在这里创建了一个仓库: https : //github.com/RedRelay/FCH_DEBUG

编辑:这似乎是与Eclipse相关的问题。 我刚刚学习了Eclipse有自己的编译器,并且似乎允许使用它而不是标准的javac。

Eclipse有自己的编译器,而不是标准的javac编译器。 我变了

protected abstract void buildIndex(final Map<K, DependencyGraph<K, ? extends IData<K>>.Node> index, final DependencyGraph<K, ? extends IData<K>>.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; 现在就可以了。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM