can't wrap weka because of attribute and method with the same name
------------------------------------------------------------------

                 Key: PYLUCENE-16
                 URL: https://issues.apache.org/jira/browse/PYLUCENE-16
             Project: PyLucene
          Issue Type: Bug
         Environment: Ubuntu Linux 10.04, Python 2.6, Java 6, PyLucene 3.5
            Reporter: Bill Janssen


I'm trying to wrap Weka, a popular machine learning system, with PyLucene.

One of the Weka classes, weka.core.Utils, has a public static variable,
and a public static method, with the same name (see below).  When I
compile it, JCC has no way to say that, and I get the following:

In file included from build/_test/__wrap__.cpp:5983:
build/_test/test.h:36: error: declaration of 'static jdouble 
test::log2(jdouble)'
build/_test/test.h:32: error: conflicts with previous declaration 'jdouble 
test::log2'
build/_test/__wrap__.cpp:5990: error: 'jdouble test::log2' is not a static 
member of 'class test'
build/_test/__wrap__.cpp: In static member function 'static _jclass* 
test::initializeClass()':
build/_test/__wrap__.cpp:6006: error: assignment of read-only location 
'test::log2'
build/_test/__wrap__.cpp:6006: error: cannot convert 'jdouble' to 
'jdouble(jdouble)' in assignment
build/_test/__wrap__.cpp: In static member function 'static void 
t_test::initialize(PyObject*)':
build/_test/__wrap__.cpp:6048: error: call of overloaded 
'make_descriptor(jdouble (&)(jdouble))' is ambiguous
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:102:
 note: candidates are: PyObject* make_descriptor(_jclass* (*)()) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:105:
 note:                 PyObject* make_descriptor(PyObject* (*)(_jobject* 
const&)) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:106:
 note:                 PyObject* make_descriptor(int (*)(PyTypeObject*, 
PyObject*, java::lang::Object*)) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:107:
 note:                 PyObject* make_descriptor(jboolean) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:108:
 note:                 PyObject* make_descriptor(jbyte) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:109:
 note:                 PyObject* make_descriptor(jchar) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:112:
 note:                 PyObject* make_descriptor(jint) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:113:
 note:                 PyObject* make_descriptor(jlong) <near match>
/usr/local/lib/python2.6/dist-packages/JCC-2.11-py2.6-linux-x86_64.egg/jcc/sources/functions.h:114:
 note:                 PyObject* make_descriptor(jshort) <near match>
error: command 'gcc' failed with exit status 1
%

Here's a simple test case which exhibits the bug.  Compile this and put it in a 
jar file, then try to wrap that jar.

public final class test {

  /** The natural logarithm of 2. */
  public static double log2 = Math.log(2);

  /**
   * Returns the logarithm of a for base 2.
   *
   * @param a   a double
   * @return    the logarithm for base 2
   */
  public static /*@pure@*/ double log2(double a) {
    
    return Math.log(a) / log2;
  }
}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to