d472972 - rewrote entire method to pass CTS.
964253
private EJBInterceptorBinding
                    validateAndMergeStyle3Or4Bindings(String methodName, String signature, EJBInterceptorBinding binding1, EJBInterceptorBinding binding2)
                                    throws EJBConfigurationException
    {
        // Add binding 2 interceptor-class list, unless it is empty.
        ArrayList<String> interceptorNames = binding1.ivInterceptorClassNames;
        if (!binding2.ivInterceptorClassNames.isEmpty())
        {
            interceptorNames.addAll(binding2.ivInterceptorClassNames);
        }

        // Add binding 2 interceptor-order list, unless it is empty.
        ArrayList<String> interceptorOrder = binding1.ivInterceptorOrder;
        if (!binding2.ivInterceptorOrder.isEmpty())
        {
            interceptorOrder.addAll(binding2.ivInterceptorOrder);
        }

        // CTS expects the exclude-default-interceptors setting in prior style 2
        // interceptor-binding to be overridden by current interceptor-binding setting.
        Boolean excludeDefault = binding1.ivExcludeDefaultLevelInterceptors;
        if (binding2.ivExcludeDefaultLevelInterceptors != null)
        {
            excludeDefault = binding2.ivExcludeDefaultLevelInterceptors;
        }

        // CTS expects the exclude-class-interceptors setting in prior style 3 or 4
        // interceptor-binding to be overridden by current interceptor-binding setting.
        // Verify at most only 1 of the bindings provides exclude-class-interceptors.
        Boolean excludeClass = binding1.ivExcludeClassLevelInterceptors;
        if (binding2.ivExcludeClassLevelInterceptors != null)
        {
            excludeClass = binding2.ivExcludeClassLevelInterceptors;
        }

        // Bindings are valid, so merge into a single binding.
        EJBInterceptorBinding mergedBinding;
        if (signature == null)
        {
            mergedBinding = new EJBInterceptorBinding
                            (binding1.ivEjbName, interceptorNames, interceptorOrder, methodName, null);
        }
        else
        {
            mergedBinding = new EJBInterceptorBinding
                            (binding1.ivEjbName, interceptorNames, interceptorOrder, methodName, binding1.ivMethodParms);
        }

        // Set whether or not default or class level interceptors are excluded.
        if (excludeClass != null)
        {
            mergedBinding.setExcludeClassLevelInterceptors(excludeClass);
        }

        if (excludeDefault != null)
        {
            mergedBinding.setExcludeDefaultInterceptors(excludeDefault);
        }

        // Return merged binding.
        return mergedBinding;
    }
624397
@SuppressWarnings("unused")
    public Callable<?> handle(Object methodDescStr, Method origin, Object[] arguments) throws
            Throwable {
        MethodDesc methodDesc = new MethodDesc((String) methodDescStr);
        Class clazz = getClassMethodWasCalledOn(methodDesc);

        Object marker = classToMarker.get(clazz);
        InvocationHandlerAdapter interceptor = markersToHandler.get(marker);
        if (interceptor == null) {
            return null;
        }

        // extended.StaticCapableStubber#whenInt
        BiConsumer<Class<?>, Method> onStub = onMethodCallDuringStubbing.get();
        if (onStub != null) {
            onStub.accept(clazz, origin);
        }

        // extended.ExtendedMockito#verifyInt
        BiConsumer<Class<?>, Method> onVerify = onMethodCallDuringVerification.get();
        if (onVerify != null) {
            onVerify.accept(clazz, origin);
        }

        return new ReturnValueWrapper(interceptor.interceptEntryHook(marker, origin, arguments,
                new SuperMethodCall(selfCallInfo, origin, marker, arguments)));
    }
367627
def _patched_method(self, method, *args, **kwargs):
        
        self._validate()
        result = method(*args, **kwargs)
        self._validate()
        return result
508649
public static void exit(TraceComponent tc, String methodName) {
    if(isTracing()) SibTr.exit(tc, methodName);

  }
430293
def pass_local_client(
    method=None,
    clean=None,
    up_to_date=None,
    commit=None,
    ignore_std_streams=True,
    lock=None,
):
    """"""
    if method is None:
        return functools.partial(
            pass_local_client,
            clean=clean,
            up_to_date=up_to_date,
            commit=commit,
            ignore_std_streams=ignore_std_streams,
            lock=lock,
        )

    def new_func(*args, **kwargs):
        ctx = click.get_current_context()
        client = ctx.ensure_object(LocalClient)
        stack = contextlib.ExitStack()

        # Handle --isolation option:
        if get_git_isolation():
            client = stack.enter_context(client.worktree())

        transaction = client.transaction(
            clean=clean,
            up_to_date=up_to_date,
            commit=commit,
            ignore_std_streams=ignore_std_streams
        )
        stack.enter_context(transaction)

        if lock or (lock is None and commit):
            stack.enter_context(client.lock)

        with stack:
            result = ctx.invoke(method, client, *args, **kwargs)
        return result

    return functools.update_wrapper(new_func, method)
