Examples of LineNumber


Examples of org.apache.bcel.classfile.LineNumber

    }
  }

  private int getLineNumber(LineNumber[] lineNumbers, Instruction line) {
    int pc = line.getPc();
    LineNumber previousLineNumber = null;
    for (LineNumber lineNumber : lineNumbers) {
      if (lineNumber.getStartPC() <= pc) {
        previousLineNumber = lineNumber;
      } else {
        return previousLineNumber.getLineNumber();
      }
    }
    if (previousLineNumber != null && previousLineNumber.getStartPC() <= pc) {
      return previousLineNumber.getLineNumber();
    }
    return -1;
  }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumber

    }
  }

  private int getLineNumber(LineNumber[] lineNumbers, Instruction line) {
    int pc = line.getPc();
    LineNumber previousLineNumber = null;
    for (LineNumber lineNumber : lineNumbers) {
      if (lineNumber.getStartPC() <= pc) {
        previousLineNumber = lineNumber;
      } else {
        return previousLineNumber.getLineNumber();
      }
    }
    if (previousLineNumber != null && previousLineNumber.getStartPC() <= pc) {
      return previousLineNumber.getLineNumber();
    }
    return -1;
  }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumber

    }
  }

  private int getLineNumber(LineNumber[] lineNumbers, Instruction line) {
    int pc = line.getPc();
    LineNumber previousLineNumber = null;
    for (LineNumber lineNumber : lineNumbers) {
      if (lineNumber.getStartPC() <= pc) {
        previousLineNumber = lineNumber;
      } else {
        return previousLineNumber.getLineNumber();
      }
    }
    if (previousLineNumber != null && previousLineNumber.getStartPC() <= pc) {
      return previousLineNumber.getLineNumber();
    }
    return -1;
  }
View Full Code Here

Examples of org.apache.bcel.classfile.LineNumber

    }
  }

  private int getLineNumber(LineNumber[] lineNumbers, Instruction line) {
    int pc = line.getPc();
    LineNumber previousLineNumber = null;
    for (LineNumber lineNumber : lineNumbers) {
      if (lineNumber.getStartPC() <= pc) {
        previousLineNumber = lineNumber;
      } else {
        return previousLineNumber.getLineNumber();
      }
    }
    if (previousLineNumber != null && previousLineNumber.getStartPC() <= pc) {
      return previousLineNumber.getLineNumber();
    }
    return -1;
  }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LineNumber

          if (a instanceof LineNumberTable) {
            LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable();
            if (useTags) {
              // abracadabra, lets create tags rather than linenumbergens.
              for (int k = 0; k < ln.length; k++) {
                LineNumber l = ln[k];
                int lnum = l.getLineNumber();
                if (lnum > highestLineNumber) {
                  highestLineNumber = lnum;
                }
                LineNumberTag lt = new LineNumberTag(lnum);
                il.findHandle(l.getStartPC(), arrayOfInstructions, true).addTargeter(lt);
              }
            } else {
              for (int k = 0; k < ln.length; k++) {
                LineNumber l = ln[k];
                addLineNumber(il.findHandle(l.getStartPC(), arrayOfInstructions, true), l.getLineNumber());
              }
            }
          } else if (a instanceof LocalVariableTable) {

            // Lets have a go at creating Tags directly
            if (useTags) {
              LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();

              for (int k = 0; k < lv.length; k++) {
                LocalVariable l = lv[k];
                Type t = Type.getType(l.getSignature());
                LocalVariableTag lvt = new LocalVariableTag(t, l.getSignature(), l.getName(), l.getIndex(), l
                    .getStartPC());
                InstructionHandle start = il.findHandle(l.getStartPC(), arrayOfInstructions, true);
                byte b = t.getType();
                if (b != Constants.T_ADDRESS) {
                  int increment = t.getSize();
                  if (l.getIndex() + increment > maxLocals) {
                    maxLocals = l.getIndex() + increment;
                  }
                }
                int end = l.getStartPC() + l.getLength();
                do {
                  start.addTargeter(lvt);
                  start = start.getNext();
                } while (start != null && start.getPosition() < end);
              }
            } else {

              LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();

              removeLocalVariables();

              for (int k = 0; k < lv.length; k++) {
                LocalVariable l = lv[k];
                InstructionHandle start = il.findHandle(l.getStartPC(), arrayOfInstructions);
                InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength(), arrayOfInstructions);
                // AMC, this actually gives us the first instruction AFTER the range,
                // so move back one... (findHandle can't cope with mid-instruction indices)
                if (end != null) {
                  end = end.getPrev();
                }
                // Repair malformed handles
                if (null == start) {
                  start = il.getStart();
                }
                if (null == end) {
                  end = il.getEnd();
                }

                addLocalVariable(l.getName(), Type.getType(l.getSignature()), l.getIndex(), start, end);
              }
            }
          } else {
            addCodeAttribute(a);
          }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LineNumber

   *
   * This relies on that the instruction list has already been dumped to byte code or
   * or that the `setPositions' methods has been called for the instruction list.
   */
  public LineNumber getLineNumber() {
    return new LineNumber(ih.getPosition(), src_line);
  }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LineNumber

          if (a instanceof LineNumberTable) {
            LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable();
            if (useTags) {
              // abracadabra, lets create tags rather than linenumbergens.
              for (int k = 0; k < ln.length; k++) {
                LineNumber l = ln[k];
                int lnum = l.getLineNumber();
                if (lnum > highestLineNumber) {
                  highestLineNumber = lnum;
                }
                LineNumberTag lt = new LineNumberTag(lnum);
                il.findHandle(l.getStartPC(), arrayOfInstructions, true).addTargeter(lt);
              }
            } else {
              for (int k = 0; k < ln.length; k++) {
                LineNumber l = ln[k];
                addLineNumber(il.findHandle(l.getStartPC(), arrayOfInstructions, true), l.getLineNumber());
              }
            }
          } else if (a instanceof LocalVariableTable) {

            // Lets have a go at creating Tags directly
            if (useTags) {
              LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();

              for (int k = 0; k < lv.length; k++) {
                LocalVariable l = lv[k];
                Type t = Type.getType(l.getSignature());
                LocalVariableTag lvt = new LocalVariableTag(t, l.getSignature(), l.getName(), l.getIndex(), l
                    .getStartPC());
                InstructionHandle start = il.findHandle(l.getStartPC(), arrayOfInstructions, true);
                byte b = t.getType();
                if (b != Constants.T_ADDRESS) {
                  int increment = t.getSize();
                  if (l.getIndex() + increment > maxLocals) {
                    maxLocals = l.getIndex() + increment;
                  }
                }
                int end = l.getStartPC() + l.getLength();
                do {
                  start.addTargeter(lvt);
                  start = start.getNext();
                } while (start != null && start.getPosition() < end);
              }
            } else {

              LocalVariable[] lv = ((LocalVariableTable) a).getLocalVariableTable();

              removeLocalVariables();

              for (int k = 0; k < lv.length; k++) {
                LocalVariable l = lv[k];
                InstructionHandle start = il.findHandle(l.getStartPC(), arrayOfInstructions);
                InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength(), arrayOfInstructions);
                // AMC, this actually gives us the first instruction AFTER the range,
                // so move back one... (findHandle can't cope with mid-instruction indices)
                if (end != null) {
                  end = end.getPrev();
                }
                // Repair malformed handles
                if (null == start) {
                  start = il.getStart();
                }
                if (null == end) {
                  end = il.getEnd();
                }

                addLocalVariable(l.getName(), Type.getType(l.getSignature()), l.getIndex(), start, end);
              }
            }
          } else {
            addCodeAttribute(a);
          }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LineNumber

   *
   * This relies on that the instruction list has already been dumped to byte code or
   * or that the `setPositions' methods has been called for the instruction list.
   */
  public LineNumber getLineNumber() {
    return new LineNumber(ih.getPosition(), src_line);
  }
