🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #20055

Bug Report

#20055
From: Lyle Thompson
Date: Fri, 07 Nov 1997 00:00
60 lines
1939 bytes
There seems to be no place on the Borland web page to report
bugs. Hope this is where they go.

JBuilder erroneously reports:

Error: (108) variable <name> might not have been initialized.

This forces code to be added which is not required by the
language spec.

Example:

{
    MyObject o;

    try
    {
	o = new MyObject();
	// some other stuff that uses o
    }
    catch (Exception e)
    {
	// recover from exception
    }
    finally
    {
	if (o != null)
	    o.dispose();
    }
}

By definition, o is assigned null upon declaration. The error
is flagged on the "if (o != null)" line. This code meets the
JLS, is technically correct (though maybe there are more elegant
ways), and should absolutely not flag an error (a warning, maybe).
This WOULD be an error if o were of a basic type, so the compiler
needs to consider this before issuing the error.

Changing the declaration to:

MyObject o = null;

removes the warning, but this should not be necessary (since its
the language's default behaviour anyway). 

Regards,

Lyle

P.S. I would also note that this is really rather minor (though
it can prevent 3rd party code from compiling unaltered), and that
I have found 3 (yes 3!) significant bugs in the JDK compiler that
don't exist in the JBuilder compiler. Kudos!

-- 
Lyle Thompson             Email:  lyle@heliosoft.com
HelioSoft, Inc.           Phone: (510) 278-5249 
664 Paseo Grande          Fax:  (510) 278-5249
San Lorenzo, CA 94580     Web: http://www.heliosoft.com
Technical Details
Message-ID: <3463B717.E9631810@heliosoft.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5179013adb8558bb,start
X-Google-Attributes: gidf74b3,public
From: Lyle Thompson <lylet@heliosoft.com>
Subject: Bug Report
Date: 1997/11/07
Message-ID: <3463B717.E9631810@heliosoft.com>
X-Deja-AN: 287777824
Organization: HelioSoft, Inc.
Reply-To: lyle@heliosoft.com
Newsgroups: borland.public.jbuilder.java.language