Skip to content

Add ability to augment classes with fields from other classes in Painless#76628

Merged
jdconrad merged 6 commits into
elastic:masterfrom
jdconrad:fa
Aug 18, 2021
Merged

Add ability to augment classes with fields from other classes in Painless#76628
jdconrad merged 6 commits into
elastic:masterfrom
jdconrad:fa

Conversation

@jdconrad

Copy link
Copy Markdown
Contributor

This change adds a a new "augmented" annotation to the Painless allowlist parser. The first use of the annotation supports adding static final fields to a specified allowlist class from another class. This supports the fields api as we can add additional fields types from other classes and augment the Field class with the new types.

@jdconrad jdconrad requested a review from stu-elastic August 17, 2021 22:16
@jdconrad jdconrad added the :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache label Aug 17, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Aug 17, 2021
@elasticmachine

Copy link
Copy Markdown
Collaborator

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

@jdconrad jdconrad added auto-backport Automatically create backport pull requests when merged v7.15.0 v8.0.0 >enhancement labels Aug 17, 2021

@stu-elastic stu-elastic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

class org.elasticsearch.script.Field {
    org.elasticsearch.script.Converter UnsignedLong @augmented[augmented_canonical_class_name="org.elasticsearch.xpack.unsignedlong.UnsignedLongField"]
}

class org.elasticsearch.xpack.unsignedlong.UnsignedLongField @no_import {
}

Works with this change, the bottom class is necessary to avoid a class_not_found_exception

@jdconrad

Copy link
Copy Markdown
Contributor Author

@stu-elastic Thanks for the review! Will add a Javadoc as requested.

@jdconrad jdconrad merged commit e398580 into elastic:master Aug 18, 2021
jdconrad added a commit to jdconrad/elasticsearch that referenced this pull request Aug 18, 2021
…less (elastic#76628)

This change adds a a new "augmented" annotation to the Painless allowlist parser. The first use of the 
annotation supports adding static final fields to a specified allowlist class from another class. This 
supports the fields api as we can add additional fields types from other classes and augment the Field 
class with the new types.
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

💚 Backport successful

Status Branch Result
7.x

jdconrad added a commit that referenced this pull request Aug 18, 2021
…less (#76628) (#76676)

This change adds a a new "augmented" annotation to the Painless allowlist parser. The first use of the 
annotation supports adding static final fields to a specified allowlist class from another class. This 
supports the fields api as we can add additional fields types from other classes and augment the Field 
class with the new types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement Team:Core/Infra Meta label for core/infra team v7.16.0 v8.0.0-alpha2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants