IType declaringtype= method.getDeclaringType(); StringBuffer buf= new StringBuffer(); String[] paramTypes= method.getParameterTypes(); String[] paramNames= method.getParameterNames(); String[] excTypes= method.getExceptionTypes(); String retTypeSig= method.getReturnType();  int lastParam= paramTypes.length -1; if (method.isConstructor()) { String desc= "Constructor for " + parenttype.getElementName(); genJavaDocStub(desc, paramNames, Signature.SIG_VOID, excTypes, buf); } else {  if (addSeeTag) { genJavaDocSeeTag(declaringtype.getElementName(), method.getElementName(), paramTypes, buf); } else {  String desc= "Method " + method.getElementName(); genJavaDocStub(desc, paramNames, retTypeSig, excTypes, buf); } } int flags= method.getFlags(); if (Flags.isPublic(flags) || (declaringtype.isInterface() && parenttype.isClass())) { buf.append("public "); } else if (Flags.isProtected(flags)) { buf.append("protected "); } else if (Flags.isPrivate(flags)) { buf.append("private "); } if (Flags.isSynchronized(flags)) { buf.append("synchronized "); } if (Flags.isVolatile(flags)) { buf.append("volatile "); } if (Flags.isStrictfp(flags)) { buf.append("strictfp "); } if (Flags.isStatic(flags)) { buf.append("static "); }  if (method.isConstructor()) { buf.append(parenttype.getElementName()); } else { String retTypeFrm= Signature.toString(retTypeSig); if (!isBuiltInType(retTypeSig)) { resolveAndAdd(retTypeSig, declaringtype, imports); } buf.append(Signature.getSimpleName(retTypeFrm)); buf.append(' '); buf.append(method.getElementName()); } buf.append('('); for (int i= 0; i <= lastParam; i++) { String paramTypeSig= paramTypes[i]; String paramTypeFrm= Signature.toString(paramTypeSig); if (!isBuiltInType(paramTypeSig)) { resolveAndAdd(paramTypeSig, declaringtype, imports); } buf.append(Signature.getSimpleName(paramTypeFrm)); buf.append(' '); buf.append(paramNames[i]); if (i < lastParam) { buf.append(", "); } } buf.append(')');  int lastExc= excTypes.length - 1; if (lastExc >= 0) { buf.append(" throws "); for (int i= 0; i <= lastExc; i++) { String excTypeSig= excTypes[i]; String excTypeFrm= Signature.toString(excTypeSig); resolveAndAdd(excTypeSig, declaringtype, imports); buf.append(Signature.getSimpleName(excTypeFrm)); if (i < lastExc) { buf.append(", "); } } } if (parenttype.isInterface()) { buf.append(";\n\n"); } else { buf.append(" {\n\t"); if (!callSuper) { if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) { buf.append('\t'); if (!isBuiltInType(retTypeSig) || Signature.getArrayCount(retTypeSig) > 0) { buf.append("return null;\n\t"); } else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) { buf.append("return false;\n\t"); } else { buf.append("return 0;\n\t"); } } } else { buf.append('\t'); if (!method.isConstructor()) { if (!Signature.SIG_VOID.equals(retTypeSig)) { buf.append("return "); } buf.append("super."); buf.append(method.getElementName()); } else { buf.append("super"); } buf.append('('); for (int i= 0; i <= lastParam; i++) { buf.append(paramNames[i]); if (i < lastParam) { buf.append(", "); } } buf.append(");\n\t"); } buf.append("}\n\n"); } return buf.toString();
return  genStub(parenttype.getElementName(), parenttype.isInterface(), method, callSuper, addSeeTag, imports);
	public static String genStub(IType parenttype, IMethod method, boolean callSuper, boolean addSeeTag, IImportsStructure imports) throws JavaModelException {		IType declaringtype= method.getDeclaringType();			StringBuffer buf= new StringBuffer();		String[] paramTypes= method.getParameterTypes();		String[] paramNames= method.getParameterNames();		String[] excTypes= method.getExceptionTypes();		String retTypeSig= method.getReturnType();				int lastParam= paramTypes.length -1;				if (method.isConstructor()) {			String desc= "Constructor for " + parenttype.getElementName(); //$NON-NLS-1$			genJavaDocStub(desc, paramNames, Signature.SIG_VOID, excTypes, buf);		} else {						// java doc			if (addSeeTag) {				genJavaDocSeeTag(declaringtype.getElementName(), method.getElementName(), paramTypes, buf);			} else {				// generate a default java doc comment				String desc= "Method " + method.getElementName(); //$NON-NLS-1$				genJavaDocStub(desc, paramNames, retTypeSig, excTypes, buf);			}		}				int flags= method.getFlags();		if (Flags.isPublic(flags) || (declaringtype.isInterface() && parenttype.isClass())) {			buf.append("public "); //$NON-NLS-1$		} else if (Flags.isProtected(flags)) {			buf.append("protected "); //$NON-NLS-1$		} else if (Flags.isPrivate(flags)) {			buf.append("private "); //$NON-NLS-1$		}		if (Flags.isSynchronized(flags)) {			buf.append("synchronized "); //$NON-NLS-1$		}				if (Flags.isVolatile(flags)) {			buf.append("volatile "); //$NON-NLS-1$		}		if (Flags.isStrictfp(flags)) {			buf.append("strictfp "); //$NON-NLS-1$		}		if (Flags.isStatic(flags)) {			buf.append("static "); //$NON-NLS-1$		}							if (method.isConstructor()) {			buf.append(parenttype.getElementName());		} else {			String retTypeFrm= Signature.toString(retTypeSig);			if (!isBuiltInType(retTypeSig)) {				resolveAndAdd(retTypeSig, declaringtype, imports);			}			buf.append(Signature.getSimpleName(retTypeFrm));			buf.append(' ');			buf.append(method.getElementName());		}		buf.append('(');		for (int i= 0; i <= lastParam; i++) {			String paramTypeSig= paramTypes[i];			String paramTypeFrm= Signature.toString(paramTypeSig);			if (!isBuiltInType(paramTypeSig)) {				resolveAndAdd(paramTypeSig, declaringtype, imports);			}			buf.append(Signature.getSimpleName(paramTypeFrm));			buf.append(' ');			buf.append(paramNames[i]);			if (i < lastParam) {				buf.append(", "); //$NON-NLS-1$			}		}		buf.append(')');				int lastExc= excTypes.length - 1;		if (lastExc >= 0) {			buf.append(" throws "); //$NON-NLS-1$			for (int i= 0; i <= lastExc; i++) {				String excTypeSig= excTypes[i];				String excTypeFrm= Signature.toString(excTypeSig);				resolveAndAdd(excTypeSig, declaringtype, imports);				buf.append(Signature.getSimpleName(excTypeFrm));				if (i < lastExc) {					buf.append(", "); //$NON-NLS-1$				}			}		}		if (parenttype.isInterface()) {			buf.append(";\n\n"); //$NON-NLS-1$		} else {			buf.append(" {\n\t"); //$NON-NLS-1$			if (!callSuper) {				if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) {					buf.append('\t');					if (!isBuiltInType(retTypeSig) || Signature.getArrayCount(retTypeSig) > 0) {						buf.append("return null;\n\t"); //$NON-NLS-1$					} else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) {						buf.append("return false;\n\t"); //$NON-NLS-1$					} else {						buf.append("return 0;\n\t"); //$NON-NLS-1$					}				}			} else {				buf.append('\t');				if (!method.isConstructor()) {					if (!Signature.SIG_VOID.equals(retTypeSig)) {						buf.append("return "); //$NON-NLS-1$					}					buf.append("super."); //$NON-NLS-1$					buf.append(method.getElementName());				} else {					buf.append("super"); //$NON-NLS-1$				}				buf.append('(');							for (int i= 0; i <= lastParam; i++) {					buf.append(paramNames[i]);					if (i < lastParam) {						buf.append(", "); //$NON-NLS-1$					}				}				buf.append(");\n\t"); //$NON-NLS-1$			}			buf.append("}\n\n");			 //$NON-NLS-1$		}		return buf.toString();	}