Skip to content

Commit b79e879

Browse files
authored
Fix compiler warnings in 6.x (#3801)
1 parent 03d11af commit b79e879

File tree

7 files changed

+71
-35
lines changed

7 files changed

+71
-35
lines changed

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
namespace Nest
1+
using System;
2+
3+
namespace Nest
24
{
35
/// <inheritdoc cref="IGeoShapeProperty" />
46
public class GeoShapeAttribute : ElasticsearchDocValuesPropertyAttributeBase, IGeoShapeProperty
57
{
68
public GeoShapeAttribute() : base(FieldType.GeoShape) { }
79

810
/// <inheritdoc cref="IGeoShapeProperty.DistanceErrorPercentage" />
11+
[Obsolete("Removed in Elasticsearch 6.6")]
912
public double DistanceErrorPercentage
1013
{
1114
get => (Self.Precision != null) | (Self.TreeLevels != null)
@@ -36,27 +39,31 @@ public GeoOrientation Orientation
3639
}
3740

3841
/// <inheritdoc cref="IGeoShapeProperty.PointsOnly" />
42+
[Obsolete("Removed in Elasticsearch 6.6")]
3943
public bool PointsOnly
4044
{
4145
get => Self.PointsOnly.GetValueOrDefault(false);
4246
set => Self.PointsOnly = value;
4347
}
4448

4549
/// <inheritdoc cref="IGeoShapeProperty.Strategy" />
50+
[Obsolete("Removed in Elasticsearch 6.6")]
4651
public GeoStrategy Strategy
4752
{
4853
get => Self.Strategy.GetValueOrDefault(GeoStrategy.Recursive);
4954
set => Self.Strategy = value;
5055
}
5156

5257
/// <inheritdoc cref="IGeoShapeProperty.Tree" />
58+
[Obsolete("Removed in Elasticsearch 6.6")]
5359
public GeoTree Tree
5460
{
5561
get => Self.Tree.GetValueOrDefault(GeoTree.Geohash);
5662
set => Self.Tree = value;
5763
}
5864

5965
/// <inheritdoc cref="IGeoShapeProperty.TreeLevels" />
66+
[Obsolete("Removed in Elasticsearch 6.6")]
6067
public int TreeLevels
6168
{
6269
get => Self.TreeLevels.GetValueOrDefault(50);
@@ -70,16 +77,30 @@ public bool Coerce
7077
set => Self.Coerce = value;
7178
}
7279

80+
[Obsolete("Removed in Elasticsearch 6.6")]
7381
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
82+
7483
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
84+
7585
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
86+
7687
GeoOrientation? IGeoShapeProperty.Orientation { get; set; }
88+
89+
[Obsolete("Removed in Elasticsearch 6.6")]
7790
bool? IGeoShapeProperty.PointsOnly { get; set; }
91+
92+
[Obsolete("Removed in Elasticsearch 6.6")]
7893
Distance IGeoShapeProperty.Precision { get; set; }
94+
7995
private IGeoShapeProperty Self => this;
96+
97+
[Obsolete("Removed in Elasticsearch 6.6")]
8098
GeoStrategy? IGeoShapeProperty.Strategy { get; set; }
8199

100+
[Obsolete("Removed in Elasticsearch 6.6")]
82101
GeoTree? IGeoShapeProperty.Tree { get; set; }
102+
103+
[Obsolete("Removed in Elasticsearch 6.6")]
83104
int? IGeoShapeProperty.TreeLevels { get; set; }
84105

85106
bool? IGeoShapeProperty.Coerce { get; set; }

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public interface IGeoShapeProperty : IDocValuesProperty
8383
/// Elasticsearch set this parameter automatically.
8484
/// </summary>
8585
[JsonProperty("strategy")]
86+
[Obsolete("Removed in Elasticsearch 6.6")]
8687
GeoStrategy? Strategy { get; set; }
8788

8889
/// <summary>
@@ -139,6 +140,7 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { }
139140
public Distance Precision { get; set; }
140141

141142
/// <inheritdoc />
143+
[Obsolete("Removed in Elasticsearch 6.6")]
142144
public GeoStrategy? Strategy { get; set; }
143145

144146
/// <inheritdoc />
@@ -161,18 +163,23 @@ public class GeoShapePropertyDescriptor<T>
161163
{
162164
public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }
163165

164-
165-
[Obsolete("Removed in Elasticsearch 6.6")]
166-
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
167166
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
168167
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
168+
169169
GeoOrientation? IGeoShapeProperty.Orientation { get; set; }
170170

171+
bool? IGeoShapeProperty.Coerce { get; set; }
172+
173+
[Obsolete("Removed in Elasticsearch 6.6")]
174+
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
175+
171176
[Obsolete("Removed in Elasticsearch 6.6")]
172177
bool? IGeoShapeProperty.PointsOnly { get; set; }
173178

174179
[Obsolete("Removed in Elasticsearch 6.6")]
175180
Distance IGeoShapeProperty.Precision { get; set; }
181+
182+
[Obsolete("Removed in Elasticsearch 6.6")]
176183
GeoStrategy? IGeoShapeProperty.Strategy { get; set; }
177184

178185
[Obsolete("Removed in Elasticsearch 6.6")]
@@ -181,10 +188,7 @@ public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }
181188
[Obsolete("Removed in Elasticsearch 6.6")]
182189
int? IGeoShapeProperty.TreeLevels { get; set; }
183190

184-
bool? IGeoShapeProperty.Coerce { get; set; }
185-
186191
/// <inheritdoc cref="IGeoShapeProperty.Tree" />
187-
188192
[Obsolete("Removed in Elasticsearch 6.6")]
189193
public GeoShapePropertyDescriptor<T> Tree(GeoTree? tree) => Assign(tree, (a, v) => a.Tree = v);
190194

@@ -193,6 +197,7 @@ public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }
193197
public GeoShapePropertyDescriptor<T> TreeLevels(int? treeLevels) => Assign(treeLevels, (a, v) => a.TreeLevels = v);
194198

195199
/// <inheritdoc cref="IGeoShapeProperty.Strategy" />
200+
[Obsolete("Removed in Elasticsearch 6.6")]
196201
public GeoShapePropertyDescriptor<T> Strategy(GeoStrategy? strategy) => Assign(strategy, (a, v) => a.Strategy = v);
197202

198203
/// <inheritdoc cref="IGeoShapeProperty.Precision" />

src/Tests/Tests/Mapping/Types/Geo/GeoShape/GeoShapeAttributeTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Nest;
1+
#pragma warning disable 612, 618
2+
using Nest;
23

34
namespace Tests.Mapping.Types.Geo.GeoShape
45
{
@@ -43,3 +44,4 @@ public class GeoShapeAttributeTests : AttributeTestsBase<GeoShapeTest>
4344
};
4445
}
4546
}
47+
#pragma warning restore 612, 618

