Skip to content

Commit

Permalink
Introduce formatter instead of checkstyle, apply code formatting wher…
Browse files Browse the repository at this point in the history
…e needed.
  • Loading branch information
manovotn committed Sep 14, 2023
1 parent 30c0538 commit 8a297f7
Show file tree
Hide file tree
Showing 2,378 changed files with 14,380 additions and 10,677 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.settings
.factorypath
.vscode/
.cache
*.ipr
.idea
*.iws
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
public interface ContainerInstance {

/**
* Returns a BeanManager used by this container. If the container uses multiple BeanManager instances it is not defined which of them is returned.
* Returns a BeanManager used by this container. If the container uses multiple BeanManager instances it is not defined
* which of them is returned.
*
* @return beanManager
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractWeldDeployment implements CDI11Deployment {

public static final String BEANS_XML = "META-INF/beans.xml";

public static final String[] RESOURCES = {BEANS_XML};
public static final String[] RESOURCES = { BEANS_XML };

private final ServiceRegistry serviceRegistry;

Expand All @@ -58,5 +58,4 @@ public Iterable<Metadata<Extension>> getExtensions() {
return extensions;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public class WeldBeanDeploymentArchive extends AbstractWeldBeanDeploymentArchive
* @param beansXml
* @param accessibleBeanDeploymentArchives
*/
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, BeansXml beansXml, Set<WeldBeanDeploymentArchive> beanDeploymentArchives) {
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, BeansXml beansXml,
Set<WeldBeanDeploymentArchive> beanDeploymentArchives) {
this(id, beanClasses, null, beansXml, beanDeploymentArchives, Collections.emptySet());
}

