This is why I love the “find usages” inspection, though the IDE (at least JetBrains ones) will usually preemptively warn you about unused methods and functions.
If it’s a block of logic in the middle of a function that you suspect is no longer needed, set a breakpoint in it and run the program before deleting it just to make sure it’s not being triggered.
Deeper down the rabbit hole, more dangerous “useless” blocks of code won’t be found with “find usages” because the usage either:
isn’t in the project, and is external. Like a powershell script calling a function present in the DLL, or your system’s equivalent. Or even hardware accessing it directly at a known address, like an IRQ table
is accessed via reflection, which the IDE won’t know about
for bonus points, the linker depends on it to make a functioning binary. Or some other dodgy code may break at runtime if offset from its original location in the binary…
This is why I love the “find usages” inspection, though the IDE (at least JetBrains ones) will usually preemptively warn you about unused methods and functions.
If it’s a block of logic in the middle of a function that you suspect is no longer needed, set a breakpoint in it and run the program before deleting it just to make sure it’s not being triggered.
Deeper down the rabbit hole, more dangerous “useless” blocks of code won’t be found with “find usages” because the usage either:
isn’t in the project, and is external. Like a powershell script calling a function present in the DLL, or your system’s equivalent. Or even hardware accessing it directly at a known address, like an IRQ table
is accessed via reflection, which the IDE won’t know about
for bonus points, the linker depends on it to make a functioning binary. Or some other dodgy code may break at runtime if offset from its original location in the binary…