private static GradleModelDefQuery2 createQuery2(final GradleProjectExtensionDef<?> extension) {
    Collection<? extends GradleModelDefQuery2> queries2 =
        extension.getLookup().lookupAll(GradleModelDefQuery2.class);
    if (!queries2.isEmpty()) {
      return createQuery2(queries2);
    }

    return query1AsQuery2(createQuery1(extension));
  }
 private static GradleModelDefQuery1 createQuery1(
     final GradleProjectExtensionDef<?> extensionDef) {
   return createQuery1(extensionDef.getLookup().lookupAll(GradleModelDefQuery1.class));
 }