All Downloads are FREE. Search and download functionalities are using the official Maven repository.

checker.src.org.checkerframework.checker.units.UnitsChecker Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.42.0
Show newest version
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; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy