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

Bug 362056

Summary: [traceability] ClassCastException with guards
Product: [Modeling] Acceleo Reporter: Stephane Begaudeau <stephane.begaudeau>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Stephane Begaudeau CLA 2011-10-26 08:10:42 EDT
A ClassCastException can occur with the traceability engine on a template like this:

[template public myTemplate (c: Class) ?(c.eAllContents()->filter()->size() > 0)]
[/template]

Something, somewhere in the evaluation of the guard is causing a NPE that returns a DynamicEObjectImpl that cannot be casted in a java.lang.Boolean.

A unit test highlighting the problem has been contributed on master.
Comment 1 Stephane Begaudeau CLA 2011-10-26 09:18:34 EDT
The problem is coming from the evaluation of the guard on a main template.

the fix for the class cast exception has been contributed with a fix for the evaluation of the guard of a main template.

The fix have been contributed on master and will be available in Acceleo 3.2+ (not 3.2.0 since we are to close from the release and a simple workaround is available: do not use the guard on the main template with the traceability engine but use it on another template later and the guard on a main template do not match the good practices for an Acceleo generator).
Comment 2 Laurent Goubet CLA 2015-05-27 08:56:09 EDT
Closing resolved bugs