Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2001 15:00:06 +1100
From:      "Joe Shevland" <shevlandj@kpi.com.au>
To:        "Thomas T. Veldhouse" <veldy@veldy.net>, "Todd Enersen" <tee@fireclick.com>
Cc:        <freebsd-java@FreeBSD.ORG>
Subject:   RE: possible bug in port of javac
Message-ID:  <NKEFKGEPLECBEFCCIDDJCEGLCDAA.shevlandj@kpi.com.au>
In-Reply-To: <005d01c0b341$5cedac20$1d750140@cascade>

next in thread | previous in thread | raw e-mail | index | archive | help

This struck me as odd too, but after reading the postings I compiled a small test on Windows JDK 1.3 that seemed to allow the initialisation to occur in the constructor. Subclasses still won't be able to access/alter the variable by overriding the constructor, but it kind of goes against the meaning of 'final' to me.

I wonder did Todd add the initialisation in _every_ constructor?

e.g.

public class test {
   private final int someint;
   public test() { someint = 5; }
}

was allowed which surprised me. The FreeBSD JDK 1.1.8 allowed it also.

Regards,
Joe


-----Original Message-----
From: owner-freebsd-java@FreeBSD.ORG [mailto:owner-freebsd-java@FreeBSD.ORG]On Behalf Of Thomas T. Veldhouse
Sent: Friday, March 23, 2001 1:31 PM
To: Todd Enersen
Cc: freebsd-java@FreeBSD.ORG
Subject: Re: possible bug in port of javac


When you declare something final, aren't you supposed to supply an initializer? I believe this is analgous to const int m_maxValuesPerName = 10 in C++.
 
private final int m_maxValuesPerName = 10; 

I believe this is analgous to const int m_maxValuesPerName = 10; in C++.
 
Tom Veldhouse
veldy@veldy.net


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?NKEFKGEPLECBEFCCIDDJCEGLCDAA.shevlandj>