Buggy code:
class JPQLExpressionBuilder extends AbstractExpressionBuilder implements JPQLTreeConstants { private static final int VAR_PATH = 1 ; private static final int VAR_ERROR = 2 ; private static Localizer _loc = Localizer . forPackage ( JPQLExpressionBuilder . class ) ; private final Stack contexts = new Stack ( ) ; private LinkedMap parameterTypes ; private int aliasCount = 0 ; public JPQLExpressionBuilder ( ExpressionFactory factory , ExpressionStoreQuery query , Object parsedQuery ) { } protected Localizer getLocalizer ( ) { } protected ClassLoader getClassLoader ( ) { } protected JPQLExpressionBuilder . ParsedJPQL getParsedQuery ( ) { } protected JPQLExpressionBuilder . ParsedJPQL getParsedQuery ( String jpql ) { } private void setCandidate ( ClassMetaData cmd , String schemaAlias ) { } private String nextAlias ( ) { } protected ClassMetaData resolveClassMetaData ( JPQLExpressionBuilder . JPQLNode node ) { } private ClassMetaData getClassMetaData ( String alias , boolean assertValid ) { ClassLoader loader = getClassLoader ( ) ; <START_BUG> MetaDataRepository repos = resolver . getConfiguration ( ) . getMetaDataRepository ( ) ; <END_BUG> ClassMetaData cmd = repos . getMetaData ( alias , loader , false ) ; if ( cmd != null ) return cmd ; Class c = resolver . classForName ( alias , null ) ; if ( c != null ) cmd = repos . getMetaData ( c , loader , assertValid ) ; else if ( assertValid ) cmd = repos . getMetaData ( alias , loader , true ) ; if ( ( cmd == null ) && assertValid ) throw parseException ( EX_USER , "not-schema-name" , new Object [ ] { alias } , null ) ; return cmd ; } private Class getCandidateType ( ) { } private ClassMetaData getCandidateMetaData ( ) { } protected ClassMetaData getCandidateMetaData ( JPQLExpressionBuilder . JPQLNode node ) { } protected String currentQuery ( ) { } QueryExpressions getQueryExpressions ( ) { } private Expression and ( Expression e1 , Expression e2 ) { } private static String assemble ( JPQLExpressionBuilder . JPQLNode node ) { } private static String assemble ( JPQLExpressionBuilder . JPQLNode node , String delimiter , int last ) { } private Expression assignProjections ( JPQLExpressionBuilder . JPQLNode parametersNode , QueryExpressions exps ) { } private void evalQueryOperation ( QueryExpressions exps ) { } private void evalGroupingClause ( QueryExpressions exps ) { } private void evalHavingClause ( QueryExpressions exps ) { } private void evalOrderingClauses ( QueryExpressions exps ) { } private Expression evalSelectClause ( QueryExpressions exps ) { } private String assertSchemaAlias ( ) { } protected Expression evalFetchJoins ( QueryExpressions exps ) { } protected void evalSetClause ( QueryExpressions exps ) { } private Expression evalWhereClause ( QueryExpressions exps ) { } private Expression evalFromClause ( boolean needsAlias ) { } private Expression addJoin ( JPQLExpressionBuilder . JPQLNode node , boolean inner , Expression exp ) { } private Expression addJoin ( Path path , JPQLExpressionBuilder . JPQLNode aliasNode , boolean inner , Expression exp ) { } private Expression evalFromItem ( Expression exp , JPQLExpressionBuilder . JPQLNode node , boolean needsAlias ) { } protected boolean isDeclaredVariable ( String name ) { } boolean isPath ( JPQLExpressionBuilder . JPQLNode node ) { } private static ClassMetaData getFieldType ( FieldMetaData fmd ) { } protected Value getVariable ( String id , boolean bind ) { } protected boolean isSeendVariable ( String id ) { } private String assertSchemaName ( JPQLExpressionBuilder . JPQLNode node ) { } private Object eval ( JPQLExpressionBuilder . JPQLNode node ) { } protected void setImplicitTypes ( Value val1 , Value val2 , Class expected ) { } private Value getStringValue ( JPQLExpressionBuilder . JPQLNode node ) { } private Value getNumberValue ( JPQLExpressionBuilder . JPQLNode node ) { } private Value getTypeValue ( JPQLExpressionBuilder . JPQLNode node , Class implicitType ) { } private Value getSubquery ( JPQLExpressionBuilder . JPQLNode node ) { } private Parameter getParameter ( String id , boolean positional ) { } private Expression evalNot ( boolean not , Expression exp ) { } private String trimQuotes ( String str ) { } private short negative ( JPQLExpressionBuilder . JPQLNode node ) { } private Value getIdentifier ( JPQLExpressionBuilder . JPQLNode node ) { } private Value getPathOrConstant ( JPQLExpressionBuilder . JPQLNode node ) { } private Path getPath ( JPQLExpressionBuilder . JPQLNode node ) { } private Path getPCPath ( JPQLExpressionBuilder . JPQLNode node ) { } private Path getPath ( JPQLExpressionBuilder . JPQLNode node , boolean pcOnly , boolean inner ) { } protected Class getDeclaredVariableType ( String name ) { } private Expression getExpression ( JPQLExpressionBuilder . JPQLNode node ) { } private Value getValue ( JPQLExpressionBuilder . JPQLNode node ) { } private Path newPath ( Value val , ClassMetaData meta ) { } private Value getValue ( JPQLExpressionBuilder . JPQLNode node , int handleVar ) { } private JPQLExpressionBuilder . Context ctx ( ) { } private JPQLExpressionBuilder . JPQLNode root ( ) { } private ClassMetaData getMetaDataForAlias ( String alias ) { } private class Context { private final JPQLExpressionBuilder . ParsedJPQL parsed ; private ClassMetaData meta ; private String schemaAlias ; private Subquery subquery ; Context ( JPQLExpressionBuilder . ParsedJPQL parsed , Subquery subquery ) { } } private JPQLExpressionBuilder . JPQLNode onlyChild ( JPQLExpressionBuilder . JPQLNode node ) throws UserException { } private JPQLExpressionBuilder . JPQLNode left ( JPQLExpressionBuilder . JPQLNode node ) { } private JPQLExpressionBuilder . JPQLNode right ( JPQLExpressionBuilder . JPQLNode node ) { } private JPQLExpressionBuilder . JPQLNode child ( JPQLExpressionBuilder . JPQLNode node , int childNum , int assertCount ) { } private JPQLExpressionBuilder . JPQLNode firstChild ( JPQLExpressionBuilder . JPQLNode node ) { } private static JPQLExpressionBuilder . JPQLNode secondChild ( JPQLExpressionBuilder . JPQLNode node ) { } private static JPQLExpressionBuilder . JPQLNode thirdChild ( JPQLExpressionBuilder . JPQLNode node ) { } private static JPQLExpressionBuilder . JPQLNode lastChild ( JPQLExpressionBuilder . JPQLNode node ) { } private static JPQLExpressionBuilder . JPQLNode lastChild ( JPQLExpressionBuilder . JPQLNode node , int fromLast ) { }

Fix:
MetaDataRepository repos = resolver . getConfiguration ( ) . getMetaDataRepositoryInstance ( ) ;