mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Adjust trap file names of external file class declarations
This commit is contained in:
@@ -213,17 +213,19 @@ public class OdasaOutput {
|
||||
private final Map<String, String> memberTrapPaths = new LinkedHashMap<String, String>();
|
||||
private static final Pattern dots = Pattern.compile(".", Pattern.LITERAL);
|
||||
private String trapFilePathForDecl(IrDeclaration sym, String signature) {
|
||||
String binaryName = getIrDeclBinaryName(sym, signature);
|
||||
String binaryName = getIrDeclBinaryName(sym);
|
||||
String binaryNameWithSignature = binaryName + signature;
|
||||
// TODO: Reinstate this?
|
||||
//if (getTrackClassOrigins())
|
||||
// classId += "-" + StringDigestor.digest(sym.getSourceFileId());
|
||||
String result = memberTrapPaths.get(binaryName);
|
||||
String result = memberTrapPaths.get(binaryNameWithSignature);
|
||||
if (result == null) {
|
||||
result = CLASSES_DIR + "/" +
|
||||
dots.matcher(binaryName).replaceAll("/") +
|
||||
signature +
|
||||
".members" +
|
||||
".trap.gz";
|
||||
memberTrapPaths.put(binaryName, result);
|
||||
memberTrapPaths.put(binaryNameWithSignature, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||
// Adapted from Kotlin's interpreter/Utils.kt function 'internalName'
|
||||
// Translates class names into their JLS section 13.1 binary name,
|
||||
// and declarations within them into the parent class' JLS 13.1 name as
|
||||
// specified above, followed by a `$` separator and then a unique identifier
|
||||
// for `that`, consisting of its short name followed by any supplied signature.
|
||||
fun getIrDeclBinaryName(that: IrDeclaration, signature: String): String {
|
||||
// specified above, followed by a `$` separator and then the short name
|
||||
// for `that`.
|
||||
fun getIrDeclBinaryName(that: IrDeclaration): String {
|
||||
val shortName = when(that) {
|
||||
is IrDeclarationWithName -> that.name.asString()
|
||||
else -> "(unknown-name)"
|
||||
}
|
||||
val internalName = StringBuilder(shortName + signature);
|
||||
val internalName = StringBuilder(shortName);
|
||||
generateSequence(that.parent) { (it as? IrDeclaration)?.parent }
|
||||
.forEach {
|
||||
when (it) {
|
||||
@@ -75,5 +75,5 @@ fun getRawIrClassBinaryPath(irClass: IrClass) =
|
||||
fun getIrClassBinaryPath(irClass: IrClass): String {
|
||||
return getRawIrClassBinaryPath(irClass)
|
||||
// Otherwise, make up a fake location:
|
||||
?: "/!unknown-binary-location/${getIrDeclBinaryName(irClass, "").replace(".", "/")}.class"
|
||||
?: "/!unknown-binary-location/${getIrDeclBinaryName(irClass).replace(".", "/")}.class"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user