Java Code Examples for javax.annotation.meta.When#MAYBE

The following examples show how to use javax.annotation.meta.When#MAYBE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowValue.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Determine whether given backwards FlowValue conflicts with given source.
 *
 * @param backwardsFlowValue
 *            a backwards FlowValue
 * @param source
 *            SourceSinkInfo object representing a source reached by the
 *            backwards flow value
 * @param typeQualifierValue
 *            TypeQualifierValue being checked
 * @param isIdentity TODO
 * @return true if backwards value conflicts with source, false if not
 */
public static boolean backwardsValueConflictsWithSource(FlowValue backwardsFlowValue, SourceSinkInfo source,
        TypeQualifierValue typeQualifierValue, boolean isIdentity) {

    When sourceWhen = source.getWhen();


    if (typeQualifierValue.isStrictQualifier() && !isIdentity) {
        // strict checking
        return (backwardsFlowValue == ALWAYS && sourceWhen != When.ALWAYS)
                || (backwardsFlowValue == NEVER && sourceWhen != When.NEVER);
    } else {
        // NOT strict checking
        return (backwardsFlowValue == ALWAYS && (sourceWhen == When.NEVER || sourceWhen == When.MAYBE))
                || (backwardsFlowValue == NEVER && (sourceWhen == When.ALWAYS || sourceWhen == When.MAYBE));
    }
}
 
Example 2
Source File: MockNullableTestCorrect.java    From ph-commons with Apache License 2.0 4 votes vote down vote up
public void paramNonnullMaybe (@Nonnull (when = When.MAYBE) final String s)
{}
 
Example 3
Source File: IMockNullableTest.java    From ph-commons with Apache License 2.0 votes vote down vote up
void paramNonnullMaybe (@Nonnull (when = When.MAYBE) String s);