F743-17630 refactored method F743-17630CodRv
511121
public void finishBMDInitWithReferenceContext(BeanMetaData bmd) throws ContainerException, EJBConfigurationException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled()) //367834.5
            Tr.entry(tc, "finishBMDInitWithReferenceContext", bmd.j2eeName); //367834.5  d640935.1

        try {
            processReferenceContext(bmd);
        } catch (InjectionException ex) {
            // Unwrap the exception thrown by ComponentNameSpaceConfigurationProviderImpl.
            for (Throwable cause = ex.getCause(); cause != null; cause = cause.getCause()) {
                if (cause instanceof EJBConfigurationException) {
                    throw (EJBConfigurationException) cause;
                }
                if (cause instanceof ContainerException) {
                    throw (ContainerException) cause;
                }
            }

            throw new EJBConfigurationException(ex);
        }

        EnterpriseBean eb = bmd.wccm.enterpriseBean;

        // -----------------------------------------------------------------------
        // Look for Session Synchronization methods for Stateful beans  F743-25855
        // -----------------------------------------------------------------------
        if (bmd.isStatefulSessionBean() &&
            !bmd.usesBeanManagedTx) {
            processSessionSynchronizationMD(bmd, (Session) eb);
        }

        // -----------------------------------------------------------------------
        // Get the managed object factory or constructor for non-entity
        // -----------------------------------------------------------------------
        // Must obtain managed object factory before generating the implementation
        // classes, as the wrapper may be different if managed object factory will
        // handle injection and interceptors.
        if (!bmd.isEntityBean()) {
            initializeManagedObjectFactoryOrConstructor(bmd);
        }

        // ------------------------------------------------------------------------------
        // Load the all the generated (ie. EJBDeploy or JITDeploy)implementation classes
        // ------------------------------------------------------------------------------
        loadGeneratedImplementationClasses(bmd,
                                           bmd.methodsExposedOnLocalInterface, // F743-17630
                                           bmd.methodsExposedOnRemoteInterface, // F743-17630
                                           bmd.methodsExposedOnLocalHomeInterface, // F743-17630
                                           bmd.methodsExposedOnRemoteHomeInterface); // F743-17630

        // -----------------------------------------------------------------------
        // Get the constructor for entity beans
        // -----------------------------------------------------------------------
        // Must obtain the entity bean constructor after loading the generated
        // implementation classes, as the concrete bean class may be generated.
        if (bmd.isEntityBean()) {
            initializeEntityConstructor(bmd);
        }

        // -----------------------------------------------------------------------
        // Build the Message Destination Link Map if this is an MDB.       d510405
        // -----------------------------------------------------------------------
        // For an annotations only configuration, there will be no Enterprise
        // Bean in WCCM.  In this case there are no resource refs in xml to retrieve.
        if (eb != null && eb.getKindValue() == EnterpriseBean.KIND_MESSAGE_DRIVEN) {
            MessageDriven mdb = (MessageDriven) eb;
            String link = mdb.getLink();

            if (link != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "processing message-destination-link : " + link +
                                 " : " + bmd.j2eeName);

                String moduleName = null;
                String destJndiName = null;
                String appName = bmd.j2eeName.getApplication();

                Map<String, Map<String, String>> appMap = InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().get(appName); //d493167

                // create a new application map if one is not present
                if (appMap == null) {
                    appMap = new HashMap<String, Map<String, String>>();
                    InjectionEngineAccessor.getMessageDestinationLinkInstance().getMessageDestinationLinks().put(appName, appMap); //493167
                }

                // Get the JNDIname of the MessageDestination from BMD
                destJndiName = bmd.ivMessageDestinationJndiName;

                // parse the link if the link name is in the format of moduleName#linkName
                int lindex = link.indexOf('#');
                if (lindex != -1) {
                    // Module name may have path information... remove it.    d510405
                    int mindex = link.lastIndexOf('/');
                    if (mindex > -1 && mindex < lindex) {
                        moduleName = link.substring(mindex + 1, lindex);
                    } else {
                        // If no path was specified, then the referenced module
                        // is in the same location. Use first half of the link.
                        moduleName = link.substring(0, lindex);
                    }
                    link = link.substring(lindex + 1);
                } else {
                    moduleName = bmd.j2eeName.getModule();
                }

                Map<String, String> moduleMap = appMap.get(moduleName);
                if (moduleMap == null) {
                    moduleMap = new HashMap<String, String>();
                    appMap.put(moduleName, moduleMap);
                }

                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "adding destination: " + link + " -> destinationJndiName:" +
                                 destJndiName + " for module: " + moduleName);

                moduleMap.put(link, destJndiName);
            }
        }

        //------------------------------------------------------------------------
        // Finish up a few last odds & ends
        //------------------------------------------------------------------------

        // Z/OS specific metadata and trace
        processZOSMetadata(bmd);

        // F743-609CodRev
        // If this bean has any asynchronous methods, make sure the container has a work manager
        // setup to execute runable objects for those methods
        if (bmd.ivHasAsynchMethod) {
            bmd.container.getEJBRuntime().setupAsync();
        }

        // Finally, run some checks to make sure everything we have initialized
        // is legal.
        bmd.validate();//d133681

        // Metadata for this bean type is now fully ready to use.  This flag must only be
        // set at the very end of BMD initialization.
        bmd.fullyInitialized = true;
        bmd.wccm = null;
        bmd.ivInitData = null;
        removeTemporaryMethodData(bmd); // F743-17630
        if (bmd._moduleMetaData.ivInterceptorBindingMap != null) {
            bmd._moduleMetaData.removeEJBInterceptorBindings(bmd.enterpriseBeanName); // d695226
        }

        // Write out bean metadata into the trace file in a format that the trace
        // explorer tool can read.
        if (isTraceOn && TEBeanMetaDataInfo.isTraceEnabled()) // d527372
            TEBeanMetaDataInfo.writeTraceBeanMetaData(bmd, bmd.ivModuleVersion); // d161864

        // TODO: MLS - this was an old comment.  Check if ActivationConfig could go
        // in the new bmd.wccm object now and be nulled out.
        // Note, do not null out ivActivationConfig at this time since
        // we must defer the destruction of reference until endpoint is
        // activated. See MessageEndpointFactoryImpl.activateEndpoint method.
        //ivActivationConfig = null;   //LI2110.41

        if (isTraceOn && tc.isEntryEnabled()) //367834.5
            Tr.exit(tc, "finishBMDInitWithReferenceContext"); //367834.5 d640935.1

    }
