8222369: ExecutableElement.getReceiverType returns null instead of NOTYPE

Reviewed-by: jjg
This commit is contained in:
Joe Darcy 2019-06-13 16:39:20 -07:00
parent 31249c3c09
commit 51cf24fcc0
3 changed files with 127 additions and 2 deletions

View file

@ -409,7 +409,7 @@ public class ElementStructureTest {
for (VariableElement param : e.getParameters()) {
visit(param, p);
}
out.write(String.valueOf(e.getReceiverType()));
out.write(String.valueOf(typeMirrorTranslate(e.getReceiverType())));
write(e.getReturnType());
out.write(e.getSimpleName().toString());
writeTypes(e.getThrownTypes());
@ -425,6 +425,18 @@ public class ElementStructureTest {
return null;
}
/**
* Original implementation of getReceiverType returned null
* for many cases where TypeKind.NONE was specified; translate
* back to null to compare against old hashes.
*/
private TypeMirror typeMirrorTranslate(TypeMirror type) {
if (type.getKind() == javax.lang.model.type.TypeKind.NONE)
return null;
else
return type;
}
@Override
public Void visitPackage(PackageElement e, Void p) {
List<Element> types = new ArrayList<>(e.getEnclosedElements());