Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7843375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:32:06+00:00 2026-06-02T16:32:06+00:00

I am trying to visit method body with another treepathscanner, but I dont know,

  • 0

I am trying to visit method body with another treepathscanner, but I dont know, which parameter to pass, because I allways get a NPE in TreePath constructor.

@Override
public Object visitMethod(MethodTree node, Trees p) {
    ...
    node.getBody().accept(new MethodVisitor(m, repository), node.getBody());
    ...
}


public class MethodVisitor extends TreePathScanner<Object, BlockTree> {...}

Exception:

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.NullPointerException
    at com.sun.source.util.TreePath.<init>(TreePath.java:94)
    at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:65)
    at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
    at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:158)
    at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:764)
    at cz.cvut.kbss.odpa.parser.visitor.OdpaVisitor.visitMethod(OdpaVisitor.java:93)
    at cz.cvut.kbss.odpa.parser.visitor.OdpaVisitor.visitMethod(OdpaVisitor.java:29)
    at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:676)
    at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
    ...

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:32:06+00:00Added an answer on June 2, 2026 at 4:32 pm

    In case that someone needs it, the correct way to call it is:

    new MethodVisitor(m, repository).scan(p.getPath(compilationUnitTree, node), node.getBody());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to visit a page with cucumber, with: visit new_video_path but I get
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
I'm trying to test the authenticate_or_request_with_http_basic method using Cucumber and Capybara, but it doesn't
I am trying to run the following C++ method from Java using JNA, but
I'm trying to get to grips with the visitor method in Java. I'm trying
Say you're trying to visit an array in a checkerboard pattern: 0 1 2
Trying to parse an iTunes Atom feed with a PHP script. If you visit
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
I'm trying to add an extension method to my MVC 2 project without success
I am trying to create a single sign on process. The method I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.