Skip to content

Commit b2991dc

Browse files
authored
Merge pull request #391 from xdev-software/develop
Release
2 parents f0c1fbe + fb859eb commit b2991dc

52 files changed

Lines changed: 673 additions & 837 deletions

Some content is hidden

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

.config/checkstyle/checkstyle.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@
7979
<property name="format" value="^(?!(.*(Map|List|Set))$).+$"/>
8080
<property name="tokens" value="PARAMETER_DEF, VARIABLE_DEF, PATTERN_VARIABLE_DEF, RECORD_COMPONENT_DEF, LAMBDA"/>
8181
</module>
82+
<!-- Name classes correctly and don't use generic name for everything -->
83+
<module name="IllegalIdentifierName">
84+
<property name="format" value="^(?!(.*(Helper|Util(s|ity)?))$).+$"/>
85+
<property name="tokens" value=" CLASS_DEF"/>
86+
</module>
8287
<module name="IllegalImport"/>
88+
<module name="IllegalSymbol"/>
8389
<module name="InterfaceIsType"/>
84-
<module name="JavadocStyle">
85-
<property name="checkFirstSentence" value="false"/>
86-
</module>
90+
<module name="JavadocContentLocation"/>
8791
<module name="LeftCurly">
8892
<!-- Default minus Lambda -->
8993
<property name="tokens" value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, INTERFACE_DEF, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF, OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
@@ -140,6 +144,8 @@
140144
<module name="UnnecessarySemicolonInTryWithResources"/>
141145
<module name="UnusedImports"/>
142146
<module name="UnusedLocalVariable"/>
147+
<!-- Disabled by default; should be enabled on Java 25+ -->
148+
<!-- <module name="UnusedTryResourceShouldBeUnnamed"/> -->
143149
<module name="UpperEll"/>
144150
<module name="VisibilityModifier">
145151
<property name="packageAllowed" value="true"/>

.config/pmd/java/ruleset.xml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<!-- About: Formatting -->
1414
<!-- Some lines (e.g. description, examples and CDATA) have to start without any indents or this will result in incorrect formatting -->
1515

16+
<rule ref="category/java/bestpractices.xml/AssertStatementInTest"/>
1617
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace"/>
1718
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
1819
<rule ref="category/java/bestpractices.xml/ConstantsInInterface"/>
@@ -45,8 +46,10 @@
4546
<rule ref="category/java/codestyle.xml/LambdaCanBeMethodReference"/>
4647
<rule ref="category/java/codestyle.xml/NoPackage"/>
4748
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
49+
<rule ref="category/java/codestyle.xml/UnnecessaryBlock"/>
4850
<rule ref="category/java/codestyle.xml/UnnecessarySemicolon"/>
4951
<rule ref="category/java/codestyle.xml/VariableCanBeInlined"/>
52+
<rule ref="category/java/codestyle.xml/VariableDeclarationUsageDistance"/>
5053

5154
<rule ref="category/java/design.xml">
5255
<!-- Sometimes abstract classes have just fields -->
@@ -138,6 +141,7 @@
138141
</properties>
139142
</rule>
140143

144+
<rule ref="category/java/errorprone.xml/AssertEqualsArgumentOrder"/>
141145
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
142146
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
143147
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
@@ -146,7 +150,6 @@
146150
<rule ref="category/java/errorprone.xml/CollectionTypeMismatch"/>
147151
<rule ref="category/java/errorprone.xml/ComparisonWithNaN"/>
148152
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
149-
<rule ref="category/java/errorprone.xml/DontImportSun"/>
150153
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
151154
<rule ref="category/java/errorprone.xml/EqualsNull"/>
152155
<rule ref="category/java/errorprone.xml/IdempotentOperations"/>
@@ -155,6 +158,7 @@
155158
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
156159
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
157160
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
161+
<rule ref="category/java/errorprone.xml/JUnitJupiterTestNoPrivateModifier"/>
158162
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
159163
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
160164
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
@@ -164,6 +168,7 @@
164168
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
165169
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
166170
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
171+
<rule ref="category/java/errorprone.xml/UnsupportedJdkApiUsage"/>
167172
<rule ref="category/java/errorprone.xml/UselessPureMethodCall"/>
168173

169174

@@ -208,6 +213,36 @@
208213
<rule ref="category/java/security.xml"/>
209214

210215

