Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,16 @@ public static String aspectjNameToPattern(String name) {
}

int length = name.length();
StringBuilder sb = new StringBuilder(length);
// Pre-size to reduce resizing for common expansions (e.g. '*' -> "[^.]*")
StringBuilder sb = new StringBuilder(Math.max(16, length * 2));
char prev = 0;
for (int i = 0; i < length; i++) {
boolean isLast = i == length - 1;
char c = name.charAt(i);
char next = isLast ? 0 : name.charAt(i + 1);
switch (c) {
case '.':
if (prev != '.' && (isLast || name.charAt(i + 1) != '.')) {
if (prev != '.' && (isLast || next != '.')) {
sb.append("[.$]");
} else if (prev == '.') {
sb.append("\\.(.+\\.)?");
Expand Down