Skip to content

Commit

Permalink
refactor: Use modern foreach loop (#2231)
Browse files Browse the repository at this point in the history
* refactor: Code inspection: Use modern foreach loop

* Fix imports
  • Loading branch information
zielint0 authored and surli committed Jul 17, 2018
1 parent 2d2fcf4 commit ebe5f16
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Iterator;

/**
* Builds Spoon model from class file using the reflection api. The Spoon model
Expand Down Expand Up @@ -332,9 +331,8 @@ public void visitParameter(RtParameter parameter) {
@Override
public <T extends GenericDeclaration> void visitTypeParameter(TypeVariable<T> parameter) {
GenericDeclaration genericDeclaration = parameter.getGenericDeclaration();
Iterator<RuntimeBuilderContext> contextIterator = contexts.iterator();
while (contextIterator.hasNext()) {
CtTypeParameter typeParameter = contextIterator.next().getTypeParameter(genericDeclaration, parameter.getName());
for (RuntimeBuilderContext context : contexts) {
CtTypeParameter typeParameter = context.getTypeParameter(genericDeclaration, parameter.getName());
if (typeParameter != null) {
contexts.peek().addFormalType(typeParameter.clone());
return;
Expand Down Expand Up @@ -380,9 +378,8 @@ public <T extends GenericDeclaration> void visitTypeParameterReference(CtRole ro
}

GenericDeclaration genericDeclaration = parameter.getGenericDeclaration();
Iterator<RuntimeBuilderContext> contextIterator = contexts.iterator();
while (contextIterator.hasNext()) {
CtTypeParameter typeParameter = contextIterator.next().getTypeParameter(genericDeclaration, parameter.getName());
for (RuntimeBuilderContext context : contexts) {
CtTypeParameter typeParameter = context.getTypeParameter(genericDeclaration, parameter.getName());
if (typeParameter != null) {
contexts.peek().addTypeReference(role, typeParameter.getReference());
return;
Expand Down

0 comments on commit ebe5f16

Please sign in to comment.