GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Error Prone
  • Bug Patterns
  • Docs
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing errorprone.info — UnnecessaryAssignment

UnnecessaryAssignment
Fields annotated with @Inject/@Mock/@TestParameter should not be manually assigned to, as they should be initialized by a framework. Remove the assignment if a framework is being used, or the annotation if one isn't.

Severity
WARNING

The problem

The @Mock annotation is used to automatically initialize mocks using MockitoAnnotations.initMocks, or MockitoJUnitRunner.

Variables annotated this way should not be explicitly initialized, as this will be overwritten by automatic initialization.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("UnnecessaryAssignment") to the enclosing element.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.