From: Berlin B. <ber...@gm...> - 2005-06-16 22:53:16
|
This is bug, why is reverse giving me this error, am I doing something wron= g? >>> from java.lang import StringBuffer >>> a =3D StringBuffer("asdfsfds") >>> a.reverse() Traceback (innermost last): File "<console>", line 1, in ? java.lang.IllegalAccessException: Class org.python.core.PyReflectedFunction can not access a member of class java.lang.AbstractStringBuilder with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.python.core.PyReflectedFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.pycode._pyx3.f$0(<console>:1) at org.python.pycode._pyx3.call_function(<console>) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyCode.call(Unknown Source) at org.python.core.Py.runCode(Unknown Source) at org.python.core.Py.exec(Unknown Source) at org.python.util.PythonInterpreter.exec(Unknown Source) at org.python.util.InteractiveInterpreter.runcode(Unknown Source) at org.python.util.InteractiveInterpreter.runsource(Unknown Source) at org.python.util.InteractiveInterpreter.runsource(Unknown Source) at org.python.util.InteractiveConsole.push(Unknown Source) at org.python.util.InteractiveConsole.interact(Unknown Source) at org.python.util.jython.main(Unknown Source) java.lang.IllegalAccessException: java.lang.IllegalAccessException: Class org.python.core.PyReflecte dFunction can not access a member of class java.lang.AbstractStringBuilder with modifiers "public" >>> print dir(a) [] >>> a.reverse <method java.lang.AbstractStringBuilder.reverse of java.lang.StringBuffer instance at 16153985> >>> |
From: Frank W. <fwi...@gm...> - 2005-06-17 01:10:13
|
> This is bug, why is reverse giving me this error, am I doing something wr= ong? It is indeed a bug, which I believe is caused by some differences in the way Java handles reflection starting at JDK 1.4. The bug occurs when accessing methods that are defined in abstract super classes (in this case it looks like reverse() is defined in AbstractStringBuilder, presumably an abstract class). The same code should work fine against JDK 1.3 or less and it is fixed in the development version, which is=20 incidentally going to be released as a development alpha soon. Frank |