Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.JavaClass


    }

    @Override
    public void visitClassContext(ClassContext classContext) {

        JavaClass jclass = classContext.getJavaClass();

        for (Method method : jclass.getMethods()) {
            XMethod xmethod = XFactory.createXMethod(classContext.getJavaClass(), method);
            ParameterProperty nonnullParameters = AnalysisContext.currentAnalysisContext().getUnconditionalDerefParamDatabase()
                    .getProperty(xmethod.getMethodDescriptor());
            if (nonnullParameters != null) {
                for (int p : nonnullParameters.iterable()) {
View Full Code Here


        annotationDatabase.addEntryForClassMember(member, annotationClass, value);
    }

    @Override
    public void visitClassContext(ClassContext classContext) {
        JavaClass javaClass = classContext.getJavaClass();
        if (!BCELUtil.preTiger(javaClass)) {
            javaClass.accept(this);
        }

    }
View Full Code Here

            ClassData classData = analysisCache.getClassAnalysis(ClassData.class, desc);
            if (classData.getData().length > 1000000) {
                return true;
            }
            try {
                JavaClass javaClass = classContext.getJavaClass();
                if (javaClass.getMethods().length > 1000) {
                    return true;
                }
            } catch (RuntimeException e) {
                AnalysisContext.logError("Error parsing class " + desc
                        + " from " + classData.getCodeBaseEntry().getCodeBase(), e);
View Full Code Here

        requireNonNull (className, "className is null");
        if (originalRepository == null) {
            throw new IllegalStateException("originalRepository is null");
        }

        JavaClass clazz = originalRepository.findClass(className);
        return (clazz == null ? originalRepository.loadClass(className) : clazz);
    }
View Full Code Here

        Map<String, InnerClassAccess> map = classToAccessMap.get(className);
        if (map == null) {
            map = new HashMap<String, InnerClassAccess>(3);

            if (!className.startsWith("[")) {
                JavaClass javaClass = Repository.lookupClass(className);

                Method[] methodList = javaClass.getMethods();
                for (Method method : methodList) {
                    String methodName = method.getName();
                    if (!methodName.startsWith("access$")) {
                        continue;
                    }
View Full Code Here

    }

    public static SourceLineAnnotation fromVisitedInstruction(MethodDescriptor methodDescriptor, int position) {
        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();
            JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, methodDescriptor.getClassDescriptor());
            Method method = analysisCache.getMethodAnalysis(Method.class, methodDescriptor);
            return fromVisitedInstruction(jclass, method, position);
        } catch (CheckedAnalysisException e) {
            return createReallyUnknown(methodDescriptor.getClassDescriptor().toDottedClassName());
        }
View Full Code Here

    static SourceLineAnnotation getSourceAnnotationForMethod(String className, String methodName, String methodSig) {
        JavaClassAndMethod targetMethod = null;
        Code code = null;

        try {
            JavaClass targetClass = AnalysisContext.currentAnalysisContext().lookupClass(className);
            targetMethod = Hierarchy.findMethod(targetClass, methodName, methodSig);
            if (targetMethod != null) {
                Method method = targetMethod.getMethod();
                if (method != null) {
                    code = method.getCode();
View Full Code Here

        int lastLine = -1;
        int firstLine = Integer.MAX_VALUE;

        try {
            JavaClass targetClass = AnalysisContext.currentAnalysisContext().lookupClass(className);
            for (Method m : targetClass.getMethods()) {
                Code c = m.getCode();
                if (c != null) {
                    LineNumberTable table = c.getLineNumberTable();
                    if (table != null) {
                        for (LineNumber line : table.getLineNumberTable()) {
View Full Code Here

            IAnalysisCache analysisCache = Global.getAnalysisCache();

            for (XClass c : allClasses) {
                try {
                    JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, c.getClassDescriptor());
                    addAllDefinitions(jclass);
                } catch (MissingClassException e) {
                    bugReporter.reportMissingClass(e.getClassDescriptor());
                } catch (CheckedAnalysisException e) {
                    bugReporter.logError("Could not find class " + c.getClassDescriptor().toDottedClassName(), e);
View Full Code Here

                String name = ((ConstantUtf8) obj.getConstantPool().getConstant(nt.getNameIndex(), CONSTANT_Utf8)).getBytes();
                String signature = ((ConstantUtf8) obj.getConstantPool().getConstant(nt.getSignatureIndex(), CONSTANT_Utf8))
                        .getBytes();

                try {
                    JavaClass target = Repository.lookupClass(className);
                    if (!find(target, name, signature)) {
                        bugReporter.reportBug(new BugInstance(this, "VR_UNRESOLVABLE_REFERENCE", NORMAL_PRIORITY).addClass(obj)
                                .addString(getMemberName(target.getClassName(), name, signature)));
                    }

                } catch (ClassNotFoundException e) {
                    bugReporter.reportMissingClass(e);
                }
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.JavaClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.