Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
<maven-jar-plugin.version>3.5.0</maven-jar-plugin.version>
<spring-javaformat-maven-plugin.version>0.0.47</spring-javaformat-maven-plugin.version>
<error-prone.version>2.44.0</error-prone.version>
<nullaway.version>0.12.12</nullaway.version>
<error-prone.version>2.45.0</error-prone.version>
<nullaway.version>0.12.14</nullaway.version>
</properties>

<build>
Expand Down Expand Up @@ -180,9 +180,10 @@
<compilerArg>
-Xplugin:ErrorProne
<!-- Check JSpecify annotations -->
-Xep:RequireExplicitNullMarking:ERROR
-Xep:NullAway:ERROR
-XepOpt:NullAway:JSpecifyMode=true
-XepOpt:NullAway:OnlyNullMarked
-XepOpt:NullAway:JSpecifyMode=true
-XepOpt:NullAway:OnlyNullMarked
-XepOpt:NullAway:SuppressionNameAliases=DataFlowIssue
<!-- https://github.com/uber/NullAway/issues/162 -->
-XepExcludedPaths:.*/src/test/java/.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
*
* @author Michael Minella
*/
package org.springframework.batch.core.annotation;
@NullMarked
package org.springframework.batch.core.annotation;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Stream;

import org.jspecify.annotations.Nullable;
import org.springframework.aop.SpringProxy;
import org.springframework.aop.framework.Advised;
import org.springframework.aot.hint.ExecutableMode;
Expand Down Expand Up @@ -91,7 +92,7 @@
public class CoreRuntimeHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {

Set<String> jdkTypes = Set.of("java.time.Ser", "java.util.Collections$SynchronizedSet",
"java.util.Collections$SynchronizedCollection", "java.util.concurrent.locks.ReentrantLock$Sync",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Core implementations of Spring AOT concerns.
*
* @author Stefano Cordio
*/
@NullMarked
package org.springframework.batch.core.aot;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.batch.core.job.parameters;

import java.util.Collections;
import java.util.List;

import org.jspecify.annotations.Nullable;
Expand All @@ -27,11 +28,11 @@
*
* @author Morten Andersen-Gott
* @author Mahmoud Ben Hassine
*
* @author Stefano Cordio
*/
public class CompositeJobParametersValidator implements JobParametersValidator, InitializingBean {

private List<JobParametersValidator> validators;
private List<JobParametersValidator> validators = Collections.emptyList();

/**
* Validates the JobParameters according to the injected JobParameterValidators
Expand All @@ -57,7 +58,6 @@ public void setValidators(List<JobParametersValidator> validators) {

@Override
public void afterPropertiesSet() throws Exception {
Assert.state(validators != null, "The 'validators' may not be null");
Assert.state(!validators.isEmpty(), "The 'validators' may not be empty");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Job parameter concerns.
*
* @author Stefano Cordio
*/
@NullMarked
package org.springframework.batch.core.job.parameters;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public JobExecution start(Job job, JobParameters jobParameters) throws JobInstan
Assert.notNull(job, "Job must not be null");
Assert.notNull(jobParameters, "JobParameters must not be null");
new JobLaunchEvent(job.getName(), jobParameters.toString()).commit();

@SuppressWarnings("DataFlowIssue")
Observation observation = MicrometerMetrics
.createObservation(METRICS_PREFIX + "job.launch.count", this.observationRegistry)
.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Job Execution")
@Description("Job Execution Event")
Expand All @@ -35,7 +36,7 @@ public class JobExecutionEvent extends Event {
public long jobExecutionId;

@Label("Job Exit Status")
public String exitStatus;
public @Nullable String exitStatus;

public JobExecutionEvent(String jobName, long jobInstanceId, long jobExecutionId) {
this.jobName = jobName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Job related JFR events.
*/
@NullMarked
package org.springframework.batch.core.observability.jfr.events.job;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Step Execution")
@Description("Step Execution Event")
Expand All @@ -38,7 +39,7 @@ public class StepExecutionEvent extends Event {
public long jobExecutionId;

@Label("Step Exit Status")
public String exitStatus;
public @Nullable String exitStatus;

public StepExecutionEvent(String stepName, String jobName, long stepExecutionId, long jobExecutionId) {
this.stepName = stepName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Chunk Transaction")
@Description("Chunk Transaction Event")
Expand All @@ -32,7 +33,7 @@ public class ChunkTransactionEvent extends Event {
public long stepExecutionId;

@Label("Transaction Status")
public String transactionStatus;
public @Nullable String transactionStatus;

public ChunkTransactionEvent(String stepName, long stepExecutionId) {
this.stepName = stepName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Chunk Write")
@Description("Chunk Write Event")
Expand All @@ -32,7 +33,7 @@ public class ChunkWriteEvent extends Event {
public long stepExecutionId;

@Label("Chunk Write Status")
public String chunkWriteStatus;
public @Nullable String chunkWriteStatus;

@Label("Item Count")
public long itemCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Item Process")
@Description("Item Process Event")
Expand All @@ -32,7 +33,7 @@ public class ItemProcessEvent extends Event {
public long stepExecutionId;

@Label("Item Process Status")
public String itemProcessStatus;
public @Nullable String itemProcessStatus;

public ItemProcessEvent(String stepName, long stepExecutionId) {
this.stepName = stepName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Item Read")
@Description("Item Read Event")
Expand All @@ -32,7 +33,7 @@ public class ItemReadEvent extends Event {
public long stepExecutionId;

@Label("Item Read Status")
public String itemReadStatus;
public @Nullable String itemReadStatus;

public ItemReadEvent(String stepName, long stepExecutionId) {
this.stepName = stepName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Chunk related JFR events.
*/
@NullMarked
package org.springframework.batch.core.observability.jfr.events.step.chunk;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Step related JFR events.
*/
@NullMarked
package org.springframework.batch.core.observability.jfr.events.step;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Partition related JFR events.
*/
@NullMarked
package org.springframework.batch.core.observability.jfr.events.step.partition;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jdk.jfr.Description;
import jdk.jfr.Event;
import jdk.jfr.Label;
import org.jspecify.annotations.Nullable;

@Label("Tasklet Execution")
@Description("Tasklet Execution Event")
Expand All @@ -35,7 +36,7 @@ public class TaskletExecutionEvent extends Event {
public String taskletType;

@Label("Tasklet Status")
public String taskletStatus;
public @Nullable String taskletStatus;

public TaskletExecutionEvent(String stepName, long stepExecutionId, String taskletType) {
this.taskletType = taskletType;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Tasklet related JFR events.
*/
@NullMarked
package org.springframework.batch.core.observability.jfr.events.step.tasklet;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Implementation of Micrometer concerns.
*/
@NullMarked
package org.springframework.batch.core.observability.micrometer;

import org.jspecify.annotations.NullMarked;
Loading
Loading