(Symbol sym, Object val)
| 124 | } |
| 125 | |
| 126 | Object reference(Symbol sym, Object val){ |
| 127 | if(sym.ns != null) |
| 128 | { |
| 129 | throw new IllegalArgumentException("Can't intern namespace-qualified symbol"); |
| 130 | } |
| 131 | |
| 132 | IPersistentMap map = getMappings(); |
| 133 | Object o; |
| 134 | while((o = map.valAt(sym)) == null) |
| 135 | { |
| 136 | IPersistentMap newMap = map.assoc(sym, val); |
| 137 | mappings.compareAndSet(map, newMap); |
| 138 | map = getMappings(); |
| 139 | } |
| 140 | if(o == val) |
| 141 | return o; |
| 142 | |
| 143 | if(checkReplacement(sym, o, val)){ |
| 144 | while (!mappings.compareAndSet(map, map.assoc(sym, val))) |
| 145 | map = getMappings(); |
| 146 | |
| 147 | return val; |
| 148 | } |
| 149 | |
| 150 | return o; |
| 151 | } |
| 152 | |
| 153 | public static boolean areDifferentInstancesOfSameClassName(Class cls1, Class cls2) { |
| 154 | return (cls1 != cls2) && (cls1.getName().equals(cls2.getName())); |
no test coverage detected