Mikhail, please pay attention on the second quotation from my first
message. It states that while calling Statement#execute() we should
think about construtors as about regular static methods with the
special name "new", and all other regular rules should be applicable
to them. This quote is from the java.beans.Statement.execute()
method's description - you may read the whole text there if you like.
Thanks,
2006/8/3, Mikhail Loenko <[EMAIL PROTECTED]>:
Well constructor is not a method :)
so RI and Harmony are not necessary violate the spec
I'd probably stick to the current behavior
Thanks,
Mikhail
2006/8/3, Alexei Zakharov <[EMAIL PROTECTED]>:
> As far as I understand RI simply take the first declared method. In
> other words, if we swap constructors in the above example like this
>
> public static class MyBean {
> static String calledM = null;
>
> public MyBean(Integer arg) {
> calledM = "new2";
> }
>
> public MyBean(Object arg) {
> calledM = "new1";
> }
>
> }
>
> the result will be "PASS".
> :-/
>
>
> Thanks,
>
> 2006/8/3, Mikhail Loenko <[EMAIL PROTECTED]>:
> > How does RI behave if there are three methods? does it alway selects less
> > specific?
> >
> > Thanks,
> > Mikhail
> >
> > 2006/8/3, Alexei Zakharov <[EMAIL PROTECTED]>:
> > > Hi community,
> > >
> > > I'd like to attract everyone's attention to another RI inconsistence.
> > > It seems RI has a bug in the implementation of execute() method of the
> > > java.beans.Statement class. The spec states:
> > >
> > > 1. "When the target's class defines many methods with the given name
> > > the implementation should choose the most specific method using the
> > > algorithm specified in the Java Language Specification (15.11)."
> > > 2. "The reserved method name "new" may be used to call a class's
> > > constructor as if all classes defined static "new" methods."
> > >
> > > But the following test shows that RI does not follow these rules –
> > > does not choose the most specific method:
> > >
> > > import java.beans.*;
> > >
> > > public class StatementTest {
> > >
> > > public static class MyBean {
> > > static String calledM = null;
> > >
> > > public MyBean(Object arg) {
> > > calledM = "new1";
> > > }
> > >
> > > public MyBean(Integer arg) {
> > > calledM = "new2";
> > > }
> > >
> > > }
> > >
> > > public static void main(String argv[]) throws Exception {
> > > Statement stmt = new Statement(MyBean.class, "new",
> > > new Object[] { new Integer(17) });
> > >
> > > stmt.execute();
> > > if (!MyBean.calledM.equals("new2")) {
> > > System.out.println("FAIL");
> > > } else {
> > > System.out.println("PASS");
> > > }
> > > }
> > >
> > > }
> > >
> > > The result is "FAIL" on RI. However, it behaves correctly for regular
> > > methods (that aren't constructors). I think I should post "Non-bug
> > > differences from RI" JIRA. I am also going to correct our
> > > implementation of Statement since it is now "compatible" with RI. Any
> > > objections?
> > >
> > > Thanks,
> > >
> > > --
> > > Alexei Zakharov,
> > > Intel Middleware Product Division
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Alexei Zakharov,
> Intel Middleware Product Division
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Alexei Zakharov,
Intel Middleware Product Division
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]