checker.src.org.checkerframework.checker.units.UnitsChecker Maven / Gradle / Ivy
Show all versions of checker Show documentation
package org.checkerframework.checker.units;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.processing.SupportedOptions;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.common.basetype.BaseTypeVisitor;
/**
* Units Checker main class.
*
*
* Supports "units" option to add support for additional individually named and
* externally defined units, and "unitsDirs" option to add support for
* directories of externally defined units. Directories must be well-formed
* paths from file system root, separated by colon (:) between each directory.
*
* @checker_framework.manual #units-checker Units Checker
*/
@SupportedOptions({ "units", "unitsDirs" })
public class UnitsChecker extends BaseTypeChecker {
/*
@Override
public void initChecker() {
super.initChecker();
}
*/
/**
* Copied from SubtypingChecker; cannot reuse it, because SubtypingChecker
* is final. TODO: SubtypingChecker might also want to always call super.
*/
@Override
public Collection getSuppressWarningsKeys() {
Set swKeys = new HashSet(
super.getSuppressWarningsKeys());
Set> annos = ((BaseTypeVisitor) visitor)
.getTypeFactory().getSupportedTypeQualifiers();
for (Class anno : annos) {
swKeys.add(anno.getSimpleName().toLowerCase());
}
return swKeys;
}
}