d450478 - added entire method
184202
@Override
    public void applicationStopping(String appName)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.entry(tc, "MEF.applicationStopping for application " + appName);
        }

        synchronized (ivStateLock)
        {
            if (ivState == ACTIVE_STATE)
            {
                // No thread is ever waiting for a notification while
                // in the active state, so simply change state to
                // indicate deactivate is pending.
                ivState = DEACTIVATE_PENDING_STATE;
            }
            else if (ivState == ACTIVATING_STATE)
            {
                // Change state to indicate deactivate is pending
                // and notify any thread that is waiting for the activate
                // to complete.
                ivState = DEACTIVATE_PENDING_STATE;
                ivStateLock.notifyAll();
            }
            else if (ivState == DEACTIVATE_PENDING_STATE)
            {
                // activateendpoint threw an exception and changed
                // state to deactivate pending.  So we need to notify
                // threads that are waiting for the activate
                // to complete (e.g. threads blocked by createEndpoint
                // during the activation of an endpoint).
                ivStateLock.notifyAll();
            }
            else if (ivState == INACTIVE_STATE)
            {
                // This is possible, but not likely. For example, we could create this
                // MEF object and initialized it to INACTIVE_STATE.  An exception occurs
                // before we make it to the activateEndpoint method for this MEF.  If
                // that happens, then it is possible to get to this method while in
                // the inactive state.  So simply trace fact that this MEF was called
                // in inactive state and nothing was actually done.
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                {
                    Tr.event(tc, "MEF.applicationStopping for application " + appName
                                 + " was called for an inactive endpoint.");
                }
            }
            else
            {
                // The only other state is DEACTIVATING_STATE. This method should NEVER
                // be called while in the deactivating state. Runtime framework should call
                // this method before it ever attempts to stop the modules of an application.
                // Thus, we should not enter deactivating state until after this method is called.
                // Create FFDC log file for this problem and trace occurrence of this event.
                // No reason to throw the exception since we created it just for the purpose
                // of doing the FFDC.
                String msg = "Internal programming error - applicationStopping called for application \""
                             + appName + "\" while in deactivating state. This should NEVER occur.";
                IllegalStateException ex = new IllegalStateException(msg);
                FFDCFilter.processException(ex, CLASS_NAME + ".applicationStopping", "1208", this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                {
                    Tr.event(tc, msg);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            Tr.exit(tc, "MEF.applicationStopping for application " + appName);
        }
    }
756071
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
    {
        String strBaseClass, strMethodVariables = DBConstants.BLANK;
        Record recClassInfo = this.getMainRecord();
        LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
        strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString();  // Get the base class name
        strMethodVariables = this.getMethodVariables(strMethodInterface);
        if (strClassName.equals(strMethodName))
        { // Call super.NewC initializer
            if (strMethodVariables.equalsIgnoreCase("VOID"))
                strMethodVariables = "";
            if (strMethodInterface.length() == 0)
                m_StreamOut.writeit("\tsuper();\n");
            else
            {
                boolean bSuperFound = false;
                if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
                    if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0)
                        strMethodReturns =  strMethodVariables;   // Special case - if you have code, pass the default variables
                if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
                    m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
                else
                {   // Special Case - Different variables are passed in, must supply and init method w/the correct interface
                    if (!strMethodReturns.equalsIgnoreCase("INIT"))
                    {
                        m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
                        m_StreamOut.writeit("}\n");
                        m_strLastMethodInterface = strMethodInterface;
                        m_strLastMethod = strMethodName;
                        this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null);                   
                        if (strMethodReturns.equalsIgnoreCase("VOID"))
                            strMethodReturns = "";
                        this.writeClassInitialize(true);
                    }
                    else
                        bSuperFound = true; // Don't call init.super();
                    if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
                    {
                        m_StreamOut.setTabs(+1);
//x                     bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n");
                        bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName);
                        m_StreamOut.setTabs(-1);
                    }
                    if (!bSuperFound)
                        m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n");
                }
            }
        }
        else
        { // Call super.NewC
            if (!strMethodName.equals("setupSFields"))
            {
                String beginString = "";
                if (strMethodReturns.length() == 0)
                    beginString = "return ";
                m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n");
            }
        else
            this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName);
        }
    }
