mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Only generate models for local supertypes
Avoid generating models for classes implementing external SPI (e.g. `FileFilter`). Keep `toString` models intact as they're commonly used as taint-propagation method (e.g. see `Joiner`).
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package p;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
|
||||
public abstract class AbstractImplOfExternalSPI implements FileFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
19
java/ql/test/utils/model-generator/p/ImplOfExternalSPI.java
Normal file
19
java/ql/test/utils/model-generator/p/ImplOfExternalSPI.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package p;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class ImplOfExternalSPI extends AbstractImplOfExternalSPI {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
try {
|
||||
Files.createFile(pathname.toPath());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package p;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class MultipleImpls {
|
||||
|
||||
|
||||
public static interface Strategy {
|
||||
String doSomething(String value);
|
||||
}
|
||||
@@ -22,7 +26,7 @@ public class MultipleImpls {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public static class Strat2 implements Strategy {
|
||||
private String foo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user