| Summary: | JvmConstructor body is generated only when it has parameters | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | rjarana Mising name <rayco.arana> |
| Component: | Xtext | Assignee: | Jan Koehnlein <jan> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | christian.dietrich.opensource, ingo.boegemann, jan, lorenzo.bettini, sven.efftinge, tmf.xtext-inbox |
| Version: | 2.2.0 | Flags: | jan:
juno+
|
| Target Milestone: | M5 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
rjarana Mising name
Pushed to MASTER I added one more condition: If there is a default constructor without any implementation hint next to another constructor, it is generated with an empty body. We are able to link aginst it, so it has to exist in Java, too. The same problem is there also in the presence of constructor parameters... (In reply to comment #3) > The same problem is there also in the presence of constructor parameters... The reason for the empty body lies in the fact that the JvmTypesBuilder already added the empty body to the constructor before applying the init procedure. If a body was added it becomes the second adapter in the eAdapters and is hence ignored. Extending the JvmTypesBuilder and commenting this out removed this particular problem for me: public class ConstructorCapableJvmTypesBuilder extends JvmTypesBuilder { public JvmConstructor toConstructor(EObject sourceElement, String simpleName, Procedure1<JvmConstructor> init) { JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); constructor.setSimpleName(nullSaveName(simpleName)); // setBody(constructor, new Function1<ImportManager, CharSequence>() { // public CharSequence apply(ImportManager p) { // return "{}"; // } // }); if (init != null && simpleName != null) init.apply(constructor); return associate(sourceElement, constructor); } } This has also already been fixed in current master. (In reply to comment #5) > This has also already been fixed in current master. Great! Looking forward to 2.3! Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |