Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler-plugin and optimized removal #122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions emoji-table-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javac.target>1.6</javac.target>
</properties>

<dependencies>
Expand All @@ -21,4 +22,18 @@
<version>4.0.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javac.target>1.6</javac.target>
</properties>

<dependencies>
Expand Down Expand Up @@ -72,6 +73,17 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/vdurmont/emoji/EmojiParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}


Expand Down