eclipse-xtext / eclipse-xtext/xtext

Xbase/Xtend and Undo Jdt save actions dont like each other

Open
#2,490 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

https://user-images.githubusercontent.com/238736/137960220-3b226d46-73bc-422e-b355-c50e4a3520e4.mov

java.lang.IllegalStateException: Could not create binding for 'lala.Viech' in context of project 'lala'.
	at org.eclipse.xtext.common.types.access.jdt.JdtBasedTypeFactory.createType(JdtBasedTypeFactory.java:338)
	at org.eclipse.xtext.common.types.access.jdt.JdtBasedTypeFactory.createType(JdtBasedTypeFactory.java:415)
	at org.eclipse.xtext.common.types.access.jdt.JdtBasedTypeFactory.createType(JdtBasedTypeFactory.java:1)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeMirror.initialize(JdtTypeMirror.java:68)
	at org.eclipse.xtext.common.types.access.TypeResource.doLoad(TypeResource.java:135)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
	at org.eclipse.xtext.common.types.access.TypeResource.load(TypeResource.java:121)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.createResourceAndFindType(JdtTypeProvider.java:290)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.findObjectTypeInJavaProject(JdtTypeProvider.java:273)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.doFindObjectType(JdtTypeProvider.java:216)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.findObjectType(JdtTypeProvider.java:196)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.doFindTypeByName(JdtTypeProvider.java:154)
	at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.findTypeByName(JdtTypeProvider.java:163)
	at org.eclipse.xtext.common.types.xtext.AbstractTypeScope.getSingleElement(AbstractTypeScope.java:60)
	at org.eclipse.xtext.common.types.xtext.AbstractTypeScope.getSingleElement(AbstractTypeScope.java:55)
	at org.eclipse.xtend.core.scoping.LocalResourceFilteringTypeScope.getSingleElement(LocalResourceFilteringTypeScope.java:43)
	at org.eclipse.xtend.core.scoping.RecordingTypeScope.getSingleElement(RecordingTypeScope.java:52)
	at org.eclipse.xtend.core.scoping.TypeScopeWithWildcardImports.getSingleElementFromParent(TypeScopeWithWildcardImports.java:73)
	at org.eclipse.xtend.core.scoping.TypeScopeWithWildcardImports.getSingleElement(TypeScopeWithWildcardImports.java:67)
	at org.eclipse.xtend.core.scoping.AbstractKnownTypesScope.getSingleElement(AbstractKnownTypesScope.java:43)
	at org.eclipse.xtend.core.scoping.PrimitiveAwareScope.getSingleElement(PrimitiveAwareScope.java:40)
	at org.eclipse.xtend.core.scoping.CachingTypeScope.getSingleElement(CachingTypeScope.java:41)
	at org.eclipse.xtend.core.scoping.AbstractKnownTypesScope.getSingleElement(AbstractKnownTypesScope.java:43)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:115)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:266)
	at org.eclipse.xtext.xbase.resource.BatchLinkableResource.getEObject(BatchLinkableResource.java:120)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:223)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:209)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:269)

undoing a save action that organizes imports leads to failing JdtBasedTypeProvider
=> Xtend file may get broken.

upon fixing the java file, the xtend file wont be built again
e.g. cause
JdtQueuedBuildData.doNeedRebuild(JavaBuilderState, Procedure1<? super UnconfirmedStructuralChangesDelta>)
says no (same last built date, am not sure if this is the correct place that should trigger affection)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by undoing a save action that organizes imports, then inspect JdtBasedTypeProvider and JdtQueuedBuildData, both identified in the report and stack trace. Trace why the Xtend file is not rebuilt after the Java file is fixed; done means the undo scenario no longer breaks the Xtend file and a subsequent Java change triggers its rebuild.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.