Bug 550180 - Tests may fail with outdated document content
Summary: Tests may fail with outdated document content
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.24   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact: Kalyan Prasad Tatavarthi CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-18 13:43 EDT by Stephan Herrmann CLA
Modified: 2024-02-13 17:51 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2019-08-18 13:43:37 EDT
When running AnnotateAssistTest18 (from JDT/UI) in the IDE, sometimes some of the last tests fail. I could narrow it down to the observation that 
   javaEditor.getViewer().getDocument().get()
contained the sources from a previous test, even though that previous test called
   JavaPlugin.getActivePage().closeAllEditors(false);

Most frequent delinquent was testAnnotateParameter_Array4, which creates a jar-file and a source-zip within the root of a Java project. Then refreshLocal(DEPTH_INFINITE, null) is invoked on the project.

Still the following access path can give outdated content:
  type = IJavaProject.findType()         // the type is in a ClassFile
  javaEditor = JavaUI.openInEditor(type) // opens source attachment
  javaEditor.getViewer().getDocument().get()

This looks pretty bad to me but currently I have no idea where to look further.
Not even if we should look in or around JavaModelManager or SourceMapper ...
Comment 1 Stephan Herrmann CLA 2019-09-07 13:59:15 EDT
By adding some tracing to org.eclipse.jdt.internal.core.AbstractClassFile.getSource() I could verify that buffers are re-used for files in jars that are re-created for each test.
Comment 2 Stephan Herrmann CLA 2019-09-07 14:34:42 EDT
Those tests even have a tearDown() that deletes all resources in the project except for .* files.

This implies that buffers are re-used for files that are deleted and created again.

I could observe that deleting the jar file triggers a JavaElementDelta, but I could not find any connection from JavaElementDeltas to buffer management.

Can s.o. please point me to how invalidation of Buffers is supposed to work in general?
Comment 3 Manoj N Palat CLA 2019-11-25 10:49:11 EST
Bulk move out of 4.14
Comment 4 Manoj N Palat CLA 2020-05-14 07:53:16 EDT
Bulk move out of 4.16
Comment 5 Manoj N Palat CLA 2020-08-25 02:43:53 EDT
bulk move out of 4.17
Comment 6 Manoj N Palat CLA 2020-11-23 22:50:03 EST
Bulk move out of 4.18
Comment 7 Manoj N Palat CLA 2021-02-23 02:10:40 EST
bulk move out of 4.19
Comment 8 Manoj N Palat CLA 2021-05-21 00:09:42 EDT
Bulk move out of 4.20
Comment 9 Sarika Sinha CLA 2021-08-19 01:32:12 EDT
Bulk Move.
Comment 10 Jay Arthanareeswaran CLA 2021-11-19 01:20:43 EST
Bulk move out of 4.22.

If this is going to make it to 4.22, feel free to set the target back.
Comment 11 Manoj N Palat CLA 2022-02-16 05:10:31 EST
Bulk move out of 4.23
Comment 12 Manoj N Palat CLA 2022-02-16 05:11:08 EST
Bulk move out of 4.23
Comment 13 Manoj N Palat CLA 2022-02-16 05:11:37 EST
Bulk move out of 4.23
Comment 14 Manoj N Palat CLA 2022-02-16 05:11:50 EST
Bulk move out of 4.23
Comment 15 Eclipse Genie CLA 2024-02-13 17:51:54 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.