lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesper Mattsson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored
Date Tue, 27 Jun 2017 12:52:00 GMT

    [ https://issues.apache.org/jira/browse/PYLUCENE-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064779#comment-16064779
] 

Jesper Mattsson commented on PYLUCENE-37:
-----------------------------------------

We ran into it because we are developing an API where the public parts are interfaces, and
the implementing classes are private. The problem was that the methods declared in the second
inherited interface was not accessible. 

I guess an alternate approach would be to include the methods from the inherited interfaces
(except the one the C++ class inherits from). That would solve the problems we've run into
so far. It looks to me that you'd run into problems when passing objects as arguments from
C++, though:

Given the declarations below:
{code:java}
class A {
  void f(B b) { /* ... */ }
}
interface B { /* ... */ }
class C extends D implements B { /* ... */ }
class D { /* ... */ }
interface E { /* ... */ }
interface F extends E, B { /* ... */ }
{code}
When trying to use the C++ wrappers to call A.f, wouldn't you currently get compilation errors
if you passed the b argument from a reference of type C or F? What about in Python? Exception
at runtime?

> Extended interfaces beyond first are ignored
> --------------------------------------------
>
>                 Key: PYLUCENE-37
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-37
>             Project: PyLucene
>          Issue Type: Bug
>            Reporter: Jesper Mattsson
>         Attachments: jcc.multiple.inheritance.patch, Test.zip
>
>
> When generating wrapper for a Java interface that extends more than one other interface,
then only the first extended interface is used when generating the C++ class.
> In cpp.header(), the code snippets:
> {code}
>     if cls.isInterface():
>         if interfaces:
>             superCls = interfaces.pop(0)
> {code}
> and:
> {code}
>         line(out, indent, 'class %s%s : public %s {',
>              _dll_export, cppname(names[-1]), absname(cppnames(superNames)))
> {code}
> are likely responsible.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message