(Symbol sym, Class val)
| 155 | } |
| 156 | |
| 157 | Class referenceClass(Symbol sym, Class val){ |
| 158 | if(sym.ns != null) |
| 159 | { |
| 160 | throw new IllegalArgumentException("Can't intern namespace-qualified symbol"); |
| 161 | } |
| 162 | IPersistentMap map = getMappings(); |
| 163 | Class c = (Class) map.valAt(sym); |
| 164 | while((c == null) || (areDifferentInstancesOfSameClassName(c, val))) |
| 165 | { |
| 166 | IPersistentMap newMap = map.assoc(sym, val); |
| 167 | mappings.compareAndSet(map, newMap); |
| 168 | map = getMappings(); |
| 169 | c = (Class) map.valAt(sym); |
| 170 | } |
| 171 | if(c == val) |
| 172 | return c; |
| 173 | |
| 174 | throw new IllegalStateException(sym + " already refers to: " + c + " in namespace: " + name); |
| 175 | } |
| 176 | |
| 177 | public void unmap(Symbol sym) { |
| 178 | if(sym.ns != null) |
no test coverage detected