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

   …ubscripts
   
   The indirect import check inspected constructor, method, static-method and 
method-pointer expressions, so a class forbidden by the import rules could 
still be built through a construction that is neither a constructor call nor a 
method call: a cast whose operand is a list, map or closure literal ((Foo) 
[..], [..] as Foo, (Runnable) { }), and a named-argument subscript (Foo[a: 1]). 
Each builds an instance of the named type.
   
   The check is extended to both. A cast constructs when its operand is a list, 
map or closure literal, as opposed to converting a value that already exists; 
its target type is checked like a constructor call (array component unwrapped, 
primitive components skipped as they name no class). A subscript constructs 
when its arguments are map entries, which are not valid in an ordinary 
subscript, so their presence marks the form unambiguously; the receiver type is 
dynamic at this phase, so the class is named by its source text.
   
   Plain converting casts ((String) x, (int) n) and positional subscripts stay 
unexamined. The residual is the non-literal coercion ((Foo) var, var as Foo), 
where an overridden asType could construct at runtime; that is statically 
invisible and out of scope, consistent with this customizer being a hardening 
aid rather than a security boundary.


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