80797
private void addGetId(TypeSpec.Builder classBuilder) {
        MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("__getStubID")
                .addModifiers(Modifier.PRIVATE)
                .returns(int.class)
                .addStatement("android.os.Parcel data = android.os.Parcel.obtain()")
                .addStatement("android.os.Parcel reply = android.os.Parcel.obtain()")
                .addStatement("int result");

        methodBuilder.beginControlFlow("try");

        //write the descriptor
        methodBuilder.addStatement("data.writeInterfaceToken(DESCRIPTOR)");
        methodBuilder.addStatement("mRemote.transact(TRANSACTION__getStubID, data, reply, 0)");
        //read exception if any
        methodBuilder.addStatement("Throwable exception = checkException(reply)");
        methodBuilder.beginControlFlow("if(exception != null)");

        methodBuilder.addStatement("throw ($T)exception", RuntimeException.class);
        methodBuilder.endControlFlow();

        methodBuilder.addStatement("result = reply.readInt()");


        //end of try
        methodBuilder.endControlFlow();


        //catch rethrow
        methodBuilder.beginControlFlow("catch ($T re)", ClassName.get("android.os", "RemoteException"));
        methodBuilder.addStatement("throw new $T(re)", RuntimeException.class);
        methodBuilder.endControlFlow();


        //finally block
        methodBuilder.beginControlFlow("finally");
        methodBuilder.addStatement("reply.recycle()");
        methodBuilder.addStatement("data.recycle()");
        methodBuilder.endControlFlow();
        methodBuilder.addStatement("return result");

        classBuilder.addMethod(methodBuilder.build());
    }
1328722
def add_method(self, m, **kwargs):
        
        if isinstance(m, types.FunctionType):
            self['function', id(m)] = m
        else:
            f, obj = get_method_vars(m)
            wrkey = (f, id(obj))
            self[wrkey] = obj
1290616
private void addCompilationErrorOnCustomMethodNode(InnerClassNode node, String methodName, Parameter[] parameters) {
        MethodNode existingMethodNode = node.getMethod(methodName, parameters);
        // if there is a user-defined methodNode, add compiler error msg and continue
        if (existingMethodNode != null && !isSynthetic(existingMethodNode))  {
            addError("\"" +methodName + "\" implementations are not supported on static inner classes as " +
                    "a synthetic version of \"" + methodName + "\" is added during compilation for the purpose " +
                    "of outer class delegation.",
                    existingMethodNode);
        }
    }
610950
public void addEngine(ReqMethod method, LinkedEngine engine) {
        for (ReqMethod md : method.parse()) {
            LinkedEngine[] methodEngines = engines[md.ordinal()];
            if (methodEngines.length == 0) {
                methodEngines = new LinkedEngine[] { engine };
            } else {
                methodEngines = Arrays.copyOf(methodEngines, methodEngines.length + 1);
                methodEngines[methodEngines.length - 1] = engine;
            }
            engines[md.ordinal()] = methodEngines;
            engineCount++;
        }
        clearCache();
    }
