-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.0b2 Method selection incorrect when accessibility enabled #325
Comments
Logged In: YES Here's a fix I've made to my local copy. I've changed boolean isPublic = Modifier.isPublic( methods[i].getModifiers // method matches name Original comment by: nfortescue |
Logged In: YES Well, so the first thing to note is that this situation So I think the question is whether we want to define our own Pat Original comment by: patn |
Logged In: YES That's partly true. It would be great if you coudl resolve it with Because Beanshell allows access to private methods through So I think casting would be great, but in the public vs. private It would be good to have a policy for resolution as well for Original comment by: nfortescue |
For this to be tested I have to first be able to but:
see #629 |
test script |
If there are two accessible matching methods, and one
is private, and one is public, the public method should be
chosen. At the moment it is random. Strictly speaking at
the moment the first Matching method is chosen.
Example: suppose we have class Foo, with two methods
public void foo(String x);
private void foo(Integer x);
If we do Foo f = new Foo(); f.foo(null); the public
method should be invoked, not the private method. This
is not guaranteed.
Consider the following test case. This test case fails
under Beanshell 2.0b2 on JDK1.3.1. The test case
passing does not mean the code is working, as the order
in the result of Class.getDeclaredMethods is not defined.
The code to fix is in bsh.Reflect.java in methods
findMostSpecificSignature(), and findMostSpecificMethod
(). The easiest fix would seem to be get
findMostSpecificMethod to sort the candidates by how
public they are, before passing to
findMostSpecificSignature, so as to take advantage of
the current behaviour of choosing the first match.
Reported by: nfortescue
Original Ticket: "beanshell/bugs/187":https://sourceforge.net/p/beanshell/bugs/187
The text was updated successfully, but these errors were encountered: