Skip to content

inline breakpoint will not work on some conditions #1414

Description

@xinqingyaohao
Environment
  • JDK version: 1.8 , some inline breakpoints will not work

图片

Environment
  • JDK version: 17 , all inline breakpoints will not work

图片

Activity

  1. xinqingyaohao commented on Nov 26, 2023

    @xinqingyaohao
    Author

    I have fixed this bug , by the following codes:

       public class LambdaExpressionLocator
             extends ASTVisitor
       {
    
            public String getMethodSignature() {
              if (!this.found) {
                 return null;
              }
              String result=BindingUtils.toSignature(this.lambdaMethodBinding);
              result=adjustSignature(result);
              return result;
            }
    
            public Integer getPeerAngleBracket(String sigResult,Integer currIdx) {
    		  int len=sigResult.length();	
    		  int deep=0;
    		  for (int i=currIdx; i<len; i++) {
    			  char iChar = sigResult.charAt(i);
    			  if (iChar == '<') {
    				  deep++;
    		      } else if (iChar == '>') {
    				  if (deep == 0) {
    					  return i;
    				  } else {
    					  deep--;
    				  }
    			  }					  
    		  }	
    		  return -1;
    		}
    		
           public String adjustSignature(String sigStr) {
              String sigResult = sigStr;
              while(true) {
                 Integer firstIdx = sigResult.indexOf("<");
                 if (firstIdx < 0 ) {
                     break;
                 }
                 Integer currIdx = firstIdx+1;
                 Integer secondIdx =  getPeerAngleBracket(sigResult,currIdx);
                 if (secondIdx < 0 ) {
                     break;
                 }
                 sigResult=sigResult.substring(0,firstIdx)+sigResult.substring(secondIdx+1);
              }
              return sigResult;               
            }
        }
    
  2. xinqingyaohao commented on Nov 26, 2023

    @xinqingyaohao
    Author

    if use JDK version: 17 , all inline breakpoints will not work for both VSCode (debugger for java) and Eclipse.

  3. testforstephen commented on Dec 1, 2023

    @testforstephen
    Contributor

    zcaij (@xinqingyaohao) Would you mind creating a pull request at https://github.com/microsoft/java-debug?

  4. xinqingyaohao commented on Dec 4, 2023

    @xinqingyaohao
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions