method depends on method inside anonymous class