This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Static inner class access methods that should throw exceptions


Hi,

Compiling the attached code gives:

InnerExcept.java: In class `InnerExcept':
InnerExcept.java: In method `access$1()':
InnerExcept.java:18: error: Exception `java.io.IOException' must be
caught, or it must be declared in the `throws' clause of `access$1'.
   }
   ^
1 error

Removing the static modifier of the createFile() method makes it compile
though. Is this a known issue or should I open a new bug report?

Cheers,

Mark
import java.io.*;

public class InnerExcept
{
  // Non-static and it compiles.
  static private void createFile() throws IOException
  {
    new File("/dev/null");
  }

  class Inner
  {
    private void m() throws IOException
    {
      createFile();
    }
  }
}

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]