Okay but why isn't it the right way to build a BuiltinMap? You're trying to
enforce a contract here, but I just don't see what we actually gain from
enforcing that contract. What's the bad thing that happens if someone
decides they happen to want to build a map this way?


On Tue, Jun 3, 2014 at 10:27 AM, Yilong Li <notifications@github.com> wrote:

> In
> src/javasources/KTool/src/org/kframework/backend/java/kil/BuiltinMap.java:
>
> > +
> > +        public Term remove(Term key) {
> > +            return entries.remove(key);
> > +        }
> > +
> > +        public Map<Term, Term> getEntries() {
> > +            return UnmodifiableMap.decorate(
> entries);
> > +        }
> > +
> > +        /**
> > +         * Sets the entries without copying the contents. Once the entries are
> > +         * set, no more modification is allowed.
> > +         *
> > +         * @param map
> > +         */
> > +        public void setEntries(Map<Term, Term> map) {
>
> Because calling this method twice is not the right way to build a
> BuiltinMap. I have already answered why I couldn't use a
> ImmutableMap.Builder in the other reply.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/kframework/k/pull/537/files#r13340564>.
>