| Summary: | import static extension toString(Type x) favors Object.toString() | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | McKinley <mckinley1411> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | sven.efftinge |
| Version: | 2.2.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
McKinley
Hmm, if this bug is to be fixed, would it be possible to have println(entity) call EntityUtils.toString(entity) automatically? Perhaps a new type of import extension would be needed to indicate that a particular static method should be the default for a particular signature like toString(). You are asking for extension methods having precedence over real members. This would make it impossible to call the real members. Why couldn't you give the extension method a different name? Regarding the second request: Extension methods are lexically scoped, that is they are only available where they are imported. Println being just a plain method doesn't (and shouldn't) know or care from what context it is called. I fully understand your use case and see how nice it was if it were supported, but it would have too many unwished side effects. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |