| Summary: | [Xtend][Scoping] Injected Extensions shadow local methods | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Christian Dietrich <christian.dietrich.opensource> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | sebastian.zarnekow, sven.efftinge | ||||
| Version: | 2.0.0 | Flags: | sven.efftinge:
indigo+
|
||||
| Target Milestone: | SR1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 199488 [details]
full source code
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: 2.0.0 Having following Xtend/Java classes public class DomainmodelCompiler extends XbaseCompiler { public String compile(Operation operation, ImportManager importManager) { StringBuilderBasedAppendable appendable = new StringBuilderBasedAppendable( importManager); for (JvmFormalParameter param : operation.getParameters()) { appendable.declareVariable(param, param.getName()); } return compile(operation.getBody(), appendable, operation.getReturnType()).toString(); } ... } and class DomainmodelGenerator implements IGenerator { ... @Inject extension DomainmodelCompiler xbc ... def body(Entity e, ImportManager importManager){ ''' public class «e.name» «IF e.superType != null»extends «e.superType.shortName(importManager)» «ENDIF»{ «FOR f:e.features.filter(typeof(Property))» «f.compile(importManager)» «ENDFOR» «FOR f:e.features.filter(typeof(Operation))» «f.compile(importManager)» «ENDFOR» } ''' } def compile(Operation o, ImportManager importManager) ''' public «o.returnType.shortName(importManager)» «o.name»(« o.parameterList(importManager)») { «xbc.compile(o, importManager)» } ''' ... } The problem is that «FOR f:e.features.filter(typeof(Operation))» «f.compile(importManager)» «ENDFOR» links to the compile method from the extension and not the local one Reproducible: Always