948370
@Override
  public final <ReqT, RespT> ServerMethodDefinition<?, ?> wrapMethodDefinition(
      ServerMethodDefinition<ReqT, RespT> oMethodDef) {
    ServerInterceptor binlogInterceptor =
        getServerInterceptor(oMethodDef.getMethodDescriptor().getFullMethodName());
    if (binlogInterceptor == null) {
      return oMethodDef;
    }
    MethodDescriptor<byte[], byte[]> binMethod =
        BinaryLogProvider.toByteBufferMethod(oMethodDef.getMethodDescriptor());
    ServerMethodDefinition<byte[], byte[]> binDef =
        InternalServerInterceptors.wrapMethod(oMethodDef, binMethod);
    ServerCallHandler<byte[], byte[]> binlogHandler =
        InternalServerInterceptors.interceptCallHandlerCreate(
            binlogInterceptor, binDef.getServerCallHandler());
    return ServerMethodDefinition.create(binMethod, binlogHandler);
  }
728649
int writeMethodParametersAttr(MethodSymbol m) {
        MethodType ty = m.externalType(types).asMethodType();
        final int allparams = ty.argtypes.size();
        if (m.params != null && allparams != 0) {
            final int attrIndex = writeAttr(names.MethodParameters);
            databuf.appendByte(allparams);
            // Write extra parameters first
            for (VarSymbol s : m.extraParams) {
                final int flags =
                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
                    ((int) m.flags() & SYNTHETIC);
                databuf.appendChar(pool.put(s.name));
                databuf.appendChar(flags);
            }
            // Now write the real parameters
            for (VarSymbol s : m.params) {
                final int flags =
                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
                    ((int) m.flags() & SYNTHETIC);
                databuf.appendChar(pool.put(s.name));
                databuf.appendChar(flags);
            }
            // Now write the captured locals
            for (VarSymbol s : m.capturedLocals) {
                final int flags =
                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
                    ((int) m.flags() & SYNTHETIC);
                databuf.appendChar(pool.put(s.name));
                databuf.appendChar(flags);
            }
            endAttr(attrIndex);
            return 1;
        } else
            return 0;
    }
