Skip to content

Commit

Permalink
Improved commit f07dfeb
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Jun 26, 2023
1 parent 9ec3b8f commit 8b82ef0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public JClass ref(Class<?> type){
}

public JClass genericRef(Class<?> type, Object... typeArgs){
List<? extends JClass> arguments = Arrays.stream(typeArgs)
List<JClass> safeTypeArgs = Arrays.stream(typeArgs)
.map(typeArg -> {

if(typeArg instanceof Class){
Expand All @@ -115,7 +115,11 @@ public JClass genericRef(Class<?> type, Object... typeArgs){
})
.collect(Collectors.toList());

return ref(type).narrow(arguments);
return genericRef(type, safeTypeArgs);
}

public JClass genericRef(Class<?> type, List<JClass> typeArgs){
return ref(type).narrow(typeArgs);
}

public JType _ref(Class<?> type){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public Number apply(FunctionInvocationPredictor tfTerm){

JVar termFrequencyTableVar = (JVar)TextIndexUtil.computeTermFrequencyTable(null, localTextIndex, textIndexVar, termIndicesVar.invoke("keySet"), maxLength, context);

JVar entriesVar = context.declare(context.genericRef(Collection.class, context.ref(Map.Entry.class).narrow(((JClass)termFrequencyTableVar.type()).getTypeParameters())), "entries", termFrequencyTableVar.invoke("entrySet"));
JVar entriesVar = context.declare(context.genericRef(Collection.class, context.genericRef(Map.Entry.class, ((JClass)termFrequencyTableVar.type()).getTypeParameters())), "entries", termFrequencyTableVar.invoke("entrySet"));

JBlock block = context.block();

Expand Down

0 comments on commit 8b82ef0

Please sign in to comment.