mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore java version detection for android & plugins sdks (IDEA-187506)
This commit is contained in:
@@ -22,7 +22,17 @@ public class JavaSdkVersionUtil {
|
||||
}
|
||||
|
||||
public static JavaSdkVersion getJavaSdkVersion(@Nullable Sdk sdk) {
|
||||
return sdk != null && sdk.getSdkType() instanceof JavaSdk ? ((JavaSdk)sdk.getSdkType()).getVersion(sdk) : null;
|
||||
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;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -225,6 +225,15 @@ public abstract class SdkType implements SdkTypeId {
|
||||
throw new IllegalArgumentException("Unknown SDk type: " + sdkTypeClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return for sdk build over another sdk, returns type of the nested sdk,
|
||||
* e.g. plugins or android sdks are build over java sdk and for them the method returns {@link JavaSdkType},
|
||||
* null otherwise
|
||||
*/
|
||||
protected SdkType getDependencyType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isRootTypeApplicable(@NotNull OrderRootType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user