216+
<rule name="AvoidOptionalGet"
217+
language="java"
218+
message="Avoid using Optional#get"
219+
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule"
220+
externalInfoUrl="https://stackoverflow.com/a/49159955">
221+
<description>
222+
`Optional#get` can be interpreted as a getter by developers, however this is not the case as it throws an exception when empty.
223+
224+
It should be replaced by
225+
* doing a mapping directly using `.map` or `.ifPresent`
226+
* using the preferred `.orElseThrow`, `.orElse` or `.or` methods
227+
228+
Java Developer Brian Goetz also writes regarding this topic:
229+
230+
> Java 8 was a huge improvement to the platform, but one of the few mistakes we made was the naming of `Optional.get()`, because the name just invites people to call it without calling `isPresent()`, undermining the whole point of using `Optional` in the first place.
231+
>
232+
> During the Java 9 time frame, we proposed to deprecate `Optional.get()`, but the public response to that was ... let's say cold. As a smaller step, we introduced `orElseThrow()` in 10 (see [JDK-8140281](https://bugs.openjdk.java.net/browse/JDK-8140281)) as a more transparently named synonym for the current pernicious behavior of `get()`. IDEs warn on unconditional use of `get()`, but not on `orElseThrow()`, which is a step forward in teaching people to code better. The question is, in a sense, a "glass half empty" view of the current situation; `get()` is still problematic.
233+
</description>
234+
<priority>3</priority>
235+
<properties>
236+
<property name="xpath">
237+
<value>
238+
<![CDATA[
239+
//MethodCall[pmd-java:matchesSig('java.util.Optional#get()')]
240+
]]>
241+
</value>
242+
</property>
243+
</properties>
244+
</rule>
245+
211246
<rule name="AvoidStringBuilderOrBuffer"
212247
language="java"
213248
message="StringBuilder/StringBuffer should not be used"
@@ -387,7 +422,8 @@ If you are 100% sure that you escaped the value properly and you have no better
387422
<value>
388423
<![CDATA[
389424
//ConstructorCall[pmd-java:typeIs('com.vaadin.flow.component.Html')] |
390-
//MethodCall[@MethodName='setAttribute' and //ImportDeclaration[starts-with(@PackageName,'com.vaadin')]]/ArgumentList/StringLiteral[1][contains(lower-case(@Image),'html')]
425+
//MethodCall[@MethodName='setAttribute' and //ImportDeclaration[starts-with(@PackageName,'com.vaadin')]]/ArgumentList/StringLiteral[1][contains(lower-case(@Image),'html')] |
426+
//MethodCall[pmd-java:matchesSig('com.vaadin.flow.dom.Element#setProperty(java.lang.String,java.lang.String)')]/ArgumentList/StringLiteral[1][contains(lower-case(@Image),'html')]
391427
]]>
392428
</value>
393429
</property>
@@ -410,7 +446,7 @@ A `Set` also prevents duplicates when the ORM reads multiple identical rows from
410446
<value>
411447
<![CDATA[
412448
//ClassDeclaration[pmd-java:hasAnnotation('jakarta.persistence.Entity')]
413-
//FieldDeclaration[pmd-java:hasAnnotation('jakarta.persistence.ManyToMany') or pmd-java:hasAnnotation('jakarta.persistence.OneToMany')]
449+
//FieldDeclaration[pmd-java:hasAnnotation('jakarta.persistence.ManyToMany') or pmd-java:hasAnnotation('jakarta.persistence.OneToMany') or pmd-java:hasAnnotation('jakarta.persistence.ElementCollection')]
414450
/ClassType[pmd-java:typeIs('java.util.List')]
415451
]]>
416452
</value>

.config/topo/upstream.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- url: https://github.com/xdev-software/openapi-client-maven-template.git
2+
branch: master

.github/.lycheeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Ignorefile for broken link check
22
localhost
33
mvnrepository.com
4+
stackoverflow.com

.github/workflows/broken-links.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Broken links
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: "23 23 * * 0"
6+
- cron: "23 5 * * 0"
77

88
permissions:
99
issues: write
@@ -13,14 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 15
1515
steps:
16-
- uses: actions/checkout@v6
16+
- uses: actions/checkout@v7
1717

1818
- run: mv .github/.lycheeignore .lycheeignore
1919

2020
- name: Link Checker
2121
id: lychee
22-
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2
22+
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2
2323
with:
24+
args: "--verbose --no-progress './**/*.md'"
2425
fail: false # Don't fail on broken links, create an issue instead
2526

2627
- name: Find already existing issue

.github/workflows/check-build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
java: [17, 21, 25]
3232
distribution: [temurin]
3333
steps:
34-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@v7
3535

3636
- name: Set up JDK
3737
uses: actions/setup-java@v5
@@ -40,7 +40,7 @@ jobs:
4040
java-version: ${{ matrix.java }}
4141

4242
- name: Cache Maven
43-
uses: actions/cache@v5
43+
uses: actions/cache@v6
4444
with:
4545
path: ~/.m2/repository
4646
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
@@ -69,7 +69,7 @@ jobs:
6969
fi
7070
7171
- name: Upload demo files
72-
uses: actions/upload-artifact@v6
72+
uses: actions/upload-artifact@v7
7373
with:
7474
name: demo-files-java-${{ matrix.java }}
7575
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
@@ -84,7 +84,7 @@ jobs:
8484
java: [21]
8585
distribution: [temurin]
8686
steps:
87-
- uses: actions/checkout@v6
87+
- uses: actions/checkout@v7
8888