1108987
function convertR1C1toA1 (ref) {
  if (!R1C1.test(ref)) {
    throw new Error(`${ref} is not a valid R1C1 cell reference`)
  }

  var refParts = ref
    .replace(R1C1, '$1,$2')
    .split(',')

  var row = refParts[0]
  var column = refParts[1]
  var columnStr = ''

  for (; column; column = Math.floor((column - 1) / 26)) {
    columnStr = String.fromCharCode(((column - 1) % 26) + 65) + columnStr
  }

  return columnStr + row
}
1269006
function (preconditions) {
        var errorCodesList = {
            "500": ["InternalServerError"],
            "400": [
                "UnexpectedDefaultValue",
                "UnexpectedType",
                "MinLengthUnderachieved",
                "MaxLengthExceeded",
                "MinValueUnderachived",
                "MaxValueExceeded",
                "ValueNotAllowed",
                "PatternMismatch",
                "MissingRequiredParameter"],
            "429": ["RateLimitExceeded"],
        };
        for (var index in preconditions) {
            if (preconditions[index].conditions && preconditions[index].conditions.responses) {
                for (var code in preconditions[index].conditions.responses) {
                    if (errorCodesList[code]) {
                        if (_.isArray(preconditions[index].conditions.responses[code])) {
                            for (var ecode in preconditions[index].conditions.responses[code]) {
                                if (_.indexOf(errorCodesList[code], preconditions[index].conditions.responses[code][ecode]) == -1) {
                                    errorCodesList[code].push(preconditions[index].conditions.responses[code][ecode]);
                                }
                            }
                        }
                        else {
                            if (_.indexOf(errorCodesList[code], preconditions[index].conditions.responses[code]) == -1) {
                                errorCodesList[code].push(preconditions[index].conditions.responses[code]);
                            }
                        }
                    }
                    else {
                        if (_.isArray(preconditions[index].conditions.responses[code])) {
                            errorCodesList[code] = _.clone(preconditions[index].conditions.responses[code]);
                        }
                        else {
                            errorCodesList[code] = [_.clone(preconditions[index].conditions.responses[code])];
                        }
                    }
                }
            }
        }
        return errorCodesList;
    }