View Full Code Here

Examples of org.aspectj.apache.bcel.classfile.LineNumber

    if(a instanceof LineNumberTable) {
      LineNumber[] ln = ((LineNumberTable)a).getLineNumberTable();

      for(int k=0; k < ln.length; k++) {
        LineNumber l = ln[k];
        addLineNumber(il.findHandle(l.getStartPC()), l.getLineNumber());
      }
    } else if(a instanceof LocalVariableTable) {
      LocalVariable[] lv = ((LocalVariableTable)a).getLocalVariableTable();

      removeLocalVariables();

      for(int k=0; k < lv.length; k++) {
        LocalVariable     l     = lv[k];
        InstructionHandle start = il.findHandle(l.getStartPC());
        InstructionHandle end   = il.findHandle(l.getStartPC() + l.getLength());
        // AMC, this actually gives us the first instruction AFTER the range,
        // so move back one... (findHandle can't cope with mid-instruction indices)
        if (end != null) end = end.getPrev();

        // Repair malformed handles
        if(null == start) {
    start = il.getStart();
        }

        if(null == end) {
    end = il.getEnd();
        }

        addLocalVariable(l.getName(), Type.getType(l.getSignature()),
             l.getIndex(), start, end);
      }
    } else
      addCodeAttribute(a);
  }
      } else if(a instanceof ExceptionTable) {
  String[] names = ((ExceptionTable)a).getExceptionNames();
  for(int j=0; j < names.length; j++)
    addException(names[j]);
      } else if (a instanceof RuntimeAnnotations) {
    RuntimeAnnotations runtimeAnnotations = (RuntimeAnnotations)a;
    List l = runtimeAnnotations.getAnnotations();
    for (Iterator it = l.iterator(); it.hasNext();) {
      Annotation element = (Annotation) it.next();
      addAnnotation(new AnnotationGen(element,cp,false));
    }
      } else {
        addAttribute(a);
View Full Code Here

Examples of ratpack.groovy.script.internal.LineNumber

    return rootClass;
  }

  public static SourceInfo getSourceInfo(Closure<?> closure) {
    Class<?> closureClass = closure.getClass();
    LineNumber lineNumber = closureClass.getAnnotation(LineNumber.class);
    if (lineNumber == null) {
      return null;
    }

    Class<?> rootClass = getRootClass(closure);
    ScriptPath scriptPath = rootClass.getAnnotation(ScriptPath.class);
    if (scriptPath == null) {
      return null;
    }

    return new SourceInfo(scriptPath.value(), lineNumber.value());
  }
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.