From 1a582b6eb730a0bc0d7dfdf8e7f6da6316884106 Mon Sep 17 00:00:00 2001 From: Che Shian Hung Date: Mon, 22 Jan 2018 11:22:17 -0500 Subject: [PATCH] fix #159, Map field type fixed --- src/java/boa/compiler/visitors/CodeGeneratingVisitor.java | 6 +++--- src/java/boa/types/BoaMap.java | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java b/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java index 4a21cd791..ee3970ed2 100644 --- a/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java +++ b/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java @@ -230,7 +230,7 @@ public void visit(final FunctionType n) { for (final Component c : params) { args.add(c.getIdentifier().getToken()); - types.add(c.getType().type.toJavaType()); + types.add(c.getType().type.toInterfaceJavaType()); } st.add("name", funcType.toJavaType()); @@ -1583,7 +1583,7 @@ public void visit(final FunctionExpression n) { if (!(c instanceof BoaName)) continue; args.add(((BoaName)c).getId()); - types.add(((BoaName)c).getType().toJavaType()); + types.add(((BoaName)c).getType().toInterfaceJavaType()); } this.varDecl.start(n); @@ -1815,7 +1815,7 @@ public void visit(final FunctionType n) { for (int i = 0; i < paramTypes.length; i++) { args.add(((BoaName) paramTypes[i]).getId()); - types.add(paramTypes[i].toJavaType()); + types.add(paramTypes[i].toInterfaceJavaType()); } st.add("name", funcType.toJavaType()); diff --git a/src/java/boa/types/BoaMap.java b/src/java/boa/types/BoaMap.java index 082fc2241..15da87eb0 100644 --- a/src/java/boa/types/BoaMap.java +++ b/src/java/boa/types/BoaMap.java @@ -154,7 +154,13 @@ public String toJavaType() { /** {@inheritDoc} */ @Override public String toInterfaceJavaType() { - return "java.util.HashMap<" + this.indexType.toParameterJavaType() + ", " + this.valueType.toParameterJavaType() + ">"; + return "java.util.Map<" + this.indexType.toParameterJavaType() + ", " + this.valueType.toParameterJavaType() + ">"; + } + + /** {@inheritDoc} */ + @Override + public String toParameterJavaType() { + return "java.util.Map<" + this.indexType.toParameterJavaType() + ", " + this.valueType.toParameterJavaType() + ">"; } /** {@inheritDoc} */