aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Praml <praml@foconis.de>2018-07-08 16:52:14 +0200
committerRoel Spilker <r.spilker@gmail.com>2018-07-20 09:41:24 +0200
commitbe1cfd2f59933725726ec5810e0c189a4aca6ad7 (patch)
treede16c667c51998773c5101f7fd3dce982c799f5a
parentff739d6d5a6a68f8d87480be7b0c0104e08f77e0 (diff)
downloadlombok-be1cfd2f59933725726ec5810e0c189a4aca6ad7.tar.gz
lombok-be1cfd2f59933725726ec5810e0c189a4aca6ad7.tar.bz2
lombok-be1cfd2f59933725726ec5810e0c189a4aca6ad7.zip
Replaced StringBuilder by simple char array in "hotspot" method
-rw-r--r--src/core/lombok/bytecode/ClassFileMetaData.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/lombok/bytecode/ClassFileMetaData.java b/src/core/lombok/bytecode/ClassFileMetaData.java
index 0dc6a6c8..826eed83 100644
--- a/src/core/lombok/bytecode/ClassFileMetaData.java
+++ b/src/core/lombok/bytecode/ClassFileMetaData.java
@@ -116,23 +116,24 @@ public class ClassFileMetaData {
int end = pos + size;
// the resulting string might be smaller
- StringBuilder result = new StringBuilder(size);
+ char[] result = new char[size];
+ int length = 0;
while (pos < end) {
int first = (byteCode[pos++] & 0xFF);
if (first < 0x80) {
- result.append((char)first);
+ result[length++] = (char)first;
} else if ((first & 0xE0) == 0xC0) {
int x = (first & 0x1F) << 6;
int y = (byteCode[pos++] & 0x3F);
- result.append((char)(x | y));
+ result[length++] = (char)(x | y);
} else {
int x = (first & 0x0F) << 12;
int y = (byteCode[pos++] & 0x3F) << 6;
int z = (byteCode[pos++] & 0x3F);
- result.append((char)(x | y | z));
+ result[length++] = (char)(x | y | z);
}
}
- return result.toString();
+ return new String(result, 0, length);
}
/**