@@ -40,13 +40,17 @@ public class SimpleRelocator implements Relocator {
4040 * Match <ul>
4141 * <li>certain Java keywords + space</li>
4242 * <li>beginning of Javadoc link + optional line breaks and continuations with '*'</li>
43+ * <li>(opening curly brace / opening parenthesis / comma / equals / semicolon) + space</li>
44+ * <li>(closing curly brace / closing multi-line comment) + space</li>
4345 * </ul>
4446 * at end of string
4547 */
46- private static final Pattern RX_ENDS_WITH_JAVA_KEYWORD =
47- Pattern . compile ( "\\ b(import|package|public|protected|private|static|final|synchronized|abstract|volatile) $"
48+ private static final Pattern RX_ENDS_WITH_JAVA_KEYWORD = Pattern . compile (
49+ "\\ b(import|package|public|protected|private|static|final|synchronized|abstract|volatile|extends|implements|throws ) $"
4850 + "|"
49- + "\\ {@link( \\ *)* $" );
51+ + "\\ {@link( \\ *)* $"
52+ + "|"
53+ + "([{}(=;,]|\\ */) $" );
5054
5155 private final String pattern ;
5256
@@ -217,7 +221,7 @@ private String shadeSourceWithExcludes(
217221 // Usually shading makes package names a bit longer, so make buffer 10% bigger than original source
218222 StringBuilder shadedSourceContent = new StringBuilder (sourceContent .length () * 11 / 10 );
219223 boolean isFirstSnippet = true ;
220- // Make sure that search pattern starts at word boundary and we look for literal ".", not regex jokers
224+ // Make sure that search pattern starts at word boundary and that we look for literal ".", not regex jokers
221225 String [] snippets = sourceContent .split ("\\ b" + patternFrom .replace ("." , "[.]" ) + "\\ b" );
222226 for (int i = 0 , snippetsLength = snippets .length ; i < snippetsLength ; i ++) {
223227 String snippet = snippets [i ];
0 commit comments