Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
n9Mtq4 committed Oct 25, 2015
1 parent 33f26d6 commit f6d31fe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/com/n9mtq4/reflection/ReflectionProtector.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ public class ReflectionProtector {
* <p>
* WARNING: this method is (relatively) slow, so use it sparingly.
*
* @return If the calling method was invoked with reflection
* @return boolean - if the calling method was invoked with reflection
* */
public static boolean usedReflection() {
return usedReflection(3, Thread.currentThread().getStackTrace());
return usedReflection(Thread.currentThread().getStackTrace());
}

private static boolean usedReflection(StackTraceElement[] stackTraceElements) {
return usedReflection(3, stackTraceElements);
}

/**
Expand All @@ -30,7 +34,7 @@ public static boolean usedReflection() {
* WARNING: this method is (relatively) slow, so use it sparingly.
*
* @param index The index for the stacktrace
* @return if the stacktrace at the given index is a reflection one.
* @return boolean - if the stacktrace at the given index is a reflection one.
* */
public static boolean usedReflection(int index) {
return usedReflection(index, Thread.currentThread().getStackTrace());
Expand All @@ -47,7 +51,7 @@ private static boolean usedReflection(int index, StackTraceElement[] stackTraceE
*
* @param min The starting stacktrace index
* @param max The ending stacktrace index
* @return if the stacktrace within the two ranges is a reflection one
* @return boolean - if the stacktrace within the two ranges is a reflection one
* */
public static boolean usedReflection(int min, int max) {
return usedReflection(min, max, Thread.currentThread().getStackTrace());
Expand Down

0 comments on commit f6d31fe

Please sign in to comment.