Common method profiling entry-point.

@param pjp
{@link ProceedingJoinPoint}
@param method
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()}
196620
@Around(value = "execution(* *(..)) && (@annotation(method))")
    public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable {
    	return doProfiling(pjp, method.producerId(), method.subsystem(), method.category());
    }
561072
public static void validateMethodOrThrow(Method method) {
    Class<?> returnType = method.getReturnType();
    if (returnType.equals(Void.TYPE)) {
      return;
    } else if (!Publisher.class.isAssignableFrom(returnType)) {
      throw new UnsupportedOperationException("Service method return type can be Publisher only");
    }
    if (method.getParameterCount() > 1) {
      throw new UnsupportedOperationException("Service method can accept 0 or 1 parameters only");
    }
  }
1336662
@GwtIncompatible("incompatible method")
    private static Throwable getCauseUsingMethodName(final Throwable throwable, final String methodName) {
        Method method = null;
        try {
            method = throwable.getClass().getMethod(methodName);
        } catch (final NoSuchMethodException | SecurityException ignored) { // NOPMD
            // exception ignored
        }

        if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
            try {
                return (Throwable) method.invoke(throwable);
            } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) { // NOPMD
                // exception ignored
            }
        }
        return null;
    }
1211648
@Override
	public void visitMethod(Method obj) {
		try {
			if (obj.isSynthetic()) {
				return;
			}

			if (Values.CONSTRUCTOR.equals(getMethodName()) && javaClass.getClassName().contains("$")) {
				return;
			}

			List<String> types = SignatureUtils.getParameterSignatures(obj.getSignature());
			if ((types.isEmpty()) || (types.size() > 2)) {
				return;
			}

			if ((obj.getAccessFlags() & Const.ACC_VARARGS) != 0) {
				return;
			}

			String lastParmSig = types.get(types.size() - 1);
			if (!lastParmSig.startsWith(Values.SIG_ARRAY_PREFIX)
					|| lastParmSig.startsWith(Values.SIG_ARRAY_OF_ARRAYS_PREFIX)) {
				return;
			}

			if (SignatureBuilder.SIG_BYTE_ARRAY.equals(lastParmSig)
					|| SignatureBuilder.SIG_CHAR_ARRAY.equals(lastParmSig)) {
				return;
			}

			if (hasSimilarParms(types)) {
				return;
			}

			if (obj.isStatic() && "main".equals(obj.getName()) && SIG_STRING_ARRAY_TO_VOID.equals(obj.getSignature())) {
				return;
			}

			if (!obj.isPrivate() && !obj.isStatic() && isInherited(obj)) {
				return;
			}

			super.visitMethod(obj);
			bugReporter.reportBug(new BugInstance(this, BugType.UVA_USE_VAR_ARGS.name(), LOW_PRIORITY).addClass(this)
					.addMethod(this));

		} catch (ClassNotFoundException cnfe) {
			bugReporter.reportMissingClass(cnfe);
		}
	}
952917
private void processSetColorOps(String methodName) throws ClassNotFoundException {
        if ("setBackground".equals(methodName) || "setForeground".equals(methodName)) {
            int argCount = SignatureUtils.getNumParameters(getSigConstantOperand());
            if (stack.getStackDepth() > argCount) {
                OpcodeStack.Item item = stack.getStackItem(0);
                if (S508UserValue.FROM_UIMANAGER != item.getUserValue()) {
                    item = stack.getStackItem(argCount);
                    JavaClass cls = item.getJavaClass();
                    if (((jcomponentClass != null) && cls.instanceOf(jcomponentClass)) || ((componentClass != null) && cls.instanceOf(componentClass))) {
                        bugReporter.reportBug(
                                new BugInstance(this, BugType.S508C_SET_COMP_COLOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this));
                    }
                }
            }
        }
    }
844402
protected Object invoke(Method method)
    {
        try
        {
            return method.invoke(target);
        }
        catch (Exception e)
        {
            return null;
        }
    }
151607
@Around("execute() || testing()")
  public Object trace(ProceedingJoinPoint call) throws Throwable {
    if (call.getArgs().length == 0 || call.getArgs()[0] == null) {
      return call.proceed();
    }

    String sql = (String) call.getArgs()[0];
    String spanName = makeSpanName(call, sql);

    return Handler.proceed(call, tracer, spanName, sql);
  }
993801
@Override
    public void visitMethod(final Method obj) {
        methodName = obj.getName();
        if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) {
            return;
        }

        List<String> parms = SignatureUtils.getParameterSignatures(obj.getSignature());

        if (!parms.isEmpty()) {
            boolean isStatic = obj.isStatic();
            isAbstract = obj.isAbstract();

            firstLocalReg = isStatic ? 0 : 1;
            for (String parmSig : parms) {
                firstLocalReg += SignatureUtils.getSignatureSize(parmSig);
            }

            sourceLines = getSourceLines(obj);
        }
    }
107030
public static boolean isAnnotationPresent(final Class<? extends Annotation> annotation, final Method method) {
        final Annotation e = DaemonScanner.getAnnotation(annotation, method);
        return e != null;
    }