394557
private Statement doVisitReturningCodeChunk(SoyNode node, boolean visitChildren) {
    // Replace jsCodeBuilder with a child JsCodeBuilder.
    JsCodeBuilder original = jsCodeBuilder;
    jsCodeBuilder = createChildJsCodeBuilder();

    // Visit body.
    // set indent to 0 since when rendering the CodeChunk, everything will get re-indented
    jsCodeBuilder.setIndent(0);

    if (visitChildren) {
      visitChildren((ParentSoyNode<?>) node);
    } else {
      visit(node);
    }

    Statement chunk =
        Statement.treatRawStringAsStatementLegacyOnly(
            jsCodeBuilder.getCode(), jsCodeBuilder.googRequires());

    jsCodeBuilder = original;

    return chunk;
  }
182347
public static void putOverloadMethodCache(String serviceName, Method method) {
        ConcurrentHashMap<String, Method> cache = OVERLOAD_METHOD_CACHE.get(serviceName);
        if (cache == null) {
            cache = new ConcurrentHashMap<String, Method>();
            ConcurrentHashMap<String, Method> old = OVERLOAD_METHOD_CACHE.putIfAbsent(serviceName, cache);
            if (old != null) {
                cache = old;
            }
        }
        StringBuilder mSigs = new StringBuilder(128);
        mSigs.append(method.getName());
        for (Class<?> paramType : method.getParameterTypes()) {
            mSigs.append(paramType.getName());
        }
        cache.putIfAbsent(mSigs.toString(), method);
    }
381708
public void restore(HttpServletRequest req, HttpServletResponse res, boolean anyMethod) {
		if (!(req instanceof IExtendedRequest)) {
			if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
				Tr.debug(tc, "It is not an IExtendedRequest object");
			}
			return;
		}
		if (!anyMethod && !req.getMethod().equalsIgnoreCase("GET")) {
			return;
		}

		String reqURL = req.getRequestURI();
		IExtendedRequest extRequest = (IExtendedRequest) req;
		if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
			Tr.debug(tc, " method : " + req.getMethod() + " URL:" + reqURL);
		}
		String postParamSaveMethod = webAppSecurityConfig.getPostParamSaveMethod();
		if (postParamSaveMethod.equalsIgnoreCase(WebAppSecurityConfig.POST_PARAM_SAVE_TO_COOKIE)) {
			restoreFromCookie(extRequest, res, reqURL);
		} else if (postParamSaveMethod.equalsIgnoreCase(WebAppSecurityConfig.POST_PARAM_SAVE_TO_SESSION)) {
			restoreFromSession(extRequest, req, reqURL);
		}
	}
419329
def with_retry(cls, methods):
    
    retry_with_backoff = retry(
        retry_on_exception=lambda e: isinstance(e, BotoServerError),
        wait_exponential_multiplier=1000,
        wait_exponential_max=10000
    )
    for method in methods:
        m = getattr(cls, method, None)
        if isinstance(m, collections.Callable):
            setattr(cls, method, retry_with_backoff(m))
    return cls
1038546
private void resetStatesAfterDecode(final ChannelHandlerContext ctx) {
        if (traceEnabled) {
            LOGGER.trace("{}Finished decoding of {}", logIdent(ctx, endpoint), currentRequest);
        }
        currentRequest = null;
        currentDecodingState = DecodingState.INITIAL;
    }
600855
void resetStream(ChannelHandlerContext ctx, int streamId, Http2Error http2Error) {
        encoder.writeRstStream(ctx, streamId, http2Error.code(), ctx.newPromise());
        http2ClientChannel.getDataEventListeners()
                .forEach(dataEventListener -> dataEventListener.onStreamReset(streamId));
        ctx.flush();
    }
