Suppress "variable is never assigned" warning in IntelliJ IDEA

You could use an annotation to mark it as an injected field. (similar to how it would treat @EJB). The IntelliJ inspections (at least with version 10.5) allow you to configure your own annotations to mark fields as being injected.

Select Analyze, Inspect Code from the menu and then go to the unused declaration inspection and you can configure an annotation.


To configure annotations in Android Studio 1.1.0 after inspecting your code right click Unused declaration -> Edit Settings -> Configure annotations.

Android Studio 1.1.0

Android Studio 1.1.0


  1. run analysis: Analyze > Inpect Code...
  2. Right click on Unused Declaration (below the Declaration redundancy tree node)
  3. Click on the "Configure Annotations..."
  4. Add com.google.google.inject.Inject and javax.inject.Inject