framework.src.org.checkerframework.qualframework.base.TypeVariableSubstitutor 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.qualframework.base;
import org.checkerframework.qualframework.base.QualifiedTypeMirror.QualifiedTypeVariable;
import java.util.Map;
import javax.lang.model.type.TypeVariable;
/**
* TypeVariableSubstitutor replaces type variables from a declaration with arguments to its use.
*/
public class TypeVariableSubstitutor {
private TypeVariableSubstitutorAdapter adapter;
/**
* Currently substitution is performed by AnnotatedTypes class. There are no hooks in the qual system
* to make that functionality flow through this method. When that is plumbed, this method should be implemented.
*/
public QualifiedTypeMirror substitute(final Map> typeParamToArg,
final QualifiedTypeMirror typeMirror) {
throw new UnsupportedOperationException("Calling this method directly is not " +
"yet supported by the qualifier parameter framework.");
}
// @see doesn't work because the method has protected visibility
/**
* see org.checkerframework.framework.type.TypeVariableSubstitutor#substituteTypeVariable(AnnotatedTypeMirror, AnnotatedTypeVariable)
*/
protected QualifiedTypeMirror substituteTypeVariable(final QualifiedTypeMirror argument,
final QualifiedTypeVariable use) {
return adapter.superSubstituteTypeVariable(argument, use);
}
public void setAdapter(TypeVariableSubstitutorAdapter adapter) {
this.adapter = adapter;
}
}