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

No error for public class in wrong file

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b27
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: