[JAVA-5126] Replace use of Subject#doAs with Subject#callAs when available Created: 30/Aug/23  Updated: 27/Sep/23

Status: Backlog
Project: Java Driver
Component/s: Deprecations, JDK
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Quarter: FY24Q4
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

The driver uses Subject#doAs in SaslAuthenticator.

However, Subject#doAs was deprecated for removal in Java 18, and Subject#callAs was added in the same release. This is related to the deprecation of the Security Manager.

To protect against the driver breaking when used against a future version of Java where Subject#doAs has actually been removed, we should replace the usage with Subject#callAs. However, we can't do that simply given that we have to run against Java release prior to Java 18. To work around this, we need to detect dynamically whether Subject#callAs is available, and then call it reflectively if it is. We should probably call Subject#doAs reflectively as well to avoid a compile- or link-time dependency on it.


Generated at Thu Feb 08 09:03:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.