我正在为游戏 Minecraft 制作一个模组。使用 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。也许这是 pur java 的泛型误解,但我对此表示怀疑,因为在 Eclipse 中一切正常。是我这边的错误还是我应该寻找 gradle 插件错误?我是gradle的初学者。
也许需要源代码和 build.gradle 来理解我的问题。我在这里创建了一个仓库:https ://github.com/RedRelay/FCH_DEBUG
编辑:这似乎是与 Eclipse 相关的问题。我刚刚了解到 Eclipse 有自己的编译器,它似乎允许这样做而不是标准的 javac。