Skip to content

Commit 23d9156

Browse files
authored
Java 48587 Review module names - Week 30 - 2025 (#18783)
1 parent 91b0c9c commit 23d9156

File tree

29 files changed

+144
-142
lines changed

29 files changed

+144
-142
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<artifactId>image-compressing</artifactId>
6+
<artifactId>image-compression</artifactId>
77

88
<parent>
99
<artifactId>parent-modules</artifactId>

image-compressing/src/main/java/com/baeldung/image/compression/ImageCompressor.java renamed to image-compression/src/main/java/com/baeldung/image/compression/ImageCompressor.java

File renamed without changes.

image-compressing/src/main/java/com/baeldung/image/compression/ThumbnailsCompressor.java renamed to image-compression/src/main/java/com/baeldung/image/compression/ThumbnailsCompressor.java

File renamed without changes.

image-compressing/src/test/java/com/baeldung/image/compression/ImageCompressorUnitTest.java renamed to image-compression/src/test/java/com/baeldung/image/compression/ImageCompressorUnitTest.java

File renamed without changes.

image-compressing/src/test/java/com/baeldung/image/compression/ThumbnailsCompressorUnitTest.java renamed to image-compression/src/test/java/com/baeldung/image/compression/ThumbnailsCompressorUnitTest.java

File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<artifactId>jetbrains</artifactId>
6+
<artifactId>jetbrains-annotations</artifactId>
77
<version>1.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
9-
<name>jetbrains</name>
9+
<name>jetbrains-annotations</name>
1010

1111
<parent>
1212
<groupId>com.baeldung</groupId>

jetbrains/src/main/java/com/baeldung/annotations/Demo.java renamed to jetbrains-annotations/src/main/java/com/baeldung/annotations/Demo.java

Lines changed: 112 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,112 @@
1-
package com.baeldung.annotations;
2-
3-
import java.util.List;
4-
5-
import org.apache.commons.lang3.StringUtils;
6-
import org.jetbrains.annotations.Contract;
7-
8-
public class Demo {
9-
10-
@Contract("_ -> new")
11-
Person fromName(String name) {
12-
return new Person().withName(name);
13-
}
14-
15-
@Contract(" -> fail")
16-
void alwaysFail() {
17-
throw new RuntimeException();
18-
}
19-
20-
@Contract(" -> fail")
21-
void doNothingWithWrongContract() {
22-
23-
}
24-
25-
@Contract("_, null -> null; null, _ -> param2; _, !null -> !null")
26-
String concatenateOnlyIfSecondArgumentIsNotNull(String head, String tail) {
27-
if (tail == null) {
28-
return null;
29-
}
30-
if (head == null) {
31-
return tail;
32-
}
33-
return head + tail;
34-
}
35-
36-
void uselessNullCheck() {
37-
String head = "1234";
38-
String tail = "5678";
39-
String concatenation = concatenateOnlyIfSecondArgumentIsNotNull(head, tail);
40-
if (concatenation != null) {
41-
System.out.println(concatenation);
42-
}
43-
}
44-
45-
void uselessNullCheckOnInferredAnnotation() {
46-
if (StringUtils.isEmpty(null)) {
47-
System.out.println("baeldung");
48-
}
49-
}
50-
51-
@Contract(pure = true)
52-
String replace(String string, char oldChar, char newChar) {
53-
return string.replace(oldChar, newChar);
54-
}
55-
56-
@Contract(value = "true -> false; false -> true", pure = true)
57-
boolean not(boolean input) {
58-
return !input;
59-
}
60-
61-
@Contract("true -> new")
62-
void contractExpectsWrongParameterType(List<Integer> integers) {
63-
64-
}
65-
66-
@Contract("_, _ -> new")
67-
void contractExpectsMoreParametersThanMethodHas(String s) {
68-
69-
}
70-
71-
@Contract("_ -> _; null -> !null")
72-
String secondContractClauseNotReachable(String s) {
73-
return "";
74-
}
75-
76-
@Contract("_ -> true")
77-
void contractExpectsWrongReturnType(String s) {
78-
79-
}
80-
81-
// NB: the following examples demonstrate how to use the mutates attribute of the annotation
82-
// This attribute is currently experimental and could be changed or removed in the future
83-
@Contract(mutates = "param")
84-
void incrementArrayFirstElement(Integer[] integers) {
85-
if (integers.length > 0) {
86-
integers[0] = integers[0] + 1;
87-
}
88-
}
89-
90-
@Contract(pure = true, mutates = "param")
91-
void impossibleToMutateParamInPureFunction(List<String> strings) {
92-
if (strings != null) {
93-
strings.forEach(System.out::println);
94-
}
95-
}
96-
97-
@Contract(mutates = "param3")
98-
void impossibleToMutateThirdParamWhenMethodHasOnlyTwoParams(int a, int b) {
99-
100-
}
101-
102-
@Contract(mutates = "param")
103-
void impossibleToMutableImmutableType(String s) {
104-
105-
}
106-
107-
@Contract(mutates = "this")
108-
static void impossibleToMutateThisInStaticMethod() {
109-
110-
}
111-
112-
}
1+
package com.baeldung.annotations;
2+
3+
import java.util.List;
4+
5+
import org.apache.commons.lang3.StringUtils;
6+
import org.jetbrains.annotations.Contract;
7+
8+
public class Demo {
9+
10+
@Contract("_ -> new")
11+
Person fromName(String name) {
12+
return new Person().withName(name);
13+
}
14+
15+
@Contract(" -> fail")
16+
void alwaysFail() {
17+
throw new RuntimeException();
18+
}
19+
20+
@Contract(" -> fail")
21+
void doNothingWithWrongContract() {
22+
23+
}
24+
25+
@Contract("_, null -> null; null, _ -> param2; _, !null -> !null")
26+
String concatenateOnlyIfSecondArgumentIsNotNull(String head, String tail) {
27+
if (tail == null) {
28+
return null;
29+
}
30+
if (head == null) {
31+
return tail;
32+
}
33+
return head + tail;
34+
}
35+
36+
void uselessNullCheck() {
37+
String head = "1234";
38+
String tail = "5678";
39+
String concatenation = concatenateOnlyIfSecondArgumentIsNotNull(head, tail);
40+
if (concatenation != null) {
41+
System.out.println(concatenation);
42+
}
43+
}
44+
45+
void uselessNullCheckOnInferredAnnotation() {
46+
if (StringUtils.isEmpty(null)) {
47+
System.out.println("baeldung");
48+
}
49+
}
50+
51+
@Contract(pure = true)
52+
String replace(String string, char oldChar, char newChar) {
53+
return string.replace(oldChar, newChar);
54+
}
55+
56+
@Contract(value = "true -> false; false -> true", pure = true)
57+
boolean not(boolean input) {
58+
return !input;
59+
}
60+
61+
@Contract("true -> new")
62+
void contractExpectsWrongParameterType(List<Integer> integers) {
63+
64+
}
65+
66+
@Contract("_, _ -> new")
67+
void contractExpectsMoreParametersThanMethodHas(String s) {
68+
69+
}
70+
71+
@Contract("_ -> _; null -> !null")
72+
String secondContractClauseNotReachable(String s) {
73+
return "";
74+
}
75+
76+
@Contract("_ -> true")
77+
void contractExpectsWrongReturnType(String s) {
78+
79+
}
80+
81+
// NB: the following examples demonstrate how to use the mutates attribute of the annotation
82+
// This attribute is currently experimental and could be changed or removed in the future
83+
@Contract(mutates = "param")
84+
void incrementArrayFirstElement(Integer[] integers) {
85+
if (integers.length > 0) {
86+
integers[0] = integers[0] + 1;
87+
}
88+
}
89+
90+
@Contract(pure = true, mutates = "param")
91+
void impossibleToMutateParamInPureFunction(List<String> strings) {
92+
if (strings != null) {
93+
strings.forEach(System.out::println);
94+
}
95+
}
96+
97+
@Contract(mutates = "param3")
98+
void impossibleToMutateThirdParamWhenMethodHasOnlyTwoParams(int a, int b) {
99+
100+
}
101+
102+
@Contract(mutates = "param")
103+
void impossibleToMutableImmutableType(String s) {
104+
105+
}
106+
107+
@Contract(mutates = "this")
108+
static void impossibleToMutateThisInStaticMethod() {
109+
110+
}
111+
112+
}

jetbrains/src/main/java/com/baeldung/annotations/Person.java renamed to jetbrains-annotations/src/main/java/com/baeldung/annotations/Person.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.baeldung.annotations;
2-
3-
import org.jetbrains.annotations.Contract;
4-
5-
public class Person {
6-
7-
String name;
8-
9-
@Contract("_ -> this")
10-
Person withName(String name) {
11-
this.name = name;
12-
return this;
13-
}
14-
15-
}
1+
package com.baeldung.annotations;
2+
3+
import org.jetbrains.annotations.Contract;
4+
5+
public class Person {
6+
7+
String name;
8+
9+
@Contract("_ -> this")
10+
Person withName(String name) {
11+
this.name = name;
12+
return this;
13+
}
14+
15+
}

maven-modules/maven-plugin-management/submodule-1/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<artifactId>plugin-management</artifactId>
1010
<groupId>com.baeldung</groupId>
1111
<version>1.0.0-SNAPSHOT</version>
12+
<relativePath>../pom.xml</relativePath>
1213
</parent>
1314

1415
<build>

0 commit comments

Comments
 (0)