You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the latest Appveyor builds are emitting this warning: <T>doAs(Subject,PrivilegedAction<T>) in Subject has been deprecated and marked for removal.
Could add @SuppressWarnings("removal") for the near-term if there's a need to support older JDKs that don't support the new Subject.current().callAs() method?
Reason for deprecation:
This deprecation is due to the reliance on the SecurityManager which is also deprecated and considered outdated in modern Java security practices.
What to do instead:
To achieve similar functionality, use the Subject.current().callAs() method which is the recommended replacement for doAs.
Example of how to migrate:
// Old code using deprecated doAsSubjectsubject = ...;
Stringresult = subject.doAs(subject, newPrivilegedAction<String>() {
publicStringrun() {
// privileged actionreturn"Some privileged data";
}
});
// Updated code using callAsSubjectsubject = Subject.current(); // Get the current subjectStringresult = subject.callAs(() -> {
// privileged actionreturn"Some privileged data";
});
The text was updated successfully, but these errors were encountered:
I noticed that the latest Appveyor builds are emitting this warning:
<T>doAs(Subject,PrivilegedAction<T>) in Subject has been deprecated and marked for removal
.doAs
is used in three places in the code:davmail/src/java/davmail/http/KerberosHelper.java
Line 201 in 4c8b688
davmail/src/java/davmail/http/KerberosHelper.java
Line 286 in 4c8b688
davmail/src/java/davmail/http/DavMailSPNegoScheme.java
Line 123 in 4c8b688
See https://docs.oracle.com/en/java/javase/23/security/migrating-deprecated-removal-methods-subject-getsubject-and-subject-doas-subject-current-and-s.html for details and advice on what the code the code should be changed to.
https://bugs.openjdk.org/browse/JDK-8275529 is apparently related to this deprecation.
Could add
@SuppressWarnings("removal")
for the near-term if there's a need to support older JDKs that don't support the newSubject.current().callAs()
method?Reason for deprecation:
This deprecation is due to the reliance on the SecurityManager which is also deprecated and considered outdated in modern Java security practices.
What to do instead:
To achieve similar functionality, use the
Subject.current().callAs()
method which is the recommended replacement fordoAs
.Example of how to migrate:
The text was updated successfully, but these errors were encountered: