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

Scripting: capture structured javadoc from stdlib #68782

Merged

Conversation

stu-elastic
Copy link
Contributor

Clean javadoc tags and strip html.
Methods and constructors have an optional javadoc field. All fields under
javadoc are optional but at least one will be present.

Fields also have optional javadoc field which, if present, is a string.

"javadoc": {
  "description": "...",

  // from @param <param name> <param description>
  "parameters": {
    "p1": "<p1 description>",
    "p2": "<p2 description>"
  },

  // from @return
  "return": "...",

  // from @throws <type> <description>
  "throws": [
    [
      "IndexOutOfBoundsException",
      "<description>"
    ],
    [
      "IOException",
      "<description>"
    ]
  ]
}

Clean javadoc tags and strip html.
Methods and constructors have an optional `javadoc` field.  All fields under
`javadoc` are optional but at least one will be present.

Fields also have optional `javadoc` field which, if present, is a string.
```
"javadoc": {
  "description": "...",

  // from @param <param name> <param description>
  "parameters": {
    "p1": "<p1 description>",
    "p2": "<p2 description>"
  },

  // from @return
  "return": "...",

  // from @throws <type> <description>
  "throws": [
    [
      "IndexOutOfBoundsException",
      "<description>"
    ],
    [
      "IOException",
      "<description>"
    ]
  ]
}
```
@stu-elastic stu-elastic added >enhancement :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v8.0.0 v7.12.0 labels Feb 9, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Feb 9, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@stu-elastic stu-elastic force-pushed the scripting/jdk-src-parse-05-clean-at branch from 6149747 to 2808682 Compare February 9, 2021 20:36
Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice update.

@@ -77,13 +77,15 @@ dependencies {
docImplementation project(':server')
docImplementation project(':modules:lang-painless')
docImplementation 'com.github.javaparser:javaparser-core:3.18.0'
docImplementation 'org.jsoup:jsoup:1.13.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used to clean html tags.

ParsedJavadoc parsed = new ParsedJavadoc(cleaned(cleaned));
for (JavadocBlockTag tag: tags) {
String tagName = tag.getTagName();
// https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadoctags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to link to Java 7 for this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to java14.

@stu-elastic stu-elastic merged commit c35eebe into elastic:master Feb 10, 2021
stu-elastic added a commit to stu-elastic/elasticsearch that referenced this pull request Feb 10, 2021
Clean javadoc tags and strip html.
Methods and constructors have an optional `javadoc` field.  All fields under
`javadoc` are optional but at least one will be present.

Fields also have optional `javadoc` field which, if present, is a string.
```
"javadoc": {
  "description": "...",

  // from @param <param name> <param description>
  "parameters": {
    "p1": "<p1 description>",
    "p2": "<p2 description>"
  },

  // from @return
  "return": "...",

  // from @throws <type> <description>
  "throws": [
    [
      "IndexOutOfBoundsException",
      "<description>"
    ],
    [
      "IOException",
      "<description>"
    ]
  ]
}
```

Backport: c35eebe
stu-elastic added a commit that referenced this pull request Feb 16, 2021
* Scripting: capture structured javadoc from stdlib (#68782)

Clean javadoc tags and strip html.
Methods and constructors have an optional `javadoc` field.  All fields under
`javadoc` are optional but at least one will be present.

Fields also have optional `javadoc` field which, if present, is a string.
```
"javadoc": {
  "description": "...",

  // from @param <param name> <param description>
  "parameters": {
    "p1": "<p1 description>",
    "p2": "<p2 description>"
  },

  // from @return
  "return": "...",

  // from @throws <type> <description>
  "throws": [
    [
      "IndexOutOfBoundsException",
      "<description>"
    ],
    [
      "IOException",
      "<description>"
    ]
  ]
}
```

Backport: c35eebe
easyice pushed a commit to easyice/elasticsearch that referenced this pull request Mar 25, 2021
Clean javadoc tags and strip html.
Methods and constructors have an optional `javadoc` field.  All fields under
`javadoc` are optional but at least one will be present.

Fields also have optional `javadoc` field which, if present, is a string.
```
"javadoc": {
  "description": "...",

  // from @param <param name> <param description>
  "parameters": {
    "p1": "<p1 description>",
    "p2": "<p2 description>"
  },

  // from @return
  "return": "...",

  // from @throws <type> <description>
  "throws": [
    [
      "IndexOutOfBoundsException",
      "<description>"
    ],
    [
      "IOException",
      "<description>"
    ]
  ]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement Team:Core/Infra Meta label for core/infra team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants