Skip to content

Commit 28cac52

Browse files
committed
Resolved review comments.
1 parent 18a81af commit 28cac52

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

substratevm/src/com.oracle.svm.truffle.tck/src/com/oracle/svm/truffle/tck/PermissionsFeature.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,22 @@ public enum ActionKind {
129129
Throw
130130
}
131131

132+
/**
133+
* Specifies how privileged method violations are reported. See
134+
* {@link Options#TruffleTCKCollectMode}.
135+
*/
132136
public enum CollectMode {
137+
/**
138+
* Reports only one violation in total.
139+
*/
133140
Single,
141+
/**
142+
* Reports one call path per privileged method used.
143+
*/
134144
SinglePrivilegedMethodUsage,
145+
/**
146+
* Reports all call paths for all violations.
147+
*/
135148
All
136149
}
137150

@@ -386,7 +399,14 @@ public void afterAnalysis(AfterAnalysisAccess access) {
386399
(pw) -> {
387400
StringBuilder builder = new StringBuilder();
388401
for (List<BaseMethodNode> callPath : report) {
402+
boolean privilegedMethod = true;
389403
for (BaseMethodNode call : callPath) {
404+
if (privilegedMethod) {
405+
builder.append("Illegal call to privileged method ");
406+
privilegedMethod = false;
407+
} else {
408+
builder.append(" at ");
409+
}
390410
builder.append(call.asStackTraceElement()).append(System.lineSeparator());
391411
}
392412
builder.append(System.lineSeparator());

vm/mx.vm/mx_vm_gate.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ def _collect_excludes(suite, suite_import, excludes):
645645
with open(report_file, "r") as f:
646646
for line in f.readlines():
647647
message = message + line
648+
message = message + ("\nNote: If the method is not used directly by the language, but is part of the call path "
649+
"because it is used internally by the JDK and introduced by a polymorphic call, consider "
650+
"adding it to `jdk_allowed_methods.json`.")
648651
if fail_on_error:
649652
mx.abort(message)
650653
else:

0 commit comments

Comments
 (0)