Skip to content

Commit 426becf

Browse files
fix: Compile with Java 23 (language level 17) (#848)
1 parent ee16766 commit 426becf

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

codestyle/pmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes">
2828
<priority>3</priority>
2929
</rule>
30-
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement">
30+
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitch">
3131
<priority>3</priority>
3232
</rule>
3333
<rule ref="category/java/bestpractices.xml/PreserveStackTrace">

datamodel/odata-generator-utility/src/main/java/com/sap/cloud/sdk/datamodel/odata/utility/ServiceNameMappings.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,25 @@ private record Value( @Nonnull String value, @Nonnull String comment )
3838
{
3939
}
4040

41+
private ServiceNameMappings( @Nonnull final Path file )
42+
{
43+
this.file = file;
44+
}
45+
4146
/**
4247
* Creates a new instance of {@link ServiceNameMappings} with the specified file.
4348
*
4449
* @param file
4550
* the file to read and write mappings from/to
4651
*/
47-
public ServiceNameMappings( @Nonnull final Path file )
52+
@Nonnull
53+
public static ServiceNameMappings load( @Nonnull final Path file )
4854
{
49-
this.file = file;
55+
final ServiceNameMappings mappings = new ServiceNameMappings(file);
5056
if( Files.exists(file) ) {
51-
populateMappings();
57+
mappings.populateMappings();
5258
}
59+
return mappings;
5360
}
5461

5562
/**

datamodel/odata-v4/odata-v4-generator/src/main/java/com/sap/cloud/sdk/datamodel/odatav4/generator/ODataToVdmGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private void cleanDirectory( final File outputDir )
293293

294294
private ServiceNameMappings loadPropertiesConfiguration( final File serviceMappingsFile )
295295
{
296-
return new ServiceNameMappings(serviceMappingsFile.toPath());
296+
return ServiceNameMappings.load(serviceMappingsFile.toPath());
297297
}
298298

299299
// Schema definitions are necessary to make the EDMX properties explorable through Olingo API at runtime, example:
@@ -334,7 +334,7 @@ static List<CsdlSchema> loadEdmxSchemas()
334334
private void storeConfiguration( final File serviceMappingsFile, final Iterable<Service> allODataServices )
335335
{
336336
ensureFileExists(serviceMappingsFile);
337-
final ServiceNameMappings mappings = new ServiceNameMappings(serviceMappingsFile.toPath());
337+
final ServiceNameMappings mappings = ServiceNameMappings.load(serviceMappingsFile.toPath());
338338

339339
for( final Service oDataService : allODataServices ) {
340340
final String javaClassNameKey = oDataService.getName() + Service.SERVICE_MAPPINGS_CLASS_SUFFIX;

datamodel/odata/odata-generator/src/main/java/com/sap/cloud/sdk/datamodel/odata/generator/ODataToVdmGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ private void cleanDirectory( final File outputDir )
288288

289289
private ServiceNameMappings loadPropertiesConfiguration( final File serviceMappingsFile )
290290
{
291-
return new ServiceNameMappings(serviceMappingsFile.toPath());
291+
return ServiceNameMappings.load(serviceMappingsFile.toPath());
292292
}
293293

294294
private void storeConfiguration( final File serviceMappingsFile, final Iterable<Service> allODataServices )
295295
{
296296
ensureFileExists(serviceMappingsFile);
297-
final ServiceNameMappings mappings = new ServiceNameMappings(serviceMappingsFile.toPath());
297+
final ServiceNameMappings mappings = ServiceNameMappings.load(serviceMappingsFile.toPath());
298298

299299
for( final Service oDataService : allODataServices ) {
300300
final String javaClassNameKey = oDataService.getName() + Service.SERVICE_MAPPINGS_CLASS_SUFFIX;

0 commit comments

Comments
 (0)