From 09765b00faa88ef17c7b1b9133c8fcf7b1b5b469 Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Fri, 15 Oct 2021 16:34:35 +0800 Subject: [PATCH] do NOT create wrapper type instance when can (#1985) --- .../src/main/java/com/taobao/arthas/client/TelnetConsole.java | 4 ++-- .../arthas/core/shell/command/internal/WordCountHandler.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java b/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java index 7bf1a6d7d..8f223fca2 100644 --- a/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java +++ b/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java @@ -285,7 +285,7 @@ public class TelnetConsole { } // ctrl + c event callback - consoleReader.getKeys().bind(new Character((char) CTRL_C).toString(), new ActionListener() { + consoleReader.getKeys().bind(Character.toString((char) CTRL_C), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { @@ -300,7 +300,7 @@ public class TelnetConsole { }); // ctrl + d event call back - consoleReader.getKeys().bind(new Character(KeyMap.CTRL_D).toString(), eotEventCallback); + consoleReader.getKeys().bind(Character.toString(KeyMap.CTRL_D), eotEventCallback); try { telnet.connect(telnetConsole.getTargetIp(), telnetConsole.getPort()); diff --git a/core/src/main/java/com/taobao/arthas/core/shell/command/internal/WordCountHandler.java b/core/src/main/java/com/taobao/arthas/core/shell/command/internal/WordCountHandler.java index 8fae21ffb..90742911b 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/command/internal/WordCountHandler.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/command/internal/WordCountHandler.java @@ -25,7 +25,7 @@ public class WordCountHandler extends StdoutHandler implements StatisticsFunctio CommandLine commandLine = CLIs.create(NAME) .addOption(new Option().setShortName("l").setFlag(true)) .parse(args); - Boolean lineMode = commandLine.isFlagEnabled("l"); + boolean lineMode = commandLine.isFlagEnabled("l"); return new WordCountHandler(lineMode); }