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

The following examples show how to use javax.annotation.meta.When#NEVER . 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: CoreStitchAuth.java    From stitch-android-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether or not the client is logged in.
 *
 * @return whether or not the client is logged in.
 */
@CheckReturnValue(when = When.NEVER)
public boolean isLoggedIn() {
  authLock.readLock().lock();
  try {
    return activeUser != null && activeUser.isLoggedIn();
  } finally {
    authLock.readLock().unlock();
  }
}
 
Example 3
Source File: ValidationSecurityManagerTest.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public @Nonnull When forConstantValue(@Nonnull SlashedClassName annotation, Object value) {
    Thread t = new Thread() {
        @Override
        public void run() {
            System.out.println("bang");
        }
    };
    t.start();
    return When.NEVER;
}
 
Example 4
Source File: TestFooSimpleControlFlow.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.NEVER)
Object returnsNotFoo() {
    return null;
}
 
Example 5
Source File: TestFooGuaranteedControlFlow.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void requiresNotFoo(@Foo(when = When.NEVER) Object x) {
}
 
Example 6
Source File: TestFooGuaranteedControlFlow.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.NEVER)
Object returnsNotFoo() {
    return null;
}
 
Example 7
Source File: TestDefaultAnnotations.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@ExpectWarning("TQ")
public void violate(@Foo(when = When.NEVER) Object x) {
    requiresFoo(x);
}
 
Example 8
Source File: I1.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.ALWAYS)
Object alwaysReturnFooParams1(@Foo(when = When.ALWAYS) Object alwaysParam, @Foo(when = When.NEVER) Object neverParam);
 
Example 9
Source File: I1.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.NEVER)
Object neverReturnFoo1();
 
Example 10
Source File: TestExhaustiveQualifier.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@ExpectWarning("TQ")
public void report4(@ExhaustiveQualifier(value = ExhaustiveQualifier.Color.BLUE, when = When.NEVER) Object v) {
    // Sanity check - should see a warning here
    blueField = v;
}
 
Example 11
Source File: TestFooSimpleControlFlow.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void requiresNotFoo(@Foo(when = When.NEVER) Object x) {
}
 
Example 12
Source File: TestFooGuaranteedControlFlow2.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void requiresNotFoo(@Foo(when = When.NEVER) Object x) {
}
 
Example 13
Source File: TestFooGuaranteedControlFlow2.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.NEVER)
Object returnsNotFoo() {
    return null;
}
 
Example 14
Source File: TestFooNoControlFlow2.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @Foo(when = When.NEVER)
Object returnsNotFoo() {
    return null;
}
 
Example 15
Source File: Bug2824716a.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@CheckReturnValue(when = When.NEVER)
public Bug2824716a append() {
    return this;
}
 
Example 16
Source File: CoreStitchAuth.java    From stitch-android-sdk with Apache License 2.0 4 votes vote down vote up
@CheckReturnValue(when = When.NEVER)
AuthInfo getAuthInfo() {
  return activeUserAuthInfo;
}
 
Example 17
Source File: ParquetRecordReader.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the next record.
 * Note that the reachedEnd() method must be called before.
 *
 * @return The next record.
 */
@CheckReturnValue(when = When.NEVER)
public T nextRecord() {
	readRecordReturned = true;
	return readRecord;
}
 
Example 18
Source File: Catalog.java    From kieker with Apache License 2.0 2 votes vote down vote up
/**
 * A dummy method returning just a book with a constant string.
 * 
 * @param complexQuery
 *            Some dummy parameter which is not used in fact.
 * 
 * @return A new book.
 */
@CheckReturnValue(when = When.NEVER)
public Book getBook(final boolean complexQuery) {
	return new Book("Kieker 1.5 User Guide");
}
 
Example 19
Source File: ParquetRecordReader.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the next record.
 * Note that the reachedEnd() method must be called before.
 *
 * @return The next record.
 */
@CheckReturnValue(when = When.NEVER)
public T nextRecord() {
	readRecordReturned = true;
	return readRecord;
}
 
Example 20
Source File: IMockNullableTest.java    From ph-commons with Apache License 2.0 votes vote down vote up
void paramNonnullNever (@Nonnull (when = When.NEVER) String s);