src/Tests/Tests/Mapping/Types/Geo/GeoShape/GeoShapeClusterMetadataApiTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#pragma warning disable 612, 618
12
using System;
23
using System.Linq;
34
using Elasticsearch.Net;
@@ -85,3 +86,4 @@ protected override void ExpectResponse(IPutMappingResponse response)
8586
}
8687
}
8788
}
89+
#pragma warning restore 612, 618

src/Tests/Tests/Mapping/Types/Geo/GeoShape/GeoShapePropertyTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#pragma warning disable 612, 618
2+
using System;
23
using Nest;
34
using Tests.Core.ManagedElasticsearch.Clusters;
45
using Tests.Domain;
@@ -58,3 +59,4 @@ public GeoShapePropertyTests(WritableCluster cluster, EndpointUsage usage) : bas
5859
};
5960
}
6061
}
62+
#pragma warning restore 612, 618

src/Tests/Tests/QueryDsl/Geo/GeoShapeSerializationTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#pragma warning disable 612, 618
2+
using System;
23
using System.Collections.Generic;
34
using System.IO;
45
using System.Linq;
@@ -253,3 +254,4 @@ protected override void ExpectResponse(ISearchResponse<Domain.Shape> response)
253254
}
254255
}
255256
}
257+
#pragma warning restore 612, 618

