It turns out this was a bug in Structural Search & Replace.
Intellij - how to keep structured search/replace from discarding annotations?
-
14-07-2023 - |
Question
I created a structured search and replace, using this search string:
protected $FieldType$ $FieldName$;
and this replace string:
private $FieldType$ $FieldName$;
to replace, for example, this:
@Autowired
protected JdbcTemplate jdbcTemplate;
with:
@Autowired
private JdbcTemplate jdbcTemplate;
However, the result is this:
private JdbcTemplate jdbcTemplate;
That is, the annotation goes away. How do I avoid this? The code base has many protected fields with various annotations, and I want to leave them untouched whatever they are.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow