java:S3655 is not correct detect

Please provide

  • Operating system: MacOS Ventunar 13.0
  • SonarLint plugin version: 7.4.0.60471
  • Programming language you’re coding in: Java
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): no

And a thorough description of the problem/question:
I used isPresent already, but it still warns the bug

 // Optional<User> user = .....
	if (user.isPresent()) {
		new TransactionTemplate(transactionManager, attribute)
			.execute(new TransactionCallbackWithoutResult() {
				@Override
				protected void doInTransactionWithoutResult(TransactionStatus status) {
					sendingEmailService.sendRemindEmail(param, user.get());
				}
			});
		entityManager.clear();
		ReadOnlyEntityManager.clear();
	}

Hi @thachlp ,

Thank you for reporting, and sorry for the late reply.

This is a false positive, and here is a ticket for it. [SONARJAVA-4515] - Jira

All the best,

Irina