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.
Code folding test in editor is broken due to Import.getStartOffset() and Import.getEndOffset() inconsistency. tested source: /* * Initial Comment Fold * Created on 15 September 2004, 10:48 */ package code_folds.JavaFoldsTest; // import section fold import javax.swing.JApplet; import javax.swing.JButton; ... If I open test source in IDE I get correct Import bounds 130,157 of the first import. While test is running the offsets are 136,163. The same problems were found in code completion tests. (jdk 1.4.2)
When asking for offset, does the test open the file in editor? Please note that if you do not open the file in editor the offset is computed against the original source text which may contain windows CRLF characters and guarded-block starting/ending marks which get removed from the source buffer when opening the file in editor thus cause a change in offsets. The test should make no assuption that offsets in files on the disk are same as offsets in the document. Please let us know if this is the problem or the problem is something else. Also, is this a regression? (did it work before?) For how long have the tests been broken if so?
The test used to work before, I've noticed the first failure on this Tuesday (11.1.2005). Martin, please answer the other questions.
Yes, this is a functional test. File is open in editor. The wrong import fold bounds are also visible in code folding bar during test running.
It can happen randomly also in IDE session (issue #49852)
See issue 49852 for additional information
You can ask for offset, but bear in mind that offsets of element will change when offsets were obtained from file, but then the file was opened in editor. (CR characters are filtered, so offsets are no longer valid.) I changed some calls in JavaEditor to obtain positions in all cases from document, so this bug should be no longer reproducible. Closing as invalid as the import returns the offsets correctly.
verified. After fixing issue #49852 tests run correctly. Thanks.
Reorganization of java component