Hi ,
I am having a stramge compilation problme.
I hava implemented some objects that (as usual) override
Object.toString.
Specifically, I have an interface called FilterObject that declares
toString as a method of it.
The following fragement of code compiles normally under NT (tried sun
jdk1.1.5 and Microsft SDK 3.1):

/**
       Dumps filterr information  in string form.
       @roseuid 3603AD400379
     */
    public String toString()
 {

  StringBuffer buf = new StringBuffer( 100 );
  buf.append( "Image Filter : Lifting Analysis Filter Bank\n" );
  buf.append( "Components : \n" );
  buf.append( polyphase_.toString() );
  for ( int i = 0; i < filters_.length; i++ )
   buf.append( filters_[i].toString() );

  return buf.toString();

    }

However, attempting to compile under jkd1.1.6v4a produces the following
error
LiftingAnalysisFilterBank.java:42: Reference to toString is ambiguous.
It is defined in java.lang.String toString() and java.lang.String
toString().
   buf.append( filters_[i].toString() );

I figured out a workaround to compile under jdk1.1.6v4a , that is to
simply cast it to FilterObject like this
 buf.append( ((FilterObject)filters_[i]).toString() );

However, shouldn't the original code compile normally (without casting)
?
Is this  behavior noraml or is it a subtle bug? (I think that if it was
normal, it should appear under nt also... )



--
Dimitrios Vyzovitis      -- Information Processing Laboratory
[EMAIL PROTECTED] -- Aristotle University of Thessaloniki
[EMAIL PROTECTED] -- Dept. of Electrical and Computer Engineering
                            http://egnatia.ee.auth.gr/~dviz


begin:          vcard
fn:             Dimitrios Vyzovitis
n:              Vyzovitis;Dimitrios
org:            AUTH
adr:            142 V. Olgas Avenue;;;Thessaloniki;;54645;Greece
email;internet: [EMAIL PROTECTED]
tel;work:       ++30-31-996359
tel;home:       ++30-31-817780
note:           Orientation in space and time is the framework of cognition.
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard

Reply via email to