Package de.loskutov.bco.asm

Examples of de.loskutov.bco.asm.DecompiledClass


        boolean clearOutput = false;

        if (inputChanged || isSelectedElementChanged(childEl)) {

            DecompiledClass result = decompileBytecode(childEl);
            if (result == null) {
                clearOutput = true;
            } else {
                if (modes.get(BCOConstants.F_SHOW_ANALYZER)
                    && !result.isAbstractOrInterface()) {
                    refreshVerifyView(result);
                } else {
                    toggleVerifierAction.setEnabled(!result
                        .isAbstractOrInterface());
                    refreshTextView(result);
                }
            }
            lastDecompiledResult = result;
View Full Code Here


        }
        InputStream is = JdtUtils.createInputStream(type);
        if (is == null) {
            return null;
        }
        DecompiledClass decompiledClass = null;
        int available = 0;
        try {
            ClassLoader cl = null;
            if (modes.get(BCOConstants.F_SHOW_ANALYZER)) {
                cl = JdtUtils.getClassLoader(type);
            }

            String fieldName = null;
            String methodName = null;
            /*
             * find out, which name we should use for selected element
             */
            if (modes.get(BCOConstants.F_SHOW_ONLY_SELECTED_ELEMENT)
                && childEl != null) {
                if (childEl.getElementType() == IJavaElement.FIELD) {
                    fieldName = childEl.getElementName();
                } else {
                    methodName = JdtUtils.getMethodSignature(childEl);
                }
            }
            available = is.available();
            decompiledClass = DecompilerClassVisitor.getDecompiledClass(
                is, fieldName, methodName, modes, cl);
        } catch (Exception e) {
            try {
                // check if compilation unit is ok - then this is the user problem
                if (type.isStructureKnown()) {
                    BytecodeOutlinePlugin.error("Cannot decompile: " + type, e);
                } else {
                    BytecodeOutlinePlugin.log(e, IStatus.ERROR);
                }
            } catch (JavaModelException e1) {
                // this is compilation problem - don't show the message
                BytecodeOutlinePlugin.log(e1, IStatus.WARNING);
            }
        } catch (UnsupportedClassVersionError e) {
            BytecodeOutlinePlugin.error("Cannot decompile: " + type
                + ". Error was caused by attempt to "
                + "load a class compiled with the Java version which is not "
                + "supported by the current JVM. ", e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                BytecodeOutlinePlugin.log(e, IStatus.WARNING);
            }
        }
        // remember class file size to show it later in UI
        if (decompiledClass != null) {
            decompiledClass.setAttribute(DecompiledClass.ATTR_CLAS_SIZE, ""
                + available);
        }
        return decompiledClass;
    }
View Full Code Here

        if (stream == null) {
            throw new CoreException(new Status(
                IStatus.ERROR, "de.loskutov.bco", -1,
                "cannot get bytecode from class file", null));
        }
        DecompiledClass decompiledClass = null;
        try {
            decompiledClass = DecompilerClassVisitor.getDecompiledClass(
                stream, null, methodName, modes, null);
        } catch (IOException e) {
            throw new CoreException(new Status(
                IStatus.ERROR, "de.loskutov.bco", -1,
                "cannot get bytecode dump", e));
        } catch (UnsupportedClassVersionError e){
            throw new CoreException(new Status(
                IStatus.ERROR, "de.loskutov.bco", -1,
                "Error caused by attempt to load class compiled with Java version which"
                + " is not supported by current JVM", e));
        } finally {
            try {
                stream.close();
            } catch (IOException e) {
                BytecodeOutlinePlugin.log(e, IStatus.WARNING);
            }
        }
        final byte[] bytes = decompiledClass.getText().getBytes();
        // use internal buffering to prevent multiple calls to this method
        Display.getDefault().syncExec(new Runnable(){
            public void run() {
                setContent(bytes);
            }
View Full Code Here

        return null;
    }

    public int getBytecodeInstructionAtLine(int line) {
        if (isDecompiled()) {
            DecompiledClass decompiledClass = sourceMapper.getDecompiledClass(getClassFile());
            if(line > 0 && decompiledClass != null) {
                return decompiledClass.getBytecodeInsn(line);
            }
        }
        return -1;
    }
View Full Code Here

TOP

Related Classes of de.loskutov.bco.asm.DecompiledClass

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.