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.
I clicked on an error message in the output window after a compile and it opened the file in the editor window then It crashed. The error message was: Import.java [133:1] reference to Statement is ambiguous, both class java.sql.Statement in java.sql and class java.beans.Statement in java.beans match Statement stmt = conn.createStatement ();
Created attachment 13308 [details] Ide.log file of crash
Reassigning to editor (based on last exceptions in the log file), although I'm not sure if they could have anything to do with the IDE crash.
What do you mean by "it crashed"? Was there any data loss? Anyway this should be fixed into 3.6.
This could caused by inconsistency problem of error annotations handled in java module - JavaEditor class. Try the following: open ColorPreview class from examples package Create i.e. three errors by adding extra letter to a text for example on lines 29: java.beans.APropertyChangeSupport 36: propertyChangeSupport.AaddPropertyChangeListener 43: propertyChangeSupport.AremovePropertyChangeListener wait until parser finish and error annotations are added into the glyph area. comile source via F9, click on the last error (43 line) in output window. The cursor jumps into the editor on 43 line. Correct the problem, delete A and immediately save the source. Result: all error annotations are removed from glyph gutter. Reassigning to java module for evaluation.
I am also able to reproduce the issue with parser annotations as described by Martin. But I do not see any connection to the problem reported by the user. It is a separate issue.
I thouhgt that it could be connected if there is inconsistent state of annotations. Anyway, I haven't reproduced the user problem yet...
I have overlooked they are two different types of error annos. org-netbeans-core-compiler-error and org-netbeans-modules-java-parser_annotation. Reassigning the issue back, sorry for the confusion. Please file a separate issue for java error annos problem. Thanks.
The exception is thrown because that the compiler's annotation is being added to the document second time (without first being removed from it). Document implementation has a consistency check that prevents it. I've looked into CompilerDisplayer and there is no extra synchronization of its AnnotationImpl.attach() method at line 497. Not sure whether adding/removing annotations can only happen in AWT there so not blaming the compiler here. However IMHO we could prevent this (or clearly point to this) by 1) syncing Annotation.attach() and detach() so the physical attaching/detaching is thread-safe. 2) not posting NbDocument.addAnnotation() and NbDocument.removeAnnotation() into AWT which is currently being done in case the operation is not performed in AWT. BTW regarding 2) there can in theory be problem in case a) Thread-1 calls Annotation.attach() => AWT-task gets scheduled for this in NbDocument.addAnnotation(). The added annotation gets remembered in an internal set inside the module. b) AWT is running some sort of a refreshing task containing BTW removal of all attached annotations including the one added in a). c) As b) runs directly in AWT the NbDocument.removeAnnotation() will not post annotation removing into AWT. d) However the NbDocument.removeAnnotation() may fail in case the AWT task from a) gets scheduled _after_ task from b) which IMHO can happen.
> What do you mean by "it crashed"? I thought that Netbeans had crashed and that I was going to loose data. So I filled out the report and added the log before I pressed the Ok button on the error dialog. > Was there any data loss? No, Netbeans seemed to continue working after the error message and I was able to save my work.
Based on the latest comment from the reporter, I'm downgrading the priority to P2 (see no evidence of crash, nor data loss). It still needs to be addressed for 3.6 though. Someone please consider replacing the current Summary line with a more descriptive text.
*** Issue 40095 has been marked as a duplicate of this issue. ***
*** Issue 39999 has been marked as a duplicate of this issue. ***
*** Issue 39794 has been marked as a duplicate of this issue. ***
Assigning to Dusan who will try the fix with black list of annotations that are being added the second time or that are being removed but they were not added yet. We should hold the use weak refs (for holding the not yet added) annotations to make sure that we introduce no leaks.
Milo, I'm not sure I understand your solution 100%, but aren't we fixing the symptomes instead of the source of the problem here? Can't we prevent this event from occuring in the first place by adding synchronizations?
Yes, you are right. We were analyzing the situation and we decided that we will attempt this fix for this version as we are in danger of the potential deadlocks that we could introduce by adding an extra locking (which would be necessary because currently it's in fact single-threaded because the request only come from AWT). After 3.6 we will revise the NbDocument.addAnnotation()/removeAnnotation() and add a lock on the editor side. IMHO we should revise the overall Annotations threading model as well.
*** Issue 40745 has been marked as a duplicate of this issue. ***
A black list of annotations implemented as a hotfix. The list contains weak references to annotations being added more than once or being removed when not added yet. Fixed in [maintrunk]. /cvs/editor/src/org/netbeans/modules/editor/NbEditorDocument.java,v <-- NbEditorDocument.java new revision: 1.37; previous revision: 1.36 done Mila, could you please review the fix. Visual diff: http://editor.netbeans.org/source/browse/editor/src/org/netbeans/modules/editor/NbEditorDocument.java.diff?r1=1.36&r2=1.37
I approve the fix.
I tried some actions with annotations and it looks good. Verified in dev 200403071900.
Integrated into release36 branch. /cvs/editor/src/org/netbeans/modules/editor/NbEditorDocument.java,v <-- NbEditorDocument.java new revision: 1.36.10.1; previous revision: 1.36 done
*** Issue 41044 has been marked as a duplicate of this issue. ***
*** Issue 41324 has been marked as a duplicate of this issue. ***
*** Issue 39445 has been marked as a duplicate of this issue. ***
Looks like there has been some mistake. Thsi issue should be already verified by pfelenda. Anyway, the annotations work fine in 200507131800. Marking as verified.