Skip to content

Commit

Permalink
Merge pull request #936 from jglick/staticInterfaceMethod-JENKINS-73031
Browse files Browse the repository at this point in the history
[JENKINS-73031] Print hint that a `static` `interface` method may be to blame
  • Loading branch information
jglick authored Sep 26, 2024
2 parents 25ee0f3 + 492a2b5 commit dc9d3ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,16 @@ private boolean run() {
if (fn != null) {
t.head.get().addAction(new ErrorAction(error));
}
if (error instanceof VerifyError) {
var msg = error.getMessage();
if (msg != null && msg.contains("Illegal type in constant pool")) {
try {
execution.getOwner().getListener().getLogger().println("May be JENKINS-73031: calling static interface methods from Groovy is not currently supported by Jenkins");
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
}
}

if (!t.isAlive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public void evaluateShallSandbox() throws Exception {
r.assertLogContains("Scripts not permitted to use new java.io.File java.lang.String", b);
}

@Issue("JENKINS-73031")
@Test public void staticInterfaceMethod() throws Exception {
var p = r.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition("def x = List.of(1, 2, 3); echo(/x=$x/)", false));
var b = r.buildAndAssertStatus(Result.FAILURE, p);
r.assertLogContains("JENKINS-73031", b);
}

@Test public void blockRun() throws Exception {
WorkflowJob p = r.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition("run(null, ['test'] as String[])\n", true));
Expand Down

0 comments on commit dc9d3ae

Please sign in to comment.