Add test for a module declaration made in a file named other than module-info.java

This triggers a weird corner case in our extractor, which used to throw a null pointer exception.
This commit is contained in:
Chris Smowton
2023-09-12 18:07:13 +01:00
parent c47ba000d6
commit 6ea7b195db
5 changed files with 14 additions and 0 deletions

View File

@@ -0,0 +1 @@
| module-info-wrong-name.java:0:0:0:0 | 2 |

View File

@@ -0,0 +1,4 @@
import java
import semmle.code.java.Diagnostics
select any(Diagnostic d | not d.toString().matches("Not rewriting trap file for%"))

View File

@@ -0,0 +1,3 @@
module module.with.wrong.name {
exports somepkg;
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17

View File

@@ -0,0 +1,5 @@
package somepkg;
public class SomeClass {
public static void someMethod() {}
}