250808
function wrapCountingMethod(method) {
  DruidNode.prototype[method] = function() {
    var self = this
      , args = utils.args(arguments, 0)
      , callback = args.pop()

    self.active++

    debug('Active calls to Druid node ' + this.data.id + ': ' + this.active)

    function wrapper() {
      self.active--

      callback.apply(null, arguments)
    }

    args.push(wrapper)

    Client.prototype[method].apply(this, args)
  }
}
1097712
function transpileDerivedExchangeClass (contents) {

    let exchangeClassDeclarationMatches = contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)

    // log.green (file, exchangeClassDeclarationMatches[3])

    let className = exchangeClassDeclarationMatches[1]
    let baseClass = exchangeClassDeclarationMatches[2]

    let methods = exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/)

    let python2 = []
    let python3 = []
    let php = []

    let methodNames = []

    // run through all methods
    for (let i = 0; i < methods.length; i++) {
        // parse the method signature
        let part = methods[i].trim ()
        let lines = part.split ("\n")
        let signature = lines[0].trim ()
        let methodSignatureRegex = /(async |)([\S]+)\s\(([^)]*)\)\s*{/ // signature line
        let matches = methodSignatureRegex.exec (signature)

        if (!matches) {
            log.red (methods[i])
            log.yellow.bright ("\nMake sure your methods don't have empty lines!\n")
        }

        // async or not
        let keyword = matches[1]
        // try {
        //     keyword = matches[1]
        // } catch (e) {
        //     log.red (e)
        //     log.green (methods[i])
        //     log.yellow (exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/))
        //     process.exit ()
        // }

        // method name
        let method = matches[2]

        methodNames.push (method)

        method = unCamelCase (method)

        // method arguments
        let args = matches[3].trim ()

        // extract argument names and local variables
        args = args.length ? args.split (',').map (x => x.trim ()) : []

        // get names of all method arguments for later substitutions
        let variables = args.map (arg => arg.split ('=').map (x => x.trim ()) [0])

        // add $ to each argument name in PHP method signature
        let phpArgs = args.join (', $').trim ().replace (/undefined/g, 'null').replace ('{}', 'array ()')
        phpArgs = phpArgs.length ? ('$' + phpArgs) : ''

        // remove excessive spacing from argument defaults in Python method signature
        let pythonArgs = args.map (x => x.replace (' = ', '='))
                                .join (', ')
                                .replace (/undefined/g, 'None')
                                .replace (/false/g, 'False')
                                .replace (/true/g, 'True')

        // method body without the signature (first line)
        // and without the closing bracket (last line)
        let js = lines.slice (1, -1).join ("\n")

        // transpile everything
        let { python3Body, python2Body, phpBody } = transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })

        // compile the final Python code for the method signature
        let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'

        // compile signature + body for Python 2
        python2.push ('');
        python2.push ('    ' + pythonString);
        python2.push (python2Body);

        // compile signature + body for Python 3
        python3.push ('');
        python3.push ('    ' + keyword + pythonString);
        python3.push (python3Body);

        // compile signature + body for PHP
        php.push ('');
        php.push ('    public function ' + method + ' (' + phpArgs + ') {');
        php.push (phpBody);
        php.push ('    }')

    }

    return {

        // altogether in PHP, Python 2 and 3
        python2: createPythonClass (className, baseClass, python2, methodNames),
        python3: createPythonClass (className, baseClass, python3, methodNames, true),
        php:     createPHPClass    (className, baseClass, php,     methodNames),

        className,
        baseClass,
    }
}
157276
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, expensiveChecks) {
  ensureSafeMemberName(key0, fullExp);
  ensureSafeMemberName(key1, fullExp);
  ensureSafeMemberName(key2, fullExp);
  ensureSafeMemberName(key3, fullExp);
  ensureSafeMemberName(key4, fullExp);
  var eso = function(o) {
    return ensureSafeObject(o, fullExp);
  };
  var eso0 = (expensiveChecks || isPossiblyDangerousMemberName(key0)) ? eso : identity;
  var eso1 = (expensiveChecks || isPossiblyDangerousMemberName(key1)) ? eso : identity;
  var eso2 = (expensiveChecks || isPossiblyDangerousMemberName(key2)) ? eso : identity;
  var eso3 = (expensiveChecks || isPossiblyDangerousMemberName(key3)) ? eso : identity;
  var eso4 = (expensiveChecks || isPossiblyDangerousMemberName(key4)) ? eso : identity;

  return function cspSafeGetter(scope, locals) {
    var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope;

    if (pathVal == null) return pathVal;
    pathVal = eso0(pathVal[key0]);

    if (!key1) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = eso1(pathVal[key1]);

    if (!key2) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = eso2(pathVal[key2]);

    if (!key3) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = eso3(pathVal[key3]);

    if (!key4) return pathVal;
    if (pathVal == null) return undefined;
    pathVal = eso4(pathVal[key4]);

    return pathVal;
  };
}
325544
@Override
    public void sawOpcode(int seen) {
        boolean sawCreate = false;
        Integer itemPC = null;

        try {
            stack.precomputation(this);

            if (seen == Const.INVOKEINTERFACE) {
                String className = getClassConstantOperand();
                String methodInfo = getNameConstantOperand() + ':' + getSigConstantOperand();
                if ("org/w3c/dom/Document".equals(className) && domCreationMethods.contains(methodInfo)) {
                    sawCreate = true;
                    itemPC = Integer.valueOf(getPC());
                }
            } else if (OpcodeUtils.isAStore(seen)) {
                Integer pc = findDOMNodeCreationPoint(0);
                int reg = RegisterUtils.getAStoreReg(this, seen);
                if (pc != null) {
                    nodeStores.put(Integer.valueOf(reg), pc);
                } else {
                    nodeStores.remove(Integer.valueOf(reg));
                }
            } else if (seen == Const.PUTFIELD) {
                // Stores to member variables are assumed ok
                findDOMNodeCreationPoint(0);
            } else if (OpcodeUtils.isALoad(seen)) {
                int reg = RegisterUtils.getALoadReg(this, seen);
                itemPC = nodeStores.get(Integer.valueOf(reg));
                if (itemPC != null) {
                    sawCreate = true;
                }
            } else if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                int reg = itm.getRegisterNumber();
                nodeCreations.remove(itm);
                nodeStores.remove(Integer.valueOf(reg));
            }

            if (!sawCreate
                    && ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESTATIC) || (seen == Const.INVOKESPECIAL))) {
                String methodSig = getSigConstantOperand();
                int argCount = SignatureUtils.getNumParameters(methodSig);
                if (stack.getStackDepth() >= argCount) {
                    for (int a = 0; a < argCount; a++) {
                        OpcodeStack.Item itm = stack.getStackItem(a);
                        if (nodeCreations.containsKey(itm)) {
                            int reg = itm.getRegisterNumber();
                            nodeCreations.remove(itm);
                            nodeStores.remove(Integer.valueOf(reg));
                        }
                    }
                    if ((seen != Const.INVOKESTATIC) && (stack.getStackDepth() > argCount)) {
                        nodeCreations.remove(stack.getStackItem(argCount));
                    }
                }
            }
        } finally {
            stack.sawOpcode(this, seen);
            if (sawCreate && (stack.getStackDepth() > 0)) {
                nodeCreations.put(stack.getStackItem(0), itemPC);
            }
        }
    }
