protected override void initializeMethods() { if (classInfo == null || classInfo.methods == null) { return; } initializeBaseTypes(); foreach (var m in classInfo.methods) { var method = new ClassFileMethod(this, m.name, m.descriptor); method.modifiers = m.modifiers; methods.add(method); if (m.signature == null) { method.returnType = getTypeInfo(m.returnType); int i = 0; foreach (var p in m.parameters) { var pi = new ParameterInfo(i++, getTypeInfo(p.type)); method.parameters.add(pi); if (p.annotations == null) { pi.annotations = Collections.emptyList(); } else { pi.annotations = buildAnnotationValues(p.annotations); } } if (m.exceptions == null) { method.exceptions = Collections.emptyList(); } else { var ex = new ArrayList<TypeInfo>(); foreach (var s in m.exceptions) { var t = typeSystem.getType(s); if (hasGenericArguments(t)) { t = t.RawType; } ex.add(t); } method.exceptions = ex; } method.genericArguments = Collections.emptyList(); } else { genericsScope.enterScope(); var genArgs = new ArrayList<TypeInfo>(); foreach (var t in m.signature.FormalTypeParameters) { var tp = new GenericParameterType(this.Library, t.Name, null); genArgs.add(tp); genericsScope.declareBinding(t.Name, tp); } method.genericArguments = genArgs; int i = 0; foreach (var t in m.signature.getFormalTypeParameters()) { if (t.FormalTypeParameterBounds.any()) { foreach (var ts in t.FormalTypeParameterBounds) { ((GenericParameterType)genArgs[i]).genericParameterBounds.add(getTypeInfo(ts)); } } i++; } method.returnType = getTypeInfo(m.signature.ReturnType); i = 0; foreach (var param in m.signature.Parameters) { var annotations = m.parameters[i].annotations; var pi = new ParameterInfo(i++, getTypeInfo(param)); method.parameters.add(pi); if (annotations == null) { pi.annotations = Collections.emptyList(); } else { pi.annotations = buildAnnotationValues(annotations); } } var excepts = new ArrayList<TypeInfo>(); foreach (var t in m.signature.Exceptions) { excepts.add(getTypeInfo(t)); } method.exceptions = excepts; genericsScope.leaveScope(); } if (m.defaultValue != null) { method.defaultValue = buildAnnotationArrayElement(m.defaultValue); } if (m.annotations == null) { method.annotations = Collections.emptyList(); } else { method.annotations = buildAnnotationValues(m.annotations); } } classInfo.methods = null; if (classInfo.fields == null) { classInfo = null; genericsScope = null; } }
protected override void initializeMethods() { if (classInfo == null || classInfo.methods == null) { return; } initializeBaseTypes(); foreach (var m in classInfo.methods) { var method = new ClassFileMethod(this, m.name, m.descriptor); method.modifiers = m.modifiers; methods.add(method); if (m.signature == null) { method.returnType = getTypeInfo(m.returnType); int i = 0; foreach (var p in m.parameters) { var pi = new ParameterInfo(i++, getTypeInfo(p.type)); method.parameters.add(pi); if (p.annotations == null) { pi.annotations = Collections.emptyList(); } else { pi.annotations = buildAnnotationValues(p.annotations); } } if (m.exceptions == null) { method.exceptions = Collections.emptyList(); } else { var ex = new ArrayList <TypeInfo>(); foreach (var s in m.exceptions) { var t = typeSystem.getType(s); if (hasGenericArguments(t)) { t = t.RawType; } ex.add(t); } method.exceptions = ex; } method.genericArguments = Collections.emptyList(); } else { genericsScope.enterScope(); var genArgs = new ArrayList <TypeInfo>(); foreach (var t in m.signature.FormalTypeParameters) { var tp = new GenericParameterType(this.Library, t.Name, null); genArgs.add(tp); genericsScope.declareBinding(t.Name, tp); } method.genericArguments = genArgs; int i = 0; foreach (var t in m.signature.getFormalTypeParameters()) { if (t.FormalTypeParameterBounds.any()) { foreach (var ts in t.FormalTypeParameterBounds) { ((GenericParameterType)genArgs[i]).genericParameterBounds.add(getTypeInfo(ts)); } } i++; } method.returnType = getTypeInfo(m.signature.ReturnType); i = 0; foreach (var param in m.signature.Parameters) { var annotations = m.parameters[i].annotations; var pi = new ParameterInfo(i++, getTypeInfo(param)); method.parameters.add(pi); if (annotations == null) { pi.annotations = Collections.emptyList(); } else { pi.annotations = buildAnnotationValues(annotations); } } var excepts = new ArrayList <TypeInfo>(); foreach (var t in m.signature.Exceptions) { excepts.add(getTypeInfo(t)); } method.exceptions = excepts; genericsScope.leaveScope(); } if (m.defaultValue != null) { method.defaultValue = buildAnnotationArrayElement(m.defaultValue); } if (m.annotations == null) { method.annotations = Collections.emptyList(); } else { method.annotations = buildAnnotationValues(m.annotations); } } classInfo.methods = null; if (classInfo.fields == null) { classInfo = null; genericsScope = null; } }