<code>optional string version = 7;</code>
772453
public java.lang.String getVersion() {
    java.lang.Object ref = version_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        version_ = s;
      }
      return s;
    }
  }
177377
static boolean isNewerVersion(String version, String newestVersion, boolean isEarlyAccess) {

        if (version == null)
            return false;
        String[] versionAry = version.split("\\.");

        if (!!!isEarlyAccess && versionAry[0].length() == 4)
            return false;

        if (isEarlyAccess && versionAry[0].length() != 4)
            return false;

        if (newestVersion == null)
            return true;

        String[] newestVersionAry = newestVersion.split("\\.");
        for (int i = 0; i < versionAry.length; i++) {
            if (Integer.parseInt(versionAry[i]) > Integer.parseInt(newestVersionAry[i]))
                return true;
            else if (Integer.parseInt(versionAry[i]) < Integer.parseInt(newestVersionAry[i]))
                return false;
        }
        return false;

    }
820971
private static String trimVersion(String apiVersion) {
    if (apiVersion != null && apiVersion.contains("/")) {
      String[] versionParts = apiVersion.split("/");
      return versionParts[versionParts.length - 1];
    }
    return apiVersion;
  }
774004
public static Version parseVersion(String version) {
		if (!Strings.isNullOrEmpty(version)) {
			try {
				return Version.parseVersion(version);
			} catch (Throwable exception) {
				//
			}
		}
		return null;
	}
1005112
public static String getDefaultCompilerId( String sbtVersion, String playVersion )
    {
        String result = null;
        if ( sbtVersion != null && !sbtVersion.isEmpty() )
        {
            if ( sbtVersion.equals( "0.13" ) || sbtVersion.startsWith( "0.13." ) )
            {
                result = "sbt013";
            }
            else if ( sbtVersion.equals( "0.12" ) || sbtVersion.startsWith( "0.12." ) )
            {
                result = "sbt012";
            }
        }
        if ( result == null )
        {
            if ( playVersion != null && !playVersion.isEmpty() )
            {
                if ( playVersion.startsWith( "2.1." ) || playVersion.startsWith( "2.1-" ) )
                {
                    result = "sbt012";
                }
            }
        }
        if ( result == null )
        {
            result = "sbt013"; // use latest version
        }
        return result;
    }
842575
protected static String formatApiVersion(String version) {
        if (StringUtils.isBlank(version)) {
            return VERSION;
        } else {
            final Matcher matcher = VERSION_PATTERN.matcher(version);
            if (matcher.matches()) {
                return String.format("%s.%s", matcher.group(1), matcher.group(2));
            } else {
                return VERSION;
            }
        }
    }
854172
public static int getJavaMajorVersion() {

        final String[] versionElements = System.getProperty(JAVA_VERSION_PROPERTY).split("\\.");
        final int[] versionNumbers = new int[versionElements.length];

        for (int i = 0; i < versionElements.length; i++) {
            try {
                versionNumbers[i] = Integer.parseInt(versionElements[i]);
            } catch (NumberFormatException e) {
                versionNumbers[i] = 0;
            }
        }

        /*
        Java versions 1 - 8 (i.e. jdk 1.1 through 1.8) yields the structure 1.8
        Java versions 9 - yields the structure 10

        JDK 10
        ======
        [java.specification.version]: 10

        JDK 8
        =====
        [java.specification.version]: 1.8

        JDK 7
        =====
        [java.specification.version]: 1.7
        */
        return versionNumbers[0] == 1 ? versionNumbers[1] : versionNumbers[0];
    }
406726
public Version parseVersion(final String version) {
    checkNotNull(version);
    try {
      return versionScheme.parseVersion(version);
    }
    catch (InvalidVersionSpecificationException e) {
      throw Throwables.propagate(e);
    }
  }
927391
public static VersionNumber parseVersion(@Nonnull final String version) {
		return VersionParser.parseVersion(Check.notNull(version, "version"));
	}
1037527
public static <T> String apiVersion(T item, String apiVersion) {
    if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) {
      return trimVersion(((HasMetadata) item).getApiVersion());
    } else if (apiVersion != null && !apiVersion.isEmpty()) {
      return trimVersion(apiVersion);
    }
    return null;
  }
456052
public final void parseVersion(String version) {
        versionParts = new ArrayList<>();
        if (version != null) {
            final Pattern rx = Pattern.compile("(\\d+[a-z]{1,3}$|[a-z]+\\d+|\\d+|(release|beta|alpha)$)");
            final Matcher matcher = rx.matcher(version.toLowerCase());
            while (matcher.find()) {
                versionParts.add(matcher.group());
            }
            if (versionParts.isEmpty()) {
                versionParts.add(version);
            }
        }
    }
