I have good news, I solved both issues.
About the fake errors like in the screenshot, right-clicking on the "common" module of the Codename One project, there was an item "Resolve Project Problems" that I hadn't noticed before. The error was:
Your project has dependencies that are not resolved locally. Code
completion in the IDE will not include classes from these dependencies
or their transitive dependencies (unless they are among the open
projects). Please download the dependencies, or install them manually,
if not available remotely.
The artifacts are:
xxx:mainclass-cn1-websockets:jar:common:1.0-SNAPSHOT
xxx:mainclass-Device:jar:common:1.0-SNAPSHOT
xxx:mainclass-NativeLogsReader:jar:common:1.0-SNAPSHOT
xxx:mainclass-SMSActivation:jar:common:1.0-SNAPSHOT
xxx:mainclass-GoogleMaps:jar:common:1.0-SNAPSHOT
xxx:mainclass-CameraKitCodenameOne:jar:common:1.0-SNAPSHOT
xxx:mainclass-VideoOptimizerCN1Lib:jar:common:1.0-SNAPSHOT
As you can see, all the errors refer to cn1libs. By clicking on "Resolve", Netbeans automatically resolved this issue and the false errors (like the one in the screenshot) disappeared.
This partially solved also the first problem, related to the fact that Netbeans did not open the java file related to the error line reported in the log. I specified "partially solved" because the problem is solved only by taking care, before pressing "Run", to left-click in the Projects view on the main module of the application (otherwise the "Run" will refer to the "common" module, with various side effects). Ultimately, however, without the use of "Resolve Project Problems" this partial solution would not have worked. I'm sure of this because I ran some tests on the exact same error before and after.
UPDATE
Removing nbactions.xml
from the common
package prevents the use of "Run" with that package, avoiding the described problem.