[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-27 Thread Andi Vajda (JIRA)

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

Andi Vajda commented on PYLUCENE-37:


If you use the wrappers generated for interfaces, you're going to face the 
problem reported here.
If you use the wrappers generated for classes implementing said interfaces, 
then you should be ok with all implemented methods anywhere as the implementing 
class has them all (or it is abstract).

You can also force the wrapping of private classes by explicitly listing them 
on the command line.


> 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)


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-25 Thread Andi Vajda (JIRA)

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

Andi Vajda commented on PYLUCENE-37:


I've been working on this bug for a while now and I'm wondering how far a fix 
can get and what it achieves. I am about to check-in a large body of changes 
that makes a fix possible by switching Python type construction to use 
PyType_FromSpecWithBases() which can create a type with multiple base types. 
This is Python 3 only and this is fine. Python 2 support is in maintenance mode 
only.
What would fixing this bug achieve ?
  - wrappers would be correct with regards to their super types and 
side-casting interfaces would work
  - wrappers would inherit static fields and methods declared on interfaces 
beyond the first one)
Other than that, all is already working. For a non abstract java class to 
implement multiple interfaces, it has to have local implementations of all 
their methods (or inherit some from a parent class with local implementations) 
- thus I don't see any functional inheritance losses at the moment (beyond the 
static ones).
Also, Python has, to say the least, some strange layout requirements when 
constructing a type from multiple bases - they all have to have the same 
tp_basicsize. This is not the case with the JCC t_type, the types used with 
Python (their sizeof() is tp_basicsize), that wrap the C++/Java bridge types as 
they may have an array of type parameter of variable size (depending on the 
number of type parameters) when the java type being wrapped is generic. At the 
moment, I'm not even sure how much Python can support JCC types with multiple 
base types - maybe the t_type layout can be modified a bit to fix the size of 
type parameters by moving to an array pointer.
All that being said, it would be very nice if multiple inheritance could be 
properly supported:
  - it would better model 'class foo extends bar implements baz, ..."
  - it would better model the interface tree you proposed in the test
The new code now has a lot of stuff in place for supporting multiple 
inheritance but it is not enabled:
  - placeholder for virtual inheritance
  - support for multiple parents everywhere
  - Python type construction supports multiple bases
The code doesn't have the change in logic yet to properly track 'extends foo 
implements bar' and the code still suffers from the bug reported here, only the 
first interface is used as parent for a sub-interface.
I'm going to continue working on this on and off as it's an interesting 
problem...


> 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)


Re: [jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-18 Thread Andi Vajda


On Wed, 14 Jun 2017, Jesper Mattsson (JIRA) wrote:

Thanks for the update. Did you think that the changes in the patch are 
reasonable?


Well, it was a start.
I had to redo this on the Python 3 side as it looks like Python types with 
multiple base types are better supported there via the new 
PyType_FromSpecWithBases() API.


I just now converted the jcc3 Python type object generation to use 
PyType_Spec structs and PyType_FromSpec in preparation for supporting 
multiple base types.


Andi..


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-14 Thread Jesper Mattsson (JIRA)

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

Jesper Mattsson commented on PYLUCENE-37:
-

Thanks for the update. Did you think that the changes in the patch are 
reasonable?

> 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)


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-13 Thread Andi Vajda (JIRA)

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

Andi Vajda commented on PYLUCENE-37:


I have gotten to the same point as you - the Python side needs to be reworked 
to accomodate
multiple parents, the current static initializations don't work with multiple 
base classes.
It's work in progress...




> 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)


Re: [jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-13 Thread Andi Vajda
I have gotten to the same point as you - the Python side needs to be reworked 
to accomodate
multiple parents, the current static initializations don't work with multiple 
base classes.
It's work in progress...

> On Jun 13, 2017, at 18:31, Jesper Mattsson (JIRA)  wrote:
> 
> 
>[ 
> https://issues.apache.org/jira/browse/PYLUCENE-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16048084#comment-16048084
>  ] 
> 
> Jesper Mattsson commented on PYLUCENE-37:
> -
> 
> I am currently unable to work any more on this beyond the patch that I sent.
> 
>> 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)



[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-13 Thread Jesper Mattsson (JIRA)

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

Jesper Mattsson commented on PYLUCENE-37:
-

I am currently unable to work any more on this beyond the patch that I sent.

> 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)


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-06-02 Thread Jesper Mattsson (JIRA)

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

Jesper Mattsson commented on PYLUCENE-37:
-

I made a first stab at a solution. It is only implemented in the Python 2 
version, and the Python wrapper generation isn't done, but I'll attach it as a 
patch in the hope that it will be of use to you.

> 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: 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.3.15#6346)


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-05-31 Thread Jesper Mattsson (JIRA)

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

Jesper Mattsson commented on PYLUCENE-37:
-

Certainly, I should have done that when creating the issue - sorry.

I attached all the files I used when verifying the bug, but here are the 
highlights:

The Java interface C is defined as:
{code}
public interface C extends B, A {
void c();
}
{code}
The generated header file for it, C.h, contains (copying only the relevant 
lines):
{code}
#include "testjcc/B.h"

namespace testjcc {
  class A;
}

namespace testjcc {
  class C : public ::testjcc::B {
{code}
As you can see, A has a forward declaration, but is not included or inherited. 
Changing the order of the interfaces in the Java file changes the generated 
file so that A is inherited instead.

I'd expect both A.h & B.h to be included, and the first line of the class to be:
{code}
  class C : public ::testjcc::B, public ::testjcc::A {
{code}

> 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: 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.3.15#6346)


[jira] [Commented] (PYLUCENE-37) Extended interfaces beyond first are ignored

2017-05-30 Thread Andi Vajda (JIRA)

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

Andi Vajda commented on PYLUCENE-37:


There seems to be something off with that code indeed.  
However, it would be helpful if you could include a small trivial example java 
code
that triggers the bug you found and an explanation of what you'd expect it
to do instead. This helps me ensure there is no misunderstanding and also helps 
with reproducing the bug.
Thanks !

> 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
>
> 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.3.15#6346)