org.eclipse.jdt.core
Class JavaCore

All Implemented Interfaces:
org.osgi.framework.BundleActivator

public final class JavaCore
extends org.eclipse.core.runtime.Plugin

COMPILER_NULLABLE_ANNOTATION_NAME

public static final java.lang.String COMPILER_NULLABLE_ANNOTATION_NAME
Compiler option ID: Name of Annotation Type for Nullable Types.

This option defines a fully qualified Java type name that the compiler may use to perform special null analysis.

If the annotation specified by this option is applied to a type in a method signature or variable declaration this will be interpreted as a contract that null is a legal value in that position. Currently supported positions are: method parameters and method return type.

If a value whose type is annotated with this annotation is dereferenced without checking for null the compiler will trigger a diagnostic as further controlled by COMPILER_PB_POTENTIAL_NULL_REFERENCE.

The compiler may furthermore check adherence to the null contract as further controlled by COMPILER_PB_NULL_CONTRACT_VIOLATION, COMPILER_PB_POTENTIAL_NULL_CONTRACT_VIOLATION and COMPILER_PB_NULL_CONTRACT_INSUFFICIENT_INFO.

Option id:
"org.eclipse.jdt.core.compiler.annotation.nullable"
Possible values:
any legal Java type name
Default:
"org.eclipse.jdt.annotation.Nullable"

Since:
3.7
See Also:
Constant Field Values

COMPILER_NONNULL_ANNOTATION_NAME

public static final java.lang.String COMPILER_NONNULL_ANNOTATION_NAME
Compiler option ID: Name of Annotation Type for Non-Null Types.

This option defines a fully qualified Java type name that the compiler may use to perform special null analysis.

If the annotation specified by this option is applied to a type in a method signature or variable declaration this will be interpreted as a contract that null is not a legal value in that position. Currently supported positions are: method parameters and method return type.

For values declared with this annotation the compiler will never trigger a null reference diagnostic (as controlled by COMPILER_PB_POTENTIAL_NULL_REFERENCE and COMPILER_PB_NULL_REFERENCE), because the assumption is made that null will never occur at runtime in these positions.

The compiler may furthermore check adherence to the null contract as further controlled by COMPILER_PB_NULL_CONTRACT_VIOLATION, COMPILER_PB_POTENTIAL_NULL_CONTRACT_VIOLATION and COMPILER_PB_NULL_CONTRACT_INSUFFICIENT_INFO.

Option id:
"org.eclipse.jdt.core.compiler.annotation.nonnull"
Possible values:
any legal Java type name
Default:
"org.eclipse.jdt.annotation.NonNull"

Since:
3.7
See Also:
Constant Field Values

COMPILER_EMULATE_NULL_ANNOTATION_TYPES

public static final java.lang.String COMPILER_EMULATE_NULL_ANNOTATION_TYPES
Compiler option ID: Emulate Null Annotation Types.

When enabled, the compiler will use the annotation types specified in COMPILER_NONNULL_ANNOTATION_NAME and COMPILER_NULLABLE_ANNOTATION_NAME without searching for a corresponding type definition, ie., these annotation types don't have to actually exist.

This option is used to make null contract analysis independent of any additional classes that would otherwise need to be supplied at compile time.

Option id:
"org.eclipse.jdt.core.compiler.annotation.emulate"
Possible values:
{ "disabled", "enabled" }
Default:
"disabled"

Since:
3.7
See Also:
Constant Field Values

COMPILER_DEFAULT_IMPORT_NULL_ANNOTATION_TYPES

public static final java.lang.String COMPILER_DEFAULT_IMPORT_NULL_ANNOTATION_TYPES
Compiler option ID: Default Import of Null Annotation Types.

When enabled, the compiler will be able to resolve the annotation types specified in COMPILER_NONNULL_ANNOTATION_NAME and COMPILER_NULLABLE_ANNOTATION_NAME by their simple names without an explicit import statement.

This option is used to avoid mentioning the fully qualified annotation names in any source files, as to facility the migration from one set of annotations to another, e.g., when standard annotations for this purpose will be defined in the future.

Option id:
"org.eclipse.jdt.core.compiler.annotation.defaultImport"
Possible values:
{ "disabled", "enabled" }
Default:
"disabled"

Since:
3.7
See Also:
Constant Field Values

COMPILER_PB_NULL_CONTRACT_VIOLATION

public static final java.lang.String COMPILER_PB_NULL_CONTRACT_VIOLATION
Compiler option ID: Reporting Violations of Null Contracts.

When enabled, the compiler will issue an error or a warning whenever one of the following situations is detected:

  1. A method declared with a nonnull annotation returns an expression that is statically known to evaluate to a null value.
  2. An expression that is statically known to evaluate to a null value is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation.
  3. A method that overrides an inherited method declared with a nonnull annotation tries to relax that contract by specifying a nullable annotation (prohibition of contravariant return).
  4. A method that overrides an inherited method which has a nullable declaration for at least one of its parameters, tries to tighten that null contract by specifying a nonnull annotation for its corresponding parameter (prohibition of covariant parameters).

The compiler options COMPILER_NONNULL_ANNOTATION_NAME and COMPILER_NULLABLE_ANNOTATION_NAME control which annotations the compiler shall interpret as nonnull or nullable annotations, respectively.

Option id:
"org.eclipse.jdt.core.compiler.problem.nullContractViolation"
Possible values:
{ "error", "warning", "ignore" }
Default:
"error"

Since:
3.7
See Also:
Constant Field Values

COMPILER_PB_POTENTIAL_NULL_CONTRACT_VIOLATION

public static final java.lang.String COMPILER_PB_POTENTIAL_NULL_CONTRACT_VIOLATION
Compiler option ID: Reporting Violations of Null Contracts with Potential Null Value.

When enabled, the compiler will issue an error or a warning whenever one of the following situations is detected:

  1. A method declared with a nonnull annotation returns an expression that is statically known to evaluate to a null value on some flow.
  2. An expression that is statically known to evaluate to a null value on some flow is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation.

The compiler options COMPILER_NONNULL_ANNOTATION_NAME and COMPILER_NULLABLE_ANNOTATION_NAME control which annotations the compiler shall interpret as nonnull or nullable annotations, respectively.

Option id:
"org.eclipse.jdt.core.compiler.problem.potentialNullContractViolation"
Possible values:
{ "error", "warning", "ignore" }
Default:
"error"

Since:
3.7
See Also:
Constant Field Values

COMPILER_PB_NULL_CONTRACT_INSUFFICIENT_INFO

public static final java.lang.String COMPILER_PB_NULL_CONTRACT_INSUFFICIENT_INFO
Compiler option ID: Reporting Insufficient Information for Analysing Adherence to Null Contracts.

When enabled, the compiler will issue an error or a warning whenever one of the following situations is detected:

  1. A method declared with a nonnull annotation returns an expression for which insufficient nullness information is available for statically proving that no flow will pass a null value at runtime.
  2. An expression for which insufficient nullness information is available for statically proving that it will never evaluate to a null value at runtime is passed as an argument in a method call where the corresponding parameter of the called method is declared with a nonnull annotation.
Insufficient nullness information is usually a consequence of using other unannotated variables or methods.

The compiler options COMPILER_NONNULL_ANNOTATION_NAME and COMPILER_NULLABLE_ANNOTATION_NAME control which annotations the compiler shall interpret as nonnull or nullable annotations, respectively.

Option id:
"org.eclipse.jdt.core.compiler.problem.nullContractInsufficientInfo"
Possible values:
{ "error", "warning", "ignore" }
Default:
"warning"

Since:
3.7
See Also:
Constant Field Values

SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD