![]() ![]() PsiReferenceExpression - some expression whose result is used as the synchronization object.It is important to bear in mind that synchronized keyword has two use cases:Īnd as an internal method structure: class ClassA ) In this case, control over synchronization is lost and third-party code may start interfering with it, which could lead to undesirable effects and eventually to deadlocks. The point is that using synchronization for objects that are publicly available is not a great idea. This task requires me to search for open lock objects using the synchronized keyword (see "Item 82 – Document thread safety", from chapter 11, "Concurrency", in Joshua Bloch’s Effective Java). Here is an example of one of my recent tasks, using a revision of a jMonkeyEngine project as the code for demonstration (rather than closed source code). A simple taskīefore we start looking at Structural Search, let’s consider some simple tasks where this search could be useful. In fact, it is this second project that encouraged me to write this post but I’m getting ahead of myself. My own pet project, plantuml-native-image, where I experiment with compiling PlantUML into native executable code using GraalVM Native Image. ![]() 3D-engine for game development, jMonkeyEngine, which is an example of a big, interesting project.In this post, I will present some of these situations and go beyond artificial cases by demonstrating examples of real code from two projects: They can be extremely useful in situations where a whole variety of other functions can’t quite get the job done. Structural search and replace is one such pair of features. Did you know that when you press F2 in IntelliJ IDEA, the cursor will jump to the nearest error in the file? And in the absence of an error – to the nearest warning? It seems that this is a secret only a few people know about. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |