Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect deprecation of ItemStreamSupport #4238

Closed
hpoettker opened this issue Nov 18, 2022 · 7 comments
Closed

Incorrect deprecation of ItemStreamSupport #4238

hpoettker opened this issue Nov 18, 2022 · 7 comments

Comments

@hpoettker
Copy link
Contributor

Starting with Spring Batch 5, the whole abstract class ItemStreamSupport is deprecated and marked for removal.

For the methods close, open, and update, the default implementations of ItemStream yield a one-to-one replacement, respectively. ItemStreamSupport also has the methods setName, setExecutionContextName, and getExecutionContextKey, for which no replacements exist as far as I can tell.

Is there a replacement available for the latter methods? Or are only the methods that are inherited from ItemStream planned to be removed? If so, why not remove them without deprecation?

@hpoettker hpoettker added the status: waiting-for-triage Issues that we did not analyse yet label Nov 18, 2022
@fmbenhassine fmbenhassine added this to the 5.0.0 milestone Nov 22, 2022
@fmbenhassine fmbenhassine added type: bug in: core and removed status: waiting-for-triage Issues that we did not analyse yet labels Nov 22, 2022
@fmbenhassine
Copy link
Contributor

Thank you for pointing this. That's correct, only the methods open, close and update should deprecated, not the entire class. This will be fixed for 5.0 GA.

@fmbenhassine fmbenhassine changed the title Clarify deprecation of ItemStreamSupport Incorrect deprecation of ItemStreamSupport Nov 22, 2022
@jpraet
Copy link
Contributor

jpraet commented Oct 4, 2024

Thank you for pointing this. That's correct, only the methods open, close and update should deprecated, not the entire class. This will be fixed for 5.0 GA.

Should these methods really be deprecated? I cannot implement open/close/update in a class that extends from ItemStreamSupport, without getting deprecation warnings.

@fmbenhassine
Copy link
Contributor

fmbenhassine commented Oct 10, 2024

I cannot implement open/close/update in a class that extends from ItemStreamSupport, without getting deprecation warnings.

You should be able to do that. Here is a quick example:

class MyItemStreamSupport extends ItemStreamSupport {

	@Override
	public void open(ExecutionContext executionContext) throws ItemStreamException {
		super.open(executionContext);
	}

	@Override
	public void update(ExecutionContext executionContext) throws ItemStreamException {
		super.update(executionContext);
	}

	@Override
	public void close() throws ItemStreamException {
		super.close();
	}
}

I have no warnings here. Is this what you are referring to, @jpraet ?

@jpraet
Copy link
Contributor

jpraet commented Oct 11, 2024

I get these warnings in IntelliJ as well as during maven compilation:

image

[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[10,16] [removal] open(ExecutionContext) in ItemStreamSupport has been deprecated and marked for removal
[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[11,13] [removal] open(ExecutionContext) in ItemStreamSupport has been deprecated and marked for removal
[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[15,16] [removal] update(ExecutionContext) in ItemStreamSupport has been deprecated and marked for removal
[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[16,13] [removal] update(ExecutionContext) in ItemStreamSupport has been deprecated and marked for removal
[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[20,16] [removal] close() in ItemStreamSupport has been deprecated and marked for removal
[WARNING] D:\projects\batch-framework\batch-core\src\main\java\be\fgov\kszbcss\batch\core\MyItemStreamSupport.java:[21,13] [removal] close() in ItemStreamSupport has been deprecated and marked for removal

@fmbenhassine
Copy link
Contributor

Which revision of Spring Batch do you have? It seems you are compiling a version that contains those methods in ItemStreamSupport. Those methods have been removed as they are now present as default methods in the ItemStream interface.

Which profile do you have in IntelliJ Idea? I also use IntelliJ Idea and I have no warnings.

Moreover, are you using the maven wrapper to compile the infrastructure module? Here is what I have when I add that class and compile on the CLI:

spring-batch-infrastructure % ../mvnw compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------< org.springframework.batch:spring-batch-infrastructure >--------
[INFO] Building Spring Batch Infrastructure 5.2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spring-javaformat-maven-plugin:0.0.39:validate (default) @ spring-batch-infrastructure ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-batch-infrastructure ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/resources
[INFO]
[INFO] --- flatten-maven-plugin:1.6.0:flatten (flatten) @ spring-batch-infrastructure ---
[INFO] Generating flattened POM of project org.springframework.batch:spring-batch-infrastructure:jar:5.2.0-SNAPSHOT...
[INFO]
[INFO] --- maven-compiler-plugin:3.13.0:compile (default-compile) @ spring-batch-infrastructure ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 360 source files with javac [debug release 17] to target/classes
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoPagingItemReader.java:[70,47] org.springframework.batch.item.data.MongoItemReader in org.springframework.batch.item.data has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoPagingItemReader.java:[70,47] org.springframework.batch.item.data.MongoItemReader in org.springframework.batch.item.data has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/MongoItemReaderBuilder.java:[267,16] org.springframework.batch.item.data.MongoItemReader in org.springframework.batch.item.data has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/MongoItemReaderBuilder.java:[279,17] org.springframework.batch.item.data.MongoItemReader in org.springframework.batch.item.data has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/MongoItemReaderBuilder.java:[279,49] org.springframework.batch.item.data.MongoItemReader in org.springframework.batch.item.data has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/MongoPagingItemReaderBuilder.java:[39,54] org.springframework.batch.item.data.builder.MongoItemReaderBuilder in org.springframework.batch.item.data.builder has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/builder/MongoPagingItemReaderBuilder.java:[39,54] org.springframework.batch.item.data.builder.MongoItemReaderBuilder in org.springframework.batch.item.data.builder has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[36,49] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[36,49] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[36,61] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[39,37] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[86,25] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[120,16] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[124,17] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[144,39] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[154,75] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[157,36] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ResultHolderResultQueue.java:[157,53] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[105,17] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[105,29] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[143,17] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[159,17] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[159,29] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[169,25] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[207,62] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[213,31] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[213,43] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[219,90] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[219,102] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[312,31] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[312,43] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[319,44] org.springframework.batch.repeat.support.ResultHolderResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[325,24] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/TaskExecutorRepeatTemplate.java:[325,36] org.springframework.batch.repeat.support.ResultHolder in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ThrottleLimitResultQueue.java:[33,53] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[WARNING] /Users/mbenhassine/projects/spring-batch/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/ThrottleLimitResultQueue.java:[33,53] org.springframework.batch.repeat.support.ResultQueue in org.springframework.batch.repeat.support has been deprecated and marked for removal
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.107 s
[INFO] Finished at: 2024-10-11T14:28:44+02:00
[INFO] ------------------------------------------------------------------------
spring-batch-infrastructure %

Apart from other deprecation warnings, I don't see any related to ItemStream.

I would be grateful to get your feedback on this to fix things if any as I am working on releasing 5.2.0-M2.

@jpraet
Copy link
Contributor

jpraet commented Oct 11, 2024

I use the latest GA version 5.1.2. I think for 5.2.0 it should be alright as the deprecated methods have been removed.

@fmbenhassine
Copy link
Contributor

OK now I see, it is because you are on 5.1.x. Indeed, these warnings are gone with 5.2.x.

Thank you for your quick feedback! Appreciated your time 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants