Returns an interface descriptor or throws an IllegalArgumentException.
339792
@Nullable
	public static <T> InterfaceDescriptor<T> findInterfaceDescriptor(final Class<T> cls) {
		if (!cls.isInterface()) {
			throw new IllegalArgumentException("Interface required, got " + cls);
		}

		Field field;
		try {
			field = cls.getField("DESCRIPTOR");
		} catch (NoSuchFieldException e) {
			throw new IllegalArgumentException("No DESCRIPTOR field in " + cls);
		}

		if (!InterfaceDescriptor.class.isAssignableFrom(field.getType())) {
			throw new IllegalArgumentException("Not an InterfaceDescriptor field, " + field);
		}

		try {
			// Get the static TYPE field.
			@SuppressWarnings("unchecked")
			InterfaceDescriptor<T> descriptor = (InterfaceDescriptor<T>) field.get(null);
			return descriptor;
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
20664
public static TypeDesc forDescriptor(final String desc) throws IllegalArgumentException {
        TypeDesc type = cDescriptorsToInstances.get(desc);
        if (type != null) {
            return type;
        }

        // TODO: Support generics in descriptor.

        String rootDesc = desc;
        int cursor = 0;
        int dim = 0;
        try {
            char c;
            while ((c = rootDesc.charAt(cursor++)) == '[') {
                dim++;
            }

            switch (c) {
            case 'V':
                type = VOID;
                break;
            case 'Z':
                type = BOOLEAN;
                break;
            case 'C':
                type = CHAR;
                break;
            case 'B':
                type = BYTE;
                break;
            case 'S':
                type = SHORT;
                break;
            case 'I':
                type = INT;
                break;
            case 'J':
                type = LONG;
                break;
            case 'F':
                type = FLOAT;
                break;
            case 'D':
                type = DOUBLE;
                break;
            case 'L':
                if (dim > 0) {
                    rootDesc = rootDesc.substring(dim);
                    cursor = 1;
                }
                StringBuffer name = new StringBuffer(rootDesc.length() - 2);
                while ((c = rootDesc.charAt(cursor++)) != ';') {
                    if (c == '/') {
                        c = '.';
                    }
                    name.append(c);
                }
                type = intern(new ObjectType(rootDesc, name.toString()));
                break;
            default:
                throw invalidDescriptor(desc);
            }
        } catch (NullPointerException e) {
            throw invalidDescriptor(desc);
        } catch (IndexOutOfBoundsException e) {
            throw invalidDescriptor(desc);
        }

        if (cursor != rootDesc.length()) {
            throw invalidDescriptor(desc);
        }

        while (--dim >= 0) {
            type = type.toArrayType();
        }

        cDescriptorsToInstances.put(desc, type);
        return type;
    }
1261363
static String getInterfaceSignature(String[] interfaces, String apiName) {
        StringBuilder signature = new StringBuilder("<T::L" + XsdSupportingStructure.elementType + "<TT;TZ;>;Z::" + XsdSupportingStructure.elementTypeDesc + ">" + JAVA_OBJECT_DESC);

        if (interfaces != null){
            for (String anInterface : interfaces) {
                signature.append("L")
                        .append(getFullClassTypeName(anInterface, apiName))
                        .append("<TT;TZ;>;");
            }
        }

        return signature.toString();
    }
155437
def method_descriptor(descriptor: str) -> MethodDescriptor:
    
    end_para = descriptor.find(')')
    returns = descriptor[end_para + 1:]
    args = descriptor[1:end_para]

    return MethodDescriptor(
        parse_descriptor(returns)[0],
        parse_descriptor(args),
        returns,
        args,
        descriptor
    )
668542
def pretty_descriptor(self):
        

        f = " ".join(self.pretty_access_flags())
        if not self.is_interface():
            f += " class"

        n = self.pretty_this()
        e = self.pretty_super()
        i = ",".join(self.pretty_interfaces())

        if i:
            return "%s %s extends %s implements %s" % (f, n, e, i)
        else:
            return "%s %s extends %s" % (f, n, e)
951541
public static Type getReturnType(final String methodDescriptor) {
        char[] buf = methodDescriptor.toCharArray();
        return getType(buf, methodDescriptor.indexOf(')') + 1);
    }
702901
def get_ioos_def(self, ident, elem_type, ont):
        """"""
        if elem_type == "identifier":
            getter_fn = self.system.get_identifiers_by_name
        elif elem_type == "classifier":
            getter_fn = self.system.get_classifiers_by_name
        else:
            raise ValueError("Unknown element type '{}'".format(elem_type))
        return DescribeSensor.get_named_by_definition(
            getter_fn(ident), urljoin(ont, ident)
        )
957358
public String getEventDescriptor(Class controlInterface)
    {
        //
        // NOTE: The input controlInterface is currently unused, but included to
        // enable downstream optimization of serialization representation.  See the
        // OPTIMIZE comment below for more details.  If implemented, the interface
        // is needed to reverse the transformation from a hash back to a method or
        // descriptor.
        //
        if (_descriptor == null)
            _descriptor = computeEventDescriptor(_method);

        return _descriptor;
    }
1049313
@SuppressWarnings("deprecation")
	private AttributeDescriptor toDescriptor(AttributeInfo attrInfo) throws IllegalArgumentException {
		if (attrInfo instanceof PrimitiveAttributeInfo) {
			PrimitiveAttributeInfo pai = (PrimitiveAttributeInfo) attrInfo;
			AttributeType type;
			switch (pai.getType()) {
				case BOOLEAN:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.BOOLEAN);
					break;
				case DATE:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.DATE);
					break;
				case CURRENCY:
				case DOUBLE:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.DOUBLE);
					break;
				case FLOAT:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.FLOAT);
					break;
				case INTEGER:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.INTEGER);
					break;
				case LONG:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.LONG);
					break;
				case SHORT:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.SHORT);
					break;
				case IMGURL:
				case URL:
				case STRING:
				default:
					type = new PrimitiveAttributeTypeImpl(PrimitiveType.STRING);
					break;
			}
			return new AttributeDescriptorImpl(type, pai.getName());
		}
		return null;
	}
1319905
public static TypeDesc forDescriptor(String desc)
        throws IllegalArgumentException
    {
        // TODO: Figure out how to cache these. Using a plain IdentityMap poses
        // a problem. The back reference to the key causes a memory leak.

        TypeDesc td;
        int cursor = 0;
        int dim = 0;
        try {
            char c;
            while ((c = desc.charAt(cursor++)) == '[') {
                dim++;
            }

            switch (c) {
            case 'V':
                td = VOID;
                break;
            case 'Z':
                td = BOOLEAN;
                break;
            case 'C':
                td = CHAR;
                break;
            case 'B':
                td = BYTE;
                break;
            case 'S':
                td = SHORT;
                break;
            case 'I':
                td = INT;
                break;
            case 'J':
                td = LONG;
                break;
            case 'F':
                td = FLOAT;
                break;
            case 'D':
                td = DOUBLE;
                break;
            case 'L':
                if (dim > 0) {
                    desc = desc.substring(dim);
                    cursor = 1;
                }
                StringBuffer name = new StringBuffer(desc.length() - 2);
                while ((c = desc.charAt(cursor++)) != ';') {
                    if (c == '/') {
                        c = '.';
                    }
                    name.append(c);
                }
                td = intern(new ObjectType(desc, name.toString()));
                break;
            default:
                throw invalidDescriptor(desc);
            }
        }
        catch (NullPointerException e) {
            throw invalidDescriptor(desc);
        }
        catch (IndexOutOfBoundsException e) {
            throw invalidDescriptor(desc);
        }

        if (cursor != desc.length()) {
            throw invalidDescriptor(desc);
        }

        while (--dim >= 0) {
            td = td.toArrayType();
        }

        return td;
    }
86471
public List<? extends TypeMirror> interfaceGenericTypesFor(TypeElement element, String interfaceName) {
        for (TypeMirror tm : element.getInterfaces()) {
            DeclaredType declaredType = (DeclaredType) tm;
            Element declaredElement = declaredType.asElement();
            if (declaredElement instanceof TypeElement) {
               TypeElement te = (TypeElement) declaredElement;
                if (interfaceName.equals(te.getQualifiedName().toString())) {
                    return declaredType.getTypeArguments();
                }
            }
        }
        return Collections.emptyList();
    }
1268767
def get_matching_interfaces(object_class, exported_intfs):
    # type: (List[str], Optional[List[str]]) -> Optional[List[str]]
    
    if object_class is None or exported_intfs is None:
        return None

    if isinstance(exported_intfs, str) and exported_intfs == "*":
        return object_class

    # after this exported_intfs will be list
    exported_intfs = get_string_plus_property_value(exported_intfs)
    if len(exported_intfs) == 1 and exported_intfs[0] == "*":
        return object_class

    return exported_intfs
1202952
def interface_type(self):
        
        value = "if="
        lst = self._attributes.get("if")
        if lst is None:
            value = ""
        else:
            value += "\"" + str(lst) + "\""
        return value
190405
private void readObject(ObjectInputStream s)
        throws IOException, ClassNotFoundException {
        scope_ifname = null;
        scope_ifname_set = false;

        if (getClass().getClassLoader() != Class.class.getClassLoader()) {
            throw new SecurityException ("invalid address type");
        }

        s.defaultReadObject();

        if (ifname != null && !"".equals (ifname)) {
            try {
                scope_ifname = NetworkInterface.getByName(ifname);
                if (scope_ifname == null) {
                    /* the interface does not exist on this system, so we clear
                     * the scope information completely */
                    scope_id_set = false;
                    scope_ifname_set = false;
                    scope_id = 0;
                } else {
                    try {
                        scope_id = deriveNumericScope (scope_ifname);
                    } catch (UnknownHostException e) {
                        // typically should not happen, but it may be that
                        // the machine being used for deserialization has
                        // the same interface name but without IPv6 configured.
                    }
                }
            } catch (SocketException e) {}

        }
        /* if ifname was not supplied, then the numeric info is used */

        ipaddress = ipaddress.clone();

        // Check that our invariants are satisfied
        if (ipaddress.length != INADDRSZ) {
            throw new InvalidObjectException("invalid address length: "+
                                             ipaddress.length);
        }

        if (holder().getFamily() != AF_INET6) {
            throw new InvalidObjectException("invalid address family type");
        }
    }
610115
private TypePair getPropertyType(Object bean, String name) throws IllegalAccessException, InvocationTargetException {
        try {
            PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(bean, name);
            if(propDescriptor!=null) {
                Method m = propDescriptor.getWriteMethod();
                if(m!=null)
                    return new TypePair(m.getGenericParameterTypes()[0], m.getParameterTypes()[0]);
            }
        } catch (NoSuchMethodException e) {
            // no such property
        }

        // try a field
        try {
            return new TypePair(bean.getClass().getField(name));
        } catch (NoSuchFieldException e) {
            // no such field
        }

        return null;
    }
1194670
@Nonnull
    public Descriptor getDescriptorOrDie(Class<? extends Describable> type) {
        Descriptor d = getDescriptor(type);
        if (d==null)
            throw new AssertionError(type+" is missing its descriptor");
        return d;
    }
637094
public static <T extends Descriptor> T create(final Class<T> type) throws IllegalArgumentException {
        return create(type, null);
    }