groovy / groovy-eclipse

Eclipse Groovy Development Tools
656 stars 193 forks source link

Compiler error when compiling against JRE 8 #188

Closed felixdo closed 8 years ago

felixdo commented 8 years ago

When using Java 8 to compile groovy-eclipse I get:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.25.0:compile (default-compile) on project org.codehaus.groovy.eclipse.codeassist.completion: Compilation failure: Compilation failure: [ERROR] C:\Users\felix\git\groovy-eclipse\ide\org.codehaus.groovy.eclipse.codeassist.completion\src\org\codehaus\groovy\eclipse\codeassist\processors\CharArraySequence.java:[35] [ERROR] char[] chars() { [ERROR] ^^^^^^ [ERROR] The return type is incompatible with CharSequence.chars() [ERROR] 1 problem (1 error) [ERROR] -> [Help 1]

CharSequence.chars() is a new method that was added in Java 8 and it collides with this implementation.

This also makes me wonder: The "official" build should use a JRE 8 to compile groovy from e46 on, since Eclipse Neon requires that so these errors are detected.

aclement commented 8 years ago

I've changed the method but don't have time to fix the build change too, unfortunately.

felixdo commented 8 years ago

I found another one. To fix, just add an import in one class. (I could have organized imports but then the patch wouldn't be as trivial as it looks now)

diff --git a/base/org.codehaus.groovy20/src/org/codehaus/groovy/vmplugin/v5/Java5.java b/base/org.codehaus.groovy20/src/org/codehaus/groovy/vmplugin/v5/Java5.java index 91cc923..d3a4047 100644 --- a/base/org.codehaus.groovy20/src/org/codehaus/groovy/vmplugin/v5/Java5.java +++ b/base/org.codehaus.groovy20/src/org/codehaus/groovy/vmplugin/v5/Java5.java @@ -18,6 +18,7 @@ package org.codehaus.groovy.vmplugin.v5;

import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.ast.; +import org.codehaus.groovy.ast.Parameter;^M import org.codehaus.groovy.ast.expr.; import org.codehaus.groovy.ast.stmt.ReturnStatement; import org.codehaus.groovy.vmplugin.VMPlugin;