| Summary: | [xbase] Allow fully qualified static imports. | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | McKinley <mckinley1411> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | anton, sebastian.zarnekow, st.oehme, sven.efftinge |
| Version: | 2.5.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | v2.6 | ||
We'll do it with the same semantics as Java, e.g. no aliasing, no explicit signatures. Things to consider: Overloaded named static imports, Duplicate static import validation, Organize imports, Unused imports, Content assist in the import section, Static member scoping (In reply to Sebastian Zarnekow from comment #1) > Static member scoping That is, an explicit import of valueOf(String) from java.lang.Integer has a higher priority than a wildcard import of the form import static java.lang.String.* Same for extension imports Another thing is the validation of the member name, the imported type has to have at least one visible static member with the given simple name I didn't try this but giving it some thought, the syntactic ambiguity (discussed offline) seems to be resolvable with this grammar rules: XImportDeclaration: 'import' ( (static?='static' extension?='extension'? importedType=[JvmDeclaredType|QualifiedNameInStaticImport] (wildcard?='*' | memberName=ValidID) | importedType=[JvmDeclaredType|QualifiedName] | importedNamespace=QualifiedNameWithWildcard) ';'? ; QualifiedNameInStaticImport: (ValidID '.')+ ; pushed to review: https://git.eclipse.org/r/23176 Works except for some minor issue described in Bug 434730 |
Build Identifier: Example: import static extension org.apache.http.util.EntityUtils.consume swallow import static extension org.apache.http.util.EntityUtils.toString(HttpEntity) consumeToString import static extension org.apache.http.util.EntityUtils.toString(HttpEntity, String) consumeToString Instead of import static extension org.apache.http.util.EntityUtils.* Usage: ... response1.entity.swallow println(response2.entity.consumeToString) println(response3.entity.consumeToString("UTF-8")) Reproducible: Always