Bug 19677 - invalid "may not have been initialized" error
Summary: invalid "may not have been initialized" error
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: diagnostic, rejects-valid
Depends on: 28067
  Show dependency treegraph
Reported: 2005-01-28 19:21 UTC by Jerry Haltom
Modified: 2007-01-09 20:46 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-01 02:37:39


Note You need to log in before you can comment on or make changes to this bug.
Description Jerry Haltom 2005-01-28 19:21:52 UTC
Following Eclipse code snippet that fails:

protected void join(InternalJob job) {
	final IJobChangeListener listener;

	synchronized (lock) {
		listener = new JobChangeAdapter() {
			public void done(IJobChangeEvent event) {

The error reports the line containing listener = as the problem.
Comment 1 Jerry Haltom 2005-01-28 19:23:53 UTC
Oh yes, of course:

    [mkdir] Created dir:
    [javac] Compiling 158 source files to
In class `org.eclipse.core.internal.jobs.JobManager':
In method
error: Variable `listener' may not have been initialized.
    [javac]                     };
    [javac]    ^
    [javac] 1 error
Comment 2 Andrew Pinski 2005-01-28 19:35:32 UTC
Confirmed, reduced to:
class a1 { public int f(){return 1;} }
class t
  Object f;
  void g(a1 a)  {}
  void f()
    final a1 a;
    a = new a1 () { public int f(){return 0;}};
Comment 3 Andrew Pinski 2005-01-28 19:43:06 UTC
Related to bug 16839.  The problem might be the same problem after all because final are collected for 
anonymous inner classes.
Comment 4 Tom Tromey 2005-01-30 19:02:56 UTC
Yes, the underlying problem is the same as with bug 16839.
gcj captures all 'final' local variables in an anonymous class.
This is incorrect -- it should only capture those which are actually
Comment 5 Tom Tromey 2007-01-09 20:46:59 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.