| Summary: | [Xbase 2.1] Negative XIntLiterals results in wrong Java code when converting PrimitiveToWrapper | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Ingo Meyer <ingo.meyer> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | unspecified | Flags: | sebastian.zarnekow:
juno+
|
| Target Milestone: | M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Pushed to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: 20110609-2236 With negative values for a XIntLiteral the Xbase compiler produces illegal code through method the method TypeConvertingCompiler.convertPrimitiveToWrapper: "( ((Integer) - 1) )". This could be easily solved by put the primitive value into parentesis: ""( ((Integer) (- 1)) )". In 2.0.1 the following was working but with 2.1 the context variable is missing: protected void convertPrimitiveToWrapper( final JvmTypeReference wrapper, final IAppendable appendable, final XExpression context, final Later expression ) { appendable.append( "((" ); serialize( wrapper, null, appendable ); appendable.append( ")" ); if (context instanceof XIntLiteral) { final XIntLiteral xInt = (XIntLiteral) context; if (xInt.getValue() < 0) { appendable.append( "(" ); expression.exec(); appendable.append( ")" ); } else expression.exec(); } else expression.exec(); appendable.append( ")" ); } Reproducible: Always