boolean () { final GrTopStatement[] topStatements = findChildrenByClass(GrTopStatement.class); boolean hasClassDefinitions = false; boolean hasTopStatements = false; for (GrTopStatement st : topStatements) { if (st instanceof GrTypeDefinition) { hasClassDefinitions = true; } else if (!(st instanceof GrImportStatement || st instanceof GrPackageDefinition)) { hasTopStatements = true; break; } } return hasTopStatements || !hasClassDefinitions; }