mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8140442: Add getOutermostTypeElement to javax.lang.model utility class
Reviewed-by: jlahoda
This commit is contained in:
parent
67869b491a
commit
57ae9fbe77
6 changed files with 269 additions and 55 deletions
|
@ -21,9 +21,11 @@
|
|||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import javax.annotation.processing.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.*;
|
||||
import javax.lang.model.util.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
|
@ -264,4 +266,60 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
|
|||
super(defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vacuous implementation of javax.lang.model.util.Elements to aid
|
||||
* in test development. Methods with defaults in the interface are
|
||||
* *not* overridden to allow them to be tested.
|
||||
*/
|
||||
public static class VacuousElements implements Elements {
|
||||
public VacuousElements() {}
|
||||
|
||||
@Override
|
||||
public PackageElement getPackageElement(CharSequence name) {return null;}
|
||||
|
||||
@Override
|
||||
public TypeElement getTypeElement(CharSequence name) {return null;}
|
||||
|
||||
@Override
|
||||
public Map<? extends ExecutableElement, ? extends AnnotationValue>
|
||||
getElementValuesWithDefaults(AnnotationMirror a) {return null;}
|
||||
@Override
|
||||
public String getDocComment(Element e) {return null;}
|
||||
|
||||
@Override
|
||||
public boolean isDeprecated(Element e) {return false;}
|
||||
|
||||
@Override
|
||||
public Name getBinaryName(TypeElement type) {return null;}
|
||||
|
||||
@Override
|
||||
public PackageElement getPackageOf(Element e) {return null;}
|
||||
|
||||
@Override
|
||||
public List<? extends Element> getAllMembers(TypeElement type) {return null;}
|
||||
|
||||
@Override
|
||||
public List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e) {return null;}
|
||||
|
||||
@Override
|
||||
public boolean hides(Element hider, Element hidden) {return false;}
|
||||
|
||||
@Override
|
||||
public boolean overrides(ExecutableElement overrider,
|
||||
ExecutableElement overridden,
|
||||
TypeElement type) {return false;}
|
||||
|
||||
@Override
|
||||
public String getConstantExpression(Object value) {return null;}
|
||||
|
||||
@Override
|
||||
public void printElements(Writer w, Element... elements) {}
|
||||
|
||||
@Override
|
||||
public Name getName(CharSequence cs) {return null;}
|
||||
|
||||
@Override
|
||||
public boolean isFunctionalInterface(TypeElement type) {return false;}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue