Created
February 22, 2013 11:03
-
-
Save epickrram/5012649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final class Unicorn | |
{ | |
private static int mainMethodLineOfLastPatInvocation = 0; | |
private static boolean pat() | |
{ | |
boolean result = false; | |
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); | |
final StackTraceElement mainMethodInvocationPoint = stackTrace[3]; | |
if(mainMethodInvocationPoint.getLineNumber() != mainMethodLineOfLastPatInvocation) | |
{ | |
result = true; | |
mainMethodLineOfLastPatInvocation = mainMethodInvocationPoint.getLineNumber(); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment