Skip to content

Commit 843fd4d

Browse files
authored
Remove lombok.
Original Pull Request #1735 Closes #1734
1 parent ebac4c0 commit 843fd4d

File tree

68 files changed

+6005
-1693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+6005
-1693
lines changed

Diff for: pom.xml

+22
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@
226226
<scope>test</scope>
227227
</dependency>
228228

229+
<!--
230+
we don't use lombok in Spring Data Elasticsearch anymore. But the dependency is set in the parent project, and so the
231+
lombok compiler stuff is executed regardless of the fact that we don't need it.
232+
On AdoptOpenJdk 16.0.0 this leads to an error, so the project does not build.
233+
Therefore we replace lombok with a jar - that just contains an empty file - that lives in a local maven repository in
234+
src/test/resources/local-maven-repo/
235+
It was installed with
236+
mvn deploy:deploy-file -DgroupId=org.projectlombok -DartifactId=lombok -Dversion=999999 -Durl=file:./src/test/resources/local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=path/to/empty.jar
237+
-->
238+
<dependency>
239+
<groupId>org.projectlombok</groupId>
240+
<artifactId>lombok</artifactId>
241+
<version>999999</version>
242+
<scope>test</scope>
243+
</dependency>
244+
229245
<dependency>
230246
<groupId>org.apache.openwebbeans.test</groupId>
231247
<artifactId>cditest-owb</artifactId>
@@ -435,6 +451,12 @@
435451
<id>spring-libs-snapshot</id>
436452
<url>https://repo.spring.io/libs-snapshot</url>
437453
</repository>
454+
455+
<repository>
456+
<id>local-maven-repo</id>
457+
<url>file:///${project.basedir}/src/test/resources/local-maven-repo</url>
458+
</repository>
459+
438460
</repositories>
439461

440462
<pluginRepositories>

Diff for: src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java

+211-58
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
import static org.elasticsearch.index.query.QueryBuilders.*;
2020
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;
2121

22-
import lombok.Data;
23-
import lombok.Getter;
24-
import lombok.Setter;
25-
2622
import java.util.ArrayList;
2723
import java.util.Arrays;
2824
import java.util.Collection;
@@ -53,6 +49,7 @@
5349
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
5450
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
5551
import org.springframework.data.elasticsearch.utils.IndexInitializer;
52+
import org.springframework.lang.Nullable;
5653
import org.springframework.test.context.ContextConfiguration;
5754

