| Summary: | [generator] Error caught while generating code model from an ecore with embedded OCL. | ||
|---|---|---|---|
| Product: | [Modeling] OCL | Reporter: | Adolfo Sanchez-Barbudo Herrera <adolfosbh> |
| Component: | Core | Assignee: | OCL Inbox <mdt-ocl-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ed |
| Version: | unspecified | ||
| Target Milestone: | M6 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=520440 | ||
| Whiteboard: | |||
| Bug Depends on: | 350891, 371394 | ||
| Bug Blocks: | |||
|
Description
Adolfo Sanchez-Barbudo Herrera
NPE indeed caused by anaonymous invariant. CD to Pivot can cope, but Pivot to Ecore can't becuase a null name is incompatible with the 'constraints' annotation summary. Changed to just ignore unnamed invariants. Bug 371171 raised to priovide a warning in the editor. JUnit test added. Pushed to master for M6. The plugin variant of this test fails on Hudson, so it has been disabled. Re-instate once Acceleo moves to Guava. (In reply to comment #2) > Re-instate once Acceleo moves to Guava. Re-instated, successful build on branch; pushed to master. CLOSED after a year in the RESOLVED state. (In reply to Adolfo Sanchez-Barbudo Herrera from comment #0) > package prueba : prueba = 'http://prueba' > { > class Clase1 > { > invariant : self.name.size() > 0; > attribute name : String[?] { ordered }; > } > } Once we add the SymbolicAnalysis, bug 520440, this fails with a mayBeInvalid on self.name. Changing to attribute name : String[1] { ordered }; eliminates the hazard. (In reply to Ed Willink from comment #5) > Changing to > > attribute name : String[1] { ordered }; > > eliminates the hazard. Yes, but that just makes the problem go away by requiring an EMF lower bound check. Changing to invariant : (self.name <> null) and (self.name.size() > 0); should ensure that the lower bound is checked and guards the size comparison. Just needs the self.name mayBeNull hypothesis for the size call to be detected as a contradiction. (The CG should factor out the CSE.) |