Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8163127

Debugger classExclusionFilter does not work correctly with method references

XMLWordPrintable

    • b06


      JDK does not allow debuggers to stop where expected when extra stepping
      filter "jdk.internal.*" is used.

      Consider the following test case:

      1 package my.stepping;
      2
      3 import java.util.ArrayList;
      4 import java.util.HashMap;
      5 import java.util.List;
      6 import java.util.Map;
      7
      8 public class StepIntoMethodRef {
      9 public static void actualMethod(long[] input, long min, long max) {
      10 Map<Long, List<Long>> lookup = new HashMap<>();
      11 long range = max - min + 1;
      12 for (long number : input) {
      13 lookup.compute(number / range, (key, list) -> list != null?
      list : new ArrayList<>()).add(number);
      14 }
      15 }
      16 interface Func {
      17 void call(long[] input, long min, long max);
      18 }
      19 public static void main(String[] args) {
      20 Func methodRef = StepIntoMethodRef::actualMethod;
      21 methodRef.call(new long[] {1, 2, 3, 4, 5, 6}, 1, 6); // breakpoint
      on this, step into
      22 }
      23 }

      With a class filter in place that excludes java.*,sun.*,jdk.internal.*
      and setting a break point on line 21, we expect to step into line 10, but
      instead, debugger steps into line 13.

      Step completed: "thread=main",
      my.stepping.StepIntoMethodRef.lambda$actualMethod$0(), line=13 bci=1


            dtitov Daniil Titov (Inactive)
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: