ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Annedouche <sannedou...@wanadoo.fr>
Subject cannot resolve symbol when overriding method.
Date Mon, 07 Mar 2005 18:42:06 GMT
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message