Example usage for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment getNonNullAnnotationName

List of usage examples for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment getNonNullAnnotationName

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment getNonNullAnnotationName.

Prototype

public char[][] getNonNullAnnotationName() 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java

License:Open Source License

public void addNonNullAnnotation(Argument argument, LookupEnvironment environment) {
    CompilerOptions compilerOptions = environment.globalOptions;
    if (compilerOptions.isAnnotationBasedNullAnalysisEnabled) {
        if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_8) {
            argument.annotations = new Annotation[] {
                    markerAnnotation(environment.getNonNullAnnotationName()) };
        } else {/*  w  w w  .jav a 2 s.  c  o  m*/
            int levels = argument.type.getAnnotatableLevels();
            argument.type.annotations = new Annotation[levels][];
            argument.type.annotations[levels - 1] = new Annotation[] {
                    markerAnnotation(environment.getNonNullAnnotationName()) };
        }
    }
}