Skip to content

Add checks for generic types and discard any unexpected types #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 77 commits into
base: develop/1.11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
564c483
Start 1.11.0
jaskarth Apr 4, 2024
765a698
Fix switches on enums with a switch map along with null cases for jav…
coehlrich Apr 5, 2024
451ab66
Bump to Java 17
jaskarth Apr 5, 2024
9541def
Make generic remapping more defensive
jaskarth Apr 5, 2024
9aa4ff3
Fix copying values in arrays (#357)
Kroppeb Apr 5, 2024
f631ae7
Fix switch expressions not generating (#358)
coehlrich Apr 6, 2024
a478d8b
Fix formatter emitting blank lines for long method invocations with n…
jpenilla Apr 8, 2024
4379782
Fix variable namer parent not being set for local classes (#361)
coehlrich Apr 9, 2024
31554b4
Don't append indent to newlines immediately followed by another newli…
jpenilla Apr 9, 2024
bd39565
Add missing range check to account for EOF (#364)
jpenilla Apr 9, 2024
8c41ea6
Only use parameter names from method parameter attributes, if they ar…
shartte Apr 10, 2024
fdc9933
Don't tear down nested class wrappers after writing the root class (#…
jpenilla Apr 10, 2024
140d738
Fix J21 nested inner class synthetic params
jaskarth Apr 12, 2024
08608f9
Don't write explicit casts where redundant (#341)
IotaBread Apr 12, 2024
4c5ebf8
Move from a fixed thread pool to a fork join pool
jaskarth Apr 12, 2024
ba3328a
Add option to exclude classes from decompilation with regex (#370)
mvisat Apr 14, 2024
b7ed6bd
Kotlin default arguments (#369)
sschr15 Apr 16, 2024
43e6f4d
Fix 2 constructors of an inner class with 1 calling another (#375)
coehlrich Apr 19, 2024
6fcd301
Fix weird indent when inlined simple lambdas return something that ta…
jpenilla Apr 19, 2024
8ed3c2f
Inline empty lambda bodies to `{}` when simple lambda inlining enable…
jpenilla Apr 19, 2024
786d566
Update to J17 features + fix ctor default params (#376)
sschr15 Apr 19, 2024
4999386
Simplify empty anonymous class bodies to `{}` (#381)
jpenilla Apr 19, 2024
e54ccfd
Fix indent on 'simple' switch branches (#382)
jpenilla Apr 23, 2024
e9ce490
Fix breaking decompile switch-on-enum when enum does not exist in cla…
EpicPlayerA10 Apr 30, 2024
fa6317a
Map all bytecode in range (#386)
jaskarth May 1, 2024
84cf6f0
Fix default case not always being last (#391)
coehlrich May 20, 2024
349d163
Add back casts in numeric operations where it increases the size of t…
Machine-Maker May 20, 2024
1394013
Fix variable used in switch head not being inlined (#399)
coehlrich May 22, 2024
883a7aa
Fix method parameters reading the parameter type from the signature f…
coehlrich May 23, 2024
4ecf1dd
Add support for intersection types in casts (#405)
coehlrich Jun 23, 2024
7d12f99
Guard var name with null check, fixes #400
jaskarth Jul 11, 2024
a80db9a
Update dependencies and tests to Kotlin 2.0.0
sschr15 Aug 14, 2024
ab5edb8
String interpolation initial run
sschr15 Aug 6, 2024
c72a35f
Fix StringBuilder-based single character issues
sschr15 Aug 6, 2024
f6c21ed
Make string concatenation toggleable
sschr15 Aug 14, 2024
7f460c3
[Kotlin] Fix class visibility when public should be explicit
sschr15 Aug 14, 2024
78728ec
[Kotlin] Fix "catch" throwable definitions
sschr15 Aug 14, 2024
a0b6136
[Kotlin] Infer `val` in method bodies
sschr15 Aug 15, 2024
36db2f6
Fix NPE when finding var fields, fixes #412
jaskarth Aug 16, 2024
4eb3409
Fixes for clashing variable renaming (#378)
jpenilla Aug 17, 2024
934ec9a
Add option to disable inner classes names validation (#392)
EpicPlayerA10 Aug 17, 2024
0625b22
Fail gracefully when decompiling mangled string concat, fixes IOOBE
jaskarth Aug 17, 2024
0c3b8af
Fix IOOBE in sequence flattening
jaskarth Aug 17, 2024
e62bc97
Fix IOOBE in finally processing when the head block is empty
jaskarth Aug 17, 2024
e8b62b1
Fix local record classes that have the parent class as the first (#414)
coehlrich Aug 17, 2024
e08520b
Fix IOOBE in NewExprent type inference
jaskarth Aug 17, 2024
22fed54
Inner records are implicitly static
jaskarth Aug 17, 2024
9986e91
Remove preview record pattern matching tests
jaskarth Aug 17, 2024
fe081e8
Fix NPE in invocation type inference
jaskarth Aug 17, 2024
9f0dbda
Avoid race condition crashes when handling duplicate classes
jaskarth Aug 18, 2024
a6b226e
Remove final from `Statement` subtypes (#415)
sschr15 Aug 18, 2024
6930e47
Convert private statement constructors to protected
sschr15 Aug 18, 2024
6333850
Decompiler option access API (#418)
sschr15 Aug 18, 2024
7092900
Fix NPE in invocation exprent inference
jaskarth Aug 19, 2024
b363268
Record pattern matching (#368)
jaskarth Aug 20, 2024
d726601
[Kotlin] Fix pass order
sschr15 Aug 20, 2024
8813624
[Kotlin] Skip braces if class body is empty
sschr15 Aug 20, 2024
ecf3104
[Kotlin] Add test for companion object
sschr15 Aug 21, 2024
ded2b9c
[Kotlin] Fix objects, companion object members, and whitespace
sschr15 Aug 21, 2024
cb905ac
Fix incorrect inlining of methods into patterns
jaskarth Aug 21, 2024
34a6163
[Kotlin] Fix NPE from annotation change
sschr15 Aug 23, 2024
6f2eb60
[Kotlin] Add enum test, fix error when ctors have defaults, fix enum …
sschr15 Aug 23, 2024
470444e
Fix tests
jaskarth Aug 23, 2024
966edd5
Update Kotlin tests
sschr15 Aug 23, 2024
a6f7865
Allow plugins to change decompiled file extensions (#420)
sschr15 Aug 23, 2024
c45692c
Fix NPE in variable remapping
jaskarth Aug 23, 2024
dca0799
Improve switch expression candidate picking with stack vars
jaskarth Aug 24, 2024
d75fd5f
Improve statement ordering and conditionals with pattern matching
jaskarth Aug 24, 2024
842371b
Fix lambdas in anonymous classes referencing parameters from the root…
coehlrich Aug 24, 2024
087e269
[Kotlin] Fix cast types being Java-style
sschr15 Aug 25, 2024
36bf983
[Kotlin] Update tests
sschr15 Aug 25, 2024
4320d60
Better handle synchronized blocks created with jsr and ret
jaskarth Aug 27, 2024
d797611
[Kotlin] Fix infinite loop, stack overflow, or whatever it is KInvoca…
sschr15 Aug 29, 2024
1931437
Quick dependency refresh (#427)
zml2008 Sep 5, 2024
d6dcb52
Add corrupted signature test
sschr15 Sep 11, 2024
1480c4b
Add mismatched generics catches
sschr15 Sep 14, 2024
1c14529
Fix all the cases where the tests indicated I messed up
sschr15 Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.bat text eol=crlf
*.css text
*.df text
*.htm text
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@ jobs:
build:
strategy:
matrix:
java: [11, 17, 19]
runs-on: ubuntu-22.04
java: [17, 21]
runs-on: ubuntu-24.04
container:
image: eclipse-temurin:${{ matrix.java }}
options: --user root
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.repository_owner != 'Vineflower' || !(contains(github.ref_name, 'develop') || contains(github.ref_name, 'master')) }}
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build --stacktrace
- name: Archive test results
if: "${{ always() }}"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "test-results-java${{ matrix.java }}"
path: |
build/reports/
plugins/*/build/reports/
build/test-results/**/*.xml
publish-test-results:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [build]
permissions:
issues: write
Expand All @@ -35,7 +36,7 @@ jobs:
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
- '*'
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: eclipse-temurin:17
options: --user root
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
- run: ./gradlew build publish publishToSonatype closeAndReleaseSonatypeStagingRepository -x test --stacktrace
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ on: [push, pull_request]
jobs:
publish:
if: ${{ github.repository_owner == 'Vineflower' && contains(github.ref_name, 'develop') }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
container:
image: eclipse-temurin:17
options: --user root
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
- run: ./gradlew publish --stacktrace
env:
STATUS: snapshot
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import org.vineflower.build.TestDataRuntimesProvider

plugins {
id 'jacoco'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id("io.github.gradle-nexus.publish-plugin") version '1.3.0'
id 'com.gradleup.shadow' version '8.3.0'
id 'org.jetbrains.kotlin.jvm' version '2.0.0'
id("io.github.gradle-nexus.publish-plugin") version '2.0.0'
}

apply plugin: 'jacoco'
Expand All @@ -18,19 +18,19 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'java'
ext.isArm = System.getProperty('os.arch') == 'aarch64'

group = 'org.vineflower'

compileJava {
sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = '17'
targetCompatibility = '17'
}

java.toolchain {
languageVersion = JavaLanguageVersion.of(11)
languageVersion = JavaLanguageVersion.of(17)
}

repositories {
Expand All @@ -54,9 +54,9 @@ allprojects {
}

group = 'org.vineflower'
archivesBaseName = 'vineflower'
base.archivesName = 'vineflower'

version = '1.10.0'
version = '1.11.0'

def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
Expand Down Expand Up @@ -144,7 +144,7 @@ def testJavaRuntimes = [:]
languageVersion = JavaLanguageVersion.of(runtimeVersion)
}
}
[16, 17, 19, 21].forEach { version -> createJavaTestDataSet(version, "Preview", ["--enable-preview"]) }
[16, 17, 21].forEach { version -> createJavaTestDataSet(version, "Preview", ["--enable-preview"]) }
[8, 16].forEach { version -> createJavaTestDataSet(version, "NoDebug", ["-g:none"])}

task compileTestDataJasm(type: JasmCompile) {
Expand Down
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
21 changes: 12 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -145,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion plugins/idea-not-null/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
archivesBaseName = 'vineflower-idea-not-null'
base.archivesName = 'vineflower-idea-not-null'

dependencies {
implementation project(":")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.vineflower.ideanotnull;

import org.jetbrains.java.decompiler.api.DecompilerOption;
import org.jetbrains.java.decompiler.api.plugin.PluginOptions;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;

public interface IdeaNotNullOptions {
@IFernflowerPreferences.Name("Resugar Intellij IDEA @NotNull")
@IFernflowerPreferences.Description("Resugar Intellij IDEA's code generated by @NotNull annotations.")
@IFernflowerPreferences.ShortName("inn")
@IFernflowerPreferences.Type(IFernflowerPreferences.Type.BOOLEAN)
@IFernflowerPreferences.Type(DecompilerOption.Type.BOOLEAN)
String IDEA_NOT_NULL_ANNOTATION = "resugar-idea-notnull";

static void addDefaults(PluginOptions.AddDefaults cons) {
Expand Down
14 changes: 14 additions & 0 deletions plugins/idea-not-null/testData/results/TestIdeaNotNull.dec
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@ class 'pkg/TestIdeaNotNull' {
f 9
10 10
11 10
12 10
13 10
14 11
1d 11
1e 13
1f 13
20 13
21 13
22 13
23 13
24 13
2c 14
30 14
34 14
Expand Down Expand Up @@ -145,11 +149,15 @@ class 'pkg/TestIdeaNotNull' {
2a 33
2b 33
2c 33
2d 33
2e 33
2f 34
30 34
31 34
32 34
33 34
34 34
35 34
36 36
}

Expand All @@ -168,6 +176,8 @@ class 'pkg/TestIdeaNotNull' {
12 43
13 43
14 43
15 43
16 43
1e 44
22 44
26 44
Expand All @@ -190,6 +200,8 @@ class 'pkg/TestIdeaNotNull' {
e 53
f 53
10 53
11 53
12 53
13 54
1d 54
1e 56
Expand All @@ -200,6 +212,8 @@ class 'pkg/TestIdeaNotNull' {
23 56
24 56
25 56
26 56
27 56
2f 57
33 57
37 57
Expand Down
1 change: 1 addition & 0 deletions plugins/kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build/
/out/
/testData/classes/kt/
/testData/classes/ktold/
bin
23 changes: 21 additions & 2 deletions plugins/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ plugins {
id 'org.jetbrains.kotlin.jvm'
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'java'
apply plugin: 'maven-publish'

group = 'org.vineflower'
version = "0.1.0"
archivesBaseName = 'vineflower-kotlin'
base.archivesName = 'vineflower-kotlin'

sourceSets {
testDataKotlin.kotlin.srcDirs files("testData/src/kt/")
testDataOldKotlin.kotlin.srcDirs files("testData/src/ktold/")
}

configurations {
testDataOldKotlinImplementation.extendsFrom testDataKotlinImplementation
}

dependencies {
Expand All @@ -35,6 +40,20 @@ compileTestDataKotlinKotlin {
}
testDataClasses.dependsOn(testDataKotlinClasses)

compileTestDataOldKotlinKotlin {
destinationDirectory = file("testData/classes/ktold")
kotlinOptions {
compilerOptions {
freeCompilerArgs = [ // Kotlin 2.0 defaults to invokedynamic implementations. Use class implementations instead.
"-Xlambdas=class",
"-Xsam-conversions=class",
"-Xstring-concat=inline",
]
}
}
}
testDataClasses.dependsOn(testDataOldKotlinClasses)

jar {
enabled = false
}
Expand Down
Loading