/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method. * * See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411 * * @return true if the super class exists and is abstract and package private */ private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) { Class<?> superClass = clazz.getSuperclass(); while (superClass != null) { if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifiers())) { // if superclass is abstract, we need to dig deeper for (Method method : superClass.getDeclaredMethods()) { if (bridgeMethod.signature.matches(method) && method.getGenericReturnType().equals(bridgeMethod.returnType) && !Reflections.isAbstract(method)) { // this is the case we are after -> methods have same signature and the one in super class has actual implementation return true; } } } superClass = superClass.getSuperclass(); } return false; }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }
/** * Check all abstract methods are declared by the decorated types. * * @param type * @param beanManager * @param delegateType * @throws DefinitionException If any of the abstract methods is not declared by the decorated types */ public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) { if (decoratedTypes == null) { decoratedTypes = new HashSet<Type>(type.getInterfaceClosure()); decoratedTypes.remove(Serializable.class); } Set<MethodSignature> signatures = new HashSet<MethodSignature>(); for (Type decoratedType : decoratedTypes) { for (EnhancedAnnotatedMethod<?, ?> method : ClassTransformer.instance(beanManager) .getEnhancedAnnotatedType(Reflections.getRawType(decoratedType), beanManager.getId()).getEnhancedMethods()) { signatures.add(method.getSignature()); } } for (EnhancedAnnotatedMethod<?, ?> method : type.getEnhancedMethods()) { if (Reflections.isAbstract(((AnnotatedMethod<?>) method).getJavaMember())) { MethodSignature methodSignature = method.getSignature(); if (!signatures.contains(methodSignature)) { throw BeanLogger.LOG.abstractMethodMustMatchDecoratedType(method, Formats.formatAsStackTraceElement(method.getJavaMember())); } } } }