mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8042981: Strip type annotations in Types' utility methods
Co-authored-by: Liam Miller-Cushon <cushon@openjdk.org> Reviewed-by: cushon, jjg, jlahoda
This commit is contained in:
parent
6d1856234f
commit
ed3272cc44
5 changed files with 451 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,6 +26,7 @@ import java.util.*;
|
|||
import javax.annotation.processing.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.*;
|
||||
import javax.lang.model.type.*;
|
||||
import javax.lang.model.util.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
|
@ -322,4 +323,73 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
|
|||
@Override
|
||||
public boolean isFunctionalInterface(TypeElement type) {return false;}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vacuous implementation of javax.lang.model.util.Types to aid
|
||||
* in test development. Methods with defaults in the interface are
|
||||
* *not* overridden to allow them to be tested.
|
||||
*/
|
||||
public static class VacuousTypes implements Types {
|
||||
public VacuousTypes() {}
|
||||
|
||||
@Override
|
||||
public Element asElement(TypeMirror t) {return null;}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(TypeMirror t1, TypeMirror t2) {return false;}
|
||||
|
||||
@Override
|
||||
public boolean isSubtype(TypeMirror t1, TypeMirror t2) {return false;};
|
||||
|
||||
@Override
|
||||
public boolean isAssignable(TypeMirror t1, TypeMirror t2) {return false;};
|
||||
|
||||
@Override
|
||||
public boolean contains(TypeMirror t1, TypeMirror t2) {return false;};
|
||||
|
||||
@Override
|
||||
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {return false;}
|
||||
|
||||
@Override
|
||||
public List<? extends TypeMirror> directSupertypes(TypeMirror t) {return null;}
|
||||
|
||||
@Override
|
||||
public TypeMirror erasure(TypeMirror t) {return null;}
|
||||
|
||||
@Override
|
||||
public TypeElement boxedClass(PrimitiveType p) {return null;}
|
||||
|
||||
@Override
|
||||
public PrimitiveType unboxedType(TypeMirror t) {return null;}
|
||||
|
||||
@Override
|
||||
public TypeMirror capture(TypeMirror t) {return null;}
|
||||
|
||||
@Override
|
||||
public PrimitiveType getPrimitiveType(TypeKind kind) {return null;}
|
||||
|
||||
@Override
|
||||
public NullType getNullType() {return null;}
|
||||
|
||||
@Override
|
||||
public NoType getNoType(TypeKind kind) {return null;}
|
||||
|
||||
@Override
|
||||
public ArrayType getArrayType(TypeMirror componentType) {return null;}
|
||||
|
||||
@Override
|
||||
public WildcardType getWildcardType(TypeMirror extendsBound,
|
||||
TypeMirror superBound) {return null;}
|
||||
|
||||
@Override
|
||||
public DeclaredType getDeclaredType(TypeElement typeElem, TypeMirror... typeArgs) {return null;}
|
||||
|
||||
|
||||
@Override
|
||||
public DeclaredType getDeclaredType(DeclaredType containing,
|
||||
TypeElement typeElem, TypeMirror... typeArgs) {return null;}
|
||||
|
||||
@Override
|
||||
public TypeMirror asMemberOf(DeclaredType containing, Element element) {return null;}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue