Buggy code:
private Class toPrimitiveWrapper ( FieldMetaData fmd ) { } private void addReplaceStateManagerMethod ( ) { } private void addNoOpApplicationIdentityMethods ( ) { } private void addCopyKeyFieldsToObjectIdMethod ( boolean fieldManager ) throws NoSuchMethodException { } private void addExtractObjectIdFieldValueCode ( Code code , FieldMetaData pk ) { } private void addCopyKeyFieldsFromObjectIdMethod ( boolean fieldManager ) throws NoSuchMethodException { } private Boolean usesClassStringIdConstructor ( ) { } private Class unwrapSingleFieldIdentity ( FieldMetaData fmd ) { } private Method getReflectionGetterMethod ( Class type , Class argType ) throws NoSuchMethodException { } private Method getFieldSupplierMethod ( Class type ) throws NoSuchMethodException { } private Method getFieldConsumerMethod ( Class type ) throws NoSuchMethodException { } private void addNewObjectIdInstanceMethod ( boolean obj ) throws NoSuchMethodException { } private Method getStateManagerMethod ( Class type , String prefix , boolean get , boolean curValue ) throws NoSuchMethodException { } private Method getMethod ( Class owner , Class type , String prefix , boolean get , boolean haspc , boolean curValue ) throws NoSuchMethodException { } private Instruction throwException ( Code code , Class type ) { } private void enhanceClass ( ) { } private void addFields ( ) { } private void addStaticInitializer ( ) { } private static byte getFieldFlag ( FieldMetaData fmd ) { } private void addSerializationCode ( ) { } private void addSubclassSerializationCode ( ) { } private boolean externalizeDetached ( ) { } private void modifyWriteObjectMethod ( BCMethod method , boolean full ) { } private void modifyReadObjectMethod ( BCMethod method , boolean full ) { } private void addIsDetachedMethod ( ) throws NoSuchMethodException { } private boolean writeIsDetachedMethod ( Code code ) throws NoSuchMethodException { } private static JumpInstruction ifDefaultValue ( Code code , FieldMetaData fmd ) { } private Code getOrCreateClassInitCode ( boolean replaceLast ) { } private void addCloningCode ( ) { } public PCEnhancer . AuxiliaryEnhancer [ ] getAuxiliaryEnhancers ( ) { } private void runAuxiliaryEnhancers ( ) { } private boolean skipEnhance ( BCMethod method ) { } private void addAccessors ( ) throws NoSuchMethodException { } private void addSubclassSetMethod ( FieldMetaData fmd ) throws NoSuchMethodException { } private boolean setVisibilityToSuperMethod ( BCMethod method ) { } private void addSubclassGetMethod ( FieldMetaData fmd ) { } private void addGetMethod ( int index , FieldMetaData fmd ) throws NoSuchMethodException { } private void addSetMethod ( int index , FieldMetaData fmd ) throws NoSuchMethodException { } private void addAttachDetachCode ( ) throws NoSuchMethodException { } private void addDetachedStateMethods ( boolean impl ) { } private void getfield ( Code code , BCClass declarer , String attrName ) { } private void putfield ( Code code , BCClass declarer , String attrName , Class fieldType ) { } private String toBackingFieldName ( String name ) { } private String fromBackingFieldName ( String name ) { } private void addDetachExternalize ( boolean parentDetachable , boolean detachedState ) throws NoSuchMethodException { } private void addReadExternal ( boolean parentDetachable , boolean detachedState ) throws NoSuchMethodException { } private void addReadUnmanaged ( Collection unmgd , boolean parentDetachable ) throws NoSuchMethodException { } private void readExternal ( Code code , String fieldName , Class type , FieldMetaData fmd ) throws NoSuchMethodException { } private void addWriteExternal ( boolean parentDetachable , boolean detachedState ) throws NoSuchMethodException { } private void addWriteUnmanaged ( Collection unmgd , boolean parentDetachable ) throws NoSuchMethodException { } private void writeExternal ( Code code , String fieldName , Class type , FieldMetaData fmd ) throws NoSuchMethodException { } private void addGetManagedValueCode ( Code code , FieldMetaData fmd ) throws NoSuchMethodException { } private void addGetManagedValueCode ( Code code , FieldMetaData fmd , boolean fromSameClass ) throws NoSuchMethodException { } private void addSetManagedValueCode ( Code code , FieldMetaData fmd ) throws NoSuchMethodException { } private Instruction loadManagedInstance ( Code code , boolean forStatic , FieldMetaData fmd ) { } private Instruction loadManagedInstance ( Code code , boolean forStatic ) { } private int getAccessorParameterOffset ( FieldMetaData fmd ) { } boolean isPropertyAccess ( ClassMetaData meta ) { } boolean isPropertyAccess ( FieldMetaData fmd ) { } boolean isFieldAccess ( FieldMetaData fmd ) { } private BCMethod createGetMethod ( FieldMetaData fmd ) { } private BCMethod createSetMethod ( FieldMetaData fmd ) { } private void addGetEnhancementContractVersionMethod ( ) { } public Class getType ( ClassMetaData meta ) { } private static void transferCodeAttributes ( BCMethod from , BCMethod to ) { } public static void main ( String [ ] args ) { } public static boolean run ( final String [ ] args , Options opts ) { } public static boolean run ( OpenJPAConfiguration conf , String [ ] args , Options opts ) throws IOException { } public static boolean run ( OpenJPAConfiguration conf , String [ ] args , PCEnhancer . Flags flags , MetaDataRepository repos , BytecodeWriter writer , ClassLoader loader ) throws IOException { } public static class Flags { public File directory = null ; public boolean addDefaultConstructor = true ; public boolean tmpClassLoader = true ; public boolean enforcePropertyRestrictions = false ; } public static interface AuxiliaryEnhancer { public void run ( BCClass bc , ClassMetaData meta ) { } public boolean skipEnhance ( BCMethod m ) { } } private void addGetIDOwningClass ( ) throws NoSuchMethodException { } public static boolean checkEnhancementLevel ( Class < ? > cls , Log log ) { if ( ( cls == null ) || ( log == null ) ) { return false ; } <START_BUG> PersistenceCapable pc = PCRegistry . newInstance ( cls , null , true ) ; <END_BUG> if ( pc == null ) { return false ; } if ( ( pc . pcGetEnhancementContractVersion ( ) ) < ( PCEnhancer . ENHANCER_VERSION ) ) { log . info ( PCEnhancer . _loc . get ( "down-level-enhanced-entity" , new Object [ ] { cls . getName ( ) , pc . pcGetEnhancementContractVersion ( ) , PCEnhancer . ENHANCER_VERSION } ) ) ; return true ; } return false ; } }

Fix:
PersistenceCapable pc = PCRegistry . newInstance ( cls , null , false ) ;