Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable warning "Access can be package-private" for @Transactional methods

I have several public methods annotated with @Transactional and IntelliJ shows the warning that they can be package-private or private.

@Transactional
public void doSomething() {
  ///body
}

Since methods annotated with @Transactional should be public, how can I disable in IntelliJ this inspection/warning only for those methods?

like image 786
Manza Avatar asked Jun 21 '17 14:06

Manza


1 Answers

Sadly, it isn't possible to make all methods annotated with @Transactional clear the warning, although it is possible to add @SuppressWarnings("WeakerAccess") to make the warning go away.
Alternatively, you can disable this inspection altogether in IntelliJ IDEA by going to FileSettingsEditorInspections. In the list show in this view you will want to navigate through the subcategories: JavaDeclaration redundancy and uncheck the checkbox called "Declaration access can be weaker" that will be available then. If you wish to disable this for future projects, choose the profile "Default" from the dropdown menu labelled "Profile", otherwise, just do this for "Project Default".

like image 136
Gabriel Tofvesson Avatar answered Nov 16 '22 07:11

Gabriel Tofvesson