1

I recently came across this stackoverflow post (Why isn't calling a static method by way of an instance an error for the Java compiler?) and it got me thinking - is it possible to configure IntelliJ to 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:

enter image description here

3
  • Currently it's not possible to stop build on inspection results. Feel free to create feature request on YouTrack: youtrack.jetbrains.com/issues/IDEA Commented Aug 15, 2022 at 12:11
  • 2
    There are libraries out there (e.g. error-prone) which will cause similar compile-time errors for you on purpose. This includes their check for StaticQualifiedUsingExpression Commented Aug 15, 2022 at 15:11
  • If you're using a build tool like Maven, there might also be code quality plugins you can use to make the build fail. But that is only partially relevant for your question, as the build in IDEA would still succeed. Commented Aug 16, 2022 at 8:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.