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: Parse stdlib files for parameter names #67837

Merged
merged 9 commits into from
Jan 28, 2021

Conversation

stu-elastic
Copy link
Contributor

@stu-elastic stu-elastic commented Jan 21, 2021

  • Task generateContextApiSpec takes optional system parameter
    jdksrc with path to extracted java standard library source
    files.
  • stdlib source files are the source of parameter_names list
    and the javadoc value.
  • javadoc values may contain newlines and markup such as
    {@code XX}, <p>, @throws

Example method:

{
  "declaring": "Appendable",
  "name": "append",
  "return": "Appendable",
  "javadoc": "Appends a subsequence of the specified character sequence to this...",
  "parameters": ["CharSequence", "int", "int" ],
  "parameter_names": ["csq", "start", "end"]
}

* Task generateContextApiSpec takes optional system parameter
  `jdksrc` with path to extracted java standard library source
  files.
* stdlib source files are the source of `parameter_names` list
  and the `javadoc` value.
* javadoc values may contain newlines and markup such as
  `{@code XX}`, `<p>`, `@throws`

Example method:
{
  "declaring": "Appendable",
  "name": "append",
  "return": "Appendable",
  "javadoc": "Appends a subsequence of the specified character sequence to this...",
  "parameters": ["CharSequence", "int", "int" ],
  "parameter_names": ["csq", "start", "end"]
}
@stu-elastic stu-elastic added >enhancement :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v8.0.0 v7.12.0 labels Jan 21, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jan 21, 2021
@elasticmachine
Copy link
Collaborator

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

this.importedMethods = Method.fromInfos(
info.getImportedMethods(),
javaNamesToDisplayNames,
new StdlibJavadocExtractor.ParsedJavaClass()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Verify if necessary.

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! Thanks for the walkthrough earlier.

A couple of thoughts:

  1. We chatted briefly about this, but would you please double check that String is correctly inserted for shared API methods, so we don't end up with the same bug our current documentation has.
  2. I wonder if on the design it would make more sense to collect the jdk info after collecting our whitelist info so that if it's null it doesn't have to be checked for null multiple times.

@stu-elastic stu-elastic merged commit 7c98d9a into elastic:master Jan 28, 2021
stu-elastic added a commit to stu-elastic/elasticsearch that referenced this pull request Feb 1, 2021
* Scripting: Parse stdlib files for parameter names

* Task `generateContextApiSpec` takes optional system parameter
  `jdksrc` with path to extracted java standard library source
  files.
* stdlib source files are the source of `parameter_names` list
  and the `javadoc` value.
* javadoc values may contain newlines and markup such as
  `{@code XX}`, `<p>`, `@throws`

Example method:
```
{
  "declaring": "Appendable",
  "name": "append",
  "return": "Appendable",
  "javadoc": "Appends a subsequence of the specified character sequence to this...",
  "parameters": ["CharSequence", "int", "int" ],
  "parameter_names": ["csq", "start", "end"]
}
```
stu-elastic added a commit that referenced this pull request Feb 2, 2021
* Scripting: Parse stdlib files for parameter names (#67837)

* Scripting: Parse stdlib files for parameter names

* Task `generateContextApiSpec` takes optional system parameter
  `jdksrc` with path to extracted java standard library source
  files.
* stdlib source files are the source of `parameter_names` list
  and the `javadoc` value.
* javadoc values may contain newlines and markup such as
  `{@code XX}`, `<p>`, `@throws`

Example method:
```
{
  "declaring": "Appendable",
  "name": "append",
  "return": "Appendable",
  "javadoc": "Appends a subsequence of the specified character sequence to this...",
  "parameters": ["CharSequence", "int", "int" ],
  "parameter_names": ["csq", "start", "end"]
}
```
Backport: 7c98d9a

* Scripting: readable array types for context api (#68237)

Instead of fixing up array names post-hoc when generating the api spec
and painless context docs, fix them up in the `_scripts/painless/_context`
API call.

Backport: 460b33f
@stu-elastic
Copy link
Contributor Author

master: 7c98d9a
7.x (7.12): 4ab4862

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.

4 participants