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

javac allows unused unassigned local blank final variables

    XMLWordPrintable

Details

    • sparc
    • solaris_7

    Description



      Name: laC46010 Date: 08/26/99



      Javac (jdk1.1-jdk1.3beta) doesn't detect an unassigned local blank final variable.
      Inner Classes Specification, section "Blank finals and final local variables", says:

      "A blank final must be assigned an initial value, at most once."

      See reduced JCK test source and logs below:

      ---------------------------------------------------------------dasg00110.java
      public class dasg00110 {
          public static void main(String args[]) {
              final int j; // compile-time error
          }
      }
      -----------------------------------------------------------------------------
      Results of compilation:

      > java -version
      java version "1.3beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
      Java(TM) HotSpot Client VM (build 1.3beta-O-release, 1.3beta-O-release, interpreted mode)
      > javac -d . dasg00110.java
      > echo $?
      0
      >
      -----------------------------------------------------------------------------

      ======================================================================

      Attachments

        Activity

          People

            wmaddoxsunw William Maddox (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: