diff --git a/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java b/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java index 9ed83593a..71b6ebe99 100644 --- a/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java +++ b/src/java/boa/compiler/visitors/CodeGeneratingVisitor.java @@ -1872,31 +1872,20 @@ public void visit(final OutputType n) { /** {@inheritDoc} */ @Override public void visit(final StackType n) { - final ST st = stg.getInstanceOf("StackType"); - - n.env.setNeedsBoxing(true); - - n.getValue().accept(this); - st.add("value", code.removeLast()); - - n.env.setNeedsBoxing(false); - - code.add(st.render()); + if(n.type != null) + code.add(n.type.toJavaType()); + else{ + final ST st = stg.getInstanceOf("StackType"); + n.getValue().accept(this); + st.add("value", code.removeLast()); + code.add(st.render()); + } } /** {@inheritDoc} */ @Override public void visit(final SetType n) { - final ST st = stg.getInstanceOf("SetType"); - - n.env.setNeedsBoxing(true); - - n.getValue().accept(this); - st.add("value", code.removeLast()); - - n.env.setNeedsBoxing(false); - - code.add(st.render()); + code.add(n.type.toJavaType()); } /** {@inheritDoc} */ diff --git a/templates/BoaJava.stg b/templates/BoaJava.stg index 4cbaf40a8..031493ebb 100644 --- a/templates/BoaJava.stg +++ b/templates/BoaJava.stg @@ -18,9 +18,7 @@ identifierMap ::= [ VarDecl(isstatic, type, id) ::= "static ___;<\n>" ArrayType(type) ::= "[]" -MapType(key, value) ::= "java.util.HashMap\<, >" StackType(value) ::= "java.util.Stack\<>" -SetType(value) ::= "java.util.LinkedHashSet\<>" Block(statements) ::= << { }>}