@@ -0,0 +1,2247 @@
+package be.kuleuven.cs.distrinet.jnome.core.type;%0A%0Aimport java.util.List;%0A%0Aimport org.aikodi.chameleon.oo.member.Member;%0Aimport org.aikodi.chameleon.oo.method.SimpleNameMethodHeader;%0Aimport org.aikodi.chameleon.oo.plugin.ObjectOrientedFactory;%0Aimport org.aikodi.chameleon.oo.type.ClassImpl;%0Aimport org.aikodi.chameleon.oo.type.RegularType;%0Aimport org.aikodi.chameleon.oo.type.generics.TypeArgument;%0Aimport org.aikodi.chameleon.support.member.simplename.method.NormalMethod;%0Aimport org.aikodi.chameleon.support.modifier.Native;%0Aimport org.aikodi.chameleon.support.modifier.Public;%0A%0Aimport be.kuleuven.cs.distrinet.jnome.core.language.Java7;%0Aimport be.kuleuven.cs.distrinet.jnome.workspace.JavaView;%0A%0Apublic abstract class AbstractJavaType extends RegularType implements JavaType %7B%0A%0A%09protected List%3CMember%3E _implicitMemberCache;%0A%0A%09/**%0A%09 * A Java reference type has a default constructor when no other constructor%0A%09 * is present.%0A%09 */%0A%09@Override%0A%09public List%3CMember%3E implicitMembers() %7B%0A%09%09if (_implicitMemberCache == null) %7B%0A%09%09%09_implicitMemberCache = buildImplicitMembersCache();%0A%09%09%7D%0A%09%09return _implicitMemberCache;%0A%09%7D%0A%0A%09public AbstractJavaType(String name) %7B%0A%09%09super(name);%0A%09%7D%0A%0A%09protected abstract List%3CMember%3E buildImplicitMembersCache();%0A%0A%09/**%0A%09 * This is actually cheating because the getClass method in Java is a member%0A%09 * of Object. Maybe we should set the parent to Object instead of the current%0A%09 * class.%0A%09 * %0A%09 * @return%0A%09 */%0A%09protected static NormalMethod getClassMethod(ClassImpl type) %7B%0A%09%09NormalMethod result = null;%0A%09%09if (type.view(JavaView.class).topLevelType() != type) %7B%0A%09%09%09Java7 language = type.language(Java7.class);%0A%09%09%09BasicJavaTypeReference returnType = language.createTypeReference(%22java.lang.Class%22);%0A%09%09%09JavaTypeReference erasedThisType = language.createTypeReference(type.name());%0A%09%09%09TypeArgument arg = language.createExtendsWildcard(erasedThisType);%0A%09%09%09returnType.addArgument(arg);%0A%09%09%09result = language.plugin(ObjectOrientedFactory.class).createNormalMethod(new SimpleNameMethodHeader(%22getClass%22, returnType));%0A//%09%09%09result = new NormalMethod(new SimpleNameMethodHeader(%22getClass%22, returnType));%0A%09%09%09result.addModifier(new Public());%0A%09%09%09result.addModifier(new Native());%0A%09%09%09result.setUniParent(type);%0A%09%09%7D%0A%09%09return result;%0A%09%7D%0A%0A%7D

Use the factory to create the method. Otherwise, the getClass() method is not a JavaMethod, and does not erase its return type.