Package gw.internal.gosu.parser
Class TypeRefFactory
- java.lang.Object
-
- gw.internal.gosu.parser.TypeRefFactory
-
- All Implemented Interfaces:
ITypeRefFactory
public class TypeRefFactory extends java.lang.Object implements ITypeRefFactory
There is one TypeRefFactory per ModuleTypeLoader.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean_bClearingprivate WeakFqnCache<AbstractTypeRef>_refByNameprivate static booleanASM_CHECKERprivate static java.util.Map<java.lang.Class<? extends IType>,java.lang.Class<? extends AbstractTypeRef>>ITYPE_PROXY_CLASS_BY_ITYPE_CLASSprivate static intJAVA_VERprivate static booleanTRACEprivate static booleanVERIFY-
Fields inherited from interface gw.lang.reflect.ITypeRefFactory
SYSTEM_PROXY_SUFFIX, USER_PROXY_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description TypeRefFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDefaultConstructor(org.objectweb.asm.ClassVisitor cv)private voidassignType(java.lang.reflect.Method ifaceMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)private voidassignType_FromField(java.lang.reflect.Method ifaceMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)private voidcall_reload(org.objectweb.asm.MethodVisitor mv)private voidcallMethod(org.objectweb.asm.MethodVisitor mv, java.lang.reflect.Method method)voidclearCaches()private voidcompileHeader(org.objectweb.asm.ClassVisitor cv, java.lang.String name, java.util.List<java.lang.Class> interfaces)private voidcompileInterfaceMembers(org.objectweb.asm.ClassVisitor cv, java.lang.Class typeClass)private intcomputeSortIndex(java.util.Map.Entry<java.lang.String,java.lang.ref.Reference<AbstractTypeRef>> entry)private voidconstructRuntimeException(org.objectweb.asm.MethodVisitor mv, int exceptionIndex)ITypeRefcreate(IType type)Wraps the actual class with a proxy.private AbstractTypeRefcreateTypeRefProxy(IType type)private voiddelegateMethodCall(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)private voidgenBody_NoRefreshSupport(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv)private voidgenBody_SupportRefresh(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv)private java.lang.Class<? extends AbstractTypeRef>generateProxyClass(java.lang.Class<? extends IType> typeClass)private voidgenMethod_DevMode(org.objectweb.asm.ClassVisitor cv, java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod)ITypeRefget(IType type)ITypeRefget(java.lang.String strTypeName)private java.lang.StringgetDescriptor(java.lang.Class<?> returnType)private intgetIns(int opcode, java.lang.Class type)private intgetIns(int opcode, java.lang.String typeName)private java.lang.reflect.MethodgetInterfaceMethod(java.lang.reflect.Method method)private java.lang.String[]getInterfaceNames(java.util.List<java.lang.Class> interfaces)private voidgetInterfacesFrom(java.lang.Class<? extends IType> classOfType, java.util.List<java.lang.Class> interfaces)private java.lang.ClassgetJavaClass(IType iface)private java.lang.StringgetMethodDescriptor(java.lang.reflect.Method m)private java.lang.StringgetMethodDescriptor(java.lang.String[] paramTypeDescriptors, java.lang.String returnTypeDescriptor)private java.lang.String[]getMethodExceptions(java.lang.reflect.Method method)private java.lang.Class<? extends AbstractTypeRef>getOrCreateTypeProxy(java.lang.Class<? extends IType> typeClass)private java.lang.String[]getParameterTypeDescriptors(java.lang.reflect.Method _method)private AbstractTypeRefgetRef(WeakFqnCache<AbstractTypeRef> map, java.lang.String key, IType type)private ITypeRefgetRefTheFastWay(IType type, java.lang.String strTypeName)private ITypeRefgetRefTheSafeWay(IType type, java.lang.String strTypeName)private java.lang.StringgetReturnTypeDescriptor(java.lang.reflect.Method _method)private java.lang.StringgetSlashName(java.lang.Class type)private java.lang.StringgetSlashName(java.lang.String typeName)java.util.List<ITypeRef>getSubordinateRefs(java.lang.String topLevelTypeName)java.util.List<java.lang.String>getTypesWithPrefix(java.lang.String namespace, java.lang.String prefix)private voidinsertGetNameStart(org.objectweb.asm.MethodVisitor mv)booleanisClearing()private booleanisTypeGosuClassInstance(java.lang.Class<?> declaringClass)private booleanisWide(java.lang.Class type)private booleanisWide(java.lang.String typeName)private static voidputRef(WeakFqnCache<AbstractTypeRef> map, java.lang.String key, AbstractTypeRef value)private voidsetClearing(boolean bClearing)private static voidverify(byte[] bytes)private voidvisitDebugLineNumber(int iLine, org.objectweb.asm.MethodVisitor mv)
-
-
-
Field Detail
-
TRACE
private static boolean TRACE
-
VERIFY
private static boolean VERIFY
-
ASM_CHECKER
private static boolean ASM_CHECKER
-
JAVA_VER
private static final int JAVA_VER
- See Also:
- Constant Field Values
-
ITYPE_PROXY_CLASS_BY_ITYPE_CLASS
private static final java.util.Map<java.lang.Class<? extends IType>,java.lang.Class<? extends AbstractTypeRef>> ITYPE_PROXY_CLASS_BY_ITYPE_CLASS
-
_refByName
private final WeakFqnCache<AbstractTypeRef> _refByName
-
_bClearing
private boolean _bClearing
-
-
Method Detail
-
create
public ITypeRef create(IType type)
Wraps the actual class with a proxy.- Specified by:
createin interfaceITypeRefFactory
-
createTypeRefProxy
private AbstractTypeRef createTypeRefProxy(IType type)
-
getOrCreateTypeProxy
private java.lang.Class<? extends AbstractTypeRef> getOrCreateTypeProxy(java.lang.Class<? extends IType> typeClass)
-
generateProxyClass
private java.lang.Class<? extends AbstractTypeRef> generateProxyClass(java.lang.Class<? extends IType> typeClass)
-
compileHeader
private void compileHeader(org.objectweb.asm.ClassVisitor cv, java.lang.String name, java.util.List<java.lang.Class> interfaces)
-
getInterfaceNames
private java.lang.String[] getInterfaceNames(java.util.List<java.lang.Class> interfaces)
-
addDefaultConstructor
private void addDefaultConstructor(org.objectweb.asm.ClassVisitor cv)
-
compileInterfaceMembers
private void compileInterfaceMembers(org.objectweb.asm.ClassVisitor cv, java.lang.Class typeClass)
-
genMethod_DevMode
private void genMethod_DevMode(org.objectweb.asm.ClassVisitor cv, java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod)
-
genBody_NoRefreshSupport
private void genBody_NoRefreshSupport(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv)
-
genBody_SupportRefresh
private void genBody_SupportRefresh(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv)
-
visitDebugLineNumber
private void visitDebugLineNumber(int iLine, org.objectweb.asm.MethodVisitor mv)
-
insertGetNameStart
private void insertGetNameStart(org.objectweb.asm.MethodVisitor mv)
-
call_reload
private void call_reload(org.objectweb.asm.MethodVisitor mv)
-
assignType
private void assignType(java.lang.reflect.Method ifaceMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)
-
assignType_FromField
private void assignType_FromField(java.lang.reflect.Method ifaceMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)
-
constructRuntimeException
private void constructRuntimeException(org.objectweb.asm.MethodVisitor mv, int exceptionIndex)
-
delegateMethodCall
private void delegateMethodCall(java.lang.reflect.Method ifaceMethod, java.lang.reflect.Method proxyMethod, org.objectweb.asm.MethodVisitor mv, int typeIndex)
-
isTypeGosuClassInstance
private boolean isTypeGosuClassInstance(java.lang.Class<?> declaringClass)
-
getInterfaceMethod
private java.lang.reflect.Method getInterfaceMethod(java.lang.reflect.Method method)
-
get
public ITypeRef get(IType type)
- Specified by:
getin interfaceITypeRefFactory
-
get
public ITypeRef get(java.lang.String strTypeName)
- Specified by:
getin interfaceITypeRefFactory
-
clearCaches
public void clearCaches()
- Specified by:
clearCachesin interfaceITypeRefFactory
-
computeSortIndex
private int computeSortIndex(java.util.Map.Entry<java.lang.String,java.lang.ref.Reference<AbstractTypeRef>> entry)
-
setClearing
private void setClearing(boolean bClearing)
-
isClearing
public boolean isClearing()
- Specified by:
isClearingin interfaceITypeRefFactory
-
getInterfacesFrom
private void getInterfacesFrom(java.lang.Class<? extends IType> classOfType, java.util.List<java.lang.Class> interfaces)
-
getJavaClass
private java.lang.Class getJavaClass(IType iface)
-
putRef
private static void putRef(WeakFqnCache<AbstractTypeRef> map, java.lang.String key, AbstractTypeRef value)
-
getRef
private AbstractTypeRef getRef(WeakFqnCache<AbstractTypeRef> map, java.lang.String key, IType type)
-
getIns
private int getIns(int opcode, java.lang.Class type)
-
getIns
private int getIns(int opcode, java.lang.String typeName)
-
isWide
private boolean isWide(java.lang.Class type)
-
isWide
private boolean isWide(java.lang.String typeName)
-
getSlashName
private java.lang.String getSlashName(java.lang.Class type)
-
getSlashName
private java.lang.String getSlashName(java.lang.String typeName)
-
getParameterTypeDescriptors
private java.lang.String[] getParameterTypeDescriptors(java.lang.reflect.Method _method)
-
getReturnTypeDescriptor
private java.lang.String getReturnTypeDescriptor(java.lang.reflect.Method _method)
-
getDescriptor
private java.lang.String getDescriptor(java.lang.Class<?> returnType)
-
getMethodDescriptor
private java.lang.String getMethodDescriptor(java.lang.reflect.Method m)
-
getMethodDescriptor
private java.lang.String getMethodDescriptor(java.lang.String[] paramTypeDescriptors, java.lang.String returnTypeDescriptor)
-
getMethodExceptions
private java.lang.String[] getMethodExceptions(java.lang.reflect.Method method)
-
callMethod
private void callMethod(org.objectweb.asm.MethodVisitor mv, java.lang.reflect.Method method)
-
verify
private static void verify(byte[] bytes)
-
getSubordinateRefs
public java.util.List<ITypeRef> getSubordinateRefs(java.lang.String topLevelTypeName)
- Specified by:
getSubordinateRefsin interfaceITypeRefFactory
-
getTypesWithPrefix
public java.util.List<java.lang.String> getTypesWithPrefix(java.lang.String namespace, java.lang.String prefix)- Specified by:
getTypesWithPrefixin interfaceITypeRefFactory
-
-