Method entry tracing for static classes.

@param sourceClass The type of class which called this method
@param methodName The method name to trace
508088
public final void entry(Class sourceClass,
                            String methodName) {
        internalEntry(null,
                      sourceClass,
                      methodName,
                      null);
    }
467083
@Override
    public void visitMethod(Method obj) {
        if (!obj.isAbstract())
            return;

        String methodName = obj.getName();
        String methodSig = obj.getSignature();
        outer: for (JavaClass cls : superClasses) {
            Method[] methods = cls.getMethods();
            for (Method m : methods) {
                if (m.isPrivate() || m.isAbstract())
                    continue;
                if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
                    BugInstance bug = new BugInstance(this, BugType.AOM_ABSTRACT_OVERRIDDEN_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this);

                    Code code = obj.getCode();
                    if (code != null)
                        bug.addSourceLineRange(clsContext, this, 0, code.getLength() - 1);
                    bugReporter.reportBug(bug);

                    break outer;
                }
            }
        }
    }
38777
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, @CheckForNull Method method) {
        String sourceFile = javaClass.getSourceFileName();
        if (method == null) {
            return createUnknown(javaClass.getClassName(), sourceFile);
        }
        Code code = method.getCode();
        LineNumberTable lineNumberTable = method.getLineNumberTable();
        if (code == null || lineNumberTable == null) {
            return createUnknown(javaClass.getClassName(), sourceFile);
        }

        return forEntireMethod(javaClass.getClassName(), sourceFile, lineNumberTable, code.getLength());
    }
419603
public void readFrom (File source)
        throws IOException
    {
        // slurp our source file into newline separated strings
        _lines = Lists.newArrayList();
        BufferedReader bin = new BufferedReader(new FileReader(source));
        String line = null;
        while ((line = bin.readLine()) != null) {
            _lines.add(line);
        }
        bin.close();

        // now determine where to insert our static field declarations and our generated methods
        int bstart = -1, bend = -1;
        for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
            line = _lines.get(ii).trim();

            // look for the start of the class body
            if (GenUtil.NAME_PATTERN.matcher(line).find()) {
                if (line.endsWith("{")) {
                    bstart = ii+1;
                } else {
                    // search down a few lines for the open brace
                    for (int oo = 1; oo < 10; oo++) {
                        if (safeGetLine(ii+oo).trim().endsWith("{")) {
                            bstart = ii+oo+1;
                            break;
                        }
                    }
                }

            // track the last } on a line by itself and we'll call that the end of the class body
            } else if (line.equals("}")) {
                bend = ii;

            // look for our field and method markers
            } else if (line.equals(FIELDS_START)) {
                _nstart = ii;
            } else if (line.equals(FIELDS_END)) {
                _nend = ii+1;
            } else if (line.equals(METHODS_START)) {
                _mstart = ii;
            } else if (line.equals(METHODS_END)) {
                _mend = ii+1;
            }
        }

        // sanity check the markers
        check(source, "fields start", _nstart, "fields end", _nend);
        check(source, "fields end", _nend, "fields start", _nstart);
        check(source, "methods start", _mstart, "methods end", _mend);
        check(source, "methods end", _mend, "methods start", _mstart);

        // we have no previous markers then stuff the fields at the top of the class body and the
        // methods at the bottom
        if (_nstart == -1) {
            _nstart = bstart;
            _nend = bstart;
        }
        if (_mstart == -1) {
            _mstart = bend;
            _mend = bend;
        }
    }
835108
public static void debug(Object source, String message) {
		LoggerFactory.getInstance().log(LoggerLevel.INFO, source, message);
	}
1017536
private final void internalInfo(Object source,
                                    Class sourceClass,
                                    String methodName,
                                    String messageIdentifier,
                                    Object object) {
        if (usePrintWriterForTrace) {
            java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
            if (printWriter != null) {
                StringBuffer stringBuffer = new StringBuffer(new java.util.Date().toString());

                stringBuffer.append(" I ");
                stringBuffer.append(sourceClass.getName());
                stringBuffer.append(".");
                stringBuffer.append(methodName);

                printWriter.println(stringBuffer.toString());
                printWriter.println("\t\t" + traceFactory.nls.format(messageIdentifier,
                                                                     object));
                printWriter.flush();
            }
        }

        if (object != null) {
            SibTr.info(traceComponent,
                       messageIdentifier,
                       object);
        } else {
            SibTr.info(traceComponent,
                       messageIdentifier);
        }
    }
