works for me. but you should throw the IOException instead of Exception ... but that�s another topic.
Jan > -----Urspr�ngliche Nachricht----- > Von: S�bastien Annedouche [mailto:[EMAIL PROTECTED] > Gesendet am: Montag, 7. M�rz 2005 19:42 > An: [email protected] > Betreff: cannot resolve symbol when overriding method. > > Hi all, > > I'm new to Ant and I've found something I can't understand > while trying > to compile one of my projects. > > Take a look at the following Dummy class. It has a silly method 'foo' > which returns an instance of an anonymous class extending > ObjectInputStream and overriding one of its protected methods : > > /import java.io.ObjectInputStream;/ > // > /// uncomment to make ant happy/ > //// > ///import java.io.IOException;/ > ///import java.io.StreamCorruptedException;/ > // > /public class Dummy {/ > / public Dummy() {/ > / }/ > // > / protected Object foo() throws Exception {/ > / return new ObjectInputStream(null) {/ > / protected void readStreamHeader() {/ > / }/ > / };/ > / }/ > /}/ > > I've got the following error : > > [javac] <path>\Dummy.java:14: cannot resolve symbol > [javac] symbol: class IOException > [javac] protected void readStreamHeader() { > > If I uncomment the imports quoted "uncomment to make ant > happy", it works. > > This class doesn't compile if the 2 exceptions thrown by the > overriden > method are not imported in the class file. > > Isn't it an ant bug ? Is there anything to do to prevent ant from > failing with such a code ? > > Thanks, > > Sebastien > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
