Answer the real ClassDescriptor for anObj
ie. aCld may be an Interface of anObj, so the cld for anObj is returned
548437
private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)
    {
        ClassDescriptor result;

        if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))
        {
            result = aCld;
        }
        else
        {
            result = aCld.getRepository().getDescriptorFor(anObj.getClass());
        }

        return result;
    }
1067700
private FieldDescriptor extractIdentityColumnField(ClassDescriptor cld)
    {
        FieldDescriptor[] pkFields = cld.getPkFields();
        for(int i = 0; i < pkFields.length; i++)
        {
            // to find the identity column we search for a autoincrement
            // read-only field
            if(pkFields[i].isAutoIncrement() && pkFields[i].isAccessReadOnly())
            {
                return pkFields[i];
            }
        }
        return null;
    }
955126
@SuppressWarnings("unchecked")
	private Set<Class<? extends S>> findScriptClass(Set<Class<?>> clazzs)
			throws InstantiationException, IllegalAccessException {
		Set<Class<? extends S>> scriptClazzs = new HashSet<Class<? extends S>>();
		for (Class<?> clazz : clazzs) {
			if (IAnnotationScript.class.isAssignableFrom(clazz)) {
				Class<S> scriptClazz = (Class<S>) clazz;
				scriptClazzs.add(scriptClazz);
			}
		}
		return scriptClazzs;
	}
987357
private static boolean descriptorToBeIgnoredByJackson(Class<?> clazz, PropertyDescriptor descriptor) {

		Field descriptorField = ReflectionUtils.findField(clazz, descriptor.getName());

		return descriptorField == null //
				? false //
				: toBeIgnoredByJackson(AnnotationUtils.getAnnotations(descriptorField));
	}
1099865
function Descriptor(attributes) {

    var instance = this,

        cur = 'descriptor: attributes argument: ',

        err = function (msg) {
            throw new TypeError(cur + msg);
        },
        getType = function (value) {
            if (typeof value === 'string')
                return value;
            if (Array.isArray(value))
                return getTypeArray(value);
            if (typeof value === 'function') {
                if (Type[value]) return Type[value];
                else {
                    instance.isClassType = true;
                    instance.className = value.name && value.name !== 'ClassWrapper' ? value.name : 'required class';
                    return value;
                }
            }
            if (value instanceof Schema) {
                instance.isSchemaType = true;
                return value;
            }
            return false;
        },

        getTypeArray = function (typeArray) {
            if (typeArray.length !== 1)
                err('type array must contain exactly one element specifying type');
            var type = typeArray[0];
            if (Array.isArray(type))
                err('nested type arrays are not supported');
            type = getType(typeArray[0]);
            if (type) {
                instance.isTypeArray = true;
                return type;
            }
            err('invalid type');
        };

    getType = getType.bind(this);
    getTypeArray = getTypeArray.bind(this);

    if (typeof attributes !== 'object') err('missing or invalid');

    if (attributes.name === undefined)
        return err('missing required attribute: name');

    // ensure name is first attribute
    instance.name = attributes.name;
    for (var attr in attributes) {
        if (attributes.hasOwnProperty(attr)) {
            instance[attr] = attributes[attr];
        }
    }
    if (instance.type) {
        instance.type = getType(instance.type);
        if (!instance.type) err('invalid type');
    }

    return instance;
}
16692
public boolean isObligationType(ClassDescriptor classDescriptor) {
        try {
            return getObligationByType(BCELUtil.getObjectTypeInstance(classDescriptor.toDottedClassName())) != null;
        } catch (ClassNotFoundException e) {
            Global.getAnalysisCache().getErrorLogger().reportMissingClass(e);
            return false;
        }
    }
1370479
private Object fromClass(final Class cl) throws Throwable {
    if (cl == null) {
      error("Must supply a class or have type attribute");
      return null;
    }

    return cl.newInstance();
  }
372927
private static Class<?> desc2class(ClassLoader cl, String desc)
			throws ClassNotFoundException {
		switch (desc.charAt(0)) {
		case JVM_VOID:
			return void.class;
		case JVM_BOOLEAN:
			return boolean.class;
		case JVM_BYTE:
			return byte.class;
		case JVM_CHAR:
			return char.class;
		case JVM_DOUBLE:
			return double.class;
		case JVM_FLOAT:
			return float.class;
		case JVM_INT:
			return int.class;
		case JVM_LONG:
			return long.class;
		case JVM_SHORT:
			return short.class;
		case 'L':
			desc = desc.substring(1, desc.length() - 1).replace('/', '.'); // "Ljava/lang/Object;"
																			// ==>
																			// "java.lang.Object"
			break;
		case '[':
			desc = desc.replace('/', '.'); // "[[Ljava/lang/Object;" ==>
											// "[[Ljava.lang.Object;"
			break;
		default:
			throw new ClassNotFoundException("Class not found: " + desc);
		}

		if (cl == null)
			cl = getClassLoader();
		Class<?> clazz = DESC_CLASS_CACHE.get(desc);
		if (clazz == null) {
			clazz = Class.forName(desc, true, cl);
			DESC_CLASS_CACHE.put(desc, clazz);
		}
		return clazz;
	}
509074
public static Descriptor getDescriptor(Class<?> cls) throws IOException {

        String idl = ProtobufIDLGenerator.getIDL(cls);
        ProtoFile file = ProtoParser.parse(ProtobufIDLProxy.DEFAULT_FILE_NAME, idl);

        FileDescriptorProtoPOJO fileDescriptorProto = new FileDescriptorProtoPOJO();

        fileDescriptorProto.name = ProtobufIDLProxy.DEFAULT_FILE_NAME;
        fileDescriptorProto.pkg = file.packageName();
        fileDescriptorProto.dependencies = file.dependencies();
        fileDescriptorProto.publicDependency = convertList(file.publicDependencies());
        fileDescriptorProto.weakDependency = null; // XXX

        fileDescriptorProto.messageTypes = new ArrayList<DescriptorProtoPOJO>();
        fileDescriptorProto.enumTypes = new ArrayList<EnumDescriptorProtoPOJO>();
        fileDescriptorProto.services = new ArrayList<ServiceDescriptorProtoPOJO>();

        Set<String> messageSet = new HashSet<String>();
        Set<String> enumSet = new HashSet<String>();

        List<TypeElement> typeElements = file.typeElements();
        if (typeElements != null) {

            for (TypeElement typeElement : typeElements) {
                if (typeElement instanceof MessageElement) {
                    messageSet.add(typeElement.name());
                } else if (typeElement instanceof EnumElement) {
                    enumSet.add(typeElement.name());
                }
            }

            for (TypeElement typeElement : typeElements) {
                if (typeElement instanceof MessageElement) {
                    fileDescriptorProto.messageTypes.add(getDescritorProtoPOJO(fileDescriptorProto,
                            (MessageElement) typeElement, messageSet, enumSet));
                } else if (typeElement instanceof EnumElement) {
                    fileDescriptorProto.enumTypes.add(
                            getDescritorProtoPOJO(fileDescriptorProto, (EnumElement) typeElement, messageSet, enumSet));
                }

            }
        }

        FileDescriptorProto fileproto;
        try {
            byte[] bs = descriptorCodec.encode(fileDescriptorProto);
            fileproto = FileDescriptorProto.parseFrom(bs);
        } catch (InvalidProtocolBufferException e) {
            throw new IOException("Failed to parse protocol buffer descriptor for generated code.", e);
        }

        FileDescriptor fileDescriptor;
        try {
            fileDescriptor =
                    FileDescriptor.buildFrom(fileproto, new com.google.protobuf.Descriptors.FileDescriptor[] {});
        } catch (DescriptorValidationException e) {
            throw new IOException(e.getMessage(), e);
        }

        return fileDescriptor.getMessageTypes().get(0);
    }
1092473
synchronized public Class toClass()
        throws ClassNotFoundException, UtilEvalError
    {
        if ( asClass != null )
            return asClass;

        reset();

        // "var" means untyped, return null class
        if ( evalName.equals("var") )
            return asClass = null;

        /* Try straightforward class name first */
        Class clas = namespace.getClass( evalName );

        if ( clas == null )
        {
            /*
                Try toObject() which knows how to work through inner classes
                and see what we end up with
            */
            Object obj = null;
            try {
                // Null interpreter and callstack references.
                // class only resolution should not require them.
                obj = toObject( null, null, true );
            } catch ( UtilEvalError  e ) { } // couldn't resolve it

            if ( obj instanceof ClassIdentifier )
                clas = ((ClassIdentifier)obj).getTargetClass();
        }

        if ( clas == null )
            throw new ClassNotFoundException(
                "Class: " + value+ " not found in namespace");

        asClass = clas;
        return asClass;
    }
735029
private FieldDescriptor getFldFromReference(TableAlias aTableAlias, ObjectReferenceDescriptor anOrd)
    {
        FieldDescriptor fld = null;

        if (aTableAlias == getRoot())
        {
            // no path expression
            FieldDescriptor[] fk = anOrd.getForeignKeyFieldDescriptors(aTableAlias.cld);
            if (fk.length > 0)
            {
                fld = fk[0];
            }
        }
        else
        {
            // attribute with path expression
            /**
             * MBAIRD
             * potentially people are referring to objects, not to the object's primary key, 
             * and then we need to take the primary key attribute of the referenced object 
             * to help them out.
             */
            ClassDescriptor cld = aTableAlias.cld.getRepository().getDescriptorFor(anOrd.getItemClass());
            if (cld != null)
            {
                fld = aTableAlias.cld.getFieldDescriptorByName(cld.getPkFields()[0].getPersistentField().getName());
            }
        }

        return fld;
    }
657103
protected ClassDescriptor getClassDescriptor()
    {
        ClassDescriptor cld = (ClassDescriptor) m_classDescriptor.get();
        if(cld == null)
        {
            throw new OJBRuntimeException("Requested ClassDescriptor instance was already GC by JVM");
        }
        return cld;
    }
1107448
public final void interfaceMemberDecl() throws RecognitionException {
		int interfaceMemberDecl_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 28) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:398:5: ( interfaceMethodOrFieldDecl | interfaceGenericMethodDecl | 'void' Identifier voidInterfaceMethodDeclaratorRest | interfaceDeclaration | classDeclaration )
			int alt41=5;
			switch ( input.LA(1) ) {
			case Identifier:
			case 65:
			case 67:
			case 71:
			case 77:
			case 85:
			case 92:
			case 94:
			case 105:
				{
				alt41=1;
				}
				break;
			case 53:
				{
				alt41=2;
				}
				break;
			case 118:
				{
				alt41=3;
				}
				break;
			case 58:
			case 93:
				{
				alt41=4;
				}
				break;
			case ENUM:
			case 72:
				{
				alt41=5;
				}
				break;
			default:
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 41, 0, input);
				throw nvae;
			}
			switch (alt41) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:398:7: interfaceMethodOrFieldDecl
					{
					pushFollow(FOLLOW_interfaceMethodOrFieldDecl_in_interfaceMemberDecl914);
					interfaceMethodOrFieldDecl();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:399:9: interfaceGenericMethodDecl
					{
					pushFollow(FOLLOW_interfaceGenericMethodDecl_in_interfaceMemberDecl924);
					interfaceGenericMethodDecl();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:400:9: 'void' Identifier voidInterfaceMethodDeclaratorRest
					{
					match(input,118,FOLLOW_118_in_interfaceMemberDecl934); if (state.failed) return;
					match(input,Identifier,FOLLOW_Identifier_in_interfaceMemberDecl936); if (state.failed) return;
					pushFollow(FOLLOW_voidInterfaceMethodDeclaratorRest_in_interfaceMemberDecl938);
					voidInterfaceMethodDeclaratorRest();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:401:9: interfaceDeclaration
					{
					pushFollow(FOLLOW_interfaceDeclaration_in_interfaceMemberDecl948);
					interfaceDeclaration();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 5 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:402:9: classDeclaration
					{
					pushFollow(FOLLOW_classDeclaration_in_interfaceMemberDecl958);
					classDeclaration();
					state._fsp--;
					if (state.failed) return;
					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 28, interfaceMemberDecl_StartIndex); }

		}
	}
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;
    }
416903
@CheckForNull
    private <T extends BugAnnotation> T findPrimaryAnnotationOfType(Class<T> cls) {
        T firstMatch = null;
        for (Iterator<BugAnnotation> i = annotationIterator(); i.hasNext();) {
            BugAnnotation annotation = i.next();
            if (cls.isAssignableFrom(annotation.getClass())) {
                if (annotation.getDescription().endsWith("DEFAULT")) {
                    return cls.cast(annotation);
                } else if (firstMatch == null) {
                    firstMatch = cls.cast(annotation);
                }
            }
        }
        return firstMatch;
    }
146558
protected SqlForClass getSqlForClass(ClassDescriptor cld)
    {
        SqlForClass result = (SqlForClass) sqlForClass.get(cld);
        if(result == null)
        {
            result = newInstanceSqlForClass();
            sqlForClass.put(cld, result);
        }
        return result;
    }
870595
private FieldConversion[] getPkFieldConversion(ClassDescriptor cld)
    {
        FieldDescriptor[] pks = cld.getPkFields();
        FieldConversion[] fc = new FieldConversion[pks.length]; 
        
        for (int i= 0; i < pks.length; i++)
        {
            fc[i] = pks[i].getFieldConversion();
        }
        
        return fc;
    }