5855
/**
@@ -384,82 +381,238 @@ public void shouldIndexAndSearchMapAsNestedType() {
384381
assertThat(books.getSearchHit(0).getContent().getId()).isEqualTo(book2.getId());
385382
}
386383

387-
@Setter
388-
@Getter
389384
@Document(indexName = "test-index-book-nested-objects", replicas = 0, refreshInterval = "-1")
390385
static class Book {
391386

392-
@Id private String id;
393-
private String name;
394-
@Field(type = FieldType.Object) private Author author;
395-
@Field(type = FieldType.Nested) private Map<Integer, Collection<String>> buckets = new HashMap<>();
396-
@MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"),
387+
@Nullable @Id private String id;
388+
@Nullable private String name;
389+
@Nullable @Field(type = FieldType.Object) private Author author;
390+
@Nullable @Field(type = FieldType.Nested) private Map<Integer, Collection<String>> buckets = new HashMap<>();
391+
@Nullable @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"),
397392
otherFields = { @InnerField(suffix = "prefix", type = FieldType.Text, analyzer = "stop",
398393
searchAnalyzer = "standard") }) private String description;
394+
395+
@Nullable
396+
public String getId() {
397+
return id;
398+
}
399+
400+
public void setId(@Nullable String id) {
401+
this.id = id;
402+
}
403+
404+
@Nullable
405+
public String getName() {
406+
return name;
407+
}
408+
409+
public void setName(@Nullable String name) {
410+
this.name = name;
411+
}
412+
413+
@Nullable
414+
public Author getAuthor() {
415+
return author;
416+
}
417+
418+
public void setAuthor(@Nullable Author author) {
419+
this.author = author;
420+
}
421+
422+
@Nullable
423+
public Map<Integer, Collection<String>> getBuckets() {
424+
return buckets;
425+
}
426+
427+
public void setBuckets(@Nullable Map<Integer, Collection<String>> buckets) {
428+
this.buckets = buckets;
429+
}
430+
431+
@Nullable
432+
public String getDescription() {
433+
return description;
434+
}
435+
436+
public void setDescription(@Nullable String description) {
437+
this.description = description;
438+
}
399439
}
400440

401-
@Data
402441
@Document(indexName = "test-index-person", replicas = 0, refreshInterval = "-1")
403442
static class Person {
404-
405-
@Id private String id;
406-
407-
private String name;
408-
409-
@Field(type = FieldType.Nested) private List<Car> car;
410-
411-
@Field(type = FieldType.Nested, includeInParent = true) private List<Book> books;
443+
@Nullable @Id private String id;
444+
@Nullable private String name;
445+
@Nullable @Field(type = FieldType.Nested) private List<Car> car;
446+
@Nullable @Field(type = FieldType.Nested, includeInParent = true) private List<Book> books;
447+
448+
@Nullable
449+
public String getId() {
450+
return id;
451+
}
452+
453+
public void setId(@Nullable String id) {
454+
this.id = id;
455+
}
456+
457+
@Nullable
458+
public String getName() {
459+
return name;
460+
}
461+
462+
public void setName(@Nullable String name) {
463+
this.name = name;
464+
}
465+
466+
@Nullable
467+
public List<Car> getCar() {
468+
return car;
469+
}
470+
471+
public void setCar(@Nullable List<Car> car) {
472+
this.car = car;
473+
}
474+
475+
@Nullable
476+
public List<Book> getBooks() {
477+
return books;
478+
}
479+
480+
public void setBooks(@Nullable List<Book> books) {
481+
this.books = books;
482+
}
412483
}
413484

414-
@Data
415485
static class Car {
416-
417-
private String name;
418-
private String model;
486+
@Nullable private String name;
487+
@Nullable private String model;
488+
489+
@Nullable
490+
public String getName() {
491+
return name;
492+
}
493+
494+
public void setName(String name) {
495+
this.name = name;
496+
}
497+
498+
@Nullable
499+
public String getModel() {
500+
return model;
501+
}
502+
503+
public void setModel(String model) {
504+
this.model = model;
505+
}
419506
}
420507

421-
/**
422-
* @author Rizwan Idrees
423-
* @author Mohsin Husen
424-
* @author Artur Konczak
425-
*/
426-
@Data
427508
@Document(indexName = "test-index-person-multiple-level-nested", replicas = 0, refreshInterval = "-1")
428509
static class PersonMultipleLevelNested {
429-
430-
@Id private String id;
431-
432-
private String name;
433-
434-
@Field(type = FieldType.Nested) private List<GirlFriend> girlFriends;
435-
436-
@Field(type = FieldType.Nested) private List<Car> cars;
437-
438-
@Field(type = FieldType.Nested, includeInParent = true) private List<Car> bestCars;
510+
@Nullable @Id private String id;
511+
@Nullable private String name;
512+
@Nullable @Field(type = FieldType.Nested) private List<GirlFriend> girlFriends;
513+
@Nullable @Field(type = FieldType.Nested) private List<Car> cars;
514+
@Nullable @Field(type = FieldType.Nested, includeInParent = true) private List<Car> bestCars;
515+
516+
@Nullable
517+
public String getId() {
518+
return id;
519+
}
520+
521+
public void setId(@Nullable String id) {
522+
this.id = id;
523+
}
524+
525+
@Nullable
526+
public String getName() {
527+
return name;
528+
}
529+
530+
public void setName(@Nullable String name) {
531+
this.name = name;
532+
}
533+
534+
@Nullable
535+
public List<GirlFriend> getGirlFriends() {
536+
return girlFriends;
537+
}
538+
539+
public void setGirlFriends(@Nullable List<GirlFriend> girlFriends) {
540+
this.girlFriends = girlFriends;
541+
}
542+
543+
@Nullable
544+
public List<Car> getCars() {
545+
return cars;
546+
}
547+
548+
public void setCars(@Nullable List<Car> cars) {
549+
this.cars = cars;
550+
}
551+
552+
@Nullable
553+
public List<Car> getBestCars() {
554+
return bestCars;
555+
}
556+
557+
public void setBestCars(@Nullable List<Car> bestCars) {
558+
this.bestCars = bestCars;
559+
}
439560
}
440561

441-
/**
442-
* @author Mohsin Husen
443-
*/
444-
@Data
445562
static class GirlFriend {
446-
447-
private String name;
448-
449-
private String type;
450-
451-
@Field(type = FieldType.Nested) private List<Car> cars;
563+
@Nullable private String name;
564+
@Nullable private String type;
565+
@Nullable @Field(type = FieldType.Nested) private List<Car> cars;
566+
567+
@Nullable
568+
public String getName() {
569+
return name;
570+
}
571+
572+
public void setName(@Nullable String name) {
573+
this.name = name;
574+
}
575+
576+
@Nullable
577+
public String getType() {
578+
return type;
579+
}
580+
581+
public void setType(@Nullable String type) {
582+
this.type = type;
583+
}
584+
585+
@Nullable
586+
public List<Car> getCars() {
587+
return cars;
588+
}
589+
590+
public void setCars(@Nullable List<Car> cars) {
591+
this.cars = cars;
592+
}
452593
}
453594

454-
/**
455-
* @author Rizwan Idrees
456-
* @author Mohsin Husen
457-
*/
458-
@Data
459595
static class Author {
460-
461-
private String id;
462-
private String name;
596+
@Nullable private String id;
597+
@Nullable private String name;
598+
599+
@Nullable
600+
public String getId() {
601+
return id;
602+
}
603+
604+
public void setId(@Nullable String id) {
605+
this.id = id;
606+
}
607+
608+
@Nullable
609+
public String getName() {
610+
return name;
611+
}
612+
613+
public void setName(@Nullable String name) {
614+
this.name = name;
615+
}
463616
}
464617

465618
}

0 commit comments

Comments
 (0)