965162
public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor)
	{
		SubMonitor sub = SubMonitor.convert(monitor, 100);
		try
		{
			DbgpException error = session.getInfo().getError();
			if (error != null)
			{
				throw error;
			}
			session.configure(target.getOptions());
			session.getStreamManager().addListener(this);

			final boolean breakOnFirstLine = // target.breakOnFirstLineEnabled()
			// ||
			isAnyThreadInStepInto();
			VdmThread thread = new VdmThread(target, session, this);
			thread.initialize(sub.newChild(25));
			addThread(thread);

			final boolean isFirstThread = waitingForThreads;
			if (isFirstThread)
			{
				waitingForThreads = false;
			}
			if (isFirstThread || !isSupportsThreads(thread))
			{
				SubMonitor child = sub.newChild(25);
				target.breakpointManager.initializeSession(thread.getDbgpSession(), child);
				child = sub.newChild(25);
				if (configurator != null)
				{
					configurator.initializeBreakpoints(thread, child);
				}
			}

			DebugEventHelper.fireCreateEvent(thread);

			final boolean stopBeforeCode = thread.getDbgpSession().getDebugOptions().get(DebugOption.ENGINE_STOP_BEFORE_CODE);
			boolean executed = false;
			if (!breakOnFirstLine)
			{
				if (stopBeforeCode || !hasBreakpointAtCurrentPosition(thread))
				{
					thread.resumeAfterAccept();
					executed = true;
				}
			} else
			{
				if (stopBeforeCode || !isValidStack(thread))
				{
					thread.initialStepInto();
					executed = true;
				}
			}
			if (!executed)
			{
				if (!thread.isStackInitialized())
				{
					thread.updateStack();
				}
				DebugEventHelper.fireChangeEvent(thread);
				DebugEventHelper.fireSuspendEvent(thread, DebugEvent.CLIENT_REQUEST);
			}
			sub.worked(25);
			fireThreadAccepted(thread, isFirstThread);
		} catch (Exception e)
		{
			try
			{
				target.terminate();
			} catch (DebugException e1)
			{
			}
			VdmDebugPlugin.log(e);
		} finally
		{
			sub.done();
		}
	}
152606
static MethodInvoker reflective(final Object target, final Method method) {
        return new MethodInvoker() {

            @Override
            public void invoke() throws Exception {
                method.invoke(target);
            }

            @Override
            public void setTarget(Object target) {
            }
        };
    }
943633
public void startCall(String method)
        throws IOException
    {
        os.write('c');
        os.write(0);
        os.write(1);

        os.write('m');
        int len = method.length();
        os.write(len >> 8);
        os.write(len);
        printString(method, 0, len);
    }
1181579
public void run(IProgressMonitor monitor) {
    try {
      page.createType(monitor);
    } catch (CoreException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
1307823
private synchronized void tryProcessMethod(Class<?> clazz, String methodName, boolean expectedToExist, Class<?> ... parameterTypes) {
        
        final Method method;
        try {
            method = clazz.getMethod(methodName, parameterTypes);
        } catch (NoSuchMethodException ex) {
            Level logLevel = expectedToExist ? Level.INFO : Level.CONFIG;
            if (LOGGER.isLoggable(logLevel)) {
                String methodSpec = String.format("%s(%s)", methodName, StringUtils.join(parameterTypes, ","));
                LOGGER.log(logLevel, "No method {0} for class {1}", new Object[] {methodSpec, clazz});
            }
            return;
        } catch (RuntimeException ex) {
            Level logLevel = expectedToExist ? Level.INFO : Level.CONFIG;
            if (LOGGER.isLoggable(logLevel)) {
                String methodSpec = String.format("%s(%s)", methodName, StringUtils.join(parameterTypes, ","));
                LOGGER.log(logLevel, "Failed to retrieve the method {0} for class {1}", new Object[] {methodSpec, clazz});
            }
            return;
        }
        
        Class<?> returnType = method.getReturnType();
            // We do not veto the the root class
            if (ParameterValue.class.isAssignableFrom(returnType)) {
                if (!ParameterValue.class.equals(returnType)) {
                    // Add this class to the cache
                    paramValueCache_maskedClasses.add(returnType.getName());
                }
            }
    }
933385
public void audit(final JoinPoint jointPoint) throws Throwable {
        MethodSignature methodSignature = (MethodSignature) jointPoint.getSignature();
        Method method = methodSignature.getMethod();
        AuditManager.getInstance().audit(jointPoint.getTarget().getClass(), method, jointPoint.getArgs());
    }
562495
@Override
    protected final <T extends Serializable, Method extends BotApiMethod<T>, Callback extends SentCallback<T>> void sendApiMethodAsync(Method method, Callback callback) {
        //noinspection Convert2Lambda
        exe.submit(new Runnable() {
            @Override
            public void run() {
                try {
                    String responseContent = sendMethodRequest(method);
                    try {
                        callback.onResult(method, method.deserializeResponse(responseContent));
                    } catch (TelegramApiRequestException e) {
                        callback.onError(method, e);
                    }
                } catch (IOException | TelegramApiValidationException e) {
                    callback.onException(method, e);
                }

            }
        });
    }
433164
public void execute() throws CheckedAnalysisException {
        method = Global.getAnalysisCache().getMethodAnalysis(Method.class, methodDescriptor);
        ClassContext classContext = Global.getAnalysisCache().getClassAnalysis(ClassContext.class,
                methodDescriptor.getClassDescriptor());

        BitSet bytecodeSet = classContext.getBytecodeSet(method);
        if (bytecodeSet == null) {
            return;
        }
        if (bytecodeSet.get(Const.MONITORENTER) || bytecodeSet.get(Const.MONITOREXIT)) {
            this.lockDataflow = classContext.getLockDataflow(method);
        } else if (method.isSynchronized()) {
            this.vnaDataflow = classContext.getValueNumberDataflow(method); // will
            // need
            // this
            // later
        }
    }