8264484: Replace uses of StringBuffer with StringBuilder in jdk.hotspot.agent

Reviewed-by: kevinw, amenkov, ysuenaga
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java
index e3d705d..3ed34ef 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java
@@ -255,7 +255,7 @@
         exceed the given number of characters per line. Strips
         extraneous whitespace. */
     private String formatMessage(String message, int charsPerLine) {
-        StringBuffer buf = new StringBuffer(message.length());
+        StringBuilder buf = new StringBuilder(message.length());
         StringTokenizer tokenizer = new StringTokenizer(message);
         int curLineLength = 0;
         while (tokenizer.hasMoreTokens()) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
index 9636946..c3e8f9b 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java
@@ -227,7 +227,7 @@
             }
         }
         String join(String sep) {
-            StringBuffer result = new StringBuffer();
+            StringBuilder result = new StringBuilder();
             for (int w = i; w < length; w++) {
                 result.append(tokens[w]);
                 if (w + 1 < length) {
@@ -350,7 +350,7 @@
     Address lookup(String symbol) {
         if (symbol.indexOf("::") != -1) {
             String[] parts = symbol.split("::");
-            StringBuffer mangled = new StringBuffer("__1c");
+            StringBuilder mangled = new StringBuilder("__1c");
             for (int i = 0; i < parts.length; i++) {
                 int len = parts[i].length();
                 if (len >= 26) {
@@ -1755,7 +1755,7 @@
                 }
 
                 /* Compute filename for class. */
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 if (tokenCount > 1) {
                     buf.append(t.nextToken());
                 } else {
@@ -1967,7 +1967,7 @@
                 ln = "";
                 err.println("History is empty");
             } else {
-                StringBuffer result = new StringBuffer();
+                StringBuilder result = new StringBuilder();
                 Matcher m = historyPattern.matcher(ln);
                 int start = 0;
                 while (m.find()) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
index 274003d..02b6651 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java
@@ -1811,7 +1811,7 @@
       exceed the given number of characters per line. Strips
       extraneous whitespace. */
   private String formatMessage(String message, int charsPerLine) {
-    StringBuffer buf = new StringBuffer(message.length());
+    StringBuilder buf = new StringBuilder(message.length());
     StringTokenizer tokenizer = new StringTokenizer(message);
     int curLineLength = 0;
     while (tokenizer.hasMoreTokens()) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java
index d74ca01..b92222c 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
         // we have to transform this as //host[:port]/<serverNamePrefix>['_'<unique_id>]
 
         int index = debugServerID.indexOf('@');
-        StringBuffer nameBuf = new StringBuffer("//");
+        StringBuilder nameBuf = new StringBuilder("//");
         String uniqueID = null;
         if (index != -1) {
             nameBuf.append(debugServerID.substring(index + 1));
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerUtilities.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerUtilities.java
index b658922..dbb14ae 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerUtilities.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/DebuggerUtilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
   }
 
   public String addressValueToString(long address) {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("0x");
     String val;
     // Make negative addresses have the correct size
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/BasicFunctionSym.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/BasicFunctionSym.java
index f6bbccc..3dd87e6 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/BasicFunctionSym.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/cdbg/basic/BasicFunctionSym.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
       return null;
     }
 
-    StringBuffer res = new StringBuffer();
+    StringBuilder res = new StringBuilder();
     res.append(getName());
     res.append("(");
     FunctionType type = (FunctionType) getType();
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java
index d9220d3..cac29b5 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/dummy/DummyDebugger.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@
   //
 
   String addressToString(DummyAddress addr) {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("0x");
     String val;
     if (addr == null) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java
index 57f676a..25e0f4b 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,7 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer(getJavaBytecodeName());
+    StringBuilder buf = new StringBuilder(getJavaBytecodeName());
     if (code() != javaCode()) {
        buf.append(spaces);
        buf.append('[');
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeBipush.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeBipush.java
index ddf68d7..b5001ae 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeBipush.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeBipush.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,10 +65,10 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("bipush");
     buf.append(spaces);
-    buf.append(Byte.toString(getValue()));
+    buf.append(getValue());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeGetPut.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeGetPut.java
index 0b4a1f5..7770dba 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeGetPut.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeGetPut.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,11 +51,11 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(indexForFieldOrMethod()));
+    buf.append(indexForFieldOrMethod());
     buf.append(" [Field ");
     StringBuffer sigBuf = new StringBuffer();
     new SignatureConverter(signature(), sigBuf).dispatchField();
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeIinc.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeIinc.java
index 4bf7214..d2452b7 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeIinc.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeIinc.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,13 +66,13 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("iinc");
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(getLocalVarIndex()));
+    buf.append(getLocalVarIndex());
     buf.append(" by ");
-    buf.append(Integer.toString(getIncrement()));
+    buf.append(getIncrement());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeInvoke.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeInvoke.java
index 393bb83..7a77255 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeInvoke.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeInvoke.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,16 +106,16 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(indexForFieldOrMethod()));
+    buf.append(indexForFieldOrMethod());
     if (isInvokedynamic()) {
       ConstantPool cp = method.getConstants();
       buf.append('(');
       int poolIndex = cp.invokeDynamicNameAndTypeRefIndexAt(indexForFieldOrMethod());
-      buf.append(Integer.toString(poolIndex));
+      buf.append(poolIndex);
       buf.append(')');
       buf.append(" [Name and Type ");
       buf.append(name().asString());
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeJmp.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeJmp.java
index a7aacf8..283eb72 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeJmp.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeJmp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,10 @@
   public abstract int getTargetBCI();
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
-    buf.append(Integer.toString(getTargetBCI()));
+    buf.append(getTargetBCI());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
index 9a714b9..81994f6 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -195,14 +195,14 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(poolIndex()));
+    buf.append(poolIndex());
     if (hasCacheIndex()) {
        buf.append('(');
-       buf.append(Integer.toString(cacheIndex()));
+       buf.append(cacheIndex());
        buf.append(')');
     }
     buf.append(spaces);
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadStore.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadStore.java
index b4673b9..0b83834 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadStore.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(getLocalVarIndex()));
+    buf.append(getLocalVarIndex());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLookupswitch.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLookupswitch.java
index 8d2d61f..62a717f 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLookupswitch.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeLookupswitch.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,19 +78,19 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("lookupswitch");
     buf.append(spaces);
     buf.append("default: ");
-    buf.append(Integer.toString(bci() + defaultOffset()));
+    buf.append(bci() + defaultOffset());
     buf.append(comma);
     int i = numberOfPairs() - 1;
     while (i-- > 0) {
       LookupswitchPair pair = pairAt(i);
       buf.append("case ");
-      buf.append(Integer.toString(pair.match()));
+      buf.append(pair.match());
       buf.append(':');
-      buf.append(Integer.toString(bci() + pair.offset()));
+      buf.append(bci() + pair.offset());
       buf.append(comma);
     }
 
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeMultiANewArray.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeMultiANewArray.java
index 630d8b9..15ed704 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeMultiANewArray.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeMultiANewArray.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,10 +69,10 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(super.toString());
     buf.append(spaces);
-    buf.append(Integer.toString(getDimension()));
+    buf.append(getDimension());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeNewArray.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeNewArray.java
index 30995fa..0fe1b5c2 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeNewArray.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeNewArray.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,7 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("newarray");
     buf.append(spaces);
     buf.append(getTypeName());
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeRet.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeRet.java
index aaa099a..014b6cd 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeRet.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeRet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,11 +61,11 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("ret");
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(getLocalVarIndex()));
+    buf.append(getLocalVarIndex());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeSipush.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeSipush.java
index 28c547e..c43b1b5 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeSipush.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeSipush.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,10 +65,10 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("sipush");
     buf.append(spaces);
-    buf.append(Short.toString(getValue()));
+    buf.append(getValue());
     return buf.toString();
   }
 }
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeTableswitch.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeTableswitch.java
index d5430dd..52915d8 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeTableswitch.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeTableswitch.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,20 +84,20 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("tableswitch");
     buf.append(spaces);
     buf.append("default: ");
-    buf.append(Integer.toString(bci() + defaultOffset()));
+    buf.append(bci() + defaultOffset());
     buf.append(comma);
     int lo = lowKey();
     int hi = highKey();
     int i  = hi - lo - 1 ;
     while (i-- > 0) {
        buf.append("case ");
-       buf.append(Integer.toString(lo + i));
+       buf.append(lo + i);
        buf.append(':');
-       buf.append(Integer.toString(bci() + destOffsetAt(i)));
+       buf.append(bci() + destOffsetAt(i));
        buf.append(comma);
     }
     return buf.toString();
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
index 8ad0aa7..12ab8fd 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,11 +41,11 @@
   }
 
   public String toString() {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append(getJavaBytecodeName());
     buf.append(spaces);
     buf.append('#');
-    buf.append(Integer.toString(index()));
+    buf.append(index());
     buf.append(spaces);
     buf.append("[Class ");
     buf.append(getClassName().asString().replace('/', '.'));
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogramElement.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogramElement.java
index 5fa56b1..c0f7ce7 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogramElement.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHistogramElement.java
@@ -86,7 +86,7 @@
           ObjArrayKlass oak = (ObjArrayKlass) ak;
           Klass bottom = oak.getBottomKlass();
           int dim = (int) oak.getDimension();
-          StringBuffer buf = new StringBuffer();
+          StringBuilder buf = new StringBuilder();
           if (bottom instanceof TypeArrayKlass) {
             buf.append(((TypeArrayKlass) bottom).getElementTypeName());
           } else if (bottom instanceof InstanceKlass) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index 7aecb63..2b9163a 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,7 +99,7 @@
       return null;
     }
     int length = (int)charArray.getLength();
-    StringBuffer buf = new StringBuffer(length);
+    StringBuilder buf = new StringBuilder(length);
     for (int i = 0; i < length; i++) {
       buf.append(charArray.getCharAt(i));
     }
@@ -111,7 +111,7 @@
       return null;
     }
     int length = (int)byteArray.getLength() >> coder;
-    StringBuffer buf = new StringBuffer(length);
+    StringBuilder buf = new StringBuilder(length);
     if (coder == 0) {
       // Latin1 encoded
       for (int i = 0; i < length; i++) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/PerfDataEntry.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/PerfDataEntry.java
index fff7ab2..4f81592 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/PerfDataEntry.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/PerfDataEntry.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -352,10 +352,10 @@
         } else { // vector
             if (dataType == BasicType.getTBoolean()) {
                 boolean[] res = booleanArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Boolean.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
@@ -369,50 +369,50 @@
                                                  StandardCharsets.US_ASCII);
             } else if (dataType == BasicType.getTShort()) {
                 short[] res = shortArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Short.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
                 str = buf.toString();
             } else if (dataType ==  BasicType.getTInt()) {
                 int[] res = intArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Integer.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
                 str = buf.toString();
             } else if (dataType == BasicType.getTLong()) {
                 long[] res = longArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Long.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
                 str = buf.toString();
             } else if (dataType == BasicType.getTFloat()) {
                 float[] res = floatArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Float.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
                 str = buf.toString();
             } else if (dataType == BasicType.getTDouble()) {
                 double[] res = doubleArrayValue();
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append('[');
                 for (int i = 0; i < res.length; i++) {
-                    buf.append(Double.toString(res[i]));
+                    buf.append(res[i]);
                     buf.append(", ");
                 }
                 buf.append(']');
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMVersionMismatchException.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMVersionMismatchException.java
index 5dc4453..aff07b3 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMVersionMismatchException.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMVersionMismatchException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,8 @@
     }
 
     public String getMessage() {
-        StringBuffer msg = new StringBuffer();
-        msg.append("Supported versions are ");
-        msg.append(supportedVersions);
-        msg.append(". Target VM is ");
-        msg.append(targetVersion);
-        return msg.toString();
+        return "Supported versions are " + supportedVersions +
+                ". Target VM is " + targetVersion;
     }
 
     public String getSupportedVersions() {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
index 7b44cfe..1884449 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
@@ -256,19 +256,19 @@
          JavaVFrame vf = jvframes[fCount];
          Frame f = vf.getFrame();
          if (fp.equals(f.getFP())) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             Method method = vf.getMethod();
             // a special char to identify java frames in output
             sb.append("* ");
             sb.append(method.externalNameAndSignature());
-            sb.append(" bci:" + vf.getBCI());
+            sb.append(" bci:").append(vf.getBCI());
             int lineNumber = method.getLineNumberFromBCI(vf.getBCI());
             if (lineNumber != -1) {
-                sb.append(" line:" + lineNumber);
+                sb.append(" line:").append(lineNumber);
             }
 
             if (verbose) {
-               sb.append(" Method*:" + method.getAddress());
+               sb.append(" Method*:").append(method.getAddress());
             }
 
             if (vf.isCompiledFrame()) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java
index 025e8fd..f0ea831 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java
@@ -402,7 +402,7 @@
   }
 
   private String bigIntToHexString(BigInteger bi) {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("0x");
     String val = bi.toString(16);
     for (int i = 0; i < ((2 * addressSize) - val.length()); i++) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java
index 9025a0f..20408f4 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java
@@ -146,7 +146,7 @@
         protected Transferable createTransferable(JComponent c) {
           JTable table = (JTable)c;
           if (haveSelection()) {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             int iDir = (getRowAnchor() < getRowLead() ? 1 : -1);
             int jDir = (getColAnchor() < getColLead() ? 1 : -1);
 
@@ -553,7 +553,7 @@
   }
 
   private String bigIntToHexString(BigInteger bi) {
-    StringBuffer buf = new StringBuffer();
+    StringBuilder buf = new StringBuilder();
     buf.append("0x");
     String val = bi.toString(16);
     for (int i = 0; i < ((2 * addressSize) - val.length()); i++) {
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SAEditorPane.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SAEditorPane.java
index 0eeb779..7e3d057 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SAEditorPane.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SAEditorPane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
    */
 
   public String getSelectedText() {
-    StringBuffer result = new StringBuffer();
+    StringBuilder result = new StringBuilder();
     Document doc = getDocument();
 
     int start = getSelectionStart();
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SourceCodePanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SourceCodePanel.java
index 0aada54..128bb37 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SourceCodePanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SourceCodePanel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -219,7 +219,7 @@
       this.filename = filename;
       File file = new File(filename);
       int len = (int) file.length();
-      StringBuffer buf = new StringBuffer(len); // Approximation
+      StringBuilder buf = new StringBuilder(len); // Approximation
       char[] tmp = new char[4096];
       FileReader in = new FileReader(file);
       int res = 0;
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SysPropsPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SysPropsPanel.java
index 2435eaf..3f436f3 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SysPropsPanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/SysPropsPanel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
     }
 
     private String getFlags() {
-       final StringBuffer buf = new StringBuffer();
+       final StringBuilder buf = new StringBuilder();
        buf.append("<html><head><title>System Properties</title></head><body>");
        buf.append("<table border='1'>");
 
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMFlagsPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMFlagsPanel.java
index eaf916a..a1adc9b 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMFlagsPanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMFlagsPanel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
     private String getFlags() {
        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
-       StringBuffer buf = new StringBuffer();
+       StringBuilder buf = new StringBuilder();
        buf.append("<html><head><title>VM Command Line Flags</title></head><body>");
        if (flags == null) {
           buf.append("<b>Command Flag info not available (use 1.4.1_03 or later)!</b>");
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMVersionInfoPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMVersionInfoPanel.java
index 5604f1c..ed4ba37 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMVersionInfoPanel.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/VMVersionInfoPanel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
     private String getVersionInfo() {
        VM vm = VM.getVM();
-       StringBuffer buf = new StringBuffer();
+       StringBuilder buf = new StringBuilder();
        buf.append("<html><head><title>VM Version Info</title></head>");
        buf.append("<body><table border='1'>");
 
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
index 0d8f6a5..9a65fcc 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -883,10 +883,7 @@
    }
 
    protected String genMultPCHref(String pcs) {
-      StringBuffer buf = new StringBuffer(genBaseHref());
-      buf.append("pc_multiple=");
-      buf.append(pcs);
-      return buf.toString();
+      return genBaseHref() + "pc_multiple=" + pcs;
    }
 
    protected String genPCHref(Address addr) {
@@ -1542,7 +1539,7 @@
    }
 
    protected String genDumpKlassesHref(InstanceKlass[] klasses) {
-      StringBuffer buf = new StringBuffer(genBaseHref());
+      StringBuilder buf = new StringBuilder(genBaseHref());
       buf.append("jcore_multiple=");
       for (int k = 0; k < klasses.length; k++) {
          buf.append(klasses[k].getAddress().toString());
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
index c558e59..a85634e 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -286,7 +286,7 @@
     // escapes XML meta-characters and illegal characters
     private static String escapeXMLChars(String s) {
         // FIXME: is there a better way or API?
-        StringBuffer result = null;
+        StringBuilder result = null;
         for(int i = 0, max = s.length(), delta = 0; i < max; i++) {
             char c = s.charAt(i);
             String replacement = null;
@@ -311,7 +311,7 @@
 
             if (replacement != null) {
                 if (result == null) {
-                    result = new StringBuffer(s);
+                    result = new StringBuilder(s);
                 }
                 result.replace(i + delta, i + delta + 1, replacement);
                 delta += (replacement.length() - 1);
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java
index 59d5770..ee56b94 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ObjectReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -774,7 +774,7 @@
       }
 
       protected String getClassName(int begin, int end) {
-         StringBuffer buf = new StringBuffer();
+         StringBuilder buf = new StringBuilder();
          for (int i = begin; i < end; i++) {
             char c = (char) (_signature.getByteAt(i) & 0xFF);
             if (c == '/') {