use of org.jetbrains.annotations.Nullable in project scss-lint-plugin by idok.
the class ThreadLocalActualFile method createFile.
@Nullable
private File createFile() {
// File retFile = new File(file.getParent().getPath(), file.getNameWithoutExtension() + "_jscs_tmp." + file.getExtension());
File retFile = createFileAsSibling();
if (retFile != null) {
return retFile;
}
// try to create a temp file in temp folder
File dir = getOrCreateTempDir();
if (dir == null) {
return null;
}
File file = new File(dir, this.baseName + this.extension);
boolean created = false;
if (!file.exists()) {
try {
created = file.createNewFile();
} catch (IOException ignored) {
LOG.warn("Can not create " + file.getAbsolutePath());
}
}
if (!created) {
try {
file = FileUtil.createTempFile(dir, this.baseName, this.extension);
} catch (IOException e) {
LOG.warn("Can not create temp file", e);
return null;
}
}
file.deleteOnExit();
return file;
}
use of org.jetbrains.annotations.Nullable in project robolectric by robolectric.
the class ConfigMerger method cachedPackageConfig.
@Nullable
private Config cachedPackageConfig(String packageName) {
synchronized (packageConfigCache) {
Config config = packageConfigCache.get(packageName);
if (config == null && !packageConfigCache.containsKey(packageName)) {
config = buildPackageConfig(packageName);
packageConfigCache.put(packageName, config);
}
return config;
}
}
use of org.jetbrains.annotations.Nullable in project jadx by skylot.
the class DexNode method deepResolveMethod.
@Nullable
private MethodNode deepResolveMethod(@NotNull ClassNode cls, String signature) {
for (MethodNode m : cls.getMethods()) {
if (m.getMethodInfo().getShortId().startsWith(signature)) {
return m;
}
}
MethodNode found;
ArgType superClass = cls.getSuperClass();
if (superClass != null) {
ClassNode superNode = resolveClass(superClass);
if (superNode != null) {
found = deepResolveMethod(superNode, signature);
if (found != null) {
return found;
}
}
}
for (ArgType iFaceType : cls.getInterfaces()) {
ClassNode iFaceNode = resolveClass(iFaceType);
if (iFaceNode != null) {
found = deepResolveMethod(iFaceNode, signature);
if (found != null) {
return found;
}
}
}
return null;
}
use of org.jetbrains.annotations.Nullable in project jadx by skylot.
the class Deobfuscator method getAliasFromSourceFile.
@Nullable
private String getAliasFromSourceFile(ClassNode cls) {
SourceFileAttr sourceFileAttr = cls.get(AType.SOURCE_FILE);
if (sourceFileAttr == null) {
return null;
}
String name = sourceFileAttr.getFileName();
if (name.endsWith(".java")) {
name = name.substring(0, name.length() - ".java".length());
}
if (NameMapper.isValidIdentifier(name) && !NameMapper.isReserved(name)) {
// TODO: check if no class with this name exists or already renamed
cls.remove(AType.SOURCE_FILE);
return name;
}
return null;
}
use of org.jetbrains.annotations.Nullable in project jadx by skylot.
the class Deobfuscator method getMethodAlias.
@Nullable
public String getMethodAlias(MethodNode mth) {
MethodInfo methodInfo = mth.getMethodInfo();
String alias = mthMap.get(methodInfo);
if (alias != null) {
return alias;
}
alias = deobfPresets.getForMth(methodInfo);
if (alias != null) {
mthMap.put(methodInfo, alias);
methodInfo.setAliasFromPreset(true);
return alias;
}
if (shouldRename(mth.getName())) {
return makeMethodAlias(mth);
}
return null;
}
Aggregations