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
Add -Aversion command-line option; fixes #3381 #3464
Conversation
Update fork
… into fix-issue-3381
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Outdated
Show resolved
Hide resolved
if (hasOption("version")) { | ||
String version = getCheckerVersion(); | ||
if (version == null) { | ||
messager.printMessage(Kind.NOTE, "Version info not available!"); |
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.
Under what circumstances is version
null? Is that a bug?
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.
Its never null for the current version. It can only be null if the tag in release.properties is not found in XML_FILE
. Should I remove this check altogether and throw an exception if ever version is null?
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.
Since that would indicate an unexpected problem, I think that is the best approach.
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.
Made the changes accordingly. Please re-review.
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.
@PRITI1999 CI does not pass. Please make it pass before requesting a review.
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.
I apologize. CI succeeds now.
@@ -2530,4 +2535,33 @@ private void printGitProperties() { | |||
System.out.println("IOException while reading git.properties: " + e.getMessage()); | |||
} | |||
} | |||
|
|||
/** | |||
* Extract the version of the Checker Framework |
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.
Minor: end sentences with punctuation (in this case, a period).
* docs/examples/MavenExample/pom.xml file | ||
* @throws NullPointerException if tag present in release.properties for Checker Framework | ||
* version is not found in docs/examples/MavenExample/pom.xml | ||
* @return Checker Framework version {@link String} |
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.
It is usually not necessary to state the type, which is already stated nearby in the source code and in the generated API documentation.
* @return Checker Framework version {@link String} | ||
*/ | ||
private String getCheckerVersion() throws IOException { | ||
String version = null; |
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.
Why is this variable needed?
@@ -2530,4 +2535,33 @@ private void printGitProperties() { | |||
System.out.println("IOException while reading git.properties: " + e.getMessage()); | |||
} | |||
} | |||
|
|||
/** | |||
* Extract the version of the Checker Framework |
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.
If you use "Extract", say from where. Even better, I would leave implementation details like that out of the specification and just use "Returns".
return version; | ||
} | ||
} | ||
throw new NullPointerException( |
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.
This is an odd choice of exception. Why not use BugInCF
?
String line = null; | ||
while ((line = reader.readLine()) != null) { | ||
if (line.split(startTag).length > 1) { | ||
version = line.split(startTag)[1].split(endTag)[0]; |
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.
This line can be combined with the following one.
framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java
Show resolved
Hide resolved
Properties releaseProperties = getProperties(getClass(), RLS_FILE); | ||
String startTag = releaseProperties.getProperty("checkers.ver.0"); | ||
String endTag = releaseProperties.getProperty("checkers.ver.1"); | ||
String XML_FILE = "/docs/examples/MavenExample/pom.xml"; |
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.
Does this work? It crashed for me when I tried to run it, because neither of the two files is not available in checker.jar
.
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.
You could use git.properties
instead. See method printGitProperties
.
@mernst Added the suggested changes. Please re-review. |
Thanks for this feature! |
#3381 Add -Aversion option