Precompile pattern for checking of classes in javax package in ReflectUtils

Signed-off-by: dreis2211 <christoph.dreis@freenet.de>
This commit is contained in:
Christoph Dreis 2016-10-14 01:05:13 +02:00 committed by Joakim Erdfelt
parent 75c5793f38
commit 41d4b59c19
1 changed files with 5 additions and 6 deletions

View File

@ -25,14 +25,13 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.websocket.api.InvalidWebSocketException;
import org.eclipse.jetty.websocket.common.DuplicateAnnotationException;
import java.util.regex.Pattern;
public class ReflectUtils
{
private static final Pattern JAVAX_CLASSNAME_PATTERN = Pattern.compile("^javax*\\..*");
private static class GenericRef
{
// The base class reference lookup started from
@ -370,7 +369,7 @@ public class ReflectUtils
Class<?> clazz = (Class<?>) type;
// prevent spinning off into Serialization and other parts of the
// standard tree that we could care less about
if (clazz.getName().matches("^javax*\\..*"))
if (JAVAX_CLASSNAME_PATTERN.matcher(clazz.getName()).matches())
{
return false;
}