You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2020/06/07 20:45:12 UTC
[openwebbeans] 02/02: replace ancient iterator loops with java6 for
This is an automated email from the ASF dual-hosted git repository.
struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
commit 9d1082c410f800a47bfa006eb5f9d6efc72cdacd
Author: Mark Struberg <st...@apache.org>
AuthorDate: Sun Jun 7 22:44:41 2020 +0200
replace ancient iterator loops with java6 for
no functional change
---
.../main/java/org/apache/webbeans/config/BeansDeployer.java | 5 +----
.../java/org/apache/webbeans/container/InjectionResolver.java | 10 +++-------
.../apache/webbeans/portable/events/discovery/ErrorStack.java | 6 ++----
.../InterceptorWithSuperClassInterceptedComponent.java | 5 +----
.../test/component/intercept/MultipleInterceptedComponent.java | 5 +----
5 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java b/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
index 057db3d..370a8fe 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
@@ -1617,12 +1617,9 @@ public class BeansDeployer
logger.fine("Deploying configurations from XML files has started.");
Set<URL> bdaLocations = scanner.getBeanXmls();
- Iterator<URL> it = bdaLocations.iterator();
- while (it.hasNext())
+ for (URL url : bdaLocations)
{
- URL url = it.next();
-
logger.fine("OpenWebBeans BeansDeployer configuring: " + url.toExternalForm());
BeanArchiveInformation beanArchiveInformation = beanArchiveService.getBeanArchiveInformation(url);
diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
index ca3cf36..8154c30 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
@@ -377,11 +377,9 @@ public class InjectionResolver
resolvedComponents = new HashSet<>();
Set<Bean<?>> deployedComponents = webBeansContext.getBeanManagerImpl().getBeans();
- Iterator<Bean<?>> it = deployedComponents.iterator();
//Finding all beans with given name
- while (it.hasNext())
+ for (Bean<?> component : deployedComponents)
{
- Bean<?> component = it.next();
if (component.getName() != null)
{
if (component.getName().equals(name))
@@ -802,10 +800,8 @@ public class InjectionResolver
int i = 0;
for (Annotation annot : annotations)
{
- Iterator<Annotation> itQualifiers = qTypes.iterator();
- while (itQualifiers.hasNext())
+ for (Annotation qualifier : qTypes)
{
- Annotation qualifier = itQualifiers.next();
if (annot.annotationType().equals(qualifier.annotationType()))
{
AnnotatedType<?> at = findQualifierModel(qualifier.annotationType());
@@ -817,7 +813,7 @@ public class InjectionResolver
}
}
else
- {
+ {
if (AnnotationUtil.isCdiAnnotationEqual(at, qualifier, annot))
{
i++;
diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java b/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
index 753d45b..95cef69 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
@@ -50,17 +50,15 @@ public class ErrorStack
{
if(!errorStack.isEmpty())
{
- Iterator<Throwable> it = errorStack.iterator();
- while(it.hasNext())
+ for (Throwable t : errorStack)
{
- Throwable t = it.next();
String message = t.getMessage();
if (message != null && message.length() > 0)
{
logger.log(Level.SEVERE, t.getMessage(), t);
}
else
- {
+ {
logger.log(Level.SEVERE, "unknown error", t);
}
}
diff --git a/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java b/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java
index ee87ed2..de17d8d 100644
--- a/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java
+++ b/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/InterceptorWithSuperClassInterceptedComponent.java
@@ -48,10 +48,7 @@ public class InterceptorWithSuperClassInterceptedComponent
java.util.List<String> s = new ArrayList<String>();
Map<String, Object> map = context.getContextData();
Set<Entry<String, Object>> set = map.entrySet();
- Iterator<Entry<String, Object>> it = set.iterator();
- while (it.hasNext())
- {
- Entry<String, Object> s2 = it.next();
+ for (Entry<String, Object> s2 : set) {
s.add(s2.getKey());
}
diff --git a/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java b/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java
index 4631705..dd45aa3 100644
--- a/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java
+++ b/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/MultipleInterceptedComponent.java
@@ -48,10 +48,7 @@ public class MultipleInterceptedComponent
java.util.List<String> s = new ArrayList<String>();
Map<String, Object> map = context.getContextData();
Set<Entry<String, Object>> set = map.entrySet();
- Iterator<Entry<String, Object>> it = set.iterator();
- while (it.hasNext())
- {
- Entry<String, Object> s2 = it.next();
+ for (Entry<String, Object> s2 : set) {
s.add(s2.getKey());
}