Commit 7b4321ec authored by Skylot's avatar Skylot

gui: fix build for java 10 and update dependencies (#291)

parent 188bfd1a
...@@ -18,7 +18,6 @@ build/ ...@@ -18,7 +18,6 @@ build/
classes/ classes/
idea/ idea/
.gradle/ .gradle/
gradle.properties
jadx-output/ jadx-output/
*-tmp/ *-tmp/
......
language: java language: java
jdk: sudo: false
- oraclejdk8 dist: trusty
before_install:
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- chmod +x gradlew
env: env:
- TERM=dumb GRADLE_OPTS="-Dorg.gradle.daemon=false" global:
- TERM=dumb
before_install: matrix:
- chmod +x gradlew include:
- env: JDK=oracle-8
jdk: oraclejdk8
- env: JDK=oracle-10
install: . ./install-jdk.sh -F 10 -L BCL
script: script:
- sed -i " 1 s/.*/&-b$TRAVIS_BUILD_NUMBER-$(git rev-parse --short HEAD)/" version - java -version
- cat version - sed -i " 1 s/.*/&-b$TRAVIS_BUILD_NUMBER-$(git rev-parse --short HEAD)/" version
- sed -i "s/BUILD_VERSION/$(head -c -1 version)/g" bintray.json - cat version
- ./gradlew clean build - sed -i "s/BUILD_VERSION/$(head -c -1 version)/g" bintray.json
- ./gradlew clean build
after_success: after_success:
- ./gradlew clean build jacocoTestReport - test $JDK = "oracle-8" && ./gradlew clean build jacocoTestReport && bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" - test $JDK = "oracle-8" && ./gradlew clean sonarqube -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_TOKEN || echo "Skip sonar build and upload"
- ./gradlew clean sonarqube -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_TOKEN
- ./gradlew clean dist
deploy: before_deploy:
provider: bintray - ./gradlew clean dist
edge:
branch: v1.8.47
file: bintray.json
user: skylot
key: $BINTRAY_KEY
skip_cleanup: true
on:
branch: master
tags: false
sudo: false deploy:
provider: bintray
edge:
branch: v1.8.47
file: bintray.json
user: skylot
key: $BINTRAY_KEY
skip_cleanup: true
on:
branch: master
tags: false
condition: $JDK = oracle-8
notifications: notifications:
email: email:
- skylot@gmail.com - skylot@gmail.com
...@@ -41,7 +41,7 @@ allprojects { ...@@ -41,7 +41,7 @@ allprojects {
testCompile 'ch.qos.logback:logback-classic:1.2.3' testCompile 'ch.qos.logback:logback-classic:1.2.3'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3' testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:2.15.0' testCompile 'org.mockito:mockito-core:2.18.3'
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4' testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
testCompile 'cglib:cglib-nodep:3.2.6' testCompile 'cglib:cglib-nodep:3.2.6'
} }
...@@ -53,7 +53,7 @@ allprojects { ...@@ -53,7 +53,7 @@ allprojects {
} }
jacoco { jacoco {
toolVersion = "0.8.0" toolVersion = "0.8.1"
} }
jacocoTestReport { jacocoTestReport {
reports { reports {
......
org.gradle.daemon=false
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
...@@ -5,7 +5,7 @@ applicationName = 'jadx' ...@@ -5,7 +5,7 @@ applicationName = 'jadx'
dependencies { dependencies {
compile(project(':jadx-core')) compile(project(':jadx-core'))
compile 'com.beust:jcommander:1.72' compile 'com.beust:jcommander:1.74'
compile 'ch.qos.logback:logback-classic:1.2.3' compile 'ch.qos.logback:logback-classic:1.2.3'
} }
......
...@@ -5,12 +5,12 @@ dependencies { ...@@ -5,12 +5,12 @@ dependencies {
compile files('lib/dx-1.14.jar') compile files('lib/dx-1.14.jar')
compile 'commons-io:commons-io:2.6' compile 'commons-io:commons-io:2.6'
compile 'org.ow2.asm:asm:6.0' compile 'org.ow2.asm:asm:6.2'
compile 'org.jetbrains:annotations:15.0' compile 'org.jetbrains:annotations:16.0.2'
compile 'uk.com.robust-it:cloning:1.9.9' compile 'uk.com.robust-it:cloning:1.9.10'
testCompile 'org.smali:smali:2.2.2' testCompile 'org.smali:smali:2.2.3'
testCompile 'org.smali:baksmali:2.2.2' testCompile 'org.smali:baksmali:2.2.3'
testCompile 'org.apache.commons:commons-lang3:3.7' testCompile 'org.apache.commons:commons-lang3:3.7'
} }
......
...@@ -249,14 +249,9 @@ public class ModVisitor extends AbstractVisitor { ...@@ -249,14 +249,9 @@ public class ModVisitor extends AbstractVisitor {
|| !parentClass.getInnerClasses().contains(classNode)) { || !parentClass.getInnerClasses().contains(classNode)) {
return; return;
} }
if (!classNode.getAccessFlags().isStatic()
&& (callMth.getArgsCount() == 0
|| !callMth.getArgumentsTypes().get(0).equals(parentClass.getClassInfo().getType()))) {
return;
}
// TODO: calculate this constructor and other constructor usage // TODO: calculate this constructor and other constructor usage
Map<InsnArg, FieldNode> argsMap = getArgsToFieldsMapping(callMthNode, co); Map<InsnArg, FieldNode> argsMap = getArgsToFieldsMapping(callMthNode, co);
if (argsMap.isEmpty()) { if (argsMap.isEmpty() && !callMthNode.getArguments(true).isEmpty()) {
return; return;
} }
...@@ -285,9 +280,14 @@ public class ModVisitor extends AbstractVisitor { ...@@ -285,9 +280,14 @@ public class ModVisitor extends AbstractVisitor {
private static Map<InsnArg, FieldNode> getArgsToFieldsMapping(MethodNode callMthNode, ConstructorInsn co) { private static Map<InsnArg, FieldNode> getArgsToFieldsMapping(MethodNode callMthNode, ConstructorInsn co) {
Map<InsnArg, FieldNode> map = new LinkedHashMap<>(); Map<InsnArg, FieldNode> map = new LinkedHashMap<>();
ClassNode parentClass = callMthNode.getParentClass(); MethodInfo callMth = callMthNode.getMethodInfo();
ClassNode cls = callMthNode.getParentClass();
ClassNode parentClass = cls.getParentClass();
List<RegisterArg> argList = callMthNode.getArguments(false); List<RegisterArg> argList = callMthNode.getArguments(false);
int startArg = parentClass.getAccessFlags().isStatic() ? 0 : 1; int startArg = 0;
if (callMth.getArgsCount() != 0 && callMth.getArgumentsTypes().get(0).equals(parentClass.getClassInfo().getType())) {
startArg = 1;
}
int argsCount = argList.size(); int argsCount = argList.size();
for (int i = startArg; i < argsCount; i++) { for (int i = startArg; i < argsCount; i++) {
RegisterArg arg = argList.get(i); RegisterArg arg = argList.get(i);
...@@ -298,7 +298,7 @@ public class ModVisitor extends AbstractVisitor { ...@@ -298,7 +298,7 @@ public class ModVisitor extends AbstractVisitor {
FieldNode fieldNode = null; FieldNode fieldNode = null;
if (useInsn.getType() == InsnType.IPUT) { if (useInsn.getType() == InsnType.IPUT) {
FieldInfo field = (FieldInfo) ((IndexInsnNode) useInsn).getIndex(); FieldInfo field = (FieldInfo) ((IndexInsnNode) useInsn).getIndex();
fieldNode = parentClass.searchField(field); fieldNode = cls.searchField(field);
if (fieldNode == null || !fieldNode.getAccessFlags().isSynthetic()) { if (fieldNode == null || !fieldNode.getAccessFlags().isSynthetic()) {
return Collections.emptyMap(); return Collections.emptyMap();
} }
......
...@@ -208,8 +208,8 @@ public class SimplifyVisitor extends AbstractVisitor { ...@@ -208,8 +208,8 @@ public class SimplifyVisitor extends AbstractVisitor {
} // end of if constructor is for StringBuilder } // end of if constructor is for StringBuilder
} // end of if we found a constructor early in the chain } // end of if we found a constructor early in the chain
} catch (Throwable e) { } catch (Exception e) {
LOG.debug("Can't convert string concatenation: {} insn: {}", mth, insn, e); LOG.warn("Can't convert string concatenation: {} insn: {}", mth, insn, e);
} }
} }
return null; return null;
......
...@@ -6,6 +6,7 @@ import java.util.LinkedHashSet; ...@@ -6,6 +6,7 @@ import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.jetbrains.annotations.TestOnly;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -32,6 +33,7 @@ import jadx.core.utils.exceptions.CodegenException; ...@@ -32,6 +33,7 @@ import jadx.core.utils.exceptions.CodegenException;
import jadx.core.utils.exceptions.JadxRuntimeException; import jadx.core.utils.exceptions.JadxRuntimeException;
@Deprecated @Deprecated
@TestOnly
public class DebugUtils { public class DebugUtils {
private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class); private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class);
......
plugins { plugins {
id 'edu.sc.seis.launch4j' version '2.4.3' id 'edu.sc.seis.launch4j' version '2.4.4'
id 'com.github.johnrengelman.shadow' version '2.0.2' id 'com.github.johnrengelman.shadow' version '2.0.4'
} }
apply plugin: 'application' apply plugin: 'application'
...@@ -11,14 +11,14 @@ dependencies { ...@@ -11,14 +11,14 @@ dependencies {
compile(project(":jadx-core")) compile(project(":jadx-core"))
compile(project(":jadx-cli")) compile(project(":jadx-cli"))
compile 'com.fifesoft:rsyntaxtextarea:2.6.1' compile 'com.fifesoft:rsyntaxtextarea:2.6.1'
compile 'com.google.code.gson:gson:2.8.2' compile 'com.google.code.gson:gson:2.8.5'
compile files('libs/jfontchooser-1.0.5.jar') compile files('libs/jfontchooser-1.0.5.jar')
compile 'hu.kazocsaba:image-viewer:1.2.3' compile 'hu.kazocsaba:image-viewer:1.2.3'
compile 'org.apache.commons:commons-lang3:3.7' compile 'org.apache.commons:commons-lang3:3.7'
compile 'io.reactivex.rxjava2:rxjava:2.1.13' compile 'io.reactivex.rxjava2:rxjava:2.1.14'
compile "com.github.akarnokd:rxjava2-swing:0.2.12" compile "com.github.akarnokd:rxjava2-swing:0.2.13"
} }
applicationDistribution.with { applicationDistribution.with {
...@@ -63,7 +63,6 @@ launch4j { ...@@ -63,7 +63,6 @@ launch4j {
initialHeapPercent = 5 initialHeapPercent = 5
maxHeapSize = 4096 maxHeapSize = 4096
maxHeapPercent = 70 maxHeapPercent = 70
} }
test { test {
......
...@@ -30,7 +30,7 @@ class CodePanel extends ContentPanel { ...@@ -30,7 +30,7 @@ class CodePanel extends ContentPanel {
add(searchBar, BorderLayout.NORTH); add(searchBar, BorderLayout.NORTH);
add(scrollPane); add(scrollPane);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK); KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK);
Utils.addKeyBinding(codeArea, key, "SearchAction", new SearchAction()); Utils.addKeyBinding(codeArea, key, "SearchAction", new SearchAction());
} }
......
package jadx.gui.utils; package jadx.gui.utils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import javax.swing.text.JTextComponent; import javax.swing.text.JTextComponent;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.*; import java.awt.*;
...@@ -102,26 +100,22 @@ public class TextStandardActions { ...@@ -102,26 +100,22 @@ public class TextStandardActions {
} }
private void addKeyActions() { private void addKeyActions() {
KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK); KeyStroke undoKey = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK);
textComponent.getInputMap().put(undoKey, undoAction); textComponent.getInputMap().put(undoKey, undoAction);
KeyStroke redoKey = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK); KeyStroke redoKey = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK);
textComponent.getInputMap().put(redoKey, redoAction); textComponent.getInputMap().put(redoKey, redoAction);
} }
private void registerListeners() { private void registerListeners() {
textComponent.addMouseListener(new MouseAdapter() { textComponent.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK if (e.getButton() == 3 && e.getSource() == textComponent) {
&& e.getSource() == textComponent) {
process(e); process(e);
} }
} }
}); });
textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() { textComponent.getDocument().addUndoableEditListener(event -> undoManager.addEdit(event.getEdit()));
public void undoableEditHappened(UndoableEditEvent event) {
undoManager.addEdit(event.getEdit());
}
});
} }
private void process(MouseEvent e) { private void process(MouseEvent e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment