Issue 188 in robotframework: Methods in Java libraries starting with 'get' are executed at library load time

2 views
Skip to first unread message

codesite...@google.com

unread,
Dec 19, 2008, 2:39:37 PM12/19/08
to robotframe...@googlegroups.com
Status: Accepted
Owner: ----
Labels: Priority-Critical Target-2.0.4 Type-Defect

New issue 188 by pekka.klarck: Methods in Java libraries starting
with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

Bug report and analysis by Torsten Kuepper:

We have this behaviour with Java test support library JVTInventoryLibrary:
It contains a method getMOPathConverter. At library load time the method
gets executed.

Reason is that Jython decorates methods which start on 'get' with an
attribute read access, having name MOPathConverter in this case. Robot goes
through the Python dictionary of the JVTInventoryLibrary class and invokes
getattr on each name found. So the the method gets executed. That is
irritating, because from Robot testwriter viewpoint methods starting with
'get' should not be treated in any special way.

Maybe Robot implemention could be changed to filter Methods in Java classes
by names returned from __class__.getDeclaredMethods() ?


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Dec 19, 2008, 2:53:39 PM12/19/08
to robotframe...@googlegroups.com

Comment #1 on issue 188 by pekka.klarck: Methods in Java libraries starting
with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

Using __class__.getDeclaredMethods like Torsten suggested doesn't actually
work since
it doesn't return methods declared in possible parent classes. This problem
is easily
solved by using getMethods instead (we already have code to ignore methods
declared
only in Object).

Even getMethods isn't enough if a Java class is extended in Python. I'm not
sure is
there any other way to fix that than ignoring all attributes that match the
end of
any getter. Since that approach could also ignore valid methods we can't
really use
it. Unless we find some other way to fix it we may simply document this
behavior as a
known problem with Python libraries extending Java classes.

Anyway, we need to fix this with normal Java libraries ASAP. Thanks for
Torsten for
the bug report and detailed analysis.

codesite...@google.com

unread,
Jan 7, 2009, 6:12:37 AM1/7/09
to robotframe...@googlegroups.com
Updates:
Owner: janne.t.harkonen

Comment #2 on issue 188 by pekka.klarck: Methods in Java libraries starting

with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

(No comment was entered for this change.)

codesite...@google.com

unread,
Jan 8, 2009, 10:17:12 AM1/8/09
to robotframe...@googlegroups.com
Updates:
Cc: pekka.klarck

Comment #3 on issue 188 by pekka.klarck: Methods in Java libraries starting

with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

Fixed in r1227. Instead of using getMethods we decided to check attribute
types using
__dict__. This makes it possible to use the same code both with Python and
Jython
(apart from a small workaround for http://bugs.jython.org/issue1223) and it
also
avoids Python properties.

codesite...@google.com

unread,
Jan 8, 2009, 10:21:12 AM1/8/09
to robotframe...@googlegroups.com
Updates:
Status: Done

Comment #4 on issue 188 by pekka.klarck: Methods in Java libraries starting

with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

(No comment was entered for this change.)

--

codesite...@google.com

unread,
Jan 13, 2009, 5:35:55 AM1/13/09
to robotframe...@googlegroups.com
Updates:
Labels: -Priority-Critical Priority-High

Comment #5 on issue 188 by pekka.klarck: Methods in Java libraries starting

with 'get' are executed at library load time
http://code.google.com/p/robotframework/issues/detail?id=188

In a retrospect, this wasn't actually a critical issue since it had pretty
easy
workaround.

Reply all
Reply to author
Forward
0 new messages