Community
Participate
Working Groups
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)
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.
Fixed & released into HEAD. Changed so that the MethodVerifier only checks overridden methods if the type is a simple subclass of a concrete superclass.
Verified for 3.0 using build I200403240800.
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; }
Subsequent issue deferred.
Also seeing this in 3.0 release with com.jclark.xml.output.XMLWriter.java with the 1.5.0 beta 2 JDK on Linux.
May consider for 3.0.1.
*** Bug 65472 has been marked as a duplicate of this bug. ***
*** Bug 68034 has been marked as a duplicate of this bug. ***
Fixed. No longer examining inherited interface methods in concrete subclasses.
Verified for 3.0.1 RC1