Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2001 09:04:41 -0500
From:      Rob Furphy <rfurphy@ox.com>
To:        freebsd-java@freebsd.org
Subject:   possible bug in port of javac
Message-ID:  <3ABB57F9.2090101@ox.com>

next in thread | raw e-mail | index | archive | help
Some documentation may clear up what is supposed to happen.
I started start here:

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#35962

and found

http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#10931

this even describes what a 'blank final' variable is and

"It is a compile-time error if a blank final class variable is not 
definitely assigned....."


Some more examples:

Using Joe Shevland's example class (and Solaris VM (build 
Solaris_JDK_1.2.2_05a, native threads, sunwjit)
  public class test {
  private final int someint;
  public test() { someint = 5; }
}

This compiles without error (I think it should).  However, if you make a 
change to thispublic class test {
  private static final int someint;
  public test() { someint = 5; }
}

this error pops out
"Blank final variable 'someint' may not have been initialized. It must 
be assigned a value in an initializer, or in every constructor"

Using the latest beta java for linux
java version "1.3.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-beta-b15)
Java HotSpot(TM) Client VM (build 1.3.1beta-b15, mixed mode)

I do not see the error in question but I get "test.java:3: cannot assign 
a value to final variable someint"
when someint is static but no error when it is not.

Rob F.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3ABB57F9.2090101>