Ticket #463 (closed defect: fixed)

Opened 21 months ago

Last modified 7 months ago

Button: Callback method selected randomly when multiple methods match

Reported by: Artur Signell Owned by: Jani Laakso
Priority: undefined Milestone: User Interface Library 5.2.0 RC
Component: Server-side framework Version:
Keywords: listenermethod Cc:
Known Issue description:
Hours estimate: Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: no Contract:

Description

{
Button b = new Button("Testbutton", this, "method"); 
}

public void method() {
    method("no parameter");
}

public void method(String parameter) {
    System.out.println("Method called with "+parameter);
}

->

IllegalArgumentException? is thrown from public ListenerMethod?(Class eventType, Object object, String methodName) if method(String) is selected to be the callback method (depends on what the result of

for (int i = 0; i < methods.length; i++)
			if (methods[i].getName().equals(methodName))
				method = methods[i];

is). Changing order of method() methods in source file possibly gives different results.

Change History

Changed 21 months ago by Jani Laakso

  • summary changed from Callback method for buttons selected randomly when multiple methods match to Button: Callback method selected randomly when multiple methods match

Changed 10 months ago by Joonas Lehtinen

  • milestone set to User Interface Library 5.1.0 RC
  • affects_release_notes unset

IMO throwing exception when registering listener is the correct way to go

Changed 10 months ago by Marc Englund

Suggestion: remove all string-reflect -type constructors & addListener -methods. Really. They are error prone, and prevent refactoring. In-line (anonymous) listeners are trivial to create and errors are caught at compile-time:

new Button("Close", new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
               close();
            }
        });

Changed 9 months ago by Joonas Lehtinen

  • priority changed from minor to undefined

Changed 9 months ago by Jani Laakso

  • status changed from new to closed
  • resolution set to fixed

Fixed, using reflect methods for listeners is now deprecated

Changed 7 months ago by Joonas Lehtinen

  • milestone changed from User Interface Library 5.1.2 to User Interface Library 5.2.0

Milestone User Interface Library 5.1.2 deleted

Note: See TracTickets for help on using tickets.