This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 196554

Summary: Errors missing in the error cache
Product: java Reporter: Jan Lahoda <jlahoda>
Component: SourceAssignee: Jan Lahoda <jlahoda>
Status: VERIFIED FIXED    
Severity: normal CC: juhrik
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 188323    

Description Jan Lahoda 2011-03-10 16:39:11 UTC
[custom build from recent sources]

Have two files in the same package, A.java and B.java:
public class A {
    B b;
    Unknown u;
}
public class B {
    A a;
    Unknown u;
}

Disable the OnePassCompileWorker in java.source (e.g. by adding "|| true" to "if (jt == null || units == null) {" in SuperOnePassCompileWorker).
Modify them both, switch to some other file and press Save All. One of the files will not have an error badge.

The problem is that org.netbeans.modules.java.source.indexing.DiagnosticListenerImpl.getDiagnostics compares JavaFileObjects on instance equality, but the instances may differ in MultipassWorker.
Comment 1 Jan Lahoda 2011-03-11 11:22:29 UTC
The original problem fixed by:
http://hg.netbeans.org/jet-main/rev/ae47803540da
I would consider this patch to be quite safe.

I have found another problem where the errors were not reported correctly, and attempted to fix it:
http://hg.netbeans.org/main/nb-javac/rev/a0140acb2b3d
http://hg.netbeans.org/jet-main/rev/8e4cf2406610

These two would be good candidates for 7.0, I think, although I cannot claim that the second fix is safe.

I have also added option to disable the one-pass compile workers, as it seems that the multi-pass worker is apparently not properly tested:
http://hg.netbeans.org/jet-main/rev/7eefbdc49d26
The multi-pass worker can be forced using the following command line option:
-J-Dorg.netbeans.modules.java.source.indexing.JavaCustomInxer.no.one.pass.compile.worker=true
Comment 2 Quality Engineering 2011-03-12 09:45:19 UTC
Integrated into 'main-golden', will be available in build *201103120400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ae47803540da
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196554: storing and getting Diagnostics based on their URIs, not FileObjects instances, as the FileObjects can differ in the MultiPassCompileWorker.
Comment 3 Dusan Balek 2011-03-15 13:38:20 UTC
The patch seems fine to me.
Comment 4 Jaromir Uhrik 2011-03-15 14:25:47 UTC
Verified in trunk based on verification of 188323. I agree with integration to NB7.0.
Comment 6 Jaromir Uhrik 2011-03-24 01:02:23 UTC
Marked as Verified in 70 - based on the verification of fix 188323.