Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Enable Null annotations warnings/errors in IDE and Maven (#3906)
Browse files Browse the repository at this point in the history
* Enable JSR305 Annotations in IDE

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>

* Enable Nullanalysis in maven

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>

* Enable maven warnings on potential nullpointer access

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>

* javax.annotation optional jsr version in variable

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>
  • Loading branch information
triller-telekom authored and maggu2810 committed Jul 31, 2017
1 parent c79e1d2 commit 6487a19
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
org.eclipse.smarthome.model.lazygen;resolution:=optional
Import-Package: com.google.common.base,
com.google.common.collect,
javax.annotation;resolution:=optional,
org.apache.commons.io,
org.apache.commons.lang,
org.apache.commons.logging,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional,
org.eclipse.smarthome.model.lazygen;resolution:=optional,
org.eclipse.xtext.xbase.lib
Import-Package: org.apache.log4j,
Import-Package: javax.annotation;resolution:=optional,
org.apache.log4j,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.core.common.registry,
org.eclipse.smarthome.core.i18n,
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<xtext-version>2.9.2</xtext-version>
<karaf.version>4.0.3</karaf.version>
<ds-annotations.version>1.2.8</ds-annotations.version>
<findbugs-jsr305-version>3.0.2</findbugs-jsr305-version>
<build.helper.maven.plugin.version>1.8</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down Expand Up @@ -156,7 +157,16 @@
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<version>${ds-annotations.version}</version>
</extraClasspathElement>
<extraClasspathElement>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${findbugs-jsr305-version}</version>
</extraClasspathElement>
</extraClasspathElements>
<compilerArgs>
<arg>-err:+nullAnnot(javax.annotation.Nullable|javax.annotation.Nonnull|org.eclipse.jdt.annotation.NonNullByDefault),+inheritNullAnnot</arg>
<arg>-warn:+null</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
Expand Down
8 changes: 8 additions & 0 deletions targetplatform/EclipseSmartHome.setup
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations"
value="enabled"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.annotation.nonnull"
value="javax.annotation.Nonnull"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.annotation.nullable"
value="javax.annotation.Nullable"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.annotation.nullanalysis"
Expand Down

0 comments on commit 6487a19

Please sign in to comment.