getgrit / gritql

GritQL is a query language for searching, linting, and modifying code.
https://docs.grit.io/
MIT License
3.17k stars 83 forks source link

Improved Java metavariable support #503

Open morgante opened 2 months ago

morgante commented 2 months ago

For this code:

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2ClientContext;

Both these should work:

import $_
import org.springframework.$_
morgante commented 2 months ago

So this actually works:

`import $import;` where $import <: contains `org.springframework`

But I think this is more intuitive:

import org.springframework.$_;

We should consider having an equivalence class that is able to map between the two.