
org.checkerframework.checker.signedness.SignednessChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker Show documentation
Show all versions of checker Show documentation
The Checker Framework enhances Java's type system to
make it more powerful and useful. This lets software developers
detect and prevent errors in their Java programs.
The Checker Framework includes compiler plug-ins ("checkers")
that find bugs or verify their absence. It also permits you to
write your own compiler plug-ins.
package org.checkerframework.checker.signedness;
import java.util.Set;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.common.value.ValueChecker;
import org.checkerframework.framework.qual.RelevantJavaTypes;
import org.checkerframework.framework.qual.StubFiles;
import org.checkerframework.framework.source.SourceChecker;
/**
* A type-checker that prevents mixing of unsigned and signed values, and prevents meaningless
* operations on unsigned values.
*
* @checker_framework.manual #signedness-checker Signedness Checker
*/
// Character and char are omitted here because they are always @Unsigned, and the user is not
// allowed to write @Signed or @Unsigned on them.
@RelevantJavaTypes({
Byte.class,
Short.class,
Integer.class,
Long.class,
byte.class,
short.class,
int.class,
long.class,
})
@StubFiles({"junit-assertions.astub"})
public class SignednessChecker extends BaseTypeChecker {
/** Creates a new SignednessChecker. */
public SignednessChecker() {}
@Override
protected Set> getImmediateSubcheckerClasses() {
Set> checkers = super.getImmediateSubcheckerClasses();
checkers.add(ValueChecker.class);
return checkers;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy