This commit is contained in:
@@ -190,15 +190,18 @@ public final class Rest {
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
final Set<Field> resourcesFieldSet = new LinkedHashSet<>();
|
final Set<Field> resourcesFieldSet = new LinkedHashSet<>();
|
||||||
final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;
|
final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;
|
||||||
|
final Set<String> resourcesFieldNameSet = new HashSet<>();
|
||||||
Class clzz = webSocketType;
|
Class clzz = webSocketType;
|
||||||
do {
|
do {
|
||||||
for (Field field : clzz.getDeclaredFields()) {
|
for (Field field : clzz.getDeclaredFields()) {
|
||||||
if (field.getAnnotation(Resource.class) == null) continue;
|
if (field.getAnnotation(Resource.class) == null) continue;
|
||||||
if (Modifier.isStatic(webSocketType.getModifiers())) throw new RuntimeException(field + " cannot static on createRestWebSocketServlet");
|
if (resourcesFieldNameSet.contains(field.getName())) continue;
|
||||||
if (Modifier.isFinal(webSocketType.getModifiers())) throw new RuntimeException(field + " cannot final on createRestWebSocketServlet");
|
if (Modifier.isStatic(field.getModifiers())) throw new RuntimeException(field + " cannot static on createRestWebSocketServlet");
|
||||||
if (!Modifier.isPublic(webSocketType.getModifiers()) && !Modifier.isProtected(webSocketType.getModifiers())) {
|
if (Modifier.isFinal(field.getModifiers())) throw new RuntimeException(field + " cannot final on createRestWebSocketServlet");
|
||||||
|
if (!Modifier.isPublic(field.getModifiers()) && !Modifier.isProtected(field.getModifiers())) {
|
||||||
throw new RuntimeException(field + " must be public or protected on createRestWebSocketServlet");
|
throw new RuntimeException(field + " must be public or protected on createRestWebSocketServlet");
|
||||||
}
|
}
|
||||||
|
resourcesFieldNameSet.add(field.getName());
|
||||||
resourcesFieldSet.add(field);
|
resourcesFieldSet.add(field);
|
||||||
}
|
}
|
||||||
} while ((clzz = clzz.getSuperclass()) != Object.class);
|
} while ((clzz = clzz.getSuperclass()) != Object.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user