[ https://issues.apache.org/jira/browse/PYLUCENE-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086112#comment-17086112 ]
Andreas Vajda commented on PYLUCENE-53: --------------------------------------- Note that you can do the casting trick already, it already checks with the JVM for compatibility, the cast_() function is really rewrapping your object with the target of the cast. In your example: >>> cat = Cat() >>> cat.getJavaFeets() 4 >>> being = Being.cast_(cat) # cast cat into a Being (ie, wrap its jobj with Being) >>> being.getFeets() # call Being's default getFeets() implementation 4 So, I spoke too fast when I said this needed implementing. It already works that way. If you override getFeets() with another implementation in Cat.java (and rebuild test2), it appears that the override version is being called (which makes sense in the java world). Thus, apart from having to cast cat into Being in order to be able to call its default implementation if no override version is present, you can cast cat to Being regardless, the correct version of getFeets is called in both cases. > JCC Default implementations from Interfaces not exposed > ------------------------------------------------------- > > Key: PYLUCENE-53 > URL: https://issues.apache.org/jira/browse/PYLUCENE-53 > Project: PyLucene > Issue Type: Bug > Reporter: Petrus Hyvönen > Priority: Major > Attachments: Test_default_implementation.zip > > > Hi, > This may be related to PYLUCENE-27 but not sure. > Default implementations of methods in an interface does not seem to be > exposed currently. > For example: > The interface: > interface Being { > public void printName(); > default int getFeets() > { > return 4; > } > } > Implemented in the class: > public class Cat extends Feline implements Being { > public void printName() { > System.out.println("Cat"); > } > public int getJavaFeets() > { > return this.getFeets(); > } > } > When wrapped in Python, the getJavaFeets is exposed to the Python side, but > not the getFeets method. > > > -- This message was sent by Atlassian Jira (v8.3.4#803005)