public static int getCurrentLineNo() { StackTraceElement[] stackTrace = (new RuntimeException()).getStackTrace(); if (stackTrace.length > 1) { return stackTrace[1].getLineNumber(); } return -1; }
java get current line no
原文:https://www.cnblogs.com/blog-ice/p/14291359.html