Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354605 - Java top-level type name change is not handled by Xtext builder
Summary: Java top-level type name change is not handled by Xtext builder
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: M6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 07:56 EDT by Vladimir Piskarev CLA
Modified: 2017-09-19 17:53 EDT (History)
1 user (show)

See Also:
jan: juno+


Attachments
Sample language projects (69.95 KB, application/zip)
2011-08-12 07:58 EDT, Vladimir Piskarev CLA
no flags Details
'example' project (1.43 KB, application/zip)
2011-08-12 08:00 EDT, Vladimir Piskarev CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Piskarev CLA 2011-08-12 07:56:43 EDT
Build Identifier: I20110613-1736

If the name of a top-level type is changed (without renaming its compilation unit) the affected resources will not be rebuilt by the Xtext builder.

It seems to be caused by the fact that there is no Xtext delta fired for the 'old' TypeResource URI in this case, only for the 'new' one. Hence, none of the resources depending on the 'old' type URI will be regarded as 'affected'.

Interestingly, it is not an issue for editors reconciling, since TypeResourceUnloader converts sufficiently fine-grained POST_RECONCILE Java delta, containing full information about added/removed types, e.g. 

    Java Model[*]: {CHILDREN}
        example[*]: {CHILDREN}
            src[*]: {CHILDREN}
                example[*]: {CHILDREN}
                    [Working copy] Foo.java[*]: {CHILDREN | FINE GRAINED}
                        Bar[+]: {}
                        Foo[-]: {}

while JavaChangeQueueFiller sees the 'course' POST_CHANGE delta:

    Java Model[*]: {CHILDREN}
        example[*]: {CHILDREN}
            src[*]: {CHILDREN}
                example[*]: {CHILDREN}
                    [Working copy] Foo.java[*]: {PRIMARY RESOURCE}


Reproducible: Always

Steps to Reproduce:
1. Import the attached 'org.xtext.example.domainmodel' and
'org.xtext.example.domainmodel.ui' projects into the workspace

2. Run the runtime workbench and import the attached 'example' project into the
runtime workspace. Open 'Foo.dmodel' and 'Foo.java' in editors

3. In 'Foo.java' change the type name 'Foo' to 'Bar' (without refactoring). Note the error tick on the 'Foo.dmodel' editor

4. Now save the change. Note that 'Foo.dmodel' has not been rebuilt (there is no error marker for it in Problems View)
Comment 1 Vladimir Piskarev CLA 2011-08-12 07:58:57 EDT
Created attachment 201388 [details]
Sample language projects
Comment 2 Vladimir Piskarev CLA 2011-08-12 08:00:01 EDT
Created attachment 201389 [details]
'example' project
Comment 3 Vladimir Piskarev CLA 2011-08-12 08:08:58 EDT
Interestingly, there seems to be a kind of 'workaround' in JdtToBeBuiltComputer#removeStorage, but it works only in the case when the compilation unit is renamed (or moved/deleted), not just its top-level type.
Comment 4 Vladimir Piskarev CLA 2011-08-23 06:17:17 EDT
This bug is related to bug 354951 (their fundamental nature is similar, see 'comment 3' in that bug for details). See the patch attached to that bug which also fixes this bug.
Comment 5 Jan Koehnlein CLA 2012-02-28 04:54:50 EST
Fixed with path from bug 354951.
Comment 6 Karsten Thoms CLA 2017-09-19 17:42:07 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:53:13 EDT
Closing all bugs that were set to RESOLVED before Neon.0