Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Findbugs detectors for Guice
Java

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
pom.xml

README.md

findbugs-guice

findbugs-guice is a detector for Findbugs, a popular static analysis tool, that detects errors in the use of Guice.

findbugs-guice detects:

  • scope annotations on interfaces (which Guice does not support)
  • installation of submodules via Module.configure() (which doesn't install @Provides methods) rather than Module.install()
  • static field injection (which is recommended against)
  • final field injection (which is recommended against and error-prone)

How to install

... using the Findbugs Maven plugin

Add the following to your pom.xml:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>fetch-findbugs-guice</id>
                        <phase>package</phase>
                        <goals>
                            <goal>get</goal>
                        </goals>
                        <configuration>
                            <groupId>uk.me.tom-fitzhenry.findbugs-guice</groupId>
                            <artifactId>findbugs-guice</artifactId>
                            <version>0.5</version>
                            <remoteRepositories>central::default::http://repo1.maven.apache.org/maven2</remoteRepositories>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <configuration>
                    <pluginList>${settings.localRepository}/uk/me/tom-fitzhenry/findbugs-guice/findbugs-guice/0.5/findbugs-guice-0.5.jar</pluginList>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

This is considered a workaround for MFINDBUGS-151.

... otherwise

Install findbugs-guice like any other Findbugs detector:

  1. Put the JAR in FINDBUGS_HOME/plugin.
  2. Test your installation against code which exhibits the issues that findbugs-guice detects.

How to build

mvn package

Something went wrong with that request. Please try again.