Hi All

I have an interface that wraps an integer, like this

  interface Wrapper {
    int getX();
  }

Why cannot I add a default toString method

    default String toString() {
      return "This is " + getX();
    }

The error is

error: default method toString in interface DSAPublicKey overrides a member of 
java.lang.Object
    default String toString() {

Is there any other way to do it? I do not want to rename it to getString() and 
let all child classes call it in their toString().

Thanks
Max

P.S. security-dev@ guys, I want to move toString() back to 
{DSA|RSA|EC}PublicKey so that we get the same strings for SunPKCS11 and SunJCE.

Reply via email to