paulk-asert opened a new pull request, #3010:
URL: https://github.com/apache/groovy/pull/3010

   …d to access a static field or call a static method
   
   Under static compilation a static member reached through an expression 
compiled to a bare GETSTATIC or INVOKESTATIC, so the expression itself never 
ran and its side effects were lost. Java evaluates it and discards the value 
(JLS 15.11.1, 15.12.4.1), as do dynamic Groovy and @TypeChecked.
   
   There were three places that skipped it: 
InvocationWriter.writeDirectMethodCall visited the receiver only for an 
instance target (this also covers static properties, which are read and written 
through their accessors); StaticTypesCallSiteWriter.makeGetField emitted 
GETSTATIC directly; and the static-extension path in StaticInvocationWriter 
passed null in its place. Each now evaluates and pops the receiver first, 
unless it is a class literal, a variable or the implicit this, which cannot 
have side effects, so the common forms compile as before. 
StaticInvocationWriter no longer wraps the receiver of a static target in a 
checkcast, which would fail for a Class-typed receiver.


-- 
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