Skip to content

Commit

Permalink
merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed May 16, 2018
2 parents 34124ec + ca2cbf4 commit 200cf26
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ else if( t instanceof WildcardType ) {

// CHECK FOR NESTED WILDCARDTYPE
if( tt instanceof ParameterizedType &&
Stream.of((Type[])((ParameterizedType)tt).getActualTypeArguments())
Stream.of(((ParameterizedType)tt).getActualTypeArguments())
.anyMatch( arg -> (arg instanceof WildcardType) ))
{
final Class<?> clazz = (Class<?>) (((ParameterizedType)tt).getRawType());
Expand All @@ -327,7 +327,7 @@ else if( t instanceof WildcardType ) {
}
}
else if( t instanceof GenericArrayType ) {
throw new IllegalArgumentException( format("type argument <%s> 'GenericArrayType' is a not supported yet!", t));
//throw new IllegalArgumentException( format("type argument <%s> 'GenericArrayType' is a not supported yet!", t));
}

}
Expand Down
18 changes: 18 additions & 0 deletions core/src/test/java/org/bsc/java2typescript/ProcessorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,22 @@ public void testSample1() throws Exception {

}

@Test
public void testSample1_GenericArrayType() throws Exception {
final Class<?> type = Sample1.class;
final Object[] arr = {};

final Method m = type.getMethod("genericArrayType", arr.getClass());
final String result =
converter.getMethodParametersAndReturnDecl( m,
TSType.from(type),
declaredTypeMap( TSType.from(java.util.List.class)),
true) ;

Assert.assertThat( result, IsNull.notNullValue());
Assert.assertThat( result, IsEqual.equalTo("( c:[E] ):java.util.List<T[]>"));


}

}
1 change: 1 addition & 0 deletions core/src/test/java/org/bsc/java2typescript/Sample1.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ public interface Sample1<E> {
<T> void merge(BiConsumer<E,Sample2<? extends Sample2<? extends T>>> source);
<T> T concatMap(Function<? super E, ? extends Sample2<? extends T>> mapper);

<T> java.util.List<T[]> genericArrayType( E[] c );
}

0 comments on commit 200cf26

Please sign in to comment.