Expand All @@ -64,7 +65,9 @@ public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Bean
* @param beanDeploymentArchives
* @param loadedBeanClasses
*/
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Collection<String> knownClasses, BeansXml beansXml, Set<WeldBeanDeploymentArchive> accessibleBeanDeploymentArchives, Collection<Class<?>> loadedBeanClasses) {
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Collection<String> knownClasses,
BeansXml beansXml, Set<WeldBeanDeploymentArchive> accessibleBeanDeploymentArchives,
Collection<Class<?>> loadedBeanClasses) {
super(id);
this.beanClasses = beanClasses;
this.knownClasses = knownClasses;
Expand All @@ -90,7 +93,8 @@ public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Bean
* @param knownClasses
* @param beansXml
*/
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Collection<String> knownClasses, BeansXml beansXml) {
public WeldBeanDeploymentArchive(String id, Collection<String> beanClasses, Collection<String> knownClasses,
BeansXml beansXml) {
this(id, beanClasses, knownClasses, beansXml, Collections.emptySet(), Collections.emptySet());
}

Expand Down Expand Up @@ -119,7 +123,6 @@ public BeansXml getBeansXml() {
return beansXml;
}


public synchronized void setAccessibleBeanDeploymentArchives(Set<WeldBeanDeploymentArchive> beanDeploymentArchives) {
accessibleBeanDeploymentArchives = Collections.unmodifiableSet(new HashSet<>(beanDeploymentArchives));
}
Expand All @@ -138,7 +141,8 @@ void addBeanClass(String className) {
* @param archives
* @return the "flat" bean deployment archive
*/
public static <T extends BeanDeploymentArchive> WeldBeanDeploymentArchive merge(CDI11Bootstrap bootstrap, Iterable<T> archives) {
public static <T extends BeanDeploymentArchive> WeldBeanDeploymentArchive merge(CDI11Bootstrap bootstrap,
Iterable<T> archives) {
BeansXml mergedBeansXml = BeansXmlParser.mergeExisting(archives, true);
Set<String> beanClasses = new HashSet<String>();
for (BeanDeploymentArchive archive : archives) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ public class WeldDeployment extends AbstractWeldDeployment {
*
* @param resourceLoader
* @param bootstrap
* @param beanDeploymentArchives The set should be mutable so that additional bean deployment archives can be eventually added
* @param beanDeploymentArchives The set should be mutable so that additional bean deployment archives can be eventually
* added
* @param extensions
*/
public WeldDeployment(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<WeldBeanDeploymentArchive> beanDeploymentArchives,
public WeldDeployment(ResourceLoader resourceLoader, Bootstrap bootstrap,
Set<WeldBeanDeploymentArchive> beanDeploymentArchives,
Iterable<Metadata<Extension>> extensions) {
super(bootstrap, extensions);
this.beanDeploymentArchives = beanDeploymentArchives;
setBeanDeploymentArchivesAccessibility();
getServices().add(ResourceLoader.class, resourceLoader);
}


@Override
public Collection<BeanDeploymentArchive> getBeanDeploymentArchives() {
return Collections.<BeanDeploymentArchive> unmodifiableSet(beanDeploymentArchives);
Expand All @@ -74,7 +75,7 @@ public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
}

@Override
public WeldBeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) {
public WeldBeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) {
for (WeldBeanDeploymentArchive beanDeploymentArchive : beanDeploymentArchives) {
if (beanDeploymentArchive.getKnownClasses().contains(beanClass.getName())) {
return beanDeploymentArchive;
Expand All @@ -96,13 +97,15 @@ protected WeldBeanDeploymentArchive getAndUpdateAdditionalBeanDeploymentArchive(
}

/**
* Additional bean deployment archives are used for extentions, synthetic annotated types and beans which do not come from a bean archive.
* Additional bean deployment archives are used for extentions, synthetic annotated types and beans which do not come from a
* bean archive.
*
* @param beanClass
* @return the additional bean deployment archive
*/
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive() {
WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, Collections.synchronizedSet(new HashSet<String>()), null);
WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID,
Collections.synchronizedSet(new HashSet<String>()), null);
additionalBda.getServices().addAll(getServices().entrySet());
beanDeploymentArchives.add(additionalBda);
setBeanDeploymentArchivesAccessibility();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @author Martin Kouba
* @author Jozef Hartinger
* @author <a href="https://about.me/lairdnelson"
* target="_parent">Laird Nelson</a>
* target="_parent">Laird Nelson</a>
*/
public abstract class AbstractDiscoveryStrategy implements DiscoveryStrategy {

Expand Down Expand Up @@ -78,8 +78,8 @@ protected AbstractDiscoveryStrategy() {
* @param emptyBeansXmlDiscoveryMode
*/
public AbstractDiscoveryStrategy(ResourceLoader resourceLoader, Bootstrap bootstrap,
Set<Class<? extends Annotation>> initialBeanDefiningAnnotations,
BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
Set<Class<? extends Annotation>> initialBeanDefiningAnnotations,
BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
handlers = new LinkedList<BeanArchiveHandler>();
setResourceLoader(resourceLoader);
setBootstrap(bootstrap);
Expand Down Expand Up @@ -147,7 +147,7 @@ public Set<WeldBeanDeploymentArchive> performDiscovery() {
for (Iterator<BeanArchiveBuilder> iterator = beanArchiveBuilders.iterator(); iterator.hasNext();) {
BeanArchiveBuilder builder = iterator.next();
BeansXml beansXml = builder.getBeansXml();
if(beansXml != null) {
if (beansXml != null) {
switch (beansXml.getBeanDiscoveryMode()) {
case ALL:
addToArchives(archives, processAllDiscovery(builder));
Expand Down Expand Up @@ -192,7 +192,8 @@ protected void addToArchives(Set<WeldBeanDeploymentArchive> deploymentArchives,
}

/**
* Initialize the strategy before accessing found BeanArchiveBuilder builders. Best used for saving some information before the process method for each
* Initialize the strategy before accessing found BeanArchiveBuilder builders. Best used for saving some information before
* the process method for each
* builder is called.
*/
protected void beforeDiscovery(Collection<BeanArchiveBuilder> builders) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import org.jboss.weld.util.Preconditions;

/**
* A class used to store information about the bean archive and to build the {@link org.jboss.weld.environment.deployment.WeldBeanDeploymentArchive}
* A class used to store information about the bean archive and to build the
* {@link org.jboss.weld.environment.deployment.WeldBeanDeploymentArchive}
* instance from the gathered information.
*
* @author Matej Briškár
Expand Down Expand Up @@ -96,7 +97,8 @@ public Set<String> getClasses() {
}

public BeanArchiveBuilder setAttribute(String key, Object value) {
attributes.put(key, value); return this;
attributes.put(key, value);
return this;
}

public Object getAttribute(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
/**
* Handles the reference to a bean archive.
* <p>
* The standard way to register a handler is via {@link DiscoveryStrategy#registerHandler(BeanArchiveHandler)}. Alternatively, handlers may be registered using
* The standard way to register a handler is via {@link DiscoveryStrategy#registerHandler(BeanArchiveHandler)}. Alternatively,
* handlers may be registered using
* the {@link ServiceLoader} mechanism.
* </p>
* <p>
* Additionaly, handlers could specify their priority using {@code jakarta.annotation.Priority}. Handlers with higher priority have precedence. The default
* priority is 0. Handlers registered programatically have the default priority {@code registeredHandlers.size - index}, i.e. derived from the order they were
* Additionaly, handlers could specify their priority using {@code jakarta.annotation.Priority}. Handlers with higher priority
* have precedence. The default
* priority is 0. Handlers registered programatically have the default priority {@code registeredHandlers.size - index}, i.e.
* derived from the order they were
* inserted.
* </p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
/**
* Scans the application for bean archives.
*
* The implementation may be optimized for bean archives containing beans.xml file with bean-discovey-mode of none. E.g. it does not have to scan classes in
* The implementation may be optimized for bean archives containing beans.xml file with bean-discovey-mode of none. E.g. it does
* not have to scan classes in
* such an archive.
*
* @author Martin Kouba
Expand Down Expand Up @@ -59,7 +60,8 @@ public String getBeanArchiveRef() {

/**
*
* @return the beans.xml representation or <code>null</code> in case of a candidate for an implicit bean archive with no beans.xml
* @return the beans.xml representation or <code>null</code> in case of a candidate for an implicit bean archive with no
* beans.xml
*/
public BeansXml getBeansXml() {
return beansXml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ private void scanJarFile(File entryFile, ImmutableList.Builder<ScanResult> resul
if (beansXmlEntry != null) {
logger.debugv(BEANS_XML_FOUND_MESSAGE, entryFile);
BeansXml beansXml = parseBeansXml(
new URL(PROCOTOL_JAR + ":" + entryFile.toURI().toURL().toExternalForm() + JAR_URL_SEPARATOR + beansXmlEntry.getName()));
new URL(PROCOTOL_JAR + ":" + entryFile.toURI().toURL().toExternalForm() + JAR_URL_SEPARATOR
+ beansXmlEntry.getName()));
if (accept(beansXml)) {
results.add(new ScanResult(beansXml, entryFile.getPath()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class DefaultBeanArchiveScanner extends AbstractBeanArchiveScanner {
* @param resourceLoader
* @param bootstrap
*/
public DefaultBeanArchiveScanner(ResourceLoader resourceLoader, Bootstrap bootstrap, BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
public DefaultBeanArchiveScanner(ResourceLoader resourceLoader, Bootstrap bootstrap,
BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
super(bootstrap, emptyBeansXmlDiscoveryMode);
this.resourceLoader = resourceLoader;
}
Expand Down Expand Up @@ -98,18 +99,18 @@ protected String getBeanArchiveReference(URL url) {
CommonLogger.LOG.couldNotReadResource(url, e);
}

if(PROCOTOL_FILE.equals(url.getProtocol())) {
if (PROCOTOL_FILE.equals(url.getProtocol())) {
// Adapt file URL, e.g. "file:///home/weld/META-INF/beans.xml" becomes "/home/weld"
ref = new File(uri.getSchemeSpecificPart()).getParentFile().getParent();
} else if(PROCOTOL_JAR.equals(url.getProtocol())) {
} else if (PROCOTOL_JAR.equals(url.getProtocol())) {
// Attempt to adapt JAR file URL, e.g. "jar:file:/home/duke/duke.jar!/META-INF/beans.xml" becomes "/home/duke/duke.jar"
// NOTE: Some class loaders may support nested jars, e.g. "jar:file:/home/duke/duke.jar!/lib/foo.jar!/META-INF/beans.xml" becomes
// "/home/duke/duke.jar!/lib/foo.jar"

// The decoded part without protocol part, i.e. without "jar:"
ref = uri.getSchemeSpecificPart();

if(ref.lastIndexOf(JAR_URL_SEPARATOR) > 0) {
if (ref.lastIndexOf(JAR_URL_SEPARATOR) > 0) {
ref = ref.substring(0, ref.lastIndexOf(JAR_URL_SEPARATOR));
}
ref = getBeanArchiveReferenceForJar(ref, url);
Expand Down Expand Up @@ -137,7 +138,7 @@ protected String getBeanArchiveReferenceForJar(String path, URL fallback) {
ClassLoader jnlpClassLoader = WeldResourceLoader.getClassLoader();
Class<?> jnlpClClass = jnlpClassLoader.getClass();

try{
try {
// Detecting if running inside icedtea-web JNLP runtime
if (jnlpClClass.getName().equals("net.sourceforge.jnlp.runtime.classloader.JNLPClassLoader")) {
// Try to get field net.sourceforge.jnlp.runtime.JNLPClassLoader#tracker from icedtea-web 1.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.jboss.weld.environment.deployment.discovery;

import java.lang.annotation.Annotation;

import java.util.Set;

import org.jboss.weld.bootstrap.api.Bootstrap;
Expand All @@ -31,7 +30,7 @@
* @author Matej Briškár
* @author Martin Kouba
* @author <a href="https://about.me/lairdnelson"
* target="_parent">Laird Nelson</a>
* target="_parent">Laird Nelson</a>
*/
public interface DiscoveryStrategy {

Expand All @@ -56,12 +55,13 @@ public interface DiscoveryStrategy {
* implementation may use when discovering beans.
*
* @param initialBeanDefiningAnnotations the initial {@link Set}
* of bean defining annotations
* of bean defining annotations
*/
void setInitialBeanDefiningAnnotations(Set<Class<? extends Annotation>> initialBeanDefiningAnnotations);

/**
* Optionally, a client may set a custom scanner implementation. If not set, the impl is allowed to use anything it considers appropriate.
* Optionally, a client may set a custom scanner implementation. If not set, the impl is allowed to use anything it
* considers appropriate.
*
* @param beanArchiveScanner
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
* @author Martin Kouba
* @author <a href="https://about.me/lairdnelson"
* target="_parent">Laird Nelson</a>
* target="_parent">Laird Nelson</a>
*/
public final class DiscoveryStrategyFactory {

Expand All @@ -47,10 +47,11 @@ private DiscoveryStrategyFactory() {
* @return the discovery strategy
*/
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap,
Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled,
BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled,
BeanDiscoveryMode emptyBeansXmlDiscoveryMode) {
DiscoveryStrategy returnValue = null;
final Iterator<Metadata<DiscoveryStrategy>> iterator = ServiceLoader.load(DiscoveryStrategy.class, resourceLoader).iterator();
final Iterator<Metadata<DiscoveryStrategy>> iterator = ServiceLoader.load(DiscoveryStrategy.class, resourceLoader)
.iterator();
if (iterator != null && iterator.hasNext()) {
final DiscoveryStrategy candidate = iterator.next().getValue();
if (candidate != null) {
Expand All @@ -70,8 +71,9 @@ public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap
initialBeanDefiningAnnotations, emptyBeansXmlDiscoveryMode);
} catch (Exception e) {
throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME,
Arrays.toString(new Object[] { resourceLoader, bootstrap,
initialBeanDefiningAnnotations, emptyBeansXmlDiscoveryMode }), e);
Arrays.toString(new Object[] { resourceLoader, bootstrap,
initialBeanDefiningAnnotations, emptyBeansXmlDiscoveryMode }),
e);
}
}
}
Expand Down
Loading

0 comments on commit 8a297f7

Please sign in to comment.