/** * Generates a method called "super$methodName()" which can be called from JavaScript that is * equivalent to calling "super.methodName()" from Java. Eventually, this may be supported * directly in JavaScript. */ private static void generateSuper( ClassFileWriter cfw, String genName, String superName, String methodName, String methodSignature, Class[] parms, Class returnType) { cfw.startMethod("super$" + methodName, methodSignature, ClassFileWriter.ACC_PUBLIC); // push "this" cfw.add(ByteCode.ALOAD, 0); // push the rest of the parameters. int paramOffset = 1; for (int i = 0; i < parms.length; i++) { paramOffset += generatePushParam(cfw, paramOffset, parms[i]); } // call the superclass implementation of the method. cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, methodName, methodSignature); // now, handle the return type appropriately. Class retType = returnType; if (!retType.equals(Void.TYPE)) { generatePopResult(cfw, retType); } else { cfw.add(ByteCode.RETURN); } cfw.stopMethod((short) (paramOffset + 1)); }