Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tab_width = 4

[*.{gradle,java}]
ij_continuation_indent_size = 8
ij_java_imports_layout = $*,|,java.**,|,javax.**,|,*,|,net.fabricmc.**
ij_java_imports_layout = $*,|,java.**,|,javax.**,|,*,|,net.fabricmc.**,|,matcher.**
ij_java_class_count_to_use_import_on_demand = 999

[*.{yml,yaml}]
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
*.bat text eol=crlf
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "17"
java-version: "21"
distribution: "temurin"

- name: Validate Gradle wrapper
Expand All @@ -22,7 +22,7 @@ jobs:
run: ./gradlew build --stacktrace --warning-mode=fail

- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: build/libs
26 changes: 21 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,45 @@ plugins {
id 'application'
id 'maven-publish'
id "checkstyle"
id 'com.diffplug.spotless'
id 'org.openjfx.javafxplugin'
id 'com.github.johnrengelman.shadow'
id 'org.gradlex.extra-java-module-info'
id 'com.gradleup.shadow'
id 'eclipse'
}

repositories {
mavenCentral()
maven {
name "Fabric"
url 'https://maven.fabricmc.net/'
name = "Fabric"
url = 'https://maven.fabricmc.net/'
}
}

archivesBaseName = 'matcher'
group = 'net.fabricmc'

base {
archivesName = 'matcher'
}

def ENV = System.getenv()

checkstyle {
configFile = project.file("checkstyle.xml")
toolVersion = project.checkstyle_version
}

spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX

java {
removeUnusedImports()
importOrder('java.', 'javax.', '', 'net.fabricmc.', 'matcher.')
indentWithTabs()
trimTrailingWhitespace()
}
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down Expand Up @@ -68,8 +83,10 @@ dependencies {
implementation "org.bitbucket.mstrobel:procyon-compilertools:${procyon_version}"
implementation ("io.github.skylot:jadx-core:${jadx_version}") {
exclude group: 'com.android.tools.build', module: 'aapt2-proto'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
implementation ("io.github.skylot:jadx-java-input:${jadx_version}") {
exclude group: 'com.android.tools.build', module: 'aapt2-proto'
exclude group: 'io.github.skylot', module: 'raung-disasm'
}
runtimeOnly "org.tinylog:tinylog-impl:${tinylog_version}"
Expand Down Expand Up @@ -107,7 +124,6 @@ extraJavaModuleInfo {

// JADX
automaticModule("io.github.skylot:jadx-core", "jadx.core")
automaticModule("io.github.skylot:jadx-plugins-api", "jadx.plugins.api")
automaticModule("io.github.skylot:jadx-java-input", "jadx.plugins.java_input")
}

Expand Down
28 changes: 19 additions & 9 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<property name="fileExtensions" value="java"/>
<property name="localeLanguage" value="en"/>
<property name="localeCountry" value="US"/>
<property name="tabWidth" value="4"/>

<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<!-- Exclude all 'module-info.java' files -->
<!-- See https://github.com/checkstyle/checkstyle/issues/3059 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
Expand Down Expand Up @@ -47,6 +48,7 @@
if <something> is a space, indicating a formatting error or ' */', it'll ignore the instance
if <something> is a tab, indicating a continued line, it'll ignore the instance
<control statement> is 'if', 'do', 'while', 'for', 'try' or nothing (instance initializer block)

- first \n: with positive lookbehind (?<=\n) to move the error marker to a more reasonable place
- capture tabs for <indentation>, later referenced via \1
- remaining preceding line as a non-comment (doesn't start with '/', '//', ' ' or '\t') or multiple lines where all but the first are a single line comment with the same indentation
Expand All @@ -66,6 +68,13 @@
</module>

<module name="TreeWalker">
<!-- Allow "//CHECKSTYLE.OFF: <InspectionName>" and "//CHECKSTYLE.ON: <InspectionName>" pairs to toggle some inspections -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

<!-- Ensure all imports are ship shape -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
Expand All @@ -74,7 +83,7 @@

<module name="ImportOrder">
<property name="groups" value="java,javax,*,net.fabricmc,matcher"/>
<property name="ordered" value="false"/><!-- the plugin orders alphabetically without considering separators.. -->
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="top"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
Expand Down Expand Up @@ -112,11 +121,11 @@
</module>

<module name="Indentation">
<property name="basicOffset" value="8"/>
<property name="basicOffset" value="4"/>
<property name="caseIndent" value="0"/>
<property name="throwsIndent" value="8"/>
<property name="arrayInitIndent" value="8"/>
<property name="lineWrappingIndentation" value="16"/>
<property name="throwsIndent" value="4"/>
<property name="arrayInitIndent" value="4"/>
<property name="lineWrappingIndentation" value="8"/>
</module>

<module name="ParenPad"/>
Expand All @@ -128,8 +137,7 @@
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<!-- Allow PLUS, MINUS, MUL, DIV as they may be more readable without spaces in some cases -->
<property name="tokens"
value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV_ASSIGN,DO_WHILE,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND"/>
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV_ASSIGN,DO_WHILE,EQUAL,GE,GT,LAMBDA,LAND,LCURLY,LE,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND"/>
</module>
<module name="SingleSpaceSeparator"/>
<module name="GenericWhitespace"/>
Expand Down Expand Up @@ -159,6 +167,8 @@
</module>

<module name="OuterTypeFilename"/>
<module name="PackageDeclaration"/>
<module name="PackageName"/>

<!--<module name="InvalidJavadocPosition"/>-->
<module name="JavadocParagraph"/>
Expand Down
25 changes: 13 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
org.gradle.jvmargs=-Xmx2G

# Gradle Plugins
spotless_version = 6.25.0
javafx_plugin_version = 0.1.0
shadow_version = 7.1.2
extra_java_module_info_version = 1.6
extra_java_module_info_version = 1.9
shadow_version = 8.3.5

# Poject Properties
# Project Properties
version = 0.1.0

# Project Dependencies
asm_version = 9.6
fabric_cfr_version = 0.2.1
vineflower_version = 1.9.3
asm_version = 9.7.1
fabric_cfr_version = 0.2.2
vineflower_version = 1.10.1
procyon_version = 0.6.0
jadx_version = 1.4.7
mappingio_version = 0.5.0
javaparser_version = 3.25.6
javafx_version = 21.0.1
checkstyle_version = 10.12.5
slf4j_version = 2.0.12
jadx_version = 1.5.1
mappingio_version = 0.7.1
javaparser_version = 3.26.3
javafx_version = 21.0.6
checkstyle_version = 10.21.2
slf4j_version = 2.0.16
tinylog_version = 2.7.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ pluginManagement {
mavenCentral();
}
plugins {
id 'com.diffplug.spotless' version "${spotless_version}"
id 'org.openjfx.javafxplugin' version "${javafx_plugin_version}"
id 'com.github.johnrengelman.shadow' version "${shadow_version}"
id 'org.gradlex.extra-java-module-info' version "${extra_java_module_info_version}"
id 'com.gradleup.shadow' version "${shadow_version}"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/matcher/gui/menu/UidMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import matcher.type.ClassEnvironment;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.Matchable;
import matcher.type.MatchType;
import matcher.type.Matchable;
import matcher.type.MemberInstance;
import matcher.type.MethodInstance;
import matcher.type.MethodVarInstance;
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/matcher/srcprocess/HtmlPrinter.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Most of this file is copied from DefaultPrettyPrinterVisitor (commit 19e0559),
* Most of this file is copied from DefaultPrettyPrinterVisitor (commit 85bb189),
* tweaked to output HTML instead of plain text. Original license:
*
* Copyright (C) 2011, 2013-2021 The JavaParser Team.
* Copyright (C) 2011, 2013-2024 The JavaParser Team.
*
* This file is part of JavaParser.
*
Expand Down Expand Up @@ -120,7 +120,6 @@
import com.github.javaparser.ast.type.ReferenceType;
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.type.TypeParameter;
import com.github.javaparser.ast.type.UnknownType;
import com.github.javaparser.ast.type.VarType;
import com.github.javaparser.ast.type.VoidType;
import com.github.javaparser.ast.type.WildcardType;
Expand Down Expand Up @@ -1168,7 +1167,7 @@ public void visit(final Parameter n, final Void arg) {
printer.print("...");
}

if (!(n.getType() instanceof UnknownType)) {
if (!(n.getType().isUnknownType())) {
printer.print(" ");
}

Expand Down Expand Up @@ -1270,6 +1269,16 @@ public void visit(final SwitchEntry n, final Void arg) {
}
}

// `case null, default -> ...` added in JEP 441
if (n.getLabels().isNonEmpty() && n.isDefault()) {
printer.print(", <span class=\"keyword\">default</span>");
}

if (n.getGuard().isPresent()) {
printer.print(" <span class=\"keyword\">when</span> ");
n.getGuard().get().accept(this, arg);
}

printer.print(separator);
}

Expand Down
Loading