Search code examples
rascal

Read java comments with the M3 library


I would like to know how Rascal can read Java comments like this:

//This intent is used to share the picture between Android applications
Intent shareIntent = new Intent();

Or this:

/**
 * This method can be called to share the picture between Android Applications
 */
private void shareImage() {
    ...
}

The method createAstFromFile seems to skip these comments.

Thanks in advance.


Solution

  • Comments are not included in the ASTs, but you can get the from the M3 model using @documentation field:

    anno rel[loc definition, loc comments] M3@documentation;