Merge branch 'GP-0_ryanmkurtz_PR-9058_Phasip_stale-script-errors'

(Closes #9057, Closes #9058)
This commit is contained in:
Ryan Kurtz
2026-03-23 10:16:45 -04:00
2 changed files with 48 additions and 2 deletions
@@ -416,6 +416,9 @@ public class GhidraSourceBundle extends GhidraBundle {
buildErrors.remove(newSourceFile);
}
}
// remove errors for missing source files
buildErrors.keySet().removeIf(sourceFile -> !sourceFile.exists());
}
private boolean stillHasErrors(ResourceFile newSourceFile) {
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -238,6 +238,49 @@ public class BundleHostTest extends AbstractGhidraHeadlessIntegrationTest {
getInstance("apackage.AClass").toString());
}
@Test
public void testDeletedSourceRemovesStaleBuildError() throws Exception {
// @formatter:off
addClass(
"apackage.BClass",
"@Override\n" +
"public String toString() {\n" +
" failing java goes here\n" +
" return \"yupyup\";\n" +
"}\n"
);
buildWithExpectations(
"BClass.java:7: error: ';' expected\n" +
" failing java goes here\n" +
" ^\n" +
"BClass.java:7: error: ';' expected\n" +
" failing java goes here\n" +
" ^\n" +
"skipping "+currentBundle.getFile().toString()+File.separator+"apackage"+File.separator+"BClass.java\n"
,
"1 source file with errors"
);
// @formatter:on
Path srcDir = currentBundle.getFile().getFile(false).toPath();
Path bpath = srcDir.resolve("apackage").resolve("BClass.java");
Files.delete(bpath);
// @formatter:off
addClass(
"apackage.AClass",
"@Override\n" +
"public String toString() {\n" +
" return \"yupyup\";\n" +
"}\n"
);
// @formatter:on
buildAndActivate();
}
@Test
public void testLibraryInBundle() throws Exception {
// @formatter:off