696763
public final void mFULL_ID() throws RecognitionException {
        try {
            int _type = FULL_ID;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:227:5: ( ID ( '.' ID )+ )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:227:7: ID ( '.' ID )+
            {
            mID(); 
            // com/dyuproject/protostuff/parser/ProtoLexer.g:227:10: ( '.' ID )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                switch ( input.LA(1) ) {
                case '.':
                    {
                    alt1=1;
                    }
                    break;

                }

                switch (alt1) {
            	case 1 :
            	    // com/dyuproject/protostuff/parser/ProtoLexer.g:227:11: '.' ID
            	    {
            	    match('.'); 
            	    mID(); 

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
1117426
public static MethodNode addGeneratedMethod(ClassNode cNode, String name,
                                int modifiers,
                                ClassNode returnType,
                                Parameter[] parameters,
                                ClassNode[] exceptions,
                                Statement code) {
        MethodNode result = cNode.addMethod(name, modifiers, returnType, parameters, exceptions, code);
        markAsGenerated(cNode, result);
        return result;
    }
1258780
int resolveMethodIndex(ExecutableElement method)
    {
         int size = 0;
        int index = 0;
        constantReadLock.lock();
        TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
        String declaringClassname = declaringClass.getQualifiedName().toString();
        String descriptor = Descriptor.getDesriptor(method);
        String name = method.getSimpleName().toString();
        try
        {
            size = getConstantPoolSize();
            index = getRefIndex(Methodref.class, declaringClassname, name, descriptor);
        }
        finally
        {
            constantReadLock.unlock();
        }
        if (index == -1)
        {
            // add entry to constant pool
            int ci = resolveClassIndex(declaringClass);
            int nati = resolveNameAndTypeIndex(name, descriptor);
            index = addConstantInfo(new Methodref(ci, nati), size);
        }
        addIndexedElement(index, method);
        return index;
    }
1080081
def add(self, method_class, action, version=None):
        
        by_version = self._by_action.setdefault(action, {})
        if version in by_version:
            raise RuntimeError("A method was already registered for action"
                               " %s in version %s" % (action, version))
        by_version[version] = method_class
473470
private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo)
            throws NotFoundException {
        StringBuilder builder = new StringBuilder();
        builder.append("{java.lang.reflect.Method originalMethod = ");
        builder.append(clazz.getName());
        builder.append(".class.getDeclaredMethod(\"");
        builder.append(ctMethod.getName());
        builder.append("\", ");
        final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod));
        if ("".equals(parametersAsString)) {
            builder.append("null");
        } else {
            builder.append(parametersAsString);
        }
        builder.append(");\n");
        builder.append("originalMethod.setAccessible(true);\n");
        final CtClass returnType = ctMethod.getReturnType();
        final boolean isVoid = returnType.equals(CtClass.voidType);
        if (!isVoid) {
            builder.append("return (");
            builder.append(returnType.getName());
            builder.append(") ");
        }
        builder.append("originalMethod.invoke(");
        if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) {
            builder.append(clazz.getName());
            builder.append(".class");
        } else {
            builder.append(classOrInstanceToDelegateTo);
        }
        builder.append(", $args);}");
        return builder.toString();
    }
1242626
public void addOperation(GetOperation o) {
    getKeys().addAll(o.getKeys());
    pcb.addCallbacks(o);
  }
1167797
public void setMethodDefaults(String method)
  {
        String defaultMethod = m_properties.getProperty(OutputKeys.METHOD);
 
        if((null == defaultMethod) || !defaultMethod.equals(method)
         // bjm - add the next condition as a hack
         // but it is because both output_xml.properties and
         // output_unknown.properties have the same method=xml
         // for their default. Otherwise we end up with
         // a ToUnknownStream wraping a ToXMLStream even
         // when the users says method="xml"
         //
         || defaultMethod.equals("xml")
         )
        {
            Properties savedProps = m_properties;
            Properties newDefaults = 
                OutputPropertiesFactory.getDefaultMethodProperties(method);
            m_properties = new Properties(newDefaults);
            copyFrom(savedProps, false);
        }
  }
680920
def method_missing(name, *args, &reply_handler)
      unless @default_iface && has_iface?(@default_iface)
        # TODO: distinguish:
        # - di not specified
        # TODO
        # - di is specified but not found in introspection data
        raise NoMethodError, "undefined method `#{name}' for DBus interface `#{@default_iface}' on object `#{@path}'"
      end

      begin
        @interfaces[@default_iface].method(name).call(*args, &reply_handler)
      rescue NameError => e
        # interesting, foo.method("unknown")
        # raises NameError, not NoMethodError
        raise unless e.to_s =~ /undefined method `#{name}'/
        # BTW e.exception("...") would preserve the class.
        raise NoMethodError, "undefined method `#{name}' for DBus interface `#{@default_iface}' on object `#{@path}'"
      end
    end
28348
public void addOperation(GetOperation o) {
    pcb.addCallbacks(o);
    for (String k : o.getKeys()) {
      addKey(k);
      setVBucket(k, ((VBucketAware) o).getVBucket(k));
    }
  }
219971
@Override
  public <V> MethodVault<V> newMethod(Class<?> type, 
                                      String methodName,
                                      Class<?> []paramTypes)
  {
    Objects.requireNonNull(type);
    
    MethodVault<V> method = newMethodRec(type, methodName, paramTypes);

    if (method != null) {
      return method;
    }
    
    throw new IllegalStateException(L.l("Unknown method {0}.{1} {2}",
                                        type.getSimpleName(),
                                        methodName,
                                        Arrays.asList(paramTypes)));
  }
484741
public static void incorrectMethodDefinition(String methodName, String className){
		throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className));
	}