matthiasblaesing commented on code in PR #5299:
URL: https://github.com/apache/netbeans/pull/5299#discussion_r1096096857


##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/ShortenedStrings.java:
##########
@@ -94,6 +95,42 @@ public static StringInfo getShortenedInfo(String s) {
         }
     }
 
+    private static boolean isSmallEndian(VirtualMachine virtualMachine) {
+        //TODO: Possibly cache this value
+        List<ReferenceType> possibleClasses = virtualMachine.classesByName(
+                "java.lang.StringUTF16");

Review Comment:
   Works for me and looks sane. The caching you introduced works (at least in 
my trivial testcase).
   
   One final idea would be to rework the synchronization. The maps are 
protected by individual `sychronized() {}` blocks. The pattern could be applied 
here two, which would also not leak the sychronization to the outside.
   
   My suggestion is to move the `isLittleEndianCache.clear();` into a separate 
block `synchronized (isLittleEndianCache) {isLittleEndianCache.clear();}`, drop 
the `synchronized` from the signature of `isLittleEndian` and instead wrap the 
whole method contents into a `synchronized (isLittleEndianCache) {....}` block.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to