0

Easier to explain with simplified code. I have the following interface

interface FooInterface{
public void foo()
}

I have the following JAVA parent class from a library (notice the final keyword):

class Parent {
public final foo()
}

Finally, the child class:

class Child extends Parent implement FooInterface{
}

This results in compilation error that I cannot override the final parent method in the child class, which technically I am not. I figure this is a groovyism I'm not familiar with. So my question are:

  1. Why does the compiler think I'm overriding?
  2. How can I get this to compile?
Jon Burgin
  • 83
  • 1
  • 6
  • Ah the parent class is a java class, so I assume groovy is trying to rewrite it make it groovy. – Jon Burgin Mar 17 '18 at 22:03
  • I can't even encapsulate it to get around because the parent library has references to both the interface and to the abstract class. – Jon Burgin Mar 17 '18 at 22:07

1 Answers1

1

can't reproduce

final method: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicBoolean.html#get()

works fine in groovy 2.4.5

import java.util.concurrent.atomic.AtomicBoolean;

interface I{
    public boolean get();
}

public class B extends AtomicBoolean implements I{
}

def b=new B()
daggett
  • 26,404
  • 3
  • 40
  • 56