Skip to content
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

Fix #292 - Add error message in message holder if minimal JRE version is incorrect #293

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,35 +239,37 @@ public void setCommand(ICommand command) {
*/
public void runMain(String[] args, boolean useSystemExit) {
final boolean doExit = useSystemExit && !flagInArgs("-noExit", args);

final boolean verbose = flagInArgs("-verbose", args);

IMessageHolder holder = clientHolder;
if (null == this.clientHolder) {
this.clientHolder = checkForCustomMessageHolder(args);
}
if (null == holder) {
holder = ourHandler;
if (verbose) {
ourHandler.setInterceptor(MessagePrinter.VERBOSE);
} else {
ourHandler.ignore(IMessage.INFO);
ourHandler.setInterceptor(MessagePrinter.TERSE);
}
}
// This needs to be checked, before any classes using JDT Core classes are used for the first time. Otherwise, users
// will see ugly UnsupportedClassVersionError stack traces, which they might or might not interpret correctly.
// Therefore, interrupt AJC usage right here, even if it means that not even a usage page can be printed. It is
// better to save users from subsequent problems later.
if (SourceVersion.latest().ordinal() < MINIMAL_JRE_VERSION) {
System.err.println(MINIMAL_JRE_VERSION_ERROR);
IMessage minimalJreVersionErrorMessage = new Message(MINIMAL_JRE_VERSION_ERROR, null, true);
holder.handleMessage(minimalJreVersionErrorMessage);
if (doExit)
System.exit(-1);
return;
}

// Urk - default no check for AJDT, enabled here for Ant, command-line
AjBuildManager.enableRuntimeVersionCheck(this);
final boolean verbose = flagInArgs("-verbose", args);
final boolean timers = flagInArgs("-timers", args);
if (null == this.clientHolder) {
this.clientHolder = checkForCustomMessageHolder(args);
}
IMessageHolder holder = clientHolder;
if (null == holder) {
holder = ourHandler;
if (verbose) {
ourHandler.setInterceptor(MessagePrinter.VERBOSE);
} else {
ourHandler.ignore(IMessage.INFO);
ourHandler.setInterceptor(MessagePrinter.TERSE);
}
}

// make sure we handle out of memory gracefully...
try {
Expand Down