Bug 232062 - [compiler] Clearly wrong blank final field error
Summary: [compiler] Clearly wrong blank final field error
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2008-05-14 09:04 EDT by Peter Larsen CLA
Modified: 2009-06-11 14:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Larsen CLA 2008-05-14 09:04:51 EDT
Build ID:  I20080330-1350

In the following code snip I am often getting an error that
WakesListenersWhenReady's final runnables field may be left uninitialized.
Clearly the runnables field is initialized with a hashmap.
If I modify anything(space etc.)and save the file the error goes away.
However it shows up again - usually after a synchronize update.


 public static ObjectRunnableObject A = 
    new ObjectRunnableObject() {
        public Object run(final Object name) {
	    return new B() {
                private boolean isReady;
                private final HashSet generalListeners = new HashSet();
                private final HashSet runnables = new HashSet();

                ....
            };
         }
    };
Comment 1 Olivier Thomann CLA 2008-05-14 09:18:58 EDT
Could you please attach a complete test case ?
Thanks.
Also provide your compiler settings: compliance, source, target values.
Comment 2 Peter Larsen CLA 2008-05-14 12:02:12 EDT
I am using compliance 1.3 with default source etc. values.
I am unable to create a test case, as I cannot reproduce
it reliable. 
Comment 3 Philipe Mulet CLA 2008-05-14 12:26:24 EDT
Cannot reproduce on following with ECJ 3.2.2, 3.3.2 or 3.4M7:
Need better steps to reproduce.

------------

import java.util.HashSet;
public class X {
	public static ObjectRunnableObject A = new ObjectRunnableObject() {
		public Object run(final Object name) {
			return new B() {
				private boolean isReady;
				private final HashSet generalListeners = new HashSet();
				private final HashSet runnables = new HashSet();
			};
		}
	};
}
interface ObjectRunnableObject {
	Object run(Object o);
}
class B {
}

Comment 4 Peter Larsen CLA 2008-05-15 12:14:54 EDT
Got this again in same file in two different branches after
a team sync update. Is there a way I can dump internal status?
I can properly leave one of them until someone find a clever way
of debugging it.

I also had the following in the tree which was my attempt to reproduce
it, but no luck.

package octotest.MiscTest;

import java.util.HashSet;

public interface EclipseFinalError extends I2 {

	public boolean getA();
	
	public void addCs(Object arg);
	
	public static ObjectRunnableObject C1 = new ObjectRunnableObject() {
		public Object run(final Object o) {
			return new EclipseFinalError() {
				private boolean a;
				private final HashSet b = new HashSet();
				private final HashSet c = new HashSet();
				
				public final boolean getA() {
					return a;
				}

				public final Object getArg() {
					return o;
				}

				public void addCs(Object arg) {
					b.add(arg);
					c.add(arg);					
				}
			};			
		}
	};
	
	
}

interface ObjectRunnableObject {
	Object run(Object o);
}

interface I2 {
	public Object getArg();
}
Comment 5 Peter Larsen CLA 2008-05-15 13:39:09 EDT
It just hit another coworker after a cvs update with eclipse version

Version: 3.2.1
Build id: M20060921-0945

Same file, place and error message.

Strange it only complains about runnables, and not also generalListeners.
Comment 6 Philipe Mulet CLA 2008-06-09 08:48:13 EDT
Cannot reproduce on testcase from comment 4, even with ECJ 3.2.0
Comment 7 Olivier Thomann CLA 2009-06-11 14:48:22 EDT
Closing as WORKSFORME.
See bug 251539 comment 25.