Source:
private IDeclaration parseTypeSpecifierList(CommonTree typeSpecifierList, List<CommonTree> pointerList) throws ParseException { IDeclaration declaration = null; CommonTree firstChild = (CommonTree) typeSpecifierList.getChild(0); switch (firstChild.getType()) { case CTFParser.FLOATING_POINT: declaration = parseFloat(firstChild); break; case CTFParser.INTEGER: declaration = parseInteger(firstChild); break; case CTFParser.STRING: declaration = parseString(firstChild); break; case CTFParser.STRUCT: declaration = parseStruct(firstChild); StructDeclaration structDeclaration = (StructDeclaration) declaration; IDeclaration idEnumDecl = structDeclaration.getFields().get("id"); if( idEnumDecl instanceof EnumDeclaration){ EnumDeclaration enumDeclaration = (EnumDeclaration) idEnumDecl; ByteOrder bo = enumDeclaration.getContainerType().getByteOrder(); if (new EventHeaderCompactDeclaration(bo).isCompactEventHeader(structDeclaration)) { declaration = new EventHeaderCompactDeclaration(bo); } else if (new EventHeaderLargeDeclaration(bo).isLargeEventHeader(structDeclaration)) { declaration = new EventHeaderLargeDeclaration(bo); } } break; case CTFParser.VARIANT: declaration = parseVariant(firstChild); break; case CTFParser.ENUM: declaration = parseEnum(firstChild); break; case CTFParser.IDENTIFIER: case CTFParser.FLOATTOK: case CTFParser.INTTOK: case CTFParser.LONGTOK: case CTFParser.SHORTTOK: case CTFParser.SIGNEDTOK: case CTFParser.UNSIGNEDTOK: case CTFParser.CHARTOK: case CTFParser.DOUBLETOK: case CTFParser.VOIDTOK: case CTFParser.BOOLTOK: case CTFParser.COMPLEXTOK: case CTFParser.IMAGINARYTOK: declaration = parseTypeDeclaration(typeSpecifierList, pointerList); break; default: childTypeError(firstChild); } return declaration; }

Target:
private IDeclaration parseTypeSpecifierList(CommonTree typeSpecifierList, List<CommonTree> pointerList) throws ParseException { IDeclaration declaration = null; CommonTree firstChild = (CommonTree) typeSpecifierList.getChild(0); switch (firstChild.getType()) { case CTFParser.FLOATING_POINT: declaration = parseFloat(firstChild); break; case CTFParser.INTEGER: declaration = parseInteger(firstChild); break; case CTFParser.STRING: declaration = parseString(firstChild); break; case CTFParser.STRUCT: declaration = parseStruct(firstChild); StructDeclaration structDeclaration = (StructDeclaration) declaration; IDeclaration idEnumDecl = structDeclaration.getFields().get("id"); if (idEnumDecl instanceof EnumDeclaration) { EnumDeclaration enumDeclaration = (EnumDeclaration) idEnumDecl; ByteOrder bo = enumDeclaration.getContainerType().getByteOrder(); if (EventHeaderCompactDeclaration.getEventHeader(bo).isCompactEventHeader(structDeclaration)) { declaration = EventHeaderCompactDeclaration.getEventHeader(bo); } else if (EventHeaderLargeDeclaration.getEventHeader(bo).isLargeEventHeader(structDeclaration)) { declaration = EventHeaderLargeDeclaration.getEventHeader(bo); } } break; case CTFParser.VARIANT: declaration = parseVariant(firstChild); break; case CTFParser.ENUM: declaration = parseEnum(firstChild); break; case CTFParser.IDENTIFIER: case CTFParser.FLOATTOK: case CTFParser.INTTOK: case CTFParser.LONGTOK: case CTFParser.SHORTTOK: case CTFParser.SIGNEDTOK: case CTFParser.UNSIGNEDTOK: case CTFParser.CHARTOK: case CTFParser.DOUBLETOK: case CTFParser.VOIDTOK: case CTFParser.BOOLTOK: case CTFParser.COMPLEXTOK: case CTFParser.IMAGINARYTOK: declaration = parseTypeDeclaration(typeSpecifierList, pointerList); break; default: childTypeError(firstChild); } return declaration; }