--- old/src/jdk.jextract/share/classes/com/sun/tools/jextract/tree/TypedefTree.java 2018-09-18 19:08:11.000000000 +0530 +++ new/src/jdk.jextract/share/classes/com/sun/tools/jextract/tree/TypedefTree.java 2018-09-18 19:08:11.000000000 +0530 @@ -22,11 +22,30 @@ */ package com.sun.tools.jextract.tree; +import java.util.Optional; +import java.util.Objects; import jdk.internal.clang.Cursor; public class TypedefTree extends Tree { - public TypedefTree(Cursor c) { - super(c); + private final Optional typeDefinition; + + TypedefTree(Cursor c, Optional definition) { + this(c, definition, c.spelling()); + } + + private TypedefTree(Cursor c, Optional definition, String name) { + super(c, name); + this.typeDefinition = Objects.requireNonNull(definition); + } + + @Override + public TypedefTree withName(String newName) { + return name().equals(newName)? this : + new TypedefTree(cursor(), typeDefinition, newName); + } + + public Optional typeDefinition() { + return typeDefinition; } @Override