Reflective access to non-existent or not visible class member
Reports reflective access to fields and methods that don't exist or aren't visible.
Example:
After the quick-fix is applied:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
JavaReflectionMemberAccess- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
With a final class, it's clear if there is a field or method with the specified name in the class.
With non-final classes, it's possible that a subclass has a field or method with that name, so there could be false positives. Use the inspection's settings to get rid of such false positives everywhere or with specific classes.
Inspection ID: JavaReflectionMemberAccess
New in 2017.2
Inspection options
Here you can find the description of settings available for the Reflective access to non-existent or not visible class member inspection, and the reference of their default values.
- Exclude classes
Option ID:
ignoredClassNamesDefault value:
[java.lang.Object, java.lang.Throwable]- Check that field/method exists in non-final classes
Option ID:
checkMemberExistsInNonFinalClassesDefault value:
Selected
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |