}
} else {
simpleTx = UnresolvedType.forName(getName(binding));
}
ReferenceType name = getWorld().lookupOrCreateName(simpleTx);
// A type can change from simple > generic > simple across a set of compiles. We need
// to ensure the entry in the typemap is promoted and demoted correctly. The call
// to setGenericType() below promotes a simple to a raw. This call demotes it back
// to simple
// pr125405
if (!binding.isRawType() && !binding.isGenericType() && name.getTypekind() == TypeKind.RAW) {
name.demoteToSimpleType();
}
EclipseSourceType t = new EclipseSourceType(name, this, binding, decl, unit);
// For generics, go a bit further - build a typex for the generic type
// give it the same delegate and link it to the raw type
if (binding.isGenericType()) {
UnresolvedType complexTx = fromBinding(binding); // fully aware of any generics info
ResolvedType cName = world.resolve(complexTx, true);
ReferenceType complexName = null;
if (!cName.isMissing()) {
complexName = (ReferenceType) cName;
complexName = (ReferenceType) complexName.getGenericType();
if (complexName == null) {
complexName = new ReferenceType(complexTx, world);
}
} else {
complexName = new ReferenceType(complexTx, world);
}
name.setGenericType(complexName);
complexName.setDelegate(t);
}
name.setDelegate(t);
if (decl instanceof AspectDeclaration) {
((AspectDeclaration) decl).typeX = name;