Skip to content

Commit

Permalink
Add -Aversion command-line option; fixes #3381
Browse files Browse the repository at this point in the history
  • Loading branch information
PRITI1999 committed Jul 20, 2020
1 parent 6c2cf99 commit 3498970
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
@@ -1,5 +1,7 @@
Version 3.6.0, August 3, 2020

Added a new option `-Aversion` to print the version of the Checker Framework.

The Interning Checker supports method annotations @EqualsMethod and
@CompareToMethod. Place them on methods like equals(), compareTo(), and
compare() to permit certain uses of == on non-interned values.
Expand Down
4 changes: 4 additions & 0 deletions docs/manual/introduction.tex
Expand Up @@ -788,6 +788,10 @@
\<-AatfCacheSize>
Miscellaneous debugging options; see Section~\ref{creating-debugging-options-misc}.

\item
\<-Aversion>
Print the Checker Framework version.

\item
\<-AprintGitProperties>
Print information about the git repository from which the Checker Framework
Expand Down
Expand Up @@ -253,6 +253,8 @@

/// Amount of detail in messages

// Print the version of the Checker Framework
"version",
// Print info about git repository from which the Checker Framework was compiled
"printGitProperties",

Expand Down Expand Up @@ -781,6 +783,9 @@ public void run() {
}
});
}
if (hasOption("version")) {
messager.printMessage(Kind.NOTE, "Checker Framework " + getCheckerVersion());
}
} catch (UserError ce) {
logUserError(ce);
} catch (TypeSystemError ce) {
Expand Down Expand Up @@ -2530,4 +2535,18 @@ private void printGitProperties() {
System.out.println("IOException while reading git.properties: " + e.getMessage());
}
}

/**
* Returns the version of the Checker Framework.
*
* @return Checker Framework version
*/
private String getCheckerVersion() {
Properties gitProperties = getProperties(getClass(), "/git.properties");
String version = gitProperties.getProperty("git.build.version");
if (version != null) {
return version;
}
throw new BugInCF("Could not find the version in git.properties");
}
}

0 comments on commit 3498970

Please sign in to comment.