All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jetbrains.pluginverifier.jdk.JdkVersion.kt Maven / Gradle / Ivy

Go to download

JetBrains Plugin Verifier Classes for IntelliJ Platform integration with API usage detection and reporting.

There is a newer version: 1.379
Show newest version
/*
 * Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 */

package com.jetbrains.pluginverifier.jdk

import com.jetbrains.plugin.structure.intellij.version.IdeVersion

data class JdkVersion(val javaVersion: String, val bundledTo: IdeVersion?) {

  val isBundled: Boolean get() = bundledTo != null

  val majorVersion: Int = if (javaVersion.startsWith("1.")) {
    javaVersion.substringAfter("1.").substringBefore(".").toIntOrNull()
  } else {
    javaVersion.substringBefore(".").toIntOrNull()
  } ?: throw IllegalArgumentException("Invalid version: '$javaVersion'")

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy