JavaSdkVersion (@Nullable Sdk sdk) { if (sdk != null) { SdkTypeId sdkType = sdk.getSdkType(); if (!(sdkType instanceof JavaSdk) && sdkType instanceof SdkType) { sdkType = ((SdkType)sdkType).getDependencyType(); } if (sdkType instanceof JavaSdk) { return ((JavaSdk)sdkType).getVersion(sdk); } } return null; }