情况
我有一个Java类的令人讨厌的子类。Java类来自依赖性,而不是我自己的本地软件包:
// A basic idea of the Java class' construction
public class JavaArea<PS, S> {
public JavaArea(PS initialStyle, BiConsumer, S otheStyle, Biconsumer) {
// constructs class...
}
}
class GroovyArea extends JavaArea<Collection<String>, Collection<String>> {
GroovyArea(Object unrelated arguments) {
super(Collections.emptyList(), defaultBiConsumer, otherStyle, defaultBiConsumer)
// do some other stuff to GroovyArea's fields
}
}
出于某种原因,类的汇编失败了:Constructor call must be the first statement in a constructor
,尽管构造函数调用是第一个语句...
Exception executing
org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@7a1c5b43
in compiler daemon:
org.gradle.api.internal.tasks.compile.CompilationFailedException:
Compilation failed; see the compiler error output for details..
super(Collections.emptyList(), otherParams)
^
gradle构建文件
我有以下root项目的构建文件:
subprojects {
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.6'
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
testRuntime "cglib:cglib-nodep:3.2.3"
testRuntime "org.objenesis:objenesis:2.4"
}
}
...以及包含错误的实际模块的以下构建文件:
version '1.0-SNAPSHOT'
apply plugin: 'groovy'
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
compile 'org.codehaus.groovyfx:groovyfx:0.4.0'
compile project(':diagrammer')
compile group: 'org.reactfx', name: 'reactfx', version: '2.0-M5'
compile group: 'org.fxmisc.wellbehaved', name: 'wellbehavedfx', version: '0.3'
compile (group: 'org.fxmisc.richtext', name: 'richtextfx', version: '1.0.0-SNAPSHOT') {
exclude group:'org.reactfx', module: 'reactfx'
}
}
我的问题
是什么引起了问题,我该如何解决?这是Groovy的错误吗?还是我的构建环境的问题?
IDE:Intellij 2016.1.3
我不认为这是IDE,因为它执行语法正确强调,并在悬停在"超级"关键字
gradle:gradle 2.12
Groovy:Groovy 2.4.6
我尝试过的
我尝试更改Gradle的版本(通过sdkman
),然后更改Groovy(通过构建文件)。这些都没有解决问题:
- gradle:
2.12
,2.14
- 使用Groovy:
2.4.5
,2.4.6
,2.4.7
- 使用Groovy:
更新
- 在Intellij中创建一个新的Gradle项目,该项目只有在我运行
gradle build
时具有相同例外的Groovyarea类所必需的组件。
看起来很groovy。以Groovy-7868