@@ -216,28 +216,35 @@ public Map<String, Supplier<ClusterState.Custom>> getInitialClusterStateCustomSu
216216 assertTrue (customSuppliers .containsKey (RestoreInProgress .TYPE ));
217217 assertTrue (customSuppliers .containsKey ("foo" ));
218218
219-
220- IllegalStateException ise = expectThrows (IllegalStateException .class ,
221- () -> ClusterModule .getClusterStateCustomSuppliers (Collections .singletonList (new ClusterPlugin () {
222- @ Override
223- public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
224- return Collections .singletonMap (SnapshotsInProgress .TYPE , () -> null );
225- }
226- })));
227- assertEquals (ise .getMessage (), "custom supplier key [snapshots] is registered more than once" );
228-
229- ise = expectThrows (IllegalStateException .class ,
230- () -> ClusterModule .getClusterStateCustomSuppliers (Arrays .asList (new ClusterPlugin () {
231- @ Override
232- public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
233- return Collections .singletonMap ("foo" , () -> null );
234- }
235- }, new ClusterPlugin () {
236- @ Override
237- public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
238- return Collections .singletonMap ("foo" , () -> null );
239- }
240- })));
241- assertEquals (ise .getMessage (), "custom supplier key [foo] is registered more than once" );
219+ {
220+ // Eclipse Neon 2 didn't compile the plugins definition inside the lambda expression,
221+ // probably due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=511750, which is
222+ // fixed in Eclipse Oxygon. Pulled out the plugins definition to make it work in older versions
223+ List <ClusterPlugin > plugins = Collections .singletonList (new ClusterPlugin () {
224+ @ Override
225+ public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
226+ return Collections .singletonMap (SnapshotsInProgress .TYPE , () -> null );
227+ }
228+ });
229+ IllegalStateException ise = expectThrows (IllegalStateException .class ,
230+ () -> ClusterModule .getClusterStateCustomSuppliers (plugins ));
231+ assertEquals (ise .getMessage (), "custom supplier key [snapshots] is registered more than once" );
232+ }
233+ {
234+ List <ClusterPlugin > plugins = Arrays .asList (new ClusterPlugin () {
235+ @ Override
236+ public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
237+ return Collections .singletonMap ("foo" , () -> null );
238+ }
239+ }, new ClusterPlugin () {
240+ @ Override
241+ public Map <String , Supplier <ClusterState .Custom >> getInitialClusterStateCustomSupplier () {
242+ return Collections .singletonMap ("foo" , () -> null );
243+ }
244+ });
245+ IllegalStateException ise = expectThrows (IllegalStateException .class ,
246+ () -> ClusterModule .getClusterStateCustomSuppliers (plugins ));
247+ assertEquals (ise .getMessage (), "custom supplier key [foo] is registered more than once" );
248+ }
242249 }
243250}
0 commit comments