src/Tests/Tests/XPack/Ilm/IlmApiTests.cs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#pragma warning disable 612, 618
12
using System;
23
using System.Collections.Generic;
34
using System.Linq;
@@ -40,14 +41,15 @@ public IlmApiTests(XPackCluster cluster, EndpointUsage usage) : base(new Coordin
4041
)
4142
},
4243
{
43-
IlmExplainLifecycleStep, u => u.Calls<ExplainLifecycleDescriptor, ExplainLifecycleRequest, IExplainLifecycleRequest, IExplainLifecycleResponse>(
44-
v => new ExplainLifecycleRequest("project"),
45-
(v, d) => d,
46-
(v, c, f) => c.ExplainLifecycle("project", f),
47-
(v, c, f) => c.ExplainLifecycleAsync("project", f),
48-
(v, c, r) => c.ExplainLifecycle(r),
49-
(v, c, r) => c.ExplainLifecycleAsync(r)
50-
)
44+
IlmExplainLifecycleStep, u =>
45+
u.Calls<ExplainLifecycleDescriptor, ExplainLifecycleRequest, IExplainLifecycleRequest, IExplainLifecycleResponse>(
46+
v => new ExplainLifecycleRequest("project"),
47+
(v, d) => d,
48+
(v, c, f) => c.ExplainLifecycle("project", f),
49+
(v, c, f) => c.ExplainLifecycleAsync("project", f),
50+
(v, c, r) => c.ExplainLifecycle(r),
51+
(v, c, r) => c.ExplainLifecycleAsync(r)
52+
)
5153
},
5254
{
5355
IlmGetStatusStep, u => u.Calls<GetIlmStatusDescriptor, GetIlmStatusRequest, IGetIlmStatusRequest, IGetIlmStatusResponse>(
@@ -81,7 +83,7 @@ public IlmApiTests(XPackCluster cluster, EndpointUsage usage) : base(new Coordin
8183
Hot = new Phase
8284
{
8385
MinimumAge = "1d",
84-
Actions = new LifecycleActions
86+
Actions = new LifecycleActions
8587
{
8688
new RolloverLifecycleAction
8789
{
@@ -103,14 +105,12 @@ public IlmApiTests(XPackCluster cluster, EndpointUsage usage) : base(new Coordin
103105
},
104106
(v, d) => d
105107
.Policy(p => p.Phases(a => a.Warm(w => w.MinimumAge("10d")
106-
.Actions(ac => ac.ForceMerge(f => f.MaximumNumberOfSegments(1))))
107-
.Hot(h => h.MinimumAge("1d")
108-
.Actions(ac => ac.Rollover(r => r.MaximumDocuments(1_000_000)
109-
#pragma warning disable 612, 618
110-
.MaximumSize(40_000_000_000))))
111-
#pragma warning restore 612, 618
112-
.Delete(w => w.MinimumAge("30d")
113-
.Actions(ac => ac.Delete(f => f)))))
108+
.Actions(ac => ac.ForceMerge(f => f.MaximumNumberOfSegments(1))))
109+
.Hot(h => h.MinimumAge("1d")
110+
.Actions(ac => ac.Rollover(r => r.MaximumDocuments(1_000_000)
111+
.MaximumSize(40_000_000_000))))
112+
.Delete(w => w.MinimumAge("30d")
113+
.Actions(ac => ac.Delete(f => f)))))
114114
,
115115
(v, c, f) => c.PutLifecycle("policy" + v, f),
116116
(v, c, f) => c.PutLifecycleAsync("policy" + v, f),
@@ -149,14 +149,15 @@ public IlmApiTests(XPackCluster cluster, EndpointUsage usage) : base(new Coordin
149149
)
150150
},
151151
{
152-
IlmDeleteLifecycleStep, u => u.Calls<DeleteLifecycleDescriptor, DeleteLifecycleRequest, IDeleteLifecycleRequest, IDeleteLifecycleResponse>(
153-
v => new DeleteLifecycleRequest("policy" + v),
154-
(v, d) => d,
155-
(v, c, f) => c.DeleteLifecycle("policy" + v, f),
156-
(v, c, f) => c.DeleteLifecycleAsync("policy" + v, f),
157-
(v, c, r) => c.DeleteLifecycle(r),
158-
(v, c, r) => c.DeleteLifecycleAsync(r)
159-
)
152+
IlmDeleteLifecycleStep, u =>
153+
u.Calls<DeleteLifecycleDescriptor, DeleteLifecycleRequest, IDeleteLifecycleRequest, IDeleteLifecycleResponse>(
154+
v => new DeleteLifecycleRequest("policy" + v),
155+
(v, d) => d,
156+
(v, c, f) => c.DeleteLifecycle("policy" + v, f),
157+
(v, c, f) => c.DeleteLifecycleAsync("policy" + v, f),
158+
(v, c, r) => c.DeleteLifecycle(r),
159+
(v, c, r) => c.DeleteLifecycleAsync(r)
160+
)
160161
},
161162
{
162163
IlmStopStep, u => u.Calls<StopIlmDescriptor, StopIlmRequest, IStopIlmRequest, IStopIlmResponse>(
@@ -272,3 +273,4 @@ [I] public async Task IlmDeleteLifecycleResponse() => await Assert<DeleteLifecyc
272273
});
273274
}
274275
}
276+
#pragma warning restore 612, 618

0 commit comments

Comments
 (0)