Examples of LineNumberTable


Examples of jasm.attributes.LineNumberTable

    ArrayList<LineNumberTable.Entry> lineNumbers = new ArrayList<LineNumberTable.Entry>();
    ArrayList<Bytecode> codes;
    codes = translate(mcase,constants,lambdas,handlers,lineNumbers);
    jasm.attributes.Code code = new jasm.attributes.Code(codes,handlers,cm);
    if(!lineNumbers.isEmpty()) {
      code.attributes().add(new LineNumberTable(lineNumbers));
    }
    cm.attributes().add(code);

    return cm;
  }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

            XClass x = getXClassOperand();

            checkPUTFIELD: if (putFieldPC + 10 > getPC() && f != null && obj != null && f.equals(putFieldXField)
                    && !f.isSynthetic() && obj.equals(putFieldObj) && x != null) {

                LineNumberTable table = getCode().getLineNumberTable();
                if (table != null) {
                    int first = table.getSourceLine(putFieldPC);
                    int second = table.getSourceLine(getPC());
                    if (first + 1 != second && first != second) {
                        break checkPUTFIELD;
                    }
                } else if (putFieldPC + 3 != getPC()) {
                    break checkPUTFIELD;
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

            }

            BitSet linesMentionedMultipleTimes = getClassContext().linesMentionedMultipleTimes(getMethod());
            SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(this);
            boolean possibleClone = source.getStartLine() > 0 && linesMentionedMultipleTimes.get(source.getStartLine());
            LineNumberTable lineNumberTable = getCode().getLineNumberTable();
            int linesDifference = 0;
            if (item0.getPC() != -1 && item1.getPC() != -1) {
                if (lineNumberTable != null) {
                    int line0 = lineNumberTable.getSourceLine(item0.getPC());
                    int line1 = lineNumberTable.getSourceLine(item1.getPC());
                    int firstPos = Math.min(item0.getPC(), item1.getPC());
                    if (firstPos < lastMethodCall && line0 != line1) {
                        return;
                    }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

     *            the method being visited
     * @return the SourceLineAnnotation, or null if we do not have line number
     *         information for the method
     */
    public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) {
        LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
        String className = methodGen.getClassName();
        int codeSize = methodGen.getInstructionList().getLength();
        if (lineNumberTable == null) {
            return createUnknown(className, sourceFile, 0, codeSize - 1);
        }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

        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());
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

        SourceLineAnnotation result = null;

        try {
            Method m = Global.getAnalysisCache().getMethodAnalysis(Method.class, methodDescriptor);
            XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, methodDescriptor.getClassDescriptor());
            LineNumberTable lnt = m.getLineNumberTable();
            String sourceFile = xclass.getSource();
            if (sourceFile != null && lnt != null) {
                int firstLine = Integer.MAX_VALUE;
                int bytecode = 0;
                LineNumber[] entries = lnt.getLineNumberTable();
                for (LineNumber entry : entries) {
                    if (entry.getLineNumber() < firstLine) {
                        firstLine = entry.getLineNumber();
                        bytecode = entry.getStartPC();
                    }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

     * @param pc
     *            bytecode offset in visited method
     * @return SourceLineAnnotation describing visited instruction
     */
    public static SourceLineAnnotation fromVisitedInstruction(JavaClass jclass, Method method, int pc) {
        LineNumberTable lineNumberTable = method.getCode().getLineNumberTable();
        String className = jclass.getClassName();
        String sourceFile = jclass.getSourceFileName();
        if (lineNumberTable == null) {
            return createUnknown(className, sourceFile, pc, pc);
        }

        int startLine = lineNumberTable.getSourceLine(pc);
        return new SourceLineAnnotation(className, sourceFile, startLine, startLine, pc, pc);
    }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

     *            the bytecode offset of the end instruction in the range
     * @return the SourceLineAnnotation, or null if we do not have line number
     *         information for the instruction
     */
    public static SourceLineAnnotation fromVisitedInstructionRange(BytecodeScanningDetector visitor, int startPC, int endPC) {
        LineNumberTable lineNumberTable = getLineNumberTable(visitor);
        String className = visitor.getDottedClassName();
        String sourceFile = visitor.getSourceFile();

        if (lineNumberTable == null) {
            return createUnknown(className, sourceFile, startPC, endPC);
        }

        int startLine = lineNumberTable.getSourceLine(startPC);
        int endLine = lineNumberTable.getSourceLine(endPC);
        return new SourceLineAnnotation(className, sourceFile, startLine, endLine, startPC, endPC);
    }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

            int startPC, int endPC) {
        if (startPC > endPC) {
            throw new IllegalArgumentException("Start pc " + startPC + " greater than end pc " + endPC);
        }

        LineNumberTable lineNumberTable = getLineNumberTable(visitor);
        String className = visitor.getDottedClassName();
        String sourceFile = visitor.getSourceFile();

        if (lineNumberTable == null) {
            return createUnknown(className, sourceFile, startPC, endPC);
        }

        int startLine = lineNumberTable.getSourceLine(startPC);
        int endLine = lineNumberTable.getSourceLine(endPC);
        return new SourceLineAnnotation(className, sourceFile, startLine, endLine, startPC, endPC);
    }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumberTable

     *         information for the instruction
     */
    @Nonnull
    public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, MethodGen methodGen, String sourceFile,
            @Nonnull InstructionHandle handle) {
        LineNumberTable table = methodGen.getLineNumberTable(methodGen.getConstantPool());
        String className = methodGen.getClassName();

        int bytecodeOffset = handle.getPosition();

        if (table == null) {
            return createUnknown(className, sourceFile, bytecodeOffset, bytecodeOffset);
        }

        int lineNumber = table.getSourceLine(handle.getPosition());
        return new SourceLineAnnotation(className, sourceFile, lineNumber, lineNumber, bytecodeOffset, bytecodeOffset);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.