Mercurial Hosting > luan
diff src/luan/impl/Pointer.java @ 1578:c922446f53aa
immutable threading
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 08 Feb 2021 14:16:19 -0700 |
parents | e1a13e707bf3 |
children |
line wrap: on
line diff
--- a/src/luan/impl/Pointer.java Sun Jan 31 16:04:39 2021 -0700 +++ b/src/luan/impl/Pointer.java Mon Feb 08 14:16:19 2021 -0700 @@ -1,12 +1,10 @@ package luan.impl; -import luan.LuanCloneable; -import luan.LuanCloner; -import luan.LuanImmutabler; +import luan.LuanMutable; import luan.LuanException; -public final class Pointer implements LuanCloneable { +public final class Pointer implements LuanMutable { private Object o; private boolean immutable = false; @@ -16,17 +14,15 @@ this.o = o; } - @Override public Pointer shallowClone() { - return new Pointer(); + @Override public boolean isImmutable() { + return immutable; } - @Override public void deepenClone(LuanCloneable clone,LuanCloner cloner) { - ((Pointer)clone).o = cloner.get(o); - } - - @Override public void makeImmutable(LuanImmutabler immutabler) throws LuanException { - immutabler.makeImmutable(o); + @Override public void makeImmutable() { + if(immutable) + return; immutable = true; + LuanMutable.makeImmutable(o); } public Object get() {