/** Returns true if the class or interface represented by the supplied Class is a member class. */ static public boolean isMemberClass (Class c) { return c.isMemberClass(); }
/** Returns true if the class or interface represented by the supplied Class is a member class. */ static public boolean isMemberClass (Class c) { return c.isMemberClass(); }
@Override public boolean isMemberType() { return type.isMemberClass(); }
/** * Determine if the supplied class is an <em>inner class</em>, * i.e. a non-static member of an enclosing class. * @return {@code true} if the supplied class is an inner class * @since 5.0.5 * @see Class#isMemberClass() */ public static boolean isInnerClass(Class<?> clazz) { return (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())); }
private Class<?> getEnclosingClassForNonStaticMemberClass(Class<?> currentTestClass) { if (currentTestClass.isMemberClass() && !Modifier.isStatic(currentTestClass.getModifiers())) { return currentTestClass.getEnclosingClass(); } else { return null; } }
public boolean isANonStaticInnerClass() { return clazz.isMemberClass() && !isStatic(clazz.getModifiers()); }
public boolean isANonStaticInnerClass() { return fClass.isMemberClass() && !isStatic(fClass.getModifiers()); } }
/** * Determine if the supplied class is an <em>inner class</em>, * i.e. a non-static member of an enclosing class. * @return {@code true} if the supplied class is an inner class * @since 5.0.5 * @see Class#isMemberClass() */ public static boolean isInnerClass(Class<?> clazz) { return (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())); }
private boolean isANonStaticInnerClass(Class<?> candidateClass) { return candidateClass.isMemberClass() && !Modifier.isStatic(candidateClass.getModifiers()); }
protected void check(Object task) { if (task == null) { throw new NullPointerException("Task is not defined"); } if (task.getClass().isAnonymousClass()) { throw new IllegalArgumentException("Task can't be created using anonymous class"); } if (task.getClass().isMemberClass() && !Modifier.isStatic(task.getClass().getModifiers())) { throw new IllegalArgumentException("Task class is an inner class and it should be static"); } }
private void check(Object task) { if (task == null) { throw new NullPointerException("Task is not defined"); } if (task.getClass().isAnonymousClass()) { throw new IllegalArgumentException("Task can't be created using anonymous class"); } if (task.getClass().isMemberClass() && !Modifier.isStatic(task.getClass().getModifiers())) { throw new IllegalArgumentException("Task class is an inner class and it should be static"); } }
private void checkNotInner(Field field) { Class<?> type = field.getType(); if(type.isMemberClass() && !isStatic(type.getModifiers())) { throw new MockitoException("the type '" + type.getSimpleName() + "' is an inner non static class."); } }
protected void check(Object task) { if (task == null) { throw new NullPointerException("Task is not defined"); } if (task.getClass().isAnonymousClass()) { throw new IllegalArgumentException("Task can't be created using anonymous class"); } if (task.getClass().isMemberClass() && !Modifier.isStatic(task.getClass().getModifiers())) { throw new IllegalArgumentException("Task class is an inner class and it should be static"); } }
private void check(Object task) { if (task == null) { throw new NullPointerException("Task is not defined"); } if (task.getClass().isAnonymousClass()) { throw new IllegalArgumentException("Task can't be created using anonymous class"); } if (task.getClass().isMemberClass() && !Modifier.isStatic(task.getClass().getModifiers())) { throw new IllegalArgumentException("Task class is an inner class and it should be static"); } }
static Constructor<?> getDefaultConstructor(Class<?> clazz, final Constructor<?>[] constructors) { if (Modifier.isAbstract(clazz.getModifiers())) { return null; } Constructor<?> defaultConstructor = null; for (Constructor<?> constructor : constructors) { if (constructor.getParameterTypes().length == 0) { defaultConstructor = constructor; break; } } if (defaultConstructor == null) { if (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) { Class<?>[] types; for (Constructor<?> constructor : constructors) { if ((types = constructor.getParameterTypes()).length == 1 && types[0].equals(clazz.getDeclaringClass())) { defaultConstructor = constructor; break; } } } } return defaultConstructor; }
private void checkNotInner(Field field) { if(field.getType().isMemberClass() && !Modifier.isStatic(field.getType().getModifiers())) { throw new MockitoException("the type '" + field.getType().getSimpleName() + "' is an inner class."); } }
public boolean checkClass(Class<?> klass) { return !(klass.isInterface() || klass.isArray() || klass.isEnum() || klass.isPrimitive() || klass.isMemberClass() || klass.isAnnotation() || klass.isAnonymousClass()); }
cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()) ? toGenericType(cls.getEnclosingClass()).runtimeType : null;
@Override public boolean apply(Class<?> input) { return !input.isAnonymousClass() && !input.isMemberClass(); } };
@SuppressWarnings("rawtypes") private static void buildTypeVariableMap(ResolvableType type, Map<TypeVariable, Type> typeVariableMap) { if (type != ResolvableType.NONE) { Class<?> resolved = type.resolve(); if (resolved != null && type.getType() instanceof ParameterizedType) { TypeVariable<?>[] variables = resolved.getTypeParameters(); for (int i = 0; i < variables.length; i++) { ResolvableType generic = type.getGeneric(i); while (generic.getType() instanceof TypeVariable<?>) { generic = generic.resolveType(); } if (generic != ResolvableType.NONE) { typeVariableMap.put(variables[i], generic.getType()); } } } buildTypeVariableMap(type.getSuperType(), typeVariableMap); for (ResolvableType interfaceType : type.getInterfaces()) { buildTypeVariableMap(interfaceType, typeVariableMap); } if (resolved != null && resolved.isMemberClass()) { buildTypeVariableMap(ResolvableType.forClass(resolved.getEnclosingClass()), typeVariableMap); } } }