Changeset 16462 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-05-19T06:36:12+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ReflectionUtils.java
r16436 r16462 7 7 import java.util.Collection; 8 8 import java.util.function.Function; 9 import java.util.stream.IntStream;10 9 11 10 import org.openstreetmap.josm.plugins.PluginHandler; … … 64 63 private static <T extends Object> T findCaller(Function<StackTraceElement, T> getter, Collection<T> exclusions) { 65 64 StackTraceElement[] stack = Thread.currentThread().getStackTrace(); 66 return IntStream.range(3, stack.length) 67 .mapToObj(i -> getter.apply(stack[i])) 68 .filter(t -> exclusions == null || !exclusions.contains(t)) 69 .findFirst().orElse(null); 65 for (int i = 3; i < stack.length; i++) { 66 T t = getter.apply(stack[i]); 67 if (exclusions == null || !exclusions.contains(t)) { 68 return t; 69 } 70 } 71 return null; 70 72 } 71 73 }
Note:
See TracChangeset
for help on using the changeset viewer.