JavaClassDecl terminalsDecl = StreamSupport.stream(jcd.getDecls().getDeclIterator().spliterator(), false)
.filter(decl -> decl instanceof JavaClassDecl)
.<JavaClassDecl>map(decl -> (JavaClassDecl) decl)
.filter(decl -> decl.getName().equals("Terminals"))
.findFirst().orElseThrow(() -> new RuntimeException("Cannot find terminals class"));
Type terminalClassType = terminalsDecl
.extend(Environment.getEmptyEnvironment(), Environment.getEmptyEnvironment())
.lookup("Terminals").getType();
Type terminalObjType = terminalsDecl
.extend(Environment.getEmptyEnvironment(), Environment.getEmptyEnvironment())
.lookupType("Terminals").getType();