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.
see attached stacktrace, on every file open we access fs in EDT
Created attachment 134430 [details] stacktrace
Actually it happens not on file open, but on first modification. Same for notifyUnmodified.
Querying file for writability upon first modification is inevitable - the modification should not proceed if the file is not modifiable.
I totally agree that canWrite is inevitable on file modification, but performing that in EDT leads to the whole IDE freeze if the file is on slow NFS
Mila, is it possible to move initialization of "canWrite" status into "org.openide.text Editor Initialization" thread?
"canWrite" is part of checking whether the document can be modified by typing (and other actions) or not. CloneableEditorSupport.notifyModified() then reports whether the file can be modified or not and the typing action either succeeds or the modification is rejected. In the past we had the state when we allowed the first modification to proceed while doing the check on the background (i.e. return true from CloneableEditorSupport.notifyModified()) and if "canWrite" fails we attempted to undo the document modification(s) that occurred in the meantime but there were numerous problems with that approach including the user-visible fact that the typed characters appear in the document and suddenly they dissapear. IMO if the user starts typing to the document she wants to be sure that it can modify the document so she will wait for the first modification to proceed even in case if it takes a while. I can't imagine that the user would start typing and when seeing that "canWrite" takes a long time to proceed that she would switch to another document and start typing there in the meanwhile or do anything else in the IDE. Alternatively we could consider switching to another concept and test writability on save but that would be a huge change to the IDE's infrastructure and IMHO many users would refuse such change.
Mila, thanks for the answer. I don't think we should switch concepts. We already have "initializing document" phase and EDT phase. It was interesting for me to know if "read only" state initialization can be moved into "initializing document".