276768
protected void defineProxyMethods(CtClass cc, CtClass orig) throws Exception {
//        cc.addMethod( CtMethod.make( "public void __setDispatcher( "+ DispatcherThread.class.getName()+" d ) { __target.__dispatcher(d); }", cc ) );
        CtMethod[] methods = getSortedPublicCtMethods(orig,false);

        for (int i = 0; i < methods.length; i++) {
            CtMethod method = methods[i];
            CtMethod originalMethod = method;
            if (method.getName().equals("getActor")) {
                ClassMap map = new ClassMap();
                map.put(Actor.class.getName(),Actor.class.getName());
                method = CtMethod.make( "public "+Actor.class.getName()+" getActor() { return __target; }", cc ) ;
            } else {
                ClassMap map = new ClassMap();
                map.fix(orig);
                map.fix(Actor.class.getName());
                method = new CtMethod(method, cc, map);
            }

            CtClass returnType = method.getReturnType();
            boolean isCallerSide = // don't touch
                    originalMethod.getAnnotation(CallerSideMethod.class) != null ||
                    (originalMethod.getName().equals("self"));// || originalMethod.getName().equals("future")); ??


            if ( isCallerSide ) {
                // verify callerside and inthread are not used
                Object[][] availableParameterAnnotations = originalMethod.getAvailableParameterAnnotations();
                CtClass[] parameterTypes = originalMethod.getParameterTypes();
                for (int j = 0; j < availableParameterAnnotations.length; j++) {
                    Object[] availableParameterAnnotation = availableParameterAnnotations[j];
                    if ( availableParameterAnnotation.length > 0 ) {
                        for (int k = 0; k < availableParameterAnnotation.length; k++) {
                            Object annot = availableParameterAnnotation[k];
                            if ( annot.toString().indexOf("kontraktor.annotations.InThread") > 0 ) {
                                throw new RuntimeException("cannot combine @CallerSide and @InThread, manually wrap callback using inThread(). method:"+originalMethod+" clz:"+orig);
                            }
                        }
                    }
                }
            }

            boolean allowed = //((method.getModifiers() & AccessFlag.ABSTRACT) == 0 ) &&
                    (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 &&
                    (method.getModifiers() & AccessFlag.PUBLIC) != 0 &&
                    !isCallerSide;
            // by default lock all method of object and actor
            allowed &= !originalMethod.getDeclaringClass().getName().equals(Object.class.getName()) &&
                       !originalMethod.getDeclaringClass().getName().equals(Actor.class.getName());

            // exceptions: async built-in actor methods that can be called
            if ( //originalMethod.getName().equals("executeInActorThread") || // needed again ! see spore
                // async methods at actor class. FIXME: add annotation
                 originalMethod.getName().equals("getSubMonitorables") ||
                 originalMethod.getName().equals("getReport") ||
                 originalMethod.getName().equals("askMsg") ||
                 originalMethod.getName().equals("tellMsg") ||
                 originalMethod.getName().equals("__unpublish") ||
                 originalMethod.getName().equals("__republished") ||
                 originalMethod.getName().equals("router$clientPing") ||
                 originalMethod.getName().equals("ping") ||
                 originalMethod.getName().equals("cyclic") ||
                 originalMethod.getName().equals("__submit") ||
                 originalMethod.getName().equals("execInThreadPool") ||
                 originalMethod.getName().equals("asyncstop") ||
                 originalMethod.getName().equals("receive") ||
                 originalMethod.getName().equals("complete") ||
                 originalMethod.getName().equals("close")
            )
            {
                allowed = true;
            }

            if (allowed) {
                boolean isVoid = returnType == CtPrimitiveType.voidType;
                boolean isCallbackCall = originalMethod.getAnnotation(AsCallback.class) != null;
                if (returnType != CtPrimitiveType.voidType && !returnType.getName().equals(IPromise.class.getName()) ) {
                    throw new RuntimeException("only void methods or methods returning IPromise allowed problematic method:"+originalMethod );
                }
                String conversion = "";
                Object[][] availableParameterAnnotations = originalMethod.getAvailableParameterAnnotations();
                CtClass[] parameterTypes = originalMethod.getParameterTypes();
                for (int j = 0; j < availableParameterAnnotations.length; j++) {
                    Object[] availableParameterAnnotation = availableParameterAnnotations[j];
                    if ( availableParameterAnnotation.length > 0 ) {
                        for (int k = 0; k < availableParameterAnnotation.length; k++) {
                            Object annot = availableParameterAnnotation[k];
                            if ( annot.toString().indexOf("kontraktor.annotations.InThread") > 0 ) {
                                if ( parameterTypes[j].getName().equals(Callback.class.getName()) ) {
                                    Log.Info(this,"InThread unnecessary when using built in Callback class. method:"+originalMethod+" clz:"+orig);
                                    continue;
                                }
                                if ( ! parameterTypes[j].isInterface() )
                                    throw new RuntimeException("@InThread can be used on interfaces only");
                                String an = Actor.class.getName();
                                conversion += an+" sender=("+an+")sender.get();";
                                conversion += "if ( sender != null ) { args[" + j + "] = sender.__scheduler.inThread(sender.__self, args[" + j + "]); }";
                                break;
                            }
                        }
                    }
                }
                String call = "__target.__enqueueCall( this, \""+method.getName()+"\", args, "+isCallbackCall+" );";
                if ( ! isVoid ) {
                    call = "return ("+originalMethod.getReturnType().getName()+") (Object)"+call;
                }
                String body = "{ Object args[] = $args;" +
                        conversion +
                        call+
                    "}";
                method.setBody(body);
                cc.addMethod(method);
            } else if ( (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 )
            {
                if (isCallerSide || method.getName().equals("toString") || method.getName().equals("__stopImpl") ) {
                } else if (
                    ! method.getName().equals("getActor") &&
                    ! method.getName().equals("delayed") &&
                    ! method.getName().equals("execInThreadPool")
                )
                {
                    method.setBody("throw new RuntimeException(\"can only call public methods on actor ref. method:'"+method.getName()+"\");");
                    cc.addMethod(method);
                } else {
                    cc.addMethod(method);
                }
            }
        }

//        methods = getSortedNonPublicCtMethods(orig);
//
//        for (int i = 0; i < methods.length; i++) {
//            CtMethod method = methods[i];
//            CtMethod originalMethod = method;
//            if (method.getName().equals("getActor")) {
//                ClassMap then = new ClassMap();
//                then.put(Actor.class.getName(),Actor.class.getName());
//                method = CtMethod.make( "public "+Actor.class.getName()+" getActor() { return __target; }", cc ) ;
//            } else {
//                ClassMap then = new ClassMap();
//                then.fix(orig);
//                method = new CtMethod(method, cc, then);
//            }
//
//            CtClass returnType = method.getReturnType();
//            // by default ignore all method of object and actor
//            boolean isObjectOrActor = !originalMethod.getDeclaringClass().getName().equals(Object.class.getName()) &&
//                    !originalMethod.getDeclaringClass().getName().equals(Actor.class.getName());
//
//            if (! isObjectOrActor &&
//                (method.getModifiers() & (AccessFlag.NATIVE|AccessFlag.FINAL|AccessFlag.STATIC)) == 0 )
//            {
//                method.setBody("throw new RuntimeException(\"can only call public methods on actor ref\");");
//                cc.addMethod(method);
//            }
//        }
    }
34200
def method_wrapper(m):
    """"""

    if m.is_simple:
        def simple_method(self):
            """TODO: no docstring!"""
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, unwrap(self)))

        return simple_method

    elif m.input_transform is not None:
        def transform_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = m.input_transform(self, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return transform_method

    elif m.static:
        def static_method(cls, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_static_request(m, *args, **kwargs)
            return apply_transform(
                cls.__stub__(__server__), m.output_transform,
                grpc_call(cls.__stub__(__server__), m, request))

        return static_method

    else:
        def request_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_request(self, m, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return request_method
830847
private Function wrapValueMethod(Method method) {
    return c -> {
      try {
        return method.invoke(this, c);
      } catch (InvocationTargetException e) {
        throw new CommandException(e);
      } catch (IllegalAccessException e) {
        throw new AssertionError(e);
      }
    };
  }
83641
private void removeOverriddenMethod(MethodDoc method) {
        ClassDoc overriddenClass = method.overriddenClass();
        if (overriddenClass != null) {
            for (int i = 0; i < methlist.size(); i++) {
                ClassDoc cd = methlist.get(i).containingClass();
                if (cd == overriddenClass || overriddenClass.subclassOf(cd)) {
                    methlist.remove(i);  // remove overridden method
                    return;
                }
            }
        }
    }
933216
public static void trimStackTraceTo(Throwable t, Class<?> cls) {
    StackTraceElement[] ste = t.getStackTrace();
    String name = cls.getName();
    for (int i = 0; i < ste.length; i++) {
      if (ste[i].getClassName().equals(name)) {
        t.setStackTrace(Arrays.copyOf(ste, i));
        return;
      }
    }
  }
464655
def __cache( self, method_name, *args, **kwargs ):
        
        trace_string           = util.get_stack(method_name)
        call_hash              = self.__get_hash(args, trace_string, kwargs)
        cd                     = call_descriptor.fetch( call_hash )
        if not cd:
            c  = self.__store__['callables'][method_name]
            if hasattr( c, '__class__' ) and c.__class__ == LazyBones:
                c = c.init()
            returnval = c(*args, **kwargs)
            cd = call_descriptor.CallDescriptor( hash      = call_hash,
                                                 stack     = trace_string,
                                                 method    = method_name,
                                                 returnval = returnval,
                                                 args      = args,
                                                 kwargs    = kwargs )
            cd.save()
            if not call_hash:
                raise Exception("CALL HASH IS NONE")

            util.last_hash = call_hash
            self.last_cached = call_hash
        else:
            returnval = cd.returnval

        if inspect.isclass(returnval):
            returnval = LazyBones( c, args, kwargs )

        return returnval