Java Issues with IntelliJ 2017.3

Answered

Hello!

First of all, thanks for this wonderful tool.

I upgrated to the 2017.3 version and I encountered two major issues, it was the first time I had to rollback to the previous version to keep working. I was waiting for the 2017.3.1 release but it did not solve them.

The first issue is that many methods are marked as non used whereas they are used. The find usages command finds no usage (that's consistent). When I open manually a usage, if I navigate to the method (Ctrl + click), it opens the method that is still marked as non used. I rebuilt my project and it did not work. It sounds like I could fix the issue by invalidating all caches and restart IntelliJ.

The second issue is about formatting and more precisely indentation size. My IDE is configured to have an indentation size of 4. When I work on a file that already exists and use the formatting command, it respects the 4 formatting rule. But when I create a new Java class, the indentation size is 2 and I cannot change that. If I manually indent the file to 4 and reformat the file, it comes back to 2. I have multiple Java projects and they are all affected by this issue.

I checked the configuration and it is set to 4 as expected:

Here is the formatting I get with this configuration:

Note that I found a workaround. If I go to the Editor -> Code Style settings page and export the code style configuration in a .editorconfig file, it works as expected. Here is the content of the generated file:

[*]
charset=utf-8
end_of_line=lf
insert_final_newline=false
indent_style=space
indent_size=4

[{.babelrc,.stylelintrc,.eslintrc,jest.config,*.bowerrc,*.jsb3,*.jsb2,*.json}]
indent_style=space
indent_size=2

[{*.ddl,*.sql}]
indent_style=space
indent_size=2

[{*.yml,*.yaml}]
indent_style=space
indent_size=2

I saw that the 2017.3.1 version fixed a major formatting issue https://youtrack.jetbrains.com/issue/IDEA-183193. I hoped it was going to fix this issue but it did not.

I also tried to remove my .IntelliJIdea2017.3 folder and reimport my 2017.2 settings with the 2017.3.1 version but it did not change anything.

Did I misconfigured something? Am I facing a 2017.3 regression?

Have a nice day!

Kind regards, Benoit.

1
3 comments

Please report at https://youtrack.jetbrains.com/issues/IDEA with the sample files to reproduce and the code style for the formatting problem.

0
Avatar
Permanently deleted user

Thanks Serge for your answer.

I reported the indentation issue here.

For the usages issue, I will report it if it comes back.

0
Avatar
Permanently deleted user

I could solve the issue thanks to the support team.

It appears that I have the EditorConfig support which is enabled (probably disabled by default) and I had a .editorconfig file specifying an indentation size of 2 in the directory containing all my IntelliJ projects (don't know why). This file was taken into account by IntelliJ 2017.3 to override the Code Style configuration. It was probably not taken into account by IntelliJ 2017.2, otherwise I would have encountered this issue with this version too. I deleted this file and everything is working fine now.

Thanks for building this wonderful tool!

0

Please sign in to leave a comment.