Class CodeUtils


  • public class CodeUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CodeUtils()  
    • Constructor Detail

      • CodeUtils

        public CodeUtils()
    • Method Detail

      • getLineForPos

        public static java.lang.String getLineForPos​(java.lang.String code,
                                                     int pos)
      • getLineStartForPos

        public static int getLineStartForPos​(java.lang.String code,
                                             int pos)
      • getLineEndForPos

        public static int getLineEndForPos​(java.lang.String code,
                                           int pos)
      • getNewLinePosAfter

        public static int getNewLinePosAfter​(java.lang.String code,
                                             int startPos)
      • getNewLinePosBefore

        public static int getNewLinePosBefore​(java.lang.String code,
                                              int startPos)
      • getLineNumForPos

        public static int getLineNumForPos​(java.lang.String code,
                                           int pos,
                                           java.lang.String newLine)
      • extractMethodCode

        public static java.lang.String extractMethodCode​(MethodNode mth,
                                                         ICodeInfo codeInfo)
        Cut method code (including comments and annotations) from class code.
        Returns:
        method code or empty string if metadata is not available
      • getMethodEnd

        public static int getMethodEnd​(MethodNode mth,
                                       ICodeInfo codeInfo)
        Search method end position in provided class code info.
        Returns:
        end pos or -1 if metadata not available