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

Fix split package org.elasticsearch.common.xcontent #78831

Merged
merged 8 commits into from Oct 8, 2021

Conversation

ChrisHegarty
Copy link
Contributor

@ChrisHegarty ChrisHegarty commented Oct 7, 2021

Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.

Much of the changes in this PR are to import statements. In some areas spotlessApply fixes up the order of import statements, in other area not so, but equally the order does not cause issues for the build. If this is deemed significant, then the imports can be reordered after this PR is merged.

relates #78166

@ChrisHegarty ChrisHegarty mentioned this pull request Oct 7, 2021
58 tasks
@ChrisHegarty
Copy link
Contributor Author

Note to reviewers. Much of the changes are related to the shimmer in package and import statements. To more easily see changes not related to the aforementioned shimmer, one can run a cross branch diff, see below.

Highlights:

  1. remove related split package ignores from server/build.gradle
  2. fix-up javadoc links
  3. make a couple of accessor methods in XContentBuilder public, for test access.
$ git diff -w master..xcontent_split | egrep -v '^(\s|diff|rename|similarity|index\s[a-z0-9]{11}\.\.[a-z0-9]{11}|@@|---|\+\+\+)' | egrep -v '^[\+|-]{1}[import|package]{1}'
-     * {@link org.elasticsearch.common.xcontent.ContextParser#parse(XContentParser, Object)}
+     * {@link org.elasticsearch.xcontent.ContextParser#parse(XContentParser, Object)}
-     * Use {@link org.elasticsearch.common.xcontent.ObjectPath} to navigate through the data
+     * Use {@link org.elasticsearch.xcontent.ObjectPath} to navigate through the data
-    static void ensureNameNotNull(String name) {
+    public static void ensureNameNotNull(String name) {
-    static void ensureNotNull(Object value, String message) {
+    public static void ensureNotNull(Object value, String message) {
- * A one stop to use {@link org.elasticsearch.common.xcontent.XContent} and {@link XContentBuilder}.
+ * A one stop to use {@link org.elasticsearch.xcontent.XContent} and {@link XContentBuilder}.
-    static final int GUESS_HEADER_LENGTH = 20;
+    public static final int GUESS_HEADER_LENGTH = 20;
-     * Returns a content builder using JSON format ({@link org.elasticsearch.common.xcontent.XContentType#JSON}.
+     * Returns a content builder using JSON format ({@link org.elasticsearch.xcontent.XContentType#JSON}.
-     * Returns a content builder using SMILE format ({@link org.elasticsearch.common.xcontent.XContentType#SMILE}.
+     * Returns a content builder using SMILE format ({@link org.elasticsearch.xcontent.XContentType#SMILE}.
-     * Returns a content builder using YAML format ({@link org.elasticsearch.common.xcontent.XContentType#YAML}.
+     * Returns a content builder using YAML format ({@link org.elasticsearch.xcontent.XContentType#YAML}.
-     * Returns a content builder using CBOR format ({@link org.elasticsearch.common.xcontent.XContentType#CBOR}.
+     * Returns a content builder using CBOR format ({@link org.elasticsearch.xcontent.XContentType#CBOR}.
-     * Returns the {@link org.elasticsearch.common.xcontent.XContent} for the provided content type.
+     * Returns the {@link org.elasticsearch.xcontent.XContent} for the provided content type.
- * The content type of {@link org.elasticsearch.common.xcontent.XContent}.
+ * The content type of {@link org.elasticsearch.xcontent.XContent}.
-    static final FilterPath EMPTY = new FilterPath();
+    public static final FilterPath EMPTY = new FilterPath();
-    boolean isDoubleWildcard() {
+    public boolean isDoubleWildcard() {
-    boolean isSimpleWildcard() {
+    public boolean isSimpleWildcard() {
-    String getSegment() {
+    public String getSegment() {
-    FilterPath getNext() {
+    public FilterPath getNext() {
-    // xcontent should not have common, all it's common packages should be renamed to xcontent
-    'org.elasticsearch.common.xcontent.*',
-    'org.elasticsearch.common.xcontent.support.XContentMapValues',
-
- * its string form ({@link #source(String, XContentType)}) or using a {@link org.elasticsearch.common.xcontent.XContentBuilder}
- * ({@link #source(org.elasticsearch.common.xcontent.XContentBuilder)}).
+ * its string form ({@link #source(String, XContentType)}) or using a {@link org.elasticsearch.xcontent.XContentBuilder}
+ * ({@link #source(org.elasticsearch.xcontent.XContentBuilder)}).
-     * the alias filter via {@link org.elasticsearch.common.xcontent.XContentParser},
+     * the alias filter via {@link org.elasticsearch.xcontent.XContentParser},
-     * {@link org.elasticsearch.common.xcontent.XContentParser.Token#START_OBJECT}.
+     * {@link org.elasticsearch.xcontent.XContentParser.Token#START_OBJECT}.
- * Defines a query parser that is able to parse {@link QueryBuilder}s from {@link org.elasticsearch.common.xcontent.XContent}.
+ * Defines a query parser that is able to parse {@link QueryBuilder}s from {@link org.elasticsearch.xcontent.XContent}.
-     * Parses a retention lease from {@link org.elasticsearch.common.xcontent.XContent}. This method assumes that the retention lease was
-     * converted to {@link org.elasticsearch.common.xcontent.XContent} via {@link #toXContent(XContentBuilder, Params)}.
+     * Parses a retention lease from {@link org.elasticsearch.xcontent.XContent}. This method assumes that the retention lease was
+     * converted to {@link org.elasticsearch.xcontent.XContent} via {@link #toXContent(XContentBuilder, Params)}.
-     * Converts the retention lease stats to {@link org.elasticsearch.common.xcontent.XContent} using the specified builder and pararms.
+     * Converts the retention lease stats to {@link org.elasticsearch.xcontent.XContent} using the specified builder and pararms.
-     * @return the builder that this retention lease collection was converted to {@link org.elasticsearch.common.xcontent.XContent} into
+     * @return the builder that this retention lease collection was converted to {@link org.elasticsearch.xcontent.XContent} into
-     * Parses a retention leases collection from {@link org.elasticsearch.common.xcontent.XContent}. This method assumes that the retention
-     * leases were converted to {@link org.elasticsearch.common.xcontent.XContent} via {@link #toXContent(XContentBuilder, Params)}.
+     * Parses a retention leases collection from {@link org.elasticsearch.xcontent.XContent}. This method assumes that the retention
+     * leases were converted to {@link org.elasticsearch.xcontent.XContent} via {@link #toXContent(XContentBuilder, Params)}.
-     * {@link #toInnerXContent(XContentBuilder, org.elasticsearch.common.xcontent.ToXContent.Params)}
+     * {@link #toInnerXContent(XContentBuilder, org.elasticsearch.xcontent.ToXContent.Params)}
-            org.elasticsearch.common.xcontent.ObjectParser.ValueType.INT
+            org.elasticsearch.xcontent.ObjectParser.ValueType.INT
-            org.elasticsearch.common.xcontent.ObjectParser.ValueType.OBJECT
+            org.elasticsearch.xcontent.ObjectParser.ValueType.OBJECT
-     * {@link org.elasticsearch.common.xcontent.XContent} format.
+     * {@link org.elasticsearch.xcontent.XContent} format.
-     * {@link org.elasticsearch.common.xcontent.XContent} format.
+     * {@link org.elasticsearch.xcontent.XContent} format.
-     * {@link org.elasticsearch.common.xcontent.XContent} format.
+     * {@link org.elasticsearch.xcontent.XContent} format.
-     * {@link org.elasticsearch.common.xcontent.XContent} format.
+     * {@link org.elasticsearch.xcontent.XContent} format.
-     * Whether or not to assert equivalence of the {@link org.elasticsearch.common.xcontent.XContent} of the test instance and the instance
-     * parsed from the {@link org.elasticsearch.common.xcontent.XContent} of the test instance.
+     * Whether or not to assert equivalence of the {@link org.elasticsearch.xcontent.XContent} of the test instance and the instance
+     * parsed from the {@link org.elasticsearch.xcontent.XContent} of the test instance.
-     * via {@link org.elasticsearch.common.xcontent.ToXContent#toXContent(XContentBuilder, ToXContent.Params)} and parsed back via
-     * {@link org.elasticsearch.common.xcontent.XContentParser#objectText()}.
+     * via {@link ToXContent#toXContent(XContentBuilder, ToXContent.Params)} and parsed back via
+     * {@link org.elasticsearch.xcontent.XContentParser#objectText()}.
-     * via {@link org.elasticsearch.common.xcontent.ToXContent#toXContent(XContentBuilder, ToXContent.Params)} and parsed back via
-     * {@link org.elasticsearch.common.xcontent.XContentParser#objectText()}.
+     * via {@link ToXContent#toXContent(XContentBuilder, ToXContent.Params)} and parsed back via
+     * {@link org.elasticsearch.xcontent.XContentParser#objectText()}.
-     * {@link org.elasticsearch.common.xcontent.ToXContent#toXContent(XContentBuilder, ToXContent.Params)} hold the same content.
+     * {@link ToXContent#toXContent(XContentBuilder, ToXContent.Params)} hold the same content.
- * It allows to transfer the allocation information to {@link org.elasticsearch.common.xcontent.XContent} using
+ * It allows to transfer the allocation information to {@link org.elasticsearch.xcontent.XContent} using
-     * {@link org.elasticsearch.common.xcontent.ContextParser#parse(XContentParser, Object)}
+     * {@link ContextParser#parse(XContentParser, Object)}
-     * This is needed because {@link SqlQueryRequest#toXContent(XContentBuilder, org.elasticsearch.common.xcontent.ToXContent.Params)}
+     * This is needed because {@link SqlQueryRequest#toXContent(XContentBuilder, ToXContent.Params)}
-                containsString("at org.elasticsearch.common.xcontent.ObjectParser.getParser(ObjectParser.java:346)"));
+                containsString("at org.elasticsearch.xcontent.ObjectParser.getParser(ObjectParser.java:346)"));

@rjernst
Copy link
Member

rjernst commented Oct 7, 2021

If this is deemed significant, then the imports can be reordered after this PR is merged

I wouldn't worry about it, the imports will be fixed up when spotless is turned on for the entire codebase.

@mark-vieira
Copy link
Contributor

@elasticmachine retest this please

@mark-vieira
Copy link
Contributor

@elasticmachine run elasticsearch-ci/packaging-tests-unix-sample

@ChrisHegarty
Copy link
Contributor Author

I'll sync up with master once this set of tests complete.

@nik9000
Copy link
Member

nik9000 commented Oct 7, 2021

Files changed 4,955

Good luck!

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

GitHub really does not handle large PRs like this well at all. Fortunately, IntelliJ GitHub integration handles this just fine. The build file changes look fine so I don't have any concerns here.

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine retest this please

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine retest this please

@ChrisHegarty ChrisHegarty merged commit 20c9f75 into elastic:master Oct 8, 2021
@ChrisHegarty ChrisHegarty deleted the xcontent_split branch October 8, 2021 17:22
wjp719 added a commit to wjp719/elasticsearch that referenced this pull request Oct 9, 2021
* master:
  Fix DataTierTests package and add a validation test (elastic#78880)
  Fix split package org.elasticsearch.common.xcontent (elastic#78831)
  Store DataTier Preference directly on IndexMetadata (elastic#78668)
  [DOCS] Fixes typo in calendar API example (elastic#78867)
  Improve Node Shutdown Observability (elastic#78727)
  Convert encrypted snapshot license object to LicensedFeature (elastic#78731)
  Revert "Make nodePaths() singular (elastic#72514)" (elastic#78801)
  Fix incorrect generic type in PolicyStepsRegistry (elastic#78628)
  [DOCS] Fixes ML get calendars API (elastic#78808)
  Implement GET API for System Feature Upgrades (elastic#78642)
  [TEST] More MetadataStateFormat tests (elastic#78577)
  Add support for rest compatibility headers to the HLRC (elastic#78490)
  Un-ignoring tests after backporting fix (elastic#78830)
  Add node REPLACE shutdown implementation (elastic#76247)
  Wrap VersionPropertiesLoader in a BuildService to decouple build logic projects (elastic#78704)
  Adjust /_cat/templates not to request all metadata (elastic#78829)
  [DOCS] Fixes ML get scheduled events API (elastic#78809)
  Enable exit on out of memory error (elastic#71542)

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Oct 11, 2021
* upstream/master: (250 commits)
  [Transform] HLRC cleanups (elastic#78909)
  [ML] Make ML indices hidden when the node becomes master (elastic#77416)
  Introduce a Few Settings Singleton Instances (elastic#78897)
  Simplify TestCluster extraJar configuration (elastic#78837)
  Add @OverRide annotations to methods in EnrichPlugin class (elastic#76873)
  Add v7 restCompat for invalidating API key with the id field (elastic#78664)
  EQL: Refine repeatable queries (elastic#78895)
  Fix DataTierTests package and add a validation test (elastic#78880)
  Fix split package org.elasticsearch.common.xcontent (elastic#78831)
  Store DataTier Preference directly on IndexMetadata (elastic#78668)
  [DOCS] Fixes typo in calendar API example (elastic#78867)
  Improve Node Shutdown Observability (elastic#78727)
  Convert encrypted snapshot license object to LicensedFeature (elastic#78731)
  Revert "Make nodePaths() singular (elastic#72514)" (elastic#78801)
  Fix incorrect generic type in PolicyStepsRegistry (elastic#78628)
  [DOCS] Fixes ML get calendars API (elastic#78808)
  Implement GET API for System Feature Upgrades (elastic#78642)
  [TEST] More MetadataStateFormat tests (elastic#78577)
  Add support for rest compatibility headers to the HLRC (elastic#78490)
  Un-ignoring tests after backporting fix (elastic#78830)
  ...

# Conflicts:
#	server/src/main/java/org/elasticsearch/ingest/IngestService.java
#	server/src/test/java/org/elasticsearch/ingest/IngestServiceTests.java
@jakelandis jakelandis removed the v8.0.0 label Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants