/** * Find or create the canonical MethodReference instance for the given tuple. * * @param mn the name of the member * @param md the descriptor of the member */ public static synchronized MethodReference findOrCreate(TypeReference tref, Atom mn, Descriptor md) { if (tref == null) { throw new IllegalArgumentException("null tref"); } Key key = new Key(tref, mn, md); MethodReference val = dictionary.get(key); if (val != null) return val; val = new MethodReference(key); dictionary.put(key, val); return val; }
/** * Find or create the canonical MethodReference instance for the given tuple. * * @param mn the name of the member * @param md the descriptor of the member */ public static synchronized MethodReference findOrCreate(TypeReference tref, Atom mn, Descriptor md) { if (tref == null) { throw new IllegalArgumentException("null tref"); } Key key = new Key(tref, mn, md); MethodReference val = dictionary.get(key); if (val != null) return val; val = new MethodReference(key); dictionary.put(key, val); return val; }
MethodReference(Key key) { super(key.type, key.name, key.hashCode()); selector = new Selector(key.name, key.descriptor); TypeName[] parameterNames = key.descriptor.getParameters(); if (parameterNames != null) { parameterTypes = new TypeReference[parameterNames.length]; } else { parameterTypes = null; } ClassLoaderReference loader = getDeclaringClass().getClassLoader(); if (parameterNames != null) { for (int i = 0; i < parameterNames.length; i++) { parameterTypes[i] = TypeReference.findOrCreate(loader, parameterNames[i]); } } TypeName r = key.descriptor.getReturnType(); returnType = TypeReference.findOrCreate(getDeclaringClass().getClassLoader(), r); }
MethodReference(Key key) { super(key.type, key.name, key.hashCode()); selector = new Selector(key.name, key.descriptor); TypeName[] parameterNames = key.descriptor.getParameters(); if (parameterNames != null) { parameterTypes = new TypeReference[parameterNames.length]; } else { parameterTypes = null; } ClassLoaderReference loader = getDeclaringClass().getClassLoader(); if (parameterNames != null) { for (int i = 0; i < parameterNames.length; i++) { parameterTypes[i] = TypeReference.findOrCreate(loader, parameterNames[i]); } } TypeName r = key.descriptor.getReturnType(); returnType = TypeReference.findOrCreate(getDeclaringClass().getClassLoader(), r); }