Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Mar 2001 15:26:28 -0500
From:      "Brian J. Sletten" <brian@parabon.com>
To:        Todd Enersen <tee@fireclick.com>
Cc:        freebsd-java@freebsd.org
Subject:   Re: possible bug in port of javac
Message-ID:  <3ABA5FF3.2E2063AF@parabon.com>
References:  <3ABA5AC3.CA8F09DD@fireclick.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm trying to port one of our software packages to the FreeBSD platform. It currently works
> on Win32, Solaris and Linux, and we have customer who'd like to see it run on FreeBSD.

Are you using the same version of the JDK on every platform? I'm using the Linux version of JDK1.3 under FreeBSD and it complains the same way. I'd say it is more likely to do with some versions of Java allowing it and some not, rather than something FreeBSD-specific.

> > Blank final variable 'm_maxValuesPerName' may not have been initialized. It must  be
> > assigned a value in an initializer, or in every constructor.
> Even though the constructor assigns a value to the final variable.
> 
> I've tried adding a default constructor but that didn't fix the problem.
I assume you mean "I've tried adding a default constructor and assigned the value in it".

I did the same thing and the aforementioned error went away.

> The only solution so far has been to remove the "final" keyword from the declaration.
I'm assuming that you are trying to assign this value from a property or something. Do you need it as a final instance variable? If the same value is going to be valid for every class, try something like:

public class A {
    private static final int m_maxValuesPerName;

    static {
       m_maxValuesPerName = Integer.getInteger( "foo.maxValuesPerName", 5 ).intValue();
    }
}

Or even the more succinct:

public class A {
    private static final int m_maxValuesPerName 
	= Integer.getInteger( "foo.maxValuesPerName", 5 ).intValue();
}

-- 
Where you stand depends on where you sit.  -- Anonymous

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?3ABA5FF3.2E2063AF>