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
In pgjdbc, we replace all synchronized with explicit Lock: pgjdbc/pgjdbc#2635
I wonder if I could use forbidden-apis to avoid more synchronized keywords creeping in the future.
The text was updated successfully, but these errors were encountered:
Good idea. But this would be an additional "feature" as it requires to not just parse for forbidden methods calls (invoke/invokespecial/invokestatic/getfield/putfield bytecode), but just look at attributes of methods.
I have to check how to detect a synchronized block inside bytecode. For method declartion it is just access flag (as far as I remember).
synchronized methods would indeed be coded as method modifiers.
On top of that, it would probably be great to include Object#wait, Object#notify, and Object#notifyAll into the forbidden set as they make sense only in case synchronized is used (they should be replaced with Condition#await, Condition#signal, Condition#signalAll).
I've no idea if synchronized methods or monitorenter could appear in synthetic code, or in the code generated by Kotlin, Scala, or the other compilers.
However, pgjdbc is Java-only for now, so it would be nice to just forbid plain Java synchronized
In pgjdbc, we replace all
synchronized
with explicitLock
: pgjdbc/pgjdbc#2635I wonder if I could use
forbidden-apis
to avoid moresynchronized
keywords creeping in the future.The text was updated successfully, but these errors were encountered: