2

I am using Java Parser to get information about the method in a source file. I based my implementation as described in this answer . However the details of constructors are not being given. I think it has to do with how the Java parser works as the normal methods have a return type and the constructor doesn't.

Does anyone know how to be able to also get information of constructors using the Java parser?

Community
  • 1
  • 1
ict1991
  • 2,060
  • 5
  • 26
  • 34

2 Answers2

2

check for a symbol that's the same as the class name. All constructors are of the type public classname(args) or private classname(args). No return, and no class declaration.

Lucas
  • 5,071
  • 1
  • 18
  • 17
0

Use ConstructorDeclaration instead of MethodDeclaration

Jeff Williams
  • 921
  • 7
  • 9