From 5e3371bdf49eda1ad1e80170f2878fd75547d197 Mon Sep 17 00:00:00 2001 From: Semyon Gashchenko Date: Wed, 19 Sep 2018 14:27:01 +0300 Subject: [PATCH 1/2] Add explicit compiler-plugin to poms --- emoji-table-generator/pom.xml | 15 +++++++++++++++ pom.xml | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/emoji-table-generator/pom.xml b/emoji-table-generator/pom.xml index c158f3dd..ed4d9c43 100644 --- a/emoji-table-generator/pom.xml +++ b/emoji-table-generator/pom.xml @@ -12,6 +12,7 @@ UTF-8 + 1.6 @@ -21,4 +22,18 @@ 4.0.0 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + ${javac.target} + ${javac.target} + + + + diff --git a/pom.xml b/pom.xml index f79163e4..ff7c350e 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ UTF-8 + 1.6 @@ -72,6 +73,17 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + ${javac.target} + ${javac.target} + + + From 2a4b6f3c46080e8d0e0c32f440be0c14d4861831 Mon Sep 17 00:00:00 2001 From: Semyon Gashchenko Date: Wed, 19 Sep 2018 14:28:55 +0300 Subject: [PATCH 2/2] Optimize all emojis removal with constant EmojiTransformer --- src/main/java/com/vdurmont/emoji/EmojiParser.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/vdurmont/emoji/EmojiParser.java b/src/main/java/com/vdurmont/emoji/EmojiParser.java index ccb9b929..efa20bf7 100644 --- a/src/main/java/com/vdurmont/emoji/EmojiParser.java +++ b/src/main/java/com/vdurmont/emoji/EmojiParser.java @@ -16,6 +16,12 @@ public class EmojiParser { private static final Pattern ALIAS_CANDIDATE_PATTERN = Pattern.compile("(?<=:)\\+?(\\w|\\||\\-)+(?=:)"); + private static final EmojiTransformer REMOVE_TRANSFORMER = new EmojiTransformer() { + public String transform(UnicodeCandidate unicodeCandidate) { + return ""; + } + }; + /** * See {@link #parseToAliases(String, FitzpatrickAction)} with the action * "PARSE" @@ -287,13 +293,7 @@ public String transform(UnicodeCandidate unicodeCandidate) { * @return the string without any emoji */ public static String removeAllEmojis(String str) { - EmojiTransformer emojiTransformer = new EmojiTransformer() { - public String transform(UnicodeCandidate unicodeCandidate) { - return ""; - } - }; - - return parseFromUnicode(str, emojiTransformer); + return parseFromUnicode(str, REMOVE_TRANSFORMER); }