1. PyLucene
  2. PYLUCENE-16

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


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Labels:
    • Environment:
      Ubuntu Linux 10.04, Python 2.6, Java 6, PyLucene 3.5


      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; }



        Andi Vajda made changes -
        Assignee Andi Vajda [ vajda ]
        Andi Vajda made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Bill Janssen created issue -


          • Assignee:
            Andi Vajda
            Bill Janssen
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: