eclipse-xtext / eclipse-xtext/xtext
[Xbase] Java Method body changes leed to rebuilds once a structural change occured
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
We observe the following behaviour of xbase based languages e.g. domain model example
- we create a java type
Base - we reference it inside a xbase file e.g
entity Demo extends Base - we create a new (public) method in
Base.Demois rebuilt as expected. - we edit the body of the Method.
Demois rebuild. that is NOT expected.
I think this has to do with the implementation of JdtQueuedBuildData.needsRebuild
it basically never updates oldState. i think it should "update" it after needsRebuild was called.
override needsRebuild(IProject it, Collection<Delta> deltas) {
val oldState = javaBuildState.get(name)
val newState = lastBuiltState
try {
return newState.doNeedRebuild(
if (oldState === null || oldState.lastStructuralBuildTime != newState.lastStructuralBuildTime) {
[
val structurallyChangedTypes = newState.structurallyChangedTypes
if (getNew.namesIntersect(structurallyChangedTypes) || old.namesIntersect(structurallyChangedTypes)) {
deltas += it
}
]
} else {
null
})
} finally {
if (newState !== null) {
javaBuildState.put(name, newState)
} else {
javaBuildState.remove(name);
}
Am not sure how to properly test that. AbstractSingleEditorQueuedBuildTest is to whiteboxy and cirumvents jdt (JdtQueuedBuildData instance not shared)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with JdtQueuedBuildData.needsRebuild and inspect how javaBuildState and lastBuiltState are handled. Use the Base/Demo scenario from the issue to distinguish a structural method addition from a method-body edit, then investigate an integration test beyond AbstractSingleEditorQueuedBuildTest, which does not share the JdtQueuedBuildData instance. Done means structural changes rebuild Demo while body-only changes do not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100