What does “Can be package local” mean? (IDEA Inspection)

前端 未结 5 1451
太阳男子
太阳男子 2020-12-14 14:08

I used IntelliJ for \"Inspect Code\", and one of its results is:

  Problem synopsis      Can be package local (at line 18(public class HeartBeat))

5条回答
  •  無奈伤痛
    2020-12-14 14:44

    If you want to suppress this warning:

    1. Go to Preferences -> Editor -> Inspections
    2. Go to Java -> Declaration redundancy
    3. Select "Declaration access can be weaker"
    4. Uncheck the "Suggest package local visibility..." checkboxes on the right

    EDIT: in the latest IDEA release step 4 this looks to have changed to "Suggest package-private visibility level for ..." and includes several options for various conditions

提交回复
热议问题