mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Merge pull request #10495 from igfoo/igfoo/traplocker
Kotlin: Tidy up TrapLocker
This commit is contained in:
@@ -266,10 +266,7 @@ public class OdasaOutput {
|
|||||||
* Any unique suffix needed to distinguish `sym` from other declarations with the same name.
|
* Any unique suffix needed to distinguish `sym` from other declarations with the same name.
|
||||||
* For functions for example, this means its parameter signature.
|
* For functions for example, this means its parameter signature.
|
||||||
*/
|
*/
|
||||||
private TrapFileManager getMembersWriterForDecl(IrDeclaration sym, String signature) {
|
private TrapFileManager getMembersWriterForDecl(File trap, IrDeclaration sym, String signature) {
|
||||||
File trap = getTrapFileForDecl(sym, signature);
|
|
||||||
if (trap==null)
|
|
||||||
return null;
|
|
||||||
TrapClassVersion currVersion = TrapClassVersion.fromSymbol(sym, log);
|
TrapClassVersion currVersion = TrapClassVersion.fromSymbol(sym, log);
|
||||||
String shortName = sym instanceof IrDeclarationWithName ? ((IrDeclarationWithName)sym).getName().asString() : "(name unknown)";
|
String shortName = sym instanceof IrDeclarationWithName ? ((IrDeclarationWithName)sym).getName().asString() : "(name unknown)";
|
||||||
if (trap.exists()) {
|
if (trap.exists()) {
|
||||||
@@ -424,33 +421,30 @@ public class OdasaOutput {
|
|||||||
private final IrDeclaration sym;
|
private final IrDeclaration sym;
|
||||||
private final File trapFile;
|
private final File trapFile;
|
||||||
private final String signature;
|
private final String signature;
|
||||||
private final boolean isNonSourceTrapFile;
|
|
||||||
private TrapLocker(IrDeclaration decl, String signature) {
|
private TrapLocker(IrDeclaration decl, String signature) {
|
||||||
this.sym = decl;
|
this.sym = decl;
|
||||||
this.signature = signature;
|
this.signature = signature;
|
||||||
if (sym==null) {
|
if (sym==null) {
|
||||||
trapFile = getTrapFileForCurrentSourceFile();
|
log.error("Null symbol passed for Kotlin TRAP locker");
|
||||||
|
trapFile = null;
|
||||||
} else {
|
} else {
|
||||||
trapFile = getTrapFileForDecl(sym, signature);
|
trapFile = getTrapFileForDecl(sym, signature);
|
||||||
}
|
}
|
||||||
isNonSourceTrapFile = false;
|
|
||||||
}
|
}
|
||||||
private TrapLocker(File jarFile) {
|
private TrapLocker(File jarFile) {
|
||||||
sym = null;
|
sym = null;
|
||||||
signature = null;
|
signature = null;
|
||||||
trapFile = getTrapFileForJarFile(jarFile);
|
trapFile = getTrapFileForJarFile(jarFile);
|
||||||
isNonSourceTrapFile = true;
|
|
||||||
}
|
}
|
||||||
private TrapLocker(String moduleName) {
|
private TrapLocker(String moduleName) {
|
||||||
sym = null;
|
sym = null;
|
||||||
signature = null;
|
signature = null;
|
||||||
trapFile = getTrapFileForModule(moduleName);
|
trapFile = getTrapFileForModule(moduleName);
|
||||||
isNonSourceTrapFile = true;
|
|
||||||
}
|
}
|
||||||
public TrapFileManager getTrapFileManager() {
|
public TrapFileManager getTrapFileManager() {
|
||||||
if (trapFile!=null) {
|
if (trapFile!=null) {
|
||||||
lockTrapFile(trapFile);
|
lockTrapFile(trapFile);
|
||||||
return getMembersWriterForDecl(sym, signature);
|
return getMembersWriterForDecl(trapFile, sym, signature);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user