org.checkerframework.checker.compilermsgs.CompilerMessagesAnnotatedTypeFactory 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.compilermsgs;
import org.checkerframework.checker.compilermsgs.qual.CompilerMessageKey;
import org.checkerframework.checker.propkey.PropertyKeyAnnotatedTypeFactory;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.type.treeannotator.ListTreeAnnotator;
import org.checkerframework.framework.type.treeannotator.TreeAnnotator;
/** A PropertyKeyATF that uses CompilerMessageKey to annotate the keys. */
public class CompilerMessagesAnnotatedTypeFactory extends PropertyKeyAnnotatedTypeFactory {
public CompilerMessagesAnnotatedTypeFactory(BaseTypeChecker checker) {
super(checker);
// Does not call postInit() because its superclass does.
// If we ever add code to this constructor, it needs to:
// * call a superclass constructor that does not call postInit(), and
// * call postInit() itself.
}
@Override
public TreeAnnotator createTreeAnnotator() {
return new ListTreeAnnotator(
super.createBasicTreeAnnotator(),
new KeyLookupTreeAnnotator(this, CompilerMessageKey.class));
}
}