828688
@Override
    public void visitCode(Code obj) {
        unusedParms.clear();
        regToParm.clear();
        stack.resetForMethodEntry(this);
        Method m = getMethod();
        String methodName = m.getName();
        if (IGNORE_METHODS.contains(methodName)) {
            return;
        }

        int accessFlags = m.getAccessFlags();
        if (((accessFlags & (Const.ACC_STATIC | Const.ACC_PRIVATE)) == 0) || ((accessFlags & Const.ACC_SYNTHETIC) != 0)) {
            return;
        }

        List<String> parmTypes = SignatureUtils.getParameterSignatures(m.getSignature());

        if (parmTypes.isEmpty()) {
            return;
        }
        int firstReg = 0;
        if ((accessFlags & Const.ACC_STATIC) == 0) {
            ++firstReg;
        }

        int reg = firstReg;
        for (int i = 0; i < parmTypes.size(); ++i) {
            unusedParms.set(reg);
            regToParm.put(Integer.valueOf(reg), Integer.valueOf(i + 1));
            String parmSig = parmTypes.get(i);
            reg += SignatureUtils.getSignatureSize(parmSig);
        }

        try {
            super.visitCode(obj);

            if (!unusedParms.isEmpty()) {
                LocalVariableTable lvt = m.getLocalVariableTable();

                reg = unusedParms.nextSetBit(firstReg);
                while (reg >= 0) {
                    LocalVariable lv = (lvt == null) ? null : lvt.getLocalVariable(reg, 0);
                    if (lv != null) {
                        String parmName = lv.getName();
                        bugReporter.reportBug(new BugInstance(this, BugType.UP_UNUSED_PARAMETER.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addString("Parameter " + regToParm.get(Integer.valueOf(reg)) + ": " + parmName));
                    }
                    reg = unusedParms.nextSetBit(reg + 1);
                }
            }
        } catch (StopOpcodeParsingException e) {
            // no unusedParms left
        }
    }
1223375
private void rewriteCall(Node getprop, String newMethodName) {
    checkArgument(getprop.isGetProp(), getprop);
    Node call = getprop.getParent();
    checkArgument(call.isCall(), call);
    Node receiver = getprop.getFirstChild();

    // This rewriting does not exactly preserve order of operations; the newly inserted static
    // method name will be resolved before `receiver` is evaluated. This is known to be safe due
    // to the eligibility checks earlier in the pass.
    //
    // We choose not to do a full-fidelity rewriting (e.g. using `ExpressionDecomposer`) because
    // doing so means extracting `receiver` into a new variable at each call-site. This  has a
    // significant code-size impact (circa 2018-11-19).

    getprop.removeChild(receiver);
    call.replaceChild(getprop, receiver);
    call.addChildToFront(IR.name(newMethodName).srcref(getprop));

    if (receiver.isSuper()) {
      // Case: `super.foo(a, b)` => `foo(this, a, b)`
      receiver.setToken(Token.THIS);
    }

    call.putBooleanProp(Node.FREE_CALL, true);
    compiler.reportChangeToEnclosingScope(call);
  }
1298173
def get_method_invocation_code(c, method)
      target = method.singleton ? get_complete_class_name(c) : instance_name(c)
      "#{target}.#{method.name}#{to_params_part(method.params)}#{get_block_code(method)}"
    end
168780
public static void checkUnusedParameters(SQLiteModelMethod method, Set<String> usedMethodParameters, TypeName excludedClasses) {
		int paramsCount = method.getParameters().size();
		int usedCount = usedMethodParameters.size();

		if (paramsCount > usedCount) {
			StringBuilder sb = new StringBuilder();
			String separator = "";
			for (Pair<String, TypeName> item : method.getParameters()) {
				if (excludedClasses != null && item.value1.equals(excludedClasses)) {
					usedCount++;
				} else {
					if (!usedMethodParameters.contains(item.value0)) {
						sb.append(separator + "'" + item.value0 + "'");
						separator = ", ";
					}
				}
			}

			if (paramsCount > usedCount) {
				throw (new InvalidMethodSignException(method, "unused parameter(s) " + sb.toString()));
			}
		}
	}
385855
function solidityToABI(methodInterface) {
  // count open and clsoed
  const methodABIObject = {};

  // not a string
  if (typeof methodInterface !== 'string') {
    throw new Error(`Method interface must be a string, currently ${typeof methodInterface}`);
  }

  // empty string
  if (methodInterface.length === 0) {
    throw new Error(`Solidity method interface must have a length greater than zero, currently ${methodInterface.length}`);
  }

  // count open brackets, closed brackets, colon count, outpouts and invalid characters
  const openBrackets = (methodInterface.match(/\(/g) || []).length;
  const closedBrackets = (methodInterface.match(/\)/g) || []).length;
  const colonCount = (methodInterface.match(/:/g) || []).length;
  const hasOutputs = openBrackets === 2 && closedBrackets === 2 && colonCount === 1;
  const hasInvalidCharacters = methodInterface.replace(/([A-Za-z0-9\_\s\,\:(\)]+)/g, '').trim().length > 0; // eslint-disable-line

  // invalid characters
  if (hasInvalidCharacters) {
    throw new Error('Invalid Solidity method interface, your method interface contains invalid chars. Only letters, numbers, spaces, commas, underscores, brackets and colons.');
  }

  // method ABI object assembly
  methodABIObject.name = methodInterface.slice(0, methodInterface.indexOf('('));
  methodABIObject.type = 'function';
  methodABIObject.constant = false;
  const methodInputsString = methodInterface.slice(methodInterface.indexOf('(') + 1, methodInterface.indexOf(')')).trim();
  const methodOutputString = (hasOutputs && methodInterface.slice(methodInterface.lastIndexOf('(') + 1, methodInterface.lastIndexOf(')')) || '').trim();
  methodABIObject.inputs = buildInputsArray(methodInputsString);
  methodABIObject.outputs = buildInputsArray(methodOutputString);

  // check open brackets
  if (methodABIObject.name === '' || typeof methodABIObject.name === 'undefined') {
    throw new Error('Invalid Solidity method interface, no method name');
  }

  // check open brackets
  if (openBrackets !== 1 && openBrackets !== 2) {
    throw new Error(`Invalid Solidity method interface, too many or too little open brackets in solidity interface, currenlty only ${openBrackets} open brackets!`);
  }

  // check open brackets
  if (openBrackets !== 1 && openBrackets !== 2) {
    throw new Error('Invalid Solidity method interface, too many or too little open brackets in solidity interface!');
  }

  // check closed brackets
  if (closedBrackets !== 1 && closedBrackets !== 2) {
    throw new Error('Invalid Solidity method interface, too many or too little closed brackets in solidity interface!');
  }

  // check colon count
  if (colonCount !== 0 && colonCount !== 1) {
    throw new Error('Invalid Solidity method interface, to many or too little colons.');
  }

  // return method abi object
  return methodABIObject;
}
890052
def method_missing(method, *args, &block)
      case method.to_s
      when /^to_(.*)_from_(.*)$/
        if CODEMAP[$1] && CODEMAP[$2]
          define_and_call_method(method) { translate(CODEMAP[$1], :from => CODEMAP[$2]) }
        else
          original_method_missing(method, *args, &block)
        end
      when /^from_(.*)_to_(.*)$/
        if CODEMAP[$1] && CODEMAP[$2]
          define_and_call_method(method) { translate(CODEMAP[$2], :from => CODEMAP[$1]) }
        else
          original_method_missing(method, *args, &block)
        end
      when /^to_(.*)$/
        if CODEMAP[$1]
          define_and_call_method(method) { translate(CODEMAP[$1]) }
        else
          original_method_missing(method, *args, &block)
        end
      else
        original_method_missing(method, *args, &block)
      end
    end
819521
private void writeMethod(Definition def, Writer out, int indent) throws IOException
   {
      if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection())
      {
         if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0)
         {
            for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods())
            {
               writeMethodSignature(out, indent, method);
               writeLeftCurlyBracket(out, indent);
               writeIndent(out, indent + 1);

               if (!method.getReturnType().equals("void"))
               {
                  out.write("return ");
               }
               out.write("mc." + method.getMethodName() + "(");
               int paramSize = method.getParams().size();
               for (int i = 0; i < paramSize; i++)
               {
                  MethodParam param = method.getParams().get(i);
                  out.write(param.getName());
                  if (i + 1 < paramSize)
                     out.write(", ");
               }
               out.write(");");

               writeRightCurlyBracket(out, indent);
               writeEol(out);
            }
         }
      }
      else
      {
         writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe()");
         writeLeftCurlyBracket(out, indent);
         writeWithIndent(out, indent + 1, "if (mc != null)\n");
         writeWithIndent(out, indent + 2, "mc.callMe();");
         writeRightCurlyBracket(out, indent);
      }

      writeEol(out);
      writeSimpleMethodSignature(out, indent, " * Close", "public void close()");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "if (mc != null)\n");
      writeLeftCurlyBracket(out, indent + 1);
      writeWithIndent(out, indent + 2, "mc.closeHandle(this);\n");
      writeIndent(out, indent + 2);
      out.write("mc = null;");
      writeRightCurlyBracket(out, indent + 1);
      writeRightCurlyBracket(out, indent);

      writeEol(out);
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Set ManagedConnection\n");
      writeWithIndent(out, indent, " */\n");
      writeWithIndent(out, indent,
            "void setManagedConnection(" + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc)");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.mc = mc;");
      writeRightCurlyBracket(out, indent);
   }
803033
static String signatureOfMethod(final CtBehavior method) throws NotFoundException {
        final StringBuilder stringBuilder = new StringBuilder();

        stringBuilder.append(Modifier.toString(method.getModifiers()));
        if (method instanceof CtMethod) {
            final String returnType = ((CtMethod) method).getReturnType().getSimpleName();
            stringBuilder.append(" ").append(returnType);
        }
        stringBuilder.append(" ").append(method.getName()).append("(");

        final CtClass[] parameterTypes = method.getParameterTypes();
        for (int i = 0; i < parameterTypes.length; i++) {
            CtClass parameterType = parameterTypes[i];
            if (i != 0) stringBuilder.append(", ");
            stringBuilder.append(parameterType.getSimpleName());
        }

        stringBuilder.append(")");
        return stringBuilder.toString();
    }