Used field "is never assigned" in InellijIdea with @FindBy annotation

Valentyn Hruzytskyi :

How can I resolve this issue in IntellijIdea?

enter image description here

This answer Why no "field is never assigned" warning with @Mock only describe the reason but not offer the resolving.

Bas Leijdekkers :

This warning is produced by the "Unused declaration" inspection, which does not know about the @FindBy annotation. To teach it, position the text cursor on the name of the field, type Alt+Enter and invoke the Suppress unused warning if annotated by '@FindBy' action. After that it will no longer warn on any field annotated by this annotation.

The action will add the intention to an internal "Mark field as implicitly written if annotated by" list. The setting can also be found in the settings of the inspection by clicking on the Annotations... button under the Entry points tab.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324646&siteId=1