Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed May 30, 2017
2 parents 3b01522 + 4a6759c commit ae4acf0
Show file tree
Hide file tree
Showing 6 changed files with 966 additions and 9 deletions.
23 changes: 15 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,37 +65,44 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<version>2.10.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.nuiton</groupId>
<artifactId>helper-maven-plugin</artifactId>
<version>2.0</version>
<version>2.3.2</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
14 changes: 13 additions & 1 deletion src/com/esotericsoftware/yamlbeans/Beans.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -289,7 +290,18 @@ private Class getElementTypeFromGenerics (Type type) {
if (isCollection(rawType) || isMap(rawType)) {
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
if (actualTypeArguments.length > 0) {
return (Class)actualTypeArguments[actualTypeArguments.length - 1];
final Type cType = actualTypeArguments[actualTypeArguments.length - 1];
if (cType instanceof Class) {
return (Class) cType;
} else if (cType instanceof WildcardType) {
WildcardType t = (WildcardType) cType;
final Type bound = t.getUpperBounds()[0];
return bound instanceof Class ? (Class) bound : null;
} else if (cType instanceof ParameterizedType) {
ParameterizedType t = (ParameterizedType) cType;
final Type rt = t.getRawType();
return rt instanceof Class ? (Class) rt : null;
}
}
}
}
Expand Down
Loading

0 comments on commit ae4acf0

Please sign in to comment.