Make inner methods static if they don't refer to "this"

As a first step towards putting lambda bodies into methods instead of
inlining them into the anonymous class, this commit turns all nested
methods into static methods if they don't refer to "this." That will
allow the anonymous classes that come from lambdas to not refer to the
owning object unless needed by the semantics of "this."