Issue1776172

classification
Title: Type of methods of java classes depends on import mechanism
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: janne_h, mastrodomenico, otmarhumbel
Priority: normal Keywords:

Created on 2007-08-17.11:47:29 by janne_h, last changed 2007-08-17.21:12:55 by otmarhumbel.

Messages
msg1847 (view) Author: Janne Härkönen (janne_h) Date: 2007-08-17.11:47:29
When importing java class with import,
type of its methods is 'method'.
When the same class is imported with __import__ statement, type of its methods is 'reflectedfunction'

Jython 2.2rc3 on java1.6.0_01
Type "copyright", "credits" or "license" for more information.
>>> from java.lang import String
>>> type(String().indexOf)
<type 'method'>
>>> clazz = __import__('java.lang.String', {}, {}, 'String')
>>> type(clazz.indexOf)
<type 'reflectedfunction'>
msg1848 (view) Author: Lino Mastrodomenico (mastrodomenico) Date: 2007-08-17.15:54:37
This doesn't seem a bug to me: are you sure this isn't simply the difference between bound (ClassName().method) and unbound methods (ClassName.method)?

Jython 2.2rc3 on java1.5.0_12
Type "copyright", "credits" or "license" for more information.
>>> from java.lang import String
>>> clazz = __import__('java.lang.String', {}, {}, 'String')
>>> type(String().indexOf), type(clazz().indexOf)
(<type 'method'>, <type 'method'>)
>>> type(String.indexOf), type(clazz.indexOf)
(<type 'reflectedfunction'>, <type 'reflectedfunction'>)
msg1849 (view) Author: Oti Humbel (otmarhumbel) Date: 2007-08-17.21:12:55
well spotted, mastrodomenico.
History
Date User Action Args
2007-08-17 11:47:29janne_hcreate