-
-
Notifications
You must be signed in to change notification settings - Fork 197
Min supported Java version check added #1820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,13 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { | |
|
||
public validateJavacVersion(installedJavaVersion: string, options?: { showWarningsAsErrors: boolean }): IFuture<boolean> { | ||
return ((): boolean => { | ||
// Check for min supported Java version | ||
let minJavaVersion = "1.8"; | ||
if (parseInt(installedJavaVersion.substr(0, 3).replace(".", "")) < parseInt(minJavaVersion.replace(".", ""))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could fail on several places, installedJavaVersion could be null or undefined. |
||
this.printMessage(`Java version ${installedJavaVersion} is not supported. You have to install at least ${minJavaVersion}.`); | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when there's an error you should return true, check the code below |
||
} | ||
|
||
let hasProblemWithJavaVersion = false; | ||
if (options) { | ||
this.showWarningsAsErrors = options.showWarningsAsErrors; | ||
|
@@ -170,7 +177,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { | |
if (matchingVersion && matchingVersion[1]) { | ||
if (semver.lt(matchingVersion[1], AndroidToolsInfo.MIN_JAVA_VERSION)) { | ||
hasProblemWithJavaVersion = true; | ||
this.printMessage(`Javac version ${installedJavaVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION}.`, additionalMessage); | ||
this.printMessage(`Java version ${installedJavaVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION}.`, additionalMessage); | ||
} | ||
} else { | ||
hasProblemWithJavaVersion = true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason to add this code, several lines below there's a check for currently installed version and verification against AndroidToolsInfo.MIN_JAVA_VERSION
Can't you just set MIN_JAVA_VERSION to 1.8.0 and do not change anything in this method?