Bug 52916 - Strange error message when using jre1.5.0 libraries
Summary: Strange error message when using jre1.5.0 libraries
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 65472 68034 (view as bug list)
Depends on:
Blocks: 80085
  Show dependency tree
 
Reported: 2004-02-24 06:22 EST by David Audel CLA
Modified: 2004-12-03 04:45 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-02-24 06:22:22 EST
build 20040219

1) launch eclipse
2) create a project P and use jre1.5.0 libraries
3) create the following class
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class X extends PrintWriter{
  public X() throws FileNotFoundException {
    super("");
  }
}

4) compile
There are 2 errors messages which looks very strange because 'append' methods 
are not override in 'X':
- The return type is incompatible with Appendable.append(char), Writer.append
(char), PrintWriter.append(char)
- The return type is incompatible with Appendable.append(CharSequence), 
Writer.append(CharSequence), PrintWriter.append(CharSequence)
Comment 1 Philipe Mulet CLA 2004-02-24 06:43:52 EST
MethodVerifier seems to check inconsistent (covariance) methods from binaries 
which it should ignore. These are clearly inconsistent for a 1.4 compiler, but 
the unit X shouldn't get the blame.
Comment 2 Kent Johnson CLA 2004-02-24 13:20:50 EST
Fixed & released into HEAD.

Changed so that the MethodVerifier only checks overridden methods if the type 
is a simple subclass of a concrete superclass.
Comment 3 Frederic Fusier CLA 2004-03-24 13:32:05 EST
Verified for 3.0 using build I200403240800.
Comment 4 Curtis Huttenhower CLA 2004-06-03 19:03:31 EDT
Using JRE1.5.0 and Eclipse build 200405290105 (3.0RC1), I get the same two
errors on the following class (not written by me):

import java.io.Writer;
import java.io.IOException;
import javax.swing.text.*;

public class DocumentWriter extends Writer {

  public DocumentWriter(Document doc, AttributeSet a) {
    this.doc = doc;
    this.a = a;
  }

  public DocumentWriter(Document doc) {
    this(doc, null);
  }

  public void write(char cbuf[], int off, int len) throws IOException {
    write(new String(cbuf, off, len));
  }

  public void write(String str, int off, int len) throws IOException {
    write(str.substring(off, len));
  }

  public void write(String str) throws IOException {
    if (doc == null) {
      throw new IOException("Writer was closed");
    }
    try {
      doc.insertString(doc.getLength(), str, a);
    } catch (BadLocationException ble) {
      throw new IOException(ble.getMessage());
    }
  }

  public void flush() throws IOException {
    if (doc == null) {
      throw new IOException("Writer was closed");
    }
    // nothing to do, everything is immediately placed into the
    // document model.
  }

  public void close() throws IOException {
    doc = null;
  }

  private Document doc;
  private AttributeSet a;
}
Comment 5 Philipe Mulet CLA 2004-06-07 13:03:16 EDT
Subsequent issue deferred.
Comment 6 Jonathan Abbey CLA 2004-07-01 17:41:44 EDT
Also seeing this in 3.0 release with com.jclark.xml.output.XMLWriter.java with
the 1.5.0 beta 2 JDK on Linux.
Comment 7 Philipe Mulet CLA 2004-07-01 18:31:48 EDT
May consider for 3.0.1.
Comment 8 Kent Johnson CLA 2004-07-05 12:12:54 EDT
*** Bug 65472 has been marked as a duplicate of this bug. ***
Comment 9 Kent Johnson CLA 2004-07-06 09:40:30 EDT
*** Bug 68034 has been marked as a duplicate of this bug. ***
Comment 10 Kent Johnson CLA 2004-07-06 16:52:32 EDT
Fixed.

No longer examining inherited interface methods in concrete subclasses.
Comment 11 David Audel CLA 2004-09-06 10:25:25 EDT
Verified for 3.0.1 RC1