689874
public static VersionSpecification parseVersionSpecification(String s) {
		if (s == null) return null;
		if (s.length() == 0) return null;
		char c = s.charAt(0);
		if (c == '[') {
			int i = s.indexOf(']');
			boolean excluded = false;
			if (i < 0) {
				i = s.indexOf(')');
				if (i > 0)
					excluded = true;
			}
			if (i < 0) {
				// no end ? consider a unique version
				return new VersionSpecification.SingleVersion(new Version(s));
			}
			String range = s.substring(1, i).trim();
			i = range.indexOf(',');
			if (i < 0) {
				// unique version
				return new VersionSpecification.SingleVersion(new Version(range));
			}
			Version min = new Version(range.substring(0, i).trim());
			range = range.substring(i + 1).trim();
			Version max;
			if (range.length() == 0 && excluded)
				max = null;
			else
				max = new Version(range);
			return new VersionSpecification.Range(new VersionRange(min, max, !excluded));
		}
		// TODO
		Version v = new Version(s);
		return new VersionSpecification.RangeWithRecommended(new VersionRange(v, null, false), v);
	}
928513
private Version getSimpleVersion(String product) {
        final Tuple coreNumbers;
        try {
            final TypedQuery<Tuple> coreNumbersQuery =
                    this.createQuery(this.findCoreVersionNumbers);
            coreNumbersQuery.setParameter(this.productParameter, product);
            coreNumbers = DataAccessUtils.singleResult(coreNumbersQuery.getResultList());
        } catch (SQLGrammarException e) {
            logger.warn("UP_VERSION table doesn't exist, returning null for version of " + product);
            return null;
        }

        if (coreNumbers == null) {
            // Table exists but no version data for the product
            return null;
        }

        // Pull out the maj/min/pat values
        final Integer major =
                coreNumbers.get(
                        VersionImpl_.major.getName(), VersionImpl_.major.getBindableJavaType());
        final Integer minor =
                coreNumbers.get(
                        VersionImpl_.minor.getName(), VersionImpl_.minor.getBindableJavaType());
        final Integer patch =
                coreNumbers.get(
                        VersionImpl_.patch.getName(), VersionImpl_.patch.getBindableJavaType());

        // See if the optional local version value exists
        Integer local;
        try {
            final TypedQuery<Integer> localNumberQuery =
                    this.createQuery(this.findLocalVersionNumber);
            localNumberQuery.setParameter(this.productParameter, product);
            local = DataAccessUtils.singleResult(localNumberQuery.getResultList());
        } catch (PersistenceException e) {
            local = null;
        }

        return new VersionImpl(product, major, minor, patch, local);
    }
143013
private final int getJavaVersionAsInt() {
		if (JAVA_VERSION == null) {
			return 0;
		}

		String str = JAVA_VERSION.substring(0, 1);

		str = str + JAVA_VERSION.substring(2, 3);

		if (JAVA_VERSION.length() >= 5) {
			str = str + JAVA_VERSION.substring(4, 5);
		} else {
			str = str + "0";
		}

		return Integer.parseInt(str);
	}
227409
String processVersion(String version) {
    if (version == null || version.trim().isEmpty() || version.equals(APPENGINE_CONFIG)) {
      throw new IllegalArgumentException(VERSION_ERROR);
    } else if (version.equals(GCLOUD_CONFIG)) {
      return null;
    }
    return version;
  }
628244
public static Version parseMavenVersion(String version) {
		if (Strings.isNullOrEmpty(version)) {
			return new Version(0, 0, 0);
		}

		// Detect the snapshot
		final boolean isSnapshot;
		final String coreVersion;
		Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(version);
		if (matcher.matches()) {
			coreVersion = matcher.group(1);
			isSnapshot = true;
		} else {
			matcher = SNAPSHOT_VERSION_PATTERN.matcher(version);
			if (matcher.matches()) {
				coreVersion = matcher.group(1);
				isSnapshot = true;
			} else {
				coreVersion = version;
				isSnapshot = false;
			}
		}

		// Parse the numbers
		final String[] parts = coreVersion.split("[.]"); //$NON-NLS-1$
		final int[] numbers = new int[] {0, 0, 0};
		int i = 0;
		while (i < numbers.length && i < parts.length) {
			try {
				numbers[i] = Integer.parseInt(parts[i]);
				++i;
			} catch (Exception exception) {
				// Force the exit of the loop since a number cannot be find.
				i = numbers.length;
			}
		}
		// Reply
		if (isSnapshot) {
			return new Version(numbers[0], numbers[1], numbers[2], SNAPSHOT_QUALIFIER);
		}
		return new Version(numbers[0], numbers[1], numbers[2]);
	}
1338451
static int getMajorJavaVersion(String javaVersion) {
    int version = parseDotted(javaVersion);
    if (version == -1) {
      version = extractBeginningInt(javaVersion);
    }
    if (version == -1) {
      return 6;  // Choose minimum supported JDK version as default
    }
    return version;
  }