mirror of
https://github.com/skylot/jadx.git
synced 2024-11-23 12:50:02 +00:00
chore: fix issues reported by lgtm.com
This commit is contained in:
parent
99935bada6
commit
7d07fb0b77
@ -2,6 +2,7 @@
|
||||
|
||||
[![Build Status](https://travis-ci.org/skylot/jadx.png?branch=master)](https://travis-ci.org/skylot/jadx)
|
||||
[![Code Coverage](https://codecov.io/gh/skylot/jadx/branch/master/graph/badge.svg)](https://codecov.io/gh/skylot/jadx)
|
||||
[![Alerts from lgtm.com](https://img.shields.io/lgtm/alerts/g/skylot/jadx.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/skylot/jadx/alerts/)
|
||||
[![SonarQube Bugs](https://sonarcloud.io/api/project_badges/measure?project=jadx&metric=bugs)](https://sonarcloud.io/dashboard?id=jadx)
|
||||
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
|
||||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package jadx.core.clsp;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -82,7 +84,7 @@ public class NMethod implements Comparable<NMethod> {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NMethod{'" + shortId + '\''
|
||||
+ ", argTypes=" + genericArgs
|
||||
+ ", argTypes=" + Arrays.toString(genericArgs)
|
||||
+ ", retType=" + retType
|
||||
+ ", varArgs=" + varArgs
|
||||
+ '}';
|
||||
|
@ -193,7 +193,7 @@ public class JsonCodeGen {
|
||||
jsonCodeLine.setSourceLine(lineMapping.get(line));
|
||||
Object obj = annotations.get(new CodePosition(line, 0));
|
||||
if (obj instanceof InsnNode) {
|
||||
int offset = ((InsnNode) obj).getOffset();
|
||||
long offset = ((InsnNode) obj).getOffset();
|
||||
jsonCodeLine.setOffset("0x" + Long.toHexString(mthCodeOffset + offset * 2));
|
||||
}
|
||||
codeLines.add(jsonCodeLine);
|
||||
|
@ -180,8 +180,11 @@ public class Utils {
|
||||
if (len == 0) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
if (len % 2 != 0) {
|
||||
throw new IllegalArgumentException("Incorrect arguments count: " + len);
|
||||
}
|
||||
Map<String, String> result = new HashMap<>(len / 2);
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
for (int i = 0; i < len - 1; i += 2) {
|
||||
result.put(parameters[i], parameters[i + 1]);
|
||||
}
|
||||
return Collections.unmodifiableMap(result);
|
||||
|
@ -50,12 +50,12 @@ public class Res9patchStreamDecoder {
|
||||
drawVLine(im2, w + 1, np.padTop + 1, h - np.padBottom);
|
||||
|
||||
int[] xDivs = np.xDivs;
|
||||
for (int i = 0; i < xDivs.length; i += 2) {
|
||||
for (int i = 0; i < xDivs.length - 1; i += 2) {
|
||||
drawHLine(im2, 0, xDivs[i] + 1, xDivs[i + 1]);
|
||||
}
|
||||
|
||||
int[] yDivs = np.yDivs;
|
||||
for (int i = 0; i < yDivs.length; i += 2) {
|
||||
for (int i = 0; i < yDivs.length - 1; i += 2) {
|
||||
drawVLine(im2, 0, yDivs[i] + 1, yDivs[i + 1]);
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,12 @@ public class ValuesParser extends ParserConstants {
|
||||
}
|
||||
|
||||
private static void decodeAndroid(RootNode root) throws IOException {
|
||||
InputStream inputStream = new BufferedInputStream(ValuesParser.class.getResourceAsStream("/resources.arsc"));
|
||||
ResTableParser androidParser = new ResTableParser(root);
|
||||
androidParser.decode(inputStream);
|
||||
androidStrings = androidParser.getStrings();
|
||||
androidResMap = androidParser.getResStorage().getResourcesNames();
|
||||
try (InputStream inputStream = new BufferedInputStream(ValuesParser.class.getResourceAsStream("/resources.arsc"))) {
|
||||
ResTableParser androidParser = new ResTableParser(root);
|
||||
androidParser.decode(inputStream);
|
||||
androidStrings = androidParser.getStrings();
|
||||
androidResMap = androidParser.getResStorage().getResourcesNames();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -13,6 +13,7 @@ import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -924,12 +925,12 @@ public class MainWindow extends JFrame {
|
||||
}
|
||||
|
||||
private void setEditorTheme(String editorThemePath) {
|
||||
try {
|
||||
editorTheme = Theme.load(getClass().getResourceAsStream(editorThemePath));
|
||||
try (InputStream is = getClass().getResourceAsStream(editorThemePath)) {
|
||||
editorTheme = Theme.load(is);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Can't load editor theme from classpath: {}", editorThemePath);
|
||||
try {
|
||||
editorTheme = Theme.load(new FileInputStream(editorThemePath));
|
||||
try (InputStream is = new FileInputStream(editorThemePath)) {
|
||||
editorTheme = Theme.load(is);
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Can't load editor theme from file: {}", editorThemePath);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user