Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.7.0.Release
-
Fix Version/s: 2.7.1.Release
-
Component/s: Compiler Integration
-
Labels:None
-
Environment:Mac Snow Leopard
-
Number of attachments :
Description
Tried searching for a similar bug, but couldn't find it.
Create a class like this:
class Foo {
public static void main(String [] args) {
Foo foo = new Foo();
foo.callFoo();
}
void callFoo() {
foo();
FooSubclass subclass = new FooSubclass();
subclass.foo();
}
void foo() {
println "In foo"
}
}
Create a subclass like this
class FooSubclass extends Foo { @Override void foo(String bar) { println "In foo subclass" } }
There is no error in Eclipse about the fact that foo()'s signature is not the same. In fact, if you run Foo, it even executes fine (how?).
Now run a Maven build and you get an error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project perftest: Compilation failure
[ERROR] /Users/tweissin/git-source/foo/bar/target/generated-sources/groovy-stubs/main/com/trw/FooSubclass.java:[18,0] method does not override or implement a method from a supertype
Issue Links
- is related to
-
GRECLIPSE-1428
Groovy editor does not respect @Override
-
-
GROOVY-5413
groovyc should emit errors when @Override is not respected
-
-
GROOVY-5011
@Override should be allowed (and verified) on properties that implement an interface
-
One minor thing, FooSubclass should extend Foo, so change the original FooSubclass to:
class FooSubclass extends Foo {
@Override
{ println "In foo subclass" }void foo(String bar)
}