[ 
https://issues.apache.org/jira/browse/GROOVY-10931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17745928#comment-17745928
 ] 

Daniel Sun edited comment on GROOVY-10931 at 7/22/23 12:04 PM:
---------------------------------------------------------------

Hi Jochen,

     Here is the code for transform method, i.e. to find visible method in the 
type tree.

[https://github.com/apache/groovy/blob/244886a6da837afe3ab39b318c32e5f8765e99cc/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java#L234]

     $getLookup method of each Groovy class can just help us to access all 
members of the Groovy class with the $getLookup method.

     If the Groovy class is declared in a JPMS module and not be exported, the 
$getLookup methods outside the module will not work either.

     As we can see, $getLookup is just trying to keep compatibility for 
reflection as possible as it could.
 


was (Author: daniel_sun):
Hi Jochen,

     Here is the code for transform method, i.e. to find visible method in the 
type tree.

[https://github.com/apache/groovy/blob/244886a6da837afe3ab39b318c32e5f8765e99cc/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java#L234]

     $getLookup method of each Groovy class can just help us to access all 
members of the Groovy class with the $getLookup method.

     If the Groovy class is declared in a JPMS module and not be exported, 
$getLookup will not work either.

     As we can see, $getLookup is just trying to keep compatibility for 
reflection as possible as it could.
 

> Remove $getLookup method generation (Groovy 4+)
> -----------------------------------------------
>
>                 Key: GROOVY-10931
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10931
>             Project: Groovy
>          Issue Type: Wish
>          Components: class generator, Compiler
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: invokedynamic, jdk16, jdk17
>             Fix For: 5.0.0-alpha-1
>
>
> The new {{$getLookup()}} method was discussed somewhat in the comments of 
> GROOVY-10273.  Groovy 3 has had JEP 396 (illegal access enforcement) support 
> backported to the invoke dynamic pathways, without {{$getLookup}}.  So, I'd 
> like to restart the discussion to find out if there are any illegal-access 
> scenarios that Groovy 4 supports that don't have a test case in Groovy 3.  
> And if there are no scenarios that remain, I'd like to propose the removal of 
> {{$getLookup}} method generation.
> I have disabled its generation in the Groovy 5 codebase, and there are no 
> tests that fail.  So I have good confidence that it can be removed and the 
> security hole can be plugged.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to