swiftlang / swift-java

Apache License 2.0
724 stars 27 forks source link

Consider @ThreadSafe when importing Java types #129

Open ktoso opened 3 weeks ago

ktoso commented 3 weeks ago

While "dormant" some project do use the JSR-305 annotations, and one of them is https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/latest/javax/annotation/concurrent/ThreadSafe.html

This is something we could use to annotate such imported Java types as Sendable.

Others are:

Name Description
GuardedBy The field or method to which this annotation is applied can only be accessed when holding a particular lock, which may be a built-in (synchronization) lock, or may be an explicit Lock.
Immutable The class to which this annotation is applied is immutable.
NotThreadSafe The class to which this annotation is applied is not thread-safe.
ThreadSafe The class to which this annotation is applied is thread-safe.
lhoward commented 1 week ago

also see #157