Skip to content

Commit 9f790e3

Browse files
committed
Fix @LayerVerifiedOption custom message handling
1 parent b972ec0 commit 9f790e3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ public static int codeAlignment() {
10661066
private static final String ENABLE_DEBUGINFO_OPTION = "-g";
10671067
// Only raise error if -g is used in current layer build but missing in the previous layer build
10681068
@LayerVerifiedOption(apiOption = ENABLE_DEBUGINFO_OPTION, kind = Kind.Added, severity = Severity.Error, message = "If you want to use " + ENABLE_DEBUGINFO_OPTION +
1069-
" in this layer, use a layer that was also built with " + ENABLE_DEBUGINFO_OPTION)//
1069+
" in this layer, use a base layer that also got built with " + ENABLE_DEBUGINFO_OPTION + ".")//
10701070
// ... but use stricter check for raw (non-API) use of GenerateDebugInfo
10711071
@LayerVerifiedOption(kind = Kind.Changed, severity = Severity.Error)//
10721072
@APIOption(name = ENABLE_DEBUGINFO_OPTION, fixedValue = "2", customHelp = "generate debugging information")//

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LoadLayerArchiveSupport.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,16 @@ private static boolean verifyCompatibility(List<String> previousArgs, List<Strin
158158
case Added -> "Current layer gets";
159159
case Equal -> throw VMError.shouldNotReachHere("diff for equal");
160160
} + " built with option argument '" + argument + "' from " + OptionOrigin.from(argumentOrigin.origin) + ".";
161-
String suffix;
162161
if (!request.message().isEmpty()) {
163-
suffix = request.message();
162+
message += " " + request.message();
164163
} else {
165164
/* fallback to generic verification message */
166-
suffix = "This is also required to be specified for the " + switch (diffResultKind) {
165+
message += " This is also required to be specified for the " + switch (diffResultKind) {
167166
case Removed -> "current layered image build";
168167
case Added -> "previous layer build";
169168
case Equal -> throw VMError.shouldNotReachHere("diff for equal");
170-
};
169+
} + (positional ? " at the same position." : ".");
171170
}
172-
message += " " + suffix + (positional ? " at the same position." : ".");
173171
Severity severity = request.severity();
174172
violations.put(diffResult, severity);
175173
if (verbose) {

0 commit comments

Comments
 (0)