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

Method reference

src/jvm/clojure/lang/Namespace.java:126–151  ·  view source on GitHub ↗
(Symbol sym, Object val)

Source from the content-addressed store, hash-verified

124}
125
126Object 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
153public static boolean areDifferentInstancesOfSameClassName(Class cls1, Class cls2) {
154 return (cls1 != cls2) && (cls1.getName().equals(cls2.getName()));

Callers 1

referMethod · 0.95

Calls 5

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

Tested by

no test coverage detected