Skip to content

Commit

Permalink
Code formatting changes due to new formatter/impsort rules
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Sep 14, 2023
1 parent 2a8c15f commit 9d4538c
Show file tree
Hide file tree
Showing 59 changed files with 315 additions and 232 deletions.
21 changes: 12 additions & 9 deletions impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
*/
package org.jboss.weld.bean;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.BeanAttributes;
import jakarta.enterprise.inject.spi.Decorator;
import jakarta.enterprise.inject.spi.InjectionPoint;
import jakarta.enterprise.inject.spi.InjectionTarget;
import jakarta.enterprise.inject.spi.Producer;
import jakarta.enterprise.invoke.Invokable;

import org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType;
import org.jboss.weld.annotated.enhanced.MethodSignature;
import org.jboss.weld.annotated.enhanced.jlr.MethodSignatureImpl;
Expand All @@ -35,13 +43,6 @@
import org.jboss.weld.serialization.spi.BeanIdentifier;
import org.jboss.weld.util.Beans;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
* An abstract bean representation common for class-based beans
*
Expand Down Expand Up @@ -210,7 +211,8 @@ private void initInvokableMethods() {
}
MethodSignature signature = MethodSignatureImpl.of(method);
if (!encounteredMethods.contains(signature) &&
(hasClassLevelInvokableAnnotation || method.getAnnotations().stream().anyMatch(a -> isInvokableAnnotation(a.annotationType(), metaAnnotationStore)))) {
(hasClassLevelInvokableAnnotation || method.getAnnotations().stream()
.anyMatch(a -> isInvokableAnnotation(a.annotationType(), metaAnnotationStore)))) {
invokableMethods.add(method);
}
encounteredMethods.add(signature);
Expand All @@ -227,7 +229,8 @@ private void initInvokableMethods() {
* @param invokableCandidate annotation class to inspect
* @return true if the annotation is considered {@link Invokable}, false otherwise
*/
private boolean isInvokableAnnotation(Class<? extends Annotation> invokableCandidate, MetaAnnotationStore metaAnnotationStore) {
private boolean isInvokableAnnotation(Class<? extends Annotation> invokableCandidate,
MetaAnnotationStore metaAnnotationStore) {
if (invokableCandidate.equals(Invokable.class)) {
return true;
} else {
Expand Down
5 changes: 3 additions & 2 deletions impl/src/main/java/org/jboss/weld/bean/ClassBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.jboss.weld.bean;

import java.util.Collection;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.BeanManager;
Expand All @@ -25,8 +27,6 @@
import org.jboss.weld.annotated.slim.SlimAnnotatedType;
import org.jboss.weld.manager.BeanManagerImpl;

import java.util.Collection;

/**
* Marker for {@link Bean} implementations that are defined by a Java class.
*
Expand Down Expand Up @@ -67,6 +67,7 @@ public interface ClassBean<T> extends WeldBean<T> {

/**
* Returns a subset of methods of this class bean for which an invoker might be registered.
*
* @return a collection of annotated methods for which an invoker can be registered
*/
Collection<AnnotatedMethod<? super T>> getInvokableMethods();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
*/
package org.jboss.weld.bootstrap.events;

import java.lang.reflect.Type;
import java.util.Collection;

import jakarta.enterprise.inject.spi.AnnotatedMethod;
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.ProcessManagedBean;
import jakarta.enterprise.invoke.Invoker;
import jakarta.enterprise.invoke.InvokerBuilder;

import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.invokable.InvokerBuilderImpl;
import org.jboss.weld.manager.BeanManagerImpl;

import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.ProcessManagedBean;
import java.lang.reflect.Type;
import java.util.Collection;

public class ProcessManagedBeanImpl<X> extends AbstractProcessClassBean<X, ManagedBean<X>> implements ProcessManagedBean<X> {

protected static <X> void fire(BeanManagerImpl beanManager, ManagedBean<X> bean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.ProcessSessionBean;
import jakarta.enterprise.inject.spi.SessionBeanType;

import jakarta.enterprise.invoke.Invoker;
import jakarta.enterprise.invoke.InvokerBuilder;

import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.invokable.InvokerBuilderImpl;
import org.jboss.weld.logging.BootstrapLogger;
Expand Down Expand Up @@ -80,6 +80,7 @@ public Collection<AnnotatedMethod<? super Object>> getInvokableMethods() {
// TODO better exception
throw new IllegalArgumentException("Not an invokable method: " + annotatedMethod);
}
return new InvokerBuilderImpl<>(getBean().getEjbDescriptor().getBeanClass(), annotatedMethod.getJavaMember(), getBeanManager());
return new InvokerBuilderImpl<>(getBean().getEjbDescriptor().getBeanClass(), annotatedMethod.getJavaMember(),
getBeanManager());
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.jboss.weld.invokable;

import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.invoke.InvokerBuilder;

import java.lang.annotation.Annotation;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
Expand All @@ -12,6 +9,9 @@
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;

import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.invoke.InvokerBuilder;

// TODO deployment-time validation of configured lookups
abstract class AbstractInvokerBuilder<B, T> implements InvokerBuilder<T> {

Expand Down Expand Up @@ -47,7 +47,8 @@ public InvokerBuilder<T> setInstanceLookup() {
public InvokerBuilder<T> setArgumentLookup(int position) {
if (position >= argLookup.length) {
// TODO better exception
throw new IllegalArgumentException("Error attempting to set CDI argument lookup for arg number " + position + " while the number of method args is " + argLookup.length);
throw new IllegalArgumentException("Error attempting to set CDI argument lookup for arg number " + position
+ " while the number of method args is " + argLookup.length);
}
argLookup[position] = true;
return this;
Expand All @@ -67,7 +68,8 @@ public InvokerBuilder<T> setInstanceTransformer(Class<?> clazz, String methodNam
public InvokerBuilder<T> setArgumentTransformer(int position, Class<?> clazz, String methodName) {
if (position >= argTransformers.length) {
// TODO better exception
throw new IllegalArgumentException("Error attempting to set an argument lookup. Number of method args: " + argLookup.length + " arg position: " + position);
throw new IllegalArgumentException("Error attempting to set an argument lookup. Number of method args: "
+ argLookup.length + " arg position: " + position);
}
if (argTransformers[position] != null) {
// TODO better exception
Expand Down Expand Up @@ -142,7 +144,8 @@ private boolean requiresCleanup() {
if (instanceTransformerMethod.type().parameterCount() == 1) { // no cleanup
mh = MethodHandles.filterArguments(mh, 0, instanceTransformerMethod);
} else if (instanceTransformerMethod.type().parameterCount() == 2) { // cleanup
instanceTransformerMethod = instanceTransformerMethod.asType(instanceTransformerMethod.type().changeParameterType(1, CleanupActions.class));
instanceTransformerMethod = instanceTransformerMethod
.asType(instanceTransformerMethod.type().changeParameterType(1, CleanupActions.class));
mh = MethodHandles.collectArguments(mh, 0, instanceTransformerMethod);
instanceArguments++;
} else {
Expand All @@ -163,7 +166,8 @@ private boolean requiresCleanup() {
if (argTransformerMethod.type().parameterCount() == 1) { // no cleanup
mh = MethodHandles.filterArguments(mh, position, argTransformerMethod);
} else if (argTransformerMethod.type().parameterCount() == 2) { // cleanup
argTransformerMethod = argTransformerMethod.asType(argTransformerMethod.type().changeParameterType(1, CleanupActions.class));
argTransformerMethod = argTransformerMethod
.asType(argTransformerMethod.type().changeParameterType(1, CleanupActions.class));
mh = MethodHandles.collectArguments(mh, position, argTransformerMethod);
} else {
// internal error, this should not pass validation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.jboss.weld.invokable;

import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.inject.Instance;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

import jakarta.enterprise.context.Dependent;
import jakarta.enterprise.inject.Instance;

class CleanupActions implements Consumer<Runnable> {
private final List<Runnable> cleanupTasks = new ArrayList<>();
private final List<Instance.Handle<?>> dependentInstances = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.jboss.weld.invokable;

import java.lang.reflect.Method;

import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.invoke.Invoker;

import java.lang.reflect.Method;

public class InvokerBuilderImpl<B> extends AbstractInvokerBuilder<B, Invoker<B, ?>> {

public InvokerBuilderImpl(Class<B> beanClass, Method method, BeanManager beanManager) {
Expand Down
4 changes: 2 additions & 2 deletions impl/src/main/java/org/jboss/weld/invokable/InvokerImpl.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.jboss.weld.invokable;

import java.lang.invoke.MethodHandle;

import jakarta.enterprise.inject.build.compatible.spi.InvokerInfo;
import jakarta.enterprise.invoke.Invoker;

import java.lang.invoke.MethodHandle;

public class InvokerImpl<T, R> implements Invoker<T, R>, InvokerInfo {
private final MethodHandle mh;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.jboss.weld.invokable;

import java.lang.reflect.Method;

import jakarta.enterprise.inject.build.compatible.spi.InvokerInfo;
import jakarta.enterprise.inject.spi.BeanManager;

import java.lang.reflect.Method;

public class InvokerInfoBuilder<B> extends AbstractInvokerBuilder<B, InvokerInfo> {

public InvokerInfoBuilder(Class<B> beanClass, Method method, BeanManager beanManager) {
Expand Down
13 changes: 7 additions & 6 deletions impl/src/main/java/org/jboss/weld/invokable/LookupUtils.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.jboss.weld.invokable;

import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Named;
import org.jboss.weld.inject.WeldInstance;

import java.lang.annotation.Annotation;
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Named;

import org.jboss.weld.inject.WeldInstance;

class LookupUtils {
private LookupUtils() {
}
Expand Down
Loading

0 comments on commit 9d4538c

Please sign in to comment.