Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326025

Summary: [Xpand] NPE on recreation when using Xpand incremental generation
Product: [Modeling] M2T Reporter: Roman Zimmer <roman.zimmer>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: karsten.thoms
Version: 1.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 374876    
Bug Blocks:    
Attachments:
Description Flags
Sample project none

Description Roman Zimmer CLA 2010-09-23 05:03:47 EDT
Created attachment 179440 [details]
Sample project

I was trying to take advantage of the incremental generation process in Xpand (latest version from official update site).

When executing the workflow, the initial generation works flawless. However, if I regenerate my project, I get a NPE independently if I changed my model or not.

Here is a stack trace:

java.lang.NullPointerException
	at org.eclipse.xpand2.incremental.IncrementalGenerationCallback.hasRelevantChangeForFile(IncrementalGenerationCallback.java:181)
	at org.eclipse.xpand2.incremental.IncrementalGenerationCallback.handleFileStatement(IncrementalGenerationCallback.java:143)
	at org.eclipse.xpand2.incremental.IncrementalGenerationCallback.pre(IncrementalGenerationCallback.java:123)
	at org.eclipse.xpand2.incremental.IncrementalGenerationFacade.pre(IncrementalGenerationFacade.java:163)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:35)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:191)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate(AbstractDefinition.java:180)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:246)
	at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:226)
	at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement.java:41)
	at org.eclipse.xpand2.Generator.invokeInternal2(Generator.java:333)
	at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent.invokeInternal(AbstractExpressionsUsingWorkflowComponent.java:239)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:104)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:89)
	at org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(WorkflowRunner.java:408)
	at org.eclipse.emf.mwe.core.WorkflowRunner.run(WorkflowRunner.java:293)
	at org.eclipse.emf.mwe.core.WorkflowRunner.main(WorkflowRunner.java:241)

I tried to debug. Obviously there seems to be a wrong handling of null values. The NPE arises when checking files that have not changed since the last generation.

I attached a sample project to reproduce the issue. When first running src/main/resources/incremental.mwe, it should work. The second time it will crash and delete all perviously generated files. This would continue infinitely.

If you need further information, I'll try my best to provide them!
Comment 1 Karsten Thoms CLA 2020-04-30 13:53:46 EDT
This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it.