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

Bug 357351

Summary: changing a query to a template or vice-versa causes problems
Product: [Modeling] Acceleo Reporter: Laurent Delaigue <laurent.delaigue>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stephane.begaudeau
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Laurent Delaigue CLA 2011-09-12 05:04:43 EDT
Build Identifier: 3.2.0.v20110909-0837

I modified a template into a queyr, *without changing its name*.
It seems that all what's needed is not recompiled, and you get
ClassCastExceptions:
java.lang.ClassCastException: org.eclipse.acceleo.model.mtl.impl.spec.QuerySpec cannot be cast to org.eclipse.acceleo.model.mtl.Template
	at org.eclipse.acceleo.model.mtl.impl.TemplateInvocationImpl.getDefinition(TemplateInvocationImpl.java:143)
	at org.eclipse.acceleo.model.mtl.impl.TemplateInvocationImpl.eGet(TemplateInvocationImpl.java:390)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1021)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1013)
	at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:409)
	at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.next(EContentsEList.java:565)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolveCrossReferences(EcoreUtil.java:308)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:302)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:287)
	at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:275)
	at org.eclipse.acceleo.internal.ide.ui.editors.template.actions.references.ReferencesSearchQuery.findReferencesForFile(ReferencesSearchQuery.java:255)
	at org.eclipse.acceleo.internal.ide.ui.editors.template.actions.references.ReferencesSearchQuery.run(ReferencesSearchQuery.java:191)
	at org.eclipse.acceleo.internal.ide.ui.editors.template.AcceleoOccurrencesFinderJob.run(AcceleoOccurrencesFinderJob.java:95)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Reproducible: Always

Steps to Reproduce:
1. create a template
2. in another module, use this template
3. modify the template into a query : String with the same name
4. edit the module that depends on it
Comment 1 Stephane Begaudeau CLA 2011-09-12 06:08:26 EDT
A fix has been contributed on HEAD. It will be available in 3.2.0
Comment 2 Laurent Goubet CLA 2015-05-27 08:57:26 EDT
Closing resolved bugs