Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline breakpoint will not work on some conditions #1414

Closed
xinqingyaohao opened this issue Nov 25, 2023 · 4 comments · Fixed by microsoft/java-debug#499
Closed

inline breakpoint will not work on some conditions #1414

xinqingyaohao opened this issue Nov 25, 2023 · 4 comments · Fixed by microsoft/java-debug#499

Comments

@xinqingyaohao
Copy link

xinqingyaohao commented Nov 25, 2023

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

图片

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

图片

@xinqingyaohao
Copy link
Author

xinqingyaohao commented Nov 26, 2023

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;               
        }
    }

@xinqingyaohao
Copy link
Author

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

@testforstephen
Copy link
Contributor

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

@xinqingyaohao
Copy link
Author

xinqingyaohao commented Dec 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants