I have an interface called Namable
public interface Namable { public String getName(); public void setName(String name); };
Several classes will implement this.
When I make code like this:
Namable foo = new X(); foo.getName();
(X is an implementing class)
I get the error:
java.lang.NoSuchMethodError: Namable.getName()Ljava/lang/String;
This is very strange to me and I'm wondering why this is happening, any thoughts?
Compilable example:
Namable class:
public interface Namable
{
public String getName();
}
Extending class X:
public class X extends java.util.ArrayList implements Namable
{
private String name;
public X()
{
this.name = "bar";
}
public String getName()
{
return name;
}
}
Testing class:
public class Test
{
public static void main()
{
Namable foo = new X();
foo.getName();
}
}
After running this, I get the same error. I am using BlueJ
newinNamable foo = X()or isXa static factory method? Are you doing anything exotic with proxy classes? Are you using an exotic framework, like a DI framework or test stubbing framework that uses proxy classes?