Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6234077

No error for public class in wrong file

XMLWordPrintable

    • b27
    • generic
    • generic
    • Verified

      The file Test1.java is incorrectly accepted by javac:

      $ cat -n Test1.java
           1 @SuppressWarnings("dep-ann")
           2 /** @deprecated */
           3 public class Foo {}
      $ cat -n Test2.java
           1 package foo;
           2 @SuppressWarnings("dep-ann")
           3 /** @deprecated */
           4 public class Foo {}
      $ javac Test1.java
      $ javac Test2.java
      Test2.java:4: class Foo is public, should be declared in a file named Foo.java
      public class Foo {}
             ^
      1 error
      $

      ###@###.### 2005-2-28 23:40:26 GMT

            jjg Jonathan Gibbons
            ahe Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: