umop apisdn
umop apisdn

Reputation: 683

Failed type migration for Intellij IDEA

I recently migrated from Eclipse to Intellij, and while exploring Intellij I came across type Migration under refactoring. Naturally, I attempted to test type migration out using an existing repository, but when I first tried it on this line:

private static final ArrayList<HashMap<String, String>> ALL_PERSONS = new ArrayList<>();

I got this:

enter image description here

So, I wondered if the issue is because:

  1. the variable is private
  2. the variable is static
  3. the variable is declared as final

To test this, I deleted parts of the signature one at a time (e.g. testing with private final ArrayList<HashMap<String, String>> ALL_PERSONS instead), but the same situation still resulted.

I tried to Google this problem as well, but there seems to be little mention of this. So while I suspect that this is a newbie mistake, I hope someone can illuminate why type migration fails in this case. Thanks in advance!

Upvotes: 2

Views: 639

Answers (1)

Noel Ang
Noel Ang

Reputation: 5109

The Type Migration refactoring is selectable if a type is highlighted, or the cursor is fixed at it before bringing up the refactor menu. So, from your example, highlight/point at ArrayList, HashMap, or String first.

The refactoring would still apply to the class field, ALL_PERSONS.

I tested on IDEA 2017.2.

Upvotes: 3

Related Questions