How to show access modifiers for classes in IntelliJ IDEA?
Asked Answered
C

2

53

I've recently upgraded to Intellij IDEA 2017.2 and access modifier icons disappeared from my file tree... How to get them back?

Cavite answered 28/7, 2017 at 9:4 Comment(0)
J
104

UPDATE

Since 2019.2 version you can enable it in the Project view options, toggle the Show Visibility Icons:

Show Visibility Icons


For older versions:

This option was disabled intentionally, see this comment for the explanation:

This information was intentionally removed, as we believe that it brings more clutter than actual value.

To enable it back add -Dide.projectView.show.visibility=true in Help | Edit Custom VM Options.

Jelks answered 28/7, 2017 at 10:16 Comment(8)
It's a nonsense to hide it this way (difficult to restore), especially when someone is using package-by-feature not package-by-layer approach and want to see at first glance which class of package is an entry point. Thanks for answer!Cavite
@mdziob, completely agree with you!Pyriform
@Cavite It makes sense to hide it. A large majority of Java programmers make every class public and don't know any better. These low-information programmers are the majority of IntelliJ users and the IDE must be dumbed down to their level. And sadly the reason so many programmers make everything public is IDEs by default add the pubic modifier to every new class. So the cycle continues.Vicarious
@Solomonoff'sSecret OK, but why don't make this setting appear in settings tab?Cavite
For anyone wondering about package by feature, it is a way of organizing code which avoids the problem of getting too many classes in a package. javapractices.com/topic/TopicAction.do?Id=205 (IMO everyone should use this.)Melitamelitopol
@Solomonoff'sSecret that is just bad practice. To break that cycle IDE shouldn't make everything public by default, but rather follow the default access modifier - which is package access.Metralgia
Wow! Feature was removed :( This is the first step to spaghetti code.Dexterdexterity
How about package-by-component tho?codingthearchitecture.com/2015/03/08/…Wysocki
P
5

Since 2019.2 there is actually an easy to use option as described in comment:

you can find this setting in options menu of Project Tool Window. It's called "Show Visibility Icons"

Phosphoresce answered 24/7, 2019 at 22:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.