[devkit] IJPL-195964 Improve threadingModelHelper docs

GitOrigin-RevId: b1e14966cc4bc221c1b02272a1aac99236e96dfb
This commit is contained in:
Bartek Pacia
2025-07-24 12:18:35 +00:00
committed by intellij-monorepo-bot
parent f3aebf133e
commit 7c148e8d3b
@@ -3,31 +3,26 @@
/**
* <h2>Threading Model Helper</h2>
* <p>
* Instruments methods annotated with
* Instruments methods (including constructors) annotated with threading annotations by inserting a call to a corresponding assertion method.
* This call becomes the first instruction in the method's body.
* <ul>
* <li>{@code @RequiresEdt}
* <li>{@code @RequiresBackgroundThread}
* <li>{@code @RequiresReadLock}
* <li>{@code @RequiresWriteLock}
* <li>{@code @RequiresReadLockAbsence}
* <li>{@code @RequiresEdt} &rarr; {@code ThreadingAssertions.assertEventDispatchThread()}
* <li>{@code @RequiresBackgroundThread} &rarr; {@code ThreadingAssertions.assertBackgroundThread()}
* <li>{@code @RequiresReadLock} &rarr; {@code ThreadingAssertions.assertReadAccess()}
* <li>{@code @RequiresWriteLock} &rarr; {@code ThreadingAssertions.assertWriteAccess()}
* <li>{@code @RequiresReadLockAbsence} &rarr; {@code Application.assertNoReadAccess()}
* </ul>
* by inserting
* <ul>
* <li>{@code ThreadingAssertions.assertEventDispatchThread()}
* <li>{@code Application.assertIsNonDispatchThread()}
* <li>{@code Application.assertReadAccessAllowed()}
* <li>{@code Application.assertWriteAccessAllowed()}
* <li>{@code Application.assertReadAccessNotAllowed()}
* </ul>
* calls accordingly.
* <p>
* To disable the instrumentation, use the {@code tmh.generate.assertions.for.annotations} key in the Registry.
*
* <h3>Limitations</h3>
*
* <ul>
* <li>Only Java code is instrumented,
* <li>Only Java code is instrumented.
* <a href="https://youtrack.jetbrains.com/issue/IDEA-263465">Kotlin instrumentation is planned</a>.
* <li>Does not instrument parameters. Consider calling the corresponding assertion method manually.</li>
* <li>Does not instrument overriding methods. If the overriding method has the same threading contract as the supermethod,
* annotate it again.</li>
* <li>Does not instrument abstract methods, as there is no method body.</li>
* </ul>
*
*/
package org.jetbrains.jps.devkit.threadingModelHelper;