|Anonymous | Login | Signup for a new account||12-07-2019 18:22 PST|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0003748||[Quercus]||feature||always||11-05-09 12:52||11-07-09 17:45|
|Summary||0003748: Avoid recursive instropection of methods.|
At the end of ...program.JavaClassDef.introspectMethods, the method calls itself recursively, first for the superclasses and then for the interfaces. This does not appear to be necessary because the line type.getMethods() already provided all of the methods from the superclasses and the interfaces. Even the code in AbstractJavaMethod.overload seems to acknowledge that the superclass and interface methods can be previously processed.
Removing this recursion would provide some performance benefit because the amount of duplicate effort would be eliminated, and the extra garbage generated by overriding the entries in _functionMap would be avoided.
In addition, it would benefit developers who are attempting to extend the existing capabilities. For example, I am attempting to provide support for another database, but I do not want to support as PHP functions some of the methods that are provided in JdbcConnectionResource. Unfortunately, overriding the method in my class and adding a @Hide annotation does not work because of the recursion in introspectMethods - the overridden methods get added as functions for my PHP class anyway.
Finally, I also noticed that the public methods on java.lang.Object are added as functions available to the PHP class. I don't think that this was intended so the attached patch includes a test to eliminate those methods.
By the way, if my logic is flawed and there is a perfectly valid reason for the recursion, then it would be nice if a comment explaining WHY THE RECURSION IS NECESSARY would appear in the code. I hate attempting to make sense of someone else's code when they have not commented on WHY they wrote the code the way they did, especially if the code in question does not make obvious sense (in the way that this recursion makes no obvious sense).
|Attached Files||quercus_introspect_recursion.txt [^] (953 bytes) 11-05-09 12:52|
|You are right that we don't want to add java.lang.Object methods to PHP classes. However, we do want to add those methods to Java classes. So we'll need to distinguish between the two and put in the fix accordingly.|
Method introspection is fixed for 4.0.2, so @Hide should work as expected.
java.lang.Object methods are not added to Java-backed PHP classes anymore
|11-05-09 12:52||PeterJ||New Issue|
|11-05-09 12:52||PeterJ||File Added: quercus_introspect_recursion.txt|
|11-05-09 12:54||PeterJ||Issue Monitored: PeterJ|
|11-05-09 19:23||nam||Note Added: 0004289|
|11-07-09 17:34||nam||Status||new => assigned|
|11-07-09 17:34||nam||Assigned To||=> nam|
|11-07-09 17:34||nam||Note Added: 0004290|
|11-07-09 17:45||nam||Status||assigned => closed|
|11-07-09 17:45||nam||Note Added: 0004291|
|11-07-09 17:45||nam||Resolution||open => fixed|
|11-07-09 17:45||nam||Fixed in Version||=> 4.0.2|
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
35 total queries executed.|
28 unique queries executed.