8989
- name: Set up JDK
9090
uses: actions/setup-java@v5
@@ -93,15 +93,15 @@ jobs:
9393
java-version: ${{ matrix.java }}
9494

9595
- name: Cache Maven
96-
uses: actions/cache@v5
96+
uses: actions/cache@v6
9797
with:
9898
path: ~/.m2/repository
9999
key: ${{ runner.os }}-mvn-checkstyle-${{ hashFiles('**/pom.xml') }}
100100
restore-keys: |
101101
${{ runner.os }}-mvn-checkstyle-
102102
103103
- name: CheckStyle Cache
104-
uses: actions/cache@v5
104+
uses: actions/cache@v6
105105
with:
106106
path: '**/target/checkstyle-cachefile'
107107
key: ${{ runner.os }}-checkstyle-${{ hashFiles('**/pom.xml') }}
@@ -120,7 +120,7 @@ jobs:
120120
java: [17]
121121
distribution: [temurin]
122122
steps:
123-
- uses: actions/checkout@v6
123+
- uses: actions/checkout@v7
124124

125125
- name: Set up JDK
126126
uses: actions/setup-java@v5
@@ -129,15 +129,15 @@ jobs:
129129
java-version: ${{ matrix.java }}
130130

131131
- name: Cache Maven
132-
uses: actions/cache@v5
132+
uses: actions/cache@v6
133133
with:
134134
path: ~/.m2/repository
135135
key: ${{ runner.os }}-mvn-pmd-${{ hashFiles('**/pom.xml') }}
136136
restore-keys: |
137137
${{ runner.os }}-mvn-pmd-
138138
139139
- name: PMD Cache
140-
uses: actions/cache@v5
140+
uses: actions/cache@v6
141141
with:
142142
path: '**/target/pmd/pmd.cache'
143143
key: ${{ runner.os }}-pmd-${{ hashFiles('**/pom.xml') }}
@@ -151,8 +151,8 @@ jobs:
151151
run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
152152

153153
- name: Upload report
154-
if: always()
155-
uses: actions/upload-artifact@v6
154+
if: ${{ !cancelled() }}
155+
uses: actions/upload-artifact@v7
156156
with:
157157
name: pmd-report
158158
if-no-files-found: ignore

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
timeout-minutes: 30
2020
steps:
21-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@v7
2222

2323
- name: Set up JDK
2424
uses: actions/setup-java@v5
@@ -28,7 +28,7 @@ jobs:
2828

2929
# Try to reuse existing cache from check-build
3030
- name: Try restore Maven Cache
31-
uses: actions/cache/restore@v5
31+
uses: actions/cache/restore@v6
3232
with:
3333
path: ~/.m2/repository
3434
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
@@ -63,7 +63,7 @@ jobs:
6363
outputs:
6464
upload_url: ${{ steps.create-release.outputs.upload_url }}
6565
steps:
66-
- uses: actions/checkout@v6
66+
- uses: actions/checkout@v7
6767

6868
- name: Configure Git
6969
run: |
@@ -91,7 +91,7 @@ jobs:
9191
9292
- name: Create Release
9393
id: create-release
94-
uses: shogo82148/actions-create-release@559c27ce7eb834825e2b55927c64f6d1bd1db716 # v1
94+
uses: shogo82148/actions-create-release@6a396031bc74c57403da1018fec74d24c6aa03cd # v1
9595
with:
9696
tag_name: v${{ steps.version.outputs.release }}
9797
release_name: v${{ steps.version.outputs.release }}
@@ -115,7 +115,7 @@ jobs:
115115
needs: [prepare-release]
116116
timeout-minutes: 60
117117
steps:
118-
- uses: actions/checkout@v6
118+
- uses: actions/checkout@v7
119119

120120
- name: Init Git and pull
121121
run: |
@@ -163,7 +163,7 @@ jobs:
163163
needs: [prepare-release]
164164
timeout-minutes: 15
165165
steps:
166-
- uses: actions/checkout@v6
166+
- uses: actions/checkout@v7
167167

168168
- name: Init Git and pull
169169
run: |
@@ -179,7 +179,7 @@ jobs:
179179

180180
# Try to reuse existing cache from check-build
181181
- name: Try restore Maven Cache
182-
uses: actions/cache/restore@v5
182+
uses: actions/cache/restore@v6
183183
with:
184184
path: ~/.m2/repository
185185
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
@@ -191,7 +191,7 @@ jobs:
191191
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
192192

193193
- name: Deploy to Github pages
194-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
194+
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4
195195
with:
196196
github_token: ${{ secrets.GITHUB_TOKEN }}
197197
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
@@ -202,7 +202,7 @@ jobs:
202202
needs: [publish-maven]
203203
timeout-minutes: 10
204204
steps:
205-
- uses: actions/checkout@v6
205+
- uses: actions/checkout@v7
206206

207207
- name: Init Git and pull
208208
run: |

0 commit comments

Comments
 (0)