Community
Participate
Working Groups
Build Identifier: 2.2.0.v201111291107 While using a static extension import of org.apache.http.util.EntityUtils, the following method is not usable from within Xtend: public static String toString(final HttpEntity entity) It favors the toString method of Object. However, the following is usable as an extension method from Xtend: public static String toString(final HttpEntity entity, final String defaultCharset) Reproducible: Always Steps to Reproduce: See above
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