| Summary: | sub types wrongly assumed to be a super type (affects instanceof, dispatch) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Meinte Boersma <meinte.boersma> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | sven.efftinge | ||||
| Version: | unspecified | Flags: | sven.efftinge:
juno+
|
||||
| Target Milestone: | M5 | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Meinte Boersma
Created attachment 208890 [details]
example Eclipse project which exhibits the problem
The reason is, that both Datatype and Classifier are functional types. That is they have only one method ()=>String. The dispatcher should really use the Java conformance computer without the Xbase-specific conversion logic. But on the Xbase-level we should try to improve on some surprising situations. For instance, currently the following is valid: val Datatype d = classifier In fact the two types really don't have to be in the same hierarchy and even the methods don't need to have the same name to make this work, because they are assignable because of their functional nature. One way to improve the situation is to require at least one of the two participating types being a real function type. So you would have to cast to make the a conversion from Classifier to Datatype : val Datatype d = classifier as ()=>String Java 8 doesn't do this, so I'm curious how they want to handle these situations. It looks like in Java 8 only closures and method references can be converted to functional interfaces. So it seems to be appropriate to require at least one functional type in such conversions. 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 |