MCPcopy Index your code
hub / github.com/clojure/clojure / referenceClass

Method referenceClass

src/jvm/clojure/lang/Namespace.java:157–175  ·  view source on GitHub ↗
(Symbol sym, Class val)

Source from the content-addressed store, hash-verified

155}
156
157Class 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
177public void unmap(Symbol sym) {
178 if(sym.ns != null)

Callers 1

importClassMethod · 0.95

Calls 5

getMappingsMethod · 0.95
assocMethod · 0.95
valAtMethod · 0.65
compareAndSetMethod · 0.65

Tested by

no test coverage detected