Skip to content

Commit

Permalink
list return values
Browse files Browse the repository at this point in the history
  • Loading branch information
mbenson committed Nov 20, 2013
1 parent 8e633f4 commit 8398807
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.jboss.forge.parser.java.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.jdt.core.dom.AST;
Expand Down Expand Up @@ -84,7 +85,6 @@ public O getOrigin()
@SuppressWarnings("unchecked")
public List<Type<O>> getTypeArguments()
{
List<Type<O>> result = new ArrayList<Type<O>>();
org.eclipse.jdt.core.dom.Type type = this.type;

if (type instanceof ArrayType)
Expand All @@ -94,25 +94,27 @@ public List<Type<O>> getTypeArguments()

if (type instanceof ParameterizedType)
{
List<Type<O>> result = new ArrayList<Type<O>>();
List<org.eclipse.jdt.core.dom.Type> arguments = ((ParameterizedType) type).typeArguments();
for (org.eclipse.jdt.core.dom.Type t : arguments)
{
result.add(new TypeImpl<O>(origin, this, t));
}
return Collections.unmodifiableList(result);
}
return result;
return Collections.emptyList();
}

@Override
public boolean isArray()
{
int extraDimensions = 0;
ASTNode parent = type.getParent();
if(parent instanceof FieldDeclaration)
if (parent instanceof FieldDeclaration)
{
for(Object f: ((FieldDeclaration) parent).fragments())
for (Object f : ((FieldDeclaration) parent).fragments())
{
if(f instanceof VariableDeclarationFragment)
if (f instanceof VariableDeclarationFragment)
{
extraDimensions = ((VariableDeclarationFragment) f).getExtraDimensions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.jboss.forge.parser.java.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.jdt.core.dom.ASTNode;
Expand Down Expand Up @@ -43,13 +44,17 @@ public List<Type<O>> getBounds()
{
@SuppressWarnings("unchecked")
List<org.eclipse.jdt.core.dom.Type> typeBounds = internal.typeBounds();
if (typeBounds.isEmpty())
{
return Collections.emptyList();
}
final List<Type<O>> result = new ArrayList<Type<O>>(typeBounds.size());

for (org.eclipse.jdt.core.dom.Type type : typeBounds)
{
result.add(new TypeImpl<O>(origin, type));
}
return result;
return Collections.unmodifiableList(result);
}

@Override
Expand Down

0 comments on commit 8398807

Please sign in to comment.