Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are Entry Points in IntelliJ code inspection and do I need to "fix" them?

I am using IntelliJ IDEA. I tried the "inspect code" function that it comes with, and I wanted to fix something called "entry points". That has something to do with my enums and my main method. I would like to know what an entry point is and how to fix that error.

like image 407
shedes Avatar asked Aug 31 '14 08:08

shedes


People also ask

What are inspections in IntelliJ?

Code inspections In IntelliJ IDEA, there is a set of code inspections that detect and correct abnormal code in your project before you compile it. The IDE can find and highlight various problems, locate dead code, find probable bugs, spelling problems, and improve the overall code structure.

How do I fix errors in IntelliJ?

Apply fixes in the Problems tool window icon on the toolbar or in the context menu. You can also press Alt+Enter and select a suitable fix from the popup menu.

Where do I enter code in IntelliJ?

In the editor, press Ctrl+Shift+Enter or from the main menu select Code | Complete Current Statement. IntelliJ IDEA inserts the required trailing comma automatically in structs, slices, and other composite literals. The caret is moved to the position where you can start typing the next statement.


1 Answers

Entry points are where the world around your code might invoke it, such as Junit tests, Servlets, classes with a main method. IntelliJ tries to trace usage of code back to at least one entry point, so if one of your classes is an entry point and Intellij couldn't detect it, more unused code will be reported than what is actual. (If class A uses code from class B, but no one uses class A, class B still has unused code). You could fix it by adding your class to the set of entry points.

like image 151
Programmer Trond Avatar answered Sep 28 '22 03:09

Programmer Trond