Buggy code:
public final class Resolver { private final ModuleLoader loader ; private HashMap < ModuleID , WhileyFile > files = new HashMap < ModuleID , WhileyFile > ( ) ; private HashMap < Triple < PkgID , String , String > , ArrayList < ModuleID > > importCache = new HashMap ( ) ; HashMap < NameID , Value > constantCache = new HashMap ( ) ; public Resolver ( ModuleLoader loader ) { } public void register ( WhileyFile WhileyFile ) { } public boolean isPackage ( PkgID pkg ) { } public boolean isName ( NameID nid ) { } private List < ModuleID > matchImport ( WhileyFile . Import imp ) { } private List < PkgID > matchPackage ( PkgID pkg ) { } public NameID resolveAsName ( String name , List < WhileyFile . Import > imports ) throws ResolveError { } public NameID resolveAsName ( List < String > names , List < WhileyFile . Import > imports ) throws ResolveError { } public ModuleID resolveAsModule ( String name , List < WhileyFile . Import > imports ) throws ResolveError { } public Nominal < Type > resolveAsType ( UnresolvedType t , List < WhileyFile . Import > imports ) throws ResolveError { } private Type resolveAsType ( UnresolvedType t , List < WhileyFile . Import > imports , boolean nominal ) throws ResolveError { } private int resolveAsType ( UnresolvedType t , List < WhileyFile . Import > imports , ArrayList < Automaton . State > states , HashMap < NameID , Integer > roots , boolean nominal ) throws ResolveError { } private int resolveAsType ( NameID key , List < WhileyFile . Import > imports , ArrayList < Automaton . State > states , HashMap < NameID , Integer > roots ) throws ResolveError { } private int resolveAsType ( UnresolvedType . Primitive t , List < WhileyFile . Import > imports , ArrayList < Automaton . State > states ) throws ResolveError { } private static int append ( Type type , ArrayList < Automaton . State > states ) { } public Value resolveAsConstant ( NameID nid ) throws ResolveError { } public Value resolveAsConstant ( Expr e , String filename , List < WhileyFile . Import > imports ) throws ResolveError { } private Value resolveAsConstant ( NameID key , HashSet < NameID > visited ) throws ResolveError { Value result = constantCache . get ( key ) ; <START_BUG> if ( key != null ) { <END_BUG> return result ; } else if ( visited . contains ( key ) ) { throw new ResolveError ( ( ( ( ( "cyclic<seq2seq4repair_space>constant<seq2seq4repair_space>definition<seq2seq4repair_space>encountered<seq2seq4repair_space>(" + key ) + "<seq2seq4repair_space>-><seq2seq4repair_space>" ) + key ) + ")" ) ) ; } else { visited . add ( key ) ; } WhileyFile wf = files . get ( key . module ( ) ) ; if ( wf != null ) { WhileyFile . Declaration decl = wf . declaration ( key . name ( ) ) ; if ( decl instanceof WhileyFile . Constant ) { WhileyFile . Constant cd = ( ( WhileyFile . Constant ) ( decl ) ) ; if ( ( cd . resolvedValue ) == null ) { cd . resolvedValue = resolveAsConstant ( cd . constant , wf . filename , buildImports ( wf , cd ) , visited ) ; } result = cd . resolvedValue ; } else { throw new ResolveError ( ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>constant<seq2seq4repair_space>" + key ) ) ; } } else { Module module = loader . loadModule ( key . module ( ) ) ; Module . ConstDef cd = module . constant ( key . name ( ) ) ; if ( cd != null ) { result = cd . constant ( ) ; } else { throw new ResolveError ( ( "unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>constant<seq2seq4repair_space>" + key ) ) ; } } constantCache . put ( key , result ) ; return result ; } private Value resolveAsConstant ( Expr expr , String filename , List < WhileyFile . Import > imports , HashSet < NameID > visited ) throws ResolveError { } private Value evaluate ( Expr . BinOp bop , Value v1 , Value v2 , String filename ) { } private Value evaluateBoolean ( Expr . BinOp bop , Value . Bool v1 , Value . Bool v2 , String filename ) { } private Value evaluate ( Expr . BinOp bop , Value . Rational v1 , Value . Rational v2 , String filename ) { } private Value evaluate ( Expr . BinOp bop , Value . List v1 , Value . List v2 , String filename ) { } private Value evaluate ( Expr . BinOp bop , Value . Set v1 , Value . Set v2 , String filename ) { } public Pair < NameID , Nominal < Type . FunctionOrMethod > > resolveAsFunctionOrMethod ( String name , List < WhileyFile . Import > imports ) throws ResolveError { } public Pair < NameID , Nominal < Type . FunctionOrMethod > > resolveAsFunctionOrMethod ( String name , List < Nominal < Type > > parameters , List < WhileyFile . Import > imports ) throws ResolveError { } public Nominal < Type . FunctionOrMethod > resolveAsFunctionOrMethod ( NameID nid , List < Nominal < Type > > parameters ) throws ResolveError { } public Pair < NameID , Nominal < Type . Message > > resolveAsMessage ( String name , Type . Reference receiver , List < Nominal < Type > > parameters , List < WhileyFile . Import > imports ) throws ResolveError { } public Nominal < Type . Message > resolveAsMessage ( NameID nid , Type . Reference receiver , List < Nominal < Type > > parameters ) throws ResolveError { } private boolean paramSubtypes ( Type . FunctionOrMethodOrMessage f1 , Type . FunctionOrMethodOrMessage f2 ) { }

Fix:
if ( result != null ) {