<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.gudenau.test</groupId>
<artifactId>AnnotationTest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<!-- This plugin will set properties values using dependency information -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<!-- Change source and target to 1.7 if using Java 7 -->
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<annotationProcessors>
<!-- Add all the checkers you want to enable here -->
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<!-- location of the annotated JDK, which comes from a Maven dependency -->
<arg>-Xbootclasspath/p:${annotatedJdk}</arg>
<!-- Uncomment the following line to use the type annotations compiler. -->
<!-- <arg>-J-Xbootclasspath/p:${typeAnnotationsJavac}</arg> -->
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- annotations from the Checker Framework: nullness, interning, locking, ... -->
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>2.1.8</version>
</dependency>
<!-- The type annotations compiler - uncomment if desired -->
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>compiler</artifactId>
<version>2.1.8</version>
</dependency>
<!-- The annotated JDK to use (change to jdk7 if using Java 7) -->
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>jdk8</artifactId>
<version>2.1.8</version>
</dependency>
</dependencies>
<properties>
<!-- These properties will be set by the Maven Dependency plugin -->
<!-- Change to jdk7 if using Java 7 -->
<annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk>
<!-- Uncomment to use the type annotations compiler. -->
<typeAnnotationsJavac>${org.checkerframework:compiler:jar}</typeAnnotationsJavac>
</properties>
</project>
> an email to checker-framework-dev+unsub...@googlegroups.com.
> > an email to checker-framework-dev+unsub...@googlegroups.com.
> > To post to this group, send email to
> > checker-fr...@googlegroups.com.
> > Visit this group at
> > https://groups.google.com/group/checker-framework-dev.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Checker Framework Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to checker-framework-dev+unsub...@googlegroups.com.
> an email to checker-framework-dev+unsub...@googlegroups.com.
> > an email to checker-framework-dev+unsub...@googlegroups.com.
> > To post to this group, send email to
> > checker-fr...@googlegroups.com.
> > Visit this group at
> > https://groups.google.com/group/checker-framework-dev.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Checker Framework Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to checker-framework-dev+unsub...@googlegroups.com.
import sun.misc.Unsafe;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
public class UnsafeHelper {
@Nullable
private static Unsafe unsafe;
public static Unsafe getUnsafe(){
if(unsafe != null){
return unsafe;
}
for(Field field : Unsafe.class.getDeclaredFields()){
if(field.getType() == Unsafe.class){
try {
field.setAccessible(true);
unsafe = (Unsafe)field.get(null);
if(unsafe != null){
return unsafe;
}
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Could not read Unsafe instance!", e);
}
}
}
throw new RuntimeException("Could not find Unsafe instance!");
}
}
> > > an email to checker-framework-dev+unsub...@googlegroups.com.
> > > To post to this group, send email to
> > > checker-fr...@googlegroups.com.
> > > Visit this group at
> > > https://groups.google.com/group/checker-framework-dev.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Checker Framework Developers" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to checker-framework-dev+unsub...@googlegroups.com.
> > To post to this group, send email to
> > checker-fr...@googlegroups.com.
> > Visit this group at
> > https://groups.google.com/group/checker-framework-dev.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Checker Framework Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to checker-framework-dev+unsub...@googlegroups.com.
<checkerframework.version>2.5.6</checkerframework.version>
<annotatedJdk>${settings.localRepository}/org/checkerframework/jdk8/${checkerframework.version}/jdk8-${checkerframework.version}.jar</annotatedJdk>
I am using IntelliJ IDEA Ultimite version 2016.3.4, I am using this POM:<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">