157883
private void traceJndiBegin(String methodname, Object... objs) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            String providerURL = "UNKNOWN";
            try {
                providerURL = (String) getEnvironment().get(Context.PROVIDER_URL);
            } catch (NamingException ne) {
                /* Ignore. */
            }
            Tr.debug(tc, JNDI_CALL + methodname + " [" + providerURL + "]", objs);
        }
    }
1021866
public final void event(Object source,
                            Class sourceClass,
                            String methodName,
                            Throwable throwable) {
        internalEvent(source,
                      sourceClass,
                      methodName,
                      throwable);
    }
430231
public static void traceEJBCallEntry(String methodDesc)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        {
            StringBuffer sbuf = new StringBuffer();

            sbuf
                            .append(BeanLifeCycle_EJBCallEntry_Type_Str).append(DataDelimiter)
                            .append(BeanLifeCycle_EJBCallEntry_Type).append(DataDelimiter)
                            .append(methodDesc);

            Tr.debug(tc, sbuf.toString());
        }
    }
579427
public static void entry(TraceComponent tc, String methodName) {
    if(isTracing()) SibTr.entry(tc, methodName);

  }
950742
@Override
	public void visitClassContext(ClassContext classContext) {
		try {
			stack = new OpcodeStack();
			localMethodCalls = new HashMap<>();
			fieldMethodCalls = new HashMap<>();
			staticMethodCalls = new HashMap<>();
			branchTargets = new BitSet();
			super.visitClassContext(classContext);
		} finally {
			stack = null;
			localMethodCalls = null;
			fieldMethodCalls = null;
			staticMethodCalls = null;
			branchTargets = null;
		}
	}
735836
protected void processClass (File source)
    {
        // load up the file and determine it's package and classname
        String name = null;
        try {
            name = GenUtil.readClassName(source);
        } catch (Exception e) {
            System.err.println("Failed to parse " + source + ": " + e.getMessage());
            return;
        }

        System.err.println("Considering " + name + "...");

        try {
            // in order for annotations to work, this task and all the classes it uses must be
            // loaded from the same class loader as the classes on which we are going to
            // introspect; this is non-ideal but unavoidable
            processClass(source, getClass().getClassLoader().loadClass(name));
        } catch (ClassNotFoundException cnfe) {
            System.err.println("Failed to load " + name + ".\nMissing class: " + cnfe.getMessage());
            System.err.println("Be sure to set the 'classpathref' attribute to a classpath\n" +
                               "that contains your projects invocation service classes.");
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
1147521
public void logp(Level level, String sourceClass, String sourceMethod,String msg) {
		delegateLogger.logp(level,sourceClass,sourceMethod,msg);
	}
1068937
public Trace getTrace(Class sourceClass,
                          String traceGroup) {
        synchronized (activeTrace) {
            TraceImpl traceImpl = new TraceImpl(sourceClass, traceGroup, this);
            activeTrace.put(sourceClass, traceImpl);
            try {
                applyActiveTrace();
            } catch (java.io.IOException exception) {
                System.out.println(cclass + ":getTrace() exception" + exception);
                exception.printStackTrace();
            } // try.

            return traceImpl;
        } // synchronized (activeTrace).
    }
194854
public final void warning(Class sourceClass,
                              String methodName,
                              String messageIdentifier,
                              Object object) {
        internalWarning(null,
                        sourceClass,
                        methodName,
                        messageIdentifier,
                        object);
    }
1090953
public final void event(Class sourceClass,
                            String methodName,
                            Throwable throwable) {
        internalEvent(null,
                      sourceClass,
                      methodName,
                      throwable);
    }
223117
public static MethodIdentifier of(final String containingClass, final String methodName, final String signature, final boolean staticMethod) {
        final String returnType = JavaUtils.getReturnType(signature);
        final List<String> parameters = JavaUtils.getParameters(signature);
        return new MethodIdentifier(containingClass, methodName, parameters, returnType, staticMethod);
    }