Java 11498 (#12382)

* added parent lombok-modules

* added lombok submodule to parent lombok-modules

* added lombok-2 submodule to parent lombok-modules

* added lombok-custom submodule to parent lombok-modules

* delete lombok submodules that were moved across

Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
panos-kakos 2022-06-20 14:18:59 +01:00 committed by GitHub
parent 033ddb7a41
commit 02c9bdff35
94 changed files with 158 additions and 120 deletions

3
lombok-modules/README.md Normal file
View File

@ -0,0 +1,3 @@
## Project Lombok
This module contains modules about project lombok

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>lombok-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>lombok-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>lombok-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

View File

@ -1,15 +1,15 @@
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 4. Using @Getter on a Boolean Field
*
*/
public class GetterBoolean {
@Getter
private Boolean running = true;
}
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 4. Using @Getter on a Boolean Field
*
*/
public class GetterBoolean {
@Getter
private Boolean running = true;
}

View File

@ -1,16 +1,16 @@
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3. Using @Getter on a boolean Field
*
*/
public class GetterBooleanPrimitive {
@Getter
private boolean running;
}
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3. Using @Getter on a boolean Field
*
*/
public class GetterBooleanPrimitive {
@Getter
private boolean running;
}

View File

@ -1,18 +1,18 @@
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3.2. Two boolean Fields With the Same Accessor Name
*
*/
public class GetterBooleanPrimitiveSameAccessor {
@Getter
boolean running = true;
@Getter
boolean isRunning = false;
}
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3.2. Two boolean Fields With the Same Accessor Name
*
*/
public class GetterBooleanPrimitiveSameAccessor {
@Getter
boolean running = true;
@Getter
boolean isRunning = false;
}

View File

@ -1,13 +1,13 @@
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3.1. A boolean Field Having the Same Name With Its Accessor
*
*/
public class GetterBooleanSameAccessor {
@Getter
private boolean isRunning = true;
}
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 3.1. A boolean Field Having the Same Name With Its Accessor
*
*/
public class GetterBooleanSameAccessor {
@Getter
private boolean isRunning = true;
}

View File

@ -1,15 +1,15 @@
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 4. Using @Getter on a Boolean Field
*
*/
public class GetterBooleanType {
@Getter
private Boolean running = true;
}
package com.baeldung.lombok.getter;
import lombok.Getter;
/**
* Related Article Sections:
* 4. Using @Getter on a Boolean Field
*
*/
public class GetterBooleanType {
@Getter
private Boolean running = true;
}

View File

@ -1,34 +1,34 @@
package com.baeldung.lombok.getter;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class GetterBooleanUnitTest {
@Test
public void whenBasicBooleanField_thenMethodNamePrefixedWithIsFollowedByFieldName() {
GetterBooleanPrimitive lombokExamples = new GetterBooleanPrimitive();
assertFalse(lombokExamples.isRunning());
}
@Test
public void whenBooleanFieldPrefixedWithIs_thenMethodNameIsSameAsFieldName() {
GetterBooleanSameAccessor lombokExamples = new GetterBooleanSameAccessor();
assertTrue(lombokExamples.isRunning());
}
@Test
public void whenTwoBooleanFieldsCauseNamingConflict_thenLombokMapsToFirstDeclaredField() {
GetterBooleanPrimitiveSameAccessor lombokExamples = new GetterBooleanPrimitiveSameAccessor();
assertTrue(lombokExamples.isRunning() == lombokExamples.running);
assertFalse(lombokExamples.isRunning() == lombokExamples.isRunning);
}
@Test
public void whenFieldOfBooleanType_thenLombokPrefixesMethodWithGetInsteadOfIs() {
GetterBooleanType lombokExamples = new GetterBooleanType();
assertTrue(lombokExamples.getRunning());
}
}
package com.baeldung.lombok.getter;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class GetterBooleanUnitTest {
@Test
public void whenBasicBooleanField_thenMethodNamePrefixedWithIsFollowedByFieldName() {
GetterBooleanPrimitive lombokExamples = new GetterBooleanPrimitive();
assertFalse(lombokExamples.isRunning());
}
@Test
public void whenBooleanFieldPrefixedWithIs_thenMethodNameIsSameAsFieldName() {
GetterBooleanSameAccessor lombokExamples = new GetterBooleanSameAccessor();
assertTrue(lombokExamples.isRunning());
}
@Test
public void whenTwoBooleanFieldsCauseNamingConflict_thenLombokMapsToFirstDeclaredField() {
GetterBooleanPrimitiveSameAccessor lombokExamples = new GetterBooleanPrimitiveSameAccessor();
assertTrue(lombokExamples.isRunning() == lombokExamples.running);
assertFalse(lombokExamples.isRunning() == lombokExamples.isRunning);
}
@Test
public void whenFieldOfBooleanType_thenLombokPrefixesMethodWithGetInsteadOfIs() {
GetterBooleanType lombokExamples = new GetterBooleanType();
assertTrue(lombokExamples.getRunning());
}
}

39
lombok-modules/pom.xml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>lombok-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>lombok-modules</name>
<packaging>pom</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath>
</parent>
<modules>
<module>lombok</module>
<module>lombok-2</module>
<module>lombok-custom</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<lombok.version>1.18.20</lombok.version>
</properties>
</project>

View File

@ -475,9 +475,7 @@
<module>libraries-testing</module>
<module>linkrest</module>
<module>logging-modules</module>
<module>lombok</module>
<module>lombok-2</module>
<module>lombok-custom</module>
<module>lombok-modules</module>
<module>lucene</module>
<module>mapstruct</module>
@ -919,9 +917,7 @@
<module>libraries-testing</module>
<module>linkrest</module>
<module>logging-modules</module>
<module>lombok</module>
<module>lombok-2</module>
<module>lombok-custom</module>
<module>lombok-modules</module>
<module>lucene</module>
<module>mapstruct</module>