Manually configure IntelliJ to throw errors on specific code smells

已回答

Hello all,

I recently came across a stackoverflow post about how Java allows static method calls via class instances without throwing errors, and it got me thinking if we could configure IntelliJ manually to throw errors / refuse to build if something like this occurs in code.

IntelliJ already detects such occurrences, but what I'm after is to have it refuse to build and throw errors when it detects something like so:

0

Afaik it's not possible to make IDEA stop build.
(you can though set another severity level for the inspection, e.g. as Error so it will be marked differently in the Editor: Alt+Enter on the warning, press Right, select "Edit inspections profile", or go directly to Preferences | Editor | Inspections | Java | Declaration redundancy | Access static member via instance reference)

0

请先登录再写评论。