codeconsole commented on PR #3050:
URL: https://github.com/apache/groovy/pull/3050#issuecomment-7088466313

   Thank you. All of these are in a851725, with one more in af95df5.
   
   - `findMethod`: its javadoc now states the rules. A private method the 
receiver only inherits is not a candidate (JLS 8.2). It is kept when it is 
declared by the declared type of the receiver variable (known only under static 
compilation), when it is static, when the call is made in its declaring class, 
and when the receiver is an enum constant body or an anonymous class created in 
a static context nested in its declaring class. When the receiver is a class 
whose code this is, or an inner class that is a subclass of one, and none of 
its own methods accepts the argument types, the methods of its outer classes 
are offered too, only the static ones beyond a class with no enclosing 
instance, as `ENCLOSING_INSTANCE_OF_RECEIVER` records. It also says that a 
method pointer or reference is resolved elsewhere, without the exceptions for a 
static method, the declaring class and an instance with no enclosing instance, 
because dynamic Groovy fails on those.
   - `SecondPassExpression`: the class javadoc now explains the declared 
receiver type and the enclosing class, and why the second pass needs them to 
find the same private members. The four-argument constructor documents each 
parameter. Leaving them out of `equals` and `hashCode` is intentional, and the 
javadoc now says why: both follow from the wrapped expression, which is one 
node of one class with one receiver variable, so two wrappers of the same 
expression never differ in them.
   - `isInheritedPrivateMethod`: the javadoc and `@return` now say what the 
body checks: the method is private, is not an extension method, and is declared 
by a class other than the receiver type. It goes on to say that for a method 
found on that type or its superclasses, this is a private method the receiver 
would only inherit.
   - `findVisibleMethods` has javadoc in place of the inline comment, including 
that a static method or a reference made in the declaring class is no exception 
there, unlike a call. `getDeclaredType` says it returns the origin type of a 
variable that is not `this`, `super` or a dynamic variable, or else `null`. The 
two-argument `thisObjectExpression` says it allows an enclosing instance of a 
subclass of `target` and links to the three-argument method.
   - `findMethodWithDeclaredType`, the helper that `findMethodThrough` and the 
second pass go through, had no javadoc either; af95df5 adds it.
   
   I left `ENCLOSING_INSTANCE_OF_RECEIVER` as a one-line comment, since every 
neighbouring marker in `StaticTypesMarker` is one; I can split it if you would 
still like that. I also merged current master, including 4f83940a 
(GROOVY-12727), in 16dddda; there were no conflicts, and since that commit also 
changes `StaticTypeCheckingVisitor`, I ran the core tests, the subproject 
tests, Checkstyle and CodeNarc on the merged tree, and all pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to