diff --git a/.gitattributes b/.gitattributes index 972529aebd..91811f8438 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12233a8ebb..bc9c095aaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,21 +4,22 @@ 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: | @@ -26,7 +27,7 @@ jobs: 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 @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96bc26e675..09c10269ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index dc314b8373..ab2f7bc831 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -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 diff --git a/build.gradle b/build.gradle index 07d2958634..0666752360 100644 --- a/build.gradle +++ b/build.gradle @@ -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' @@ -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 { @@ -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") @@ -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) { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c49..a4b76b9530 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e0930b..9355b41557 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index 0adc8e1a53..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -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/. @@ -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 @@ -145,7 +148,7 @@ 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 @@ -153,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | 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 @@ -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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f13..9d21a21834 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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 ########################################################################## @@ -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 @@ -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 diff --git a/plugins/idea-not-null/build.gradle b/plugins/idea-not-null/build.gradle index 4db1e4e6cd..b67b65fd8c 100644 --- a/plugins/idea-not-null/build.gradle +++ b/plugins/idea-not-null/build.gradle @@ -1,4 +1,4 @@ -archivesBaseName = 'vineflower-idea-not-null' +base.archivesName = 'vineflower-idea-not-null' dependencies { implementation project(":") diff --git a/plugins/idea-not-null/src/main/java/org/vineflower/ideanotnull/IdeaNotNullOptions.java b/plugins/idea-not-null/src/main/java/org/vineflower/ideanotnull/IdeaNotNullOptions.java index 1fd13b2fd3..399743ff21 100644 --- a/plugins/idea-not-null/src/main/java/org/vineflower/ideanotnull/IdeaNotNullOptions.java +++ b/plugins/idea-not-null/src/main/java/org/vineflower/ideanotnull/IdeaNotNullOptions.java @@ -1,5 +1,6 @@ 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; @@ -7,7 +8,7 @@ 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) { diff --git a/plugins/idea-not-null/testData/results/TestIdeaNotNull.dec b/plugins/idea-not-null/testData/results/TestIdeaNotNull.dec index 02010fc8e0..8f3aa2dd71 100644 --- a/plugins/idea-not-null/testData/results/TestIdeaNotNull.dec +++ b/plugins/idea-not-null/testData/results/TestIdeaNotNull.dec @@ -76,6 +76,8 @@ class 'pkg/TestIdeaNotNull' { f 9 10 10 11 10 + 12 10 + 13 10 14 11 1d 11 1e 13 @@ -83,6 +85,8 @@ class 'pkg/TestIdeaNotNull' { 20 13 21 13 22 13 + 23 13 + 24 13 2c 14 30 14 34 14 @@ -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 } @@ -168,6 +176,8 @@ class 'pkg/TestIdeaNotNull' { 12 43 13 43 14 43 + 15 43 + 16 43 1e 44 22 44 26 44 @@ -190,6 +200,8 @@ class 'pkg/TestIdeaNotNull' { e 53 f 53 10 53 + 11 53 + 12 53 13 54 1d 54 1e 56 @@ -200,6 +212,8 @@ class 'pkg/TestIdeaNotNull' { 23 56 24 56 25 56 + 26 56 + 27 56 2f 57 33 57 37 57 diff --git a/plugins/kotlin/.gitignore b/plugins/kotlin/.gitignore index 7dc657844a..9f83c1522d 100644 --- a/plugins/kotlin/.gitignore +++ b/plugins/kotlin/.gitignore @@ -1,4 +1,5 @@ /build/ /out/ /testData/classes/kt/ +/testData/classes/ktold/ bin \ No newline at end of file diff --git a/plugins/kotlin/build.gradle b/plugins/kotlin/build.gradle index d906f1f5f1..bd170b70ca 100644 --- a/plugins/kotlin/build.gradle +++ b/plugins/kotlin/build.gradle @@ -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 { @@ -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 } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinOptions.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinOptions.java index e1f9154a1b..c451b2f4b2 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinOptions.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinOptions.java @@ -1,24 +1,34 @@ package org.vineflower.kotlin; +import org.jetbrains.java.decompiler.api.DecompilerOption; import org.jetbrains.java.decompiler.api.plugin.PluginOptions; -import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences.*; -import java.util.Map; - public interface KotlinOptions { @Name("Show public visibility") @Description("If a construct is public, show the public keyword") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SHOW_PUBLIC_VISIBILITY = "kt-show-public"; - @Name("Decompile Kotlin") + @Name("Enable Kotlin plugin") @Description("Decompile Kotlin classes as Kotlin instead of Java") - @Type(Type.BOOLEAN) - String DECOMPILE_KOTLIN = "kt-decompile-kotlin"; + @Type(DecompilerOption.Type.BOOLEAN) + String DECOMPILE_KOTLIN = "kt-enable"; + + @Name("Unknown default arg string") + @Description("String to use for unknown default arguments, or empty to not indicate unknown defaults") + @Type(DecompilerOption.Type.STRING) + String UNKNOWN_DEFAULT_ARG_STRING = "kt-unknown-defaults"; + + @Name("Collapse string concatenation") + @Description("Convert string concatenations to Kotlin string templates.") + @Type(DecompilerOption.Type.BOOLEAN) + String COLLAPSE_STRING_CONCATENATION = "kt-collapse-string-concat"; static void addDefaults(PluginOptions.AddDefaults cons) { cons.addDefault(SHOW_PUBLIC_VISIBILITY, "1"); cons.addDefault(DECOMPILE_KOTLIN, "1"); + cons.addDefault(UNKNOWN_DEFAULT_ARG_STRING, "..."); + cons.addDefault(COLLAPSE_STRING_CONCATENATION, "1"); } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinPlugin.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinPlugin.java index 7e79998ae4..d8e71f1066 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinPlugin.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinPlugin.java @@ -37,7 +37,7 @@ public String description() { @Override public LanguageSpec getLanguageSpec() { - return new LanguageSpec("kotlin", new KotlinChooser(), new DomHelper(), new KotlinWriter(), makePass()); + return new LanguageSpec("kotlin", new KotlinChooser(), new DomHelper(), new KotlinWriter(), makePass(), "kt"); } private static Pass makePass() { @@ -81,6 +81,7 @@ private static Pass makePass() { .addPass("ReplaceExprs", new ReplaceExprentsPass()) // TODO: preference for this pass .addPass("ResugarMethods", new ResugarKotlinMethodsPass()) + .addPass("CollapseStringConcat", new CollapseStringConcatPass()) .addPass("ReplaceContinue", ctx -> LabelHelper.replaceContinueWithBreak(ctx.getRoot())) .build(); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinWriter.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinWriter.java index e5558e0f0e..9d59efd2c3 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinWriter.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinWriter.java @@ -32,6 +32,7 @@ import org.jetbrains.java.decompiler.struct.gen.generics.GenericClassDescriptor; import org.jetbrains.java.decompiler.struct.gen.generics.GenericFieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.generics.GenericMethodDescriptor; +import org.jetbrains.java.decompiler.struct.gen.generics.GenericsChecker; import org.jetbrains.java.decompiler.util.*; import org.jetbrains.java.decompiler.util.collections.VBStyleCollection; import org.vineflower.kotlin.expr.KAnnotationExprent; @@ -43,7 +44,6 @@ import java.io.IOException; import java.util.*; -import java.util.stream.Collectors; public class KotlinWriter implements StatementWriter { private static final Set ERROR_DUMP_STOP_POINTS = new HashSet<>(Arrays.asList( @@ -97,8 +97,7 @@ private boolean invokeProcessors(TextBuffer buffer, ClassNode node) { ClassWrapper wrapper = node.getWrapper(); if (wrapper == null) { buffer.append("/* $VF: Couldn't be decompiled. Class " + node.classStruct.qualifiedName + " wasn't processed yet! */"); - List lines = new ArrayList<>(); - lines.addAll(KotlinWriter.getErrorComment()); + List lines = new ArrayList<>(KotlinWriter.getErrorComment()); for (String line : lines) { buffer.append("//"); if (!line.isEmpty()) buffer.append(' ').append(line); @@ -132,8 +131,7 @@ private boolean invokeProcessors(TextBuffer buffer, ClassNode node) { buffer.append("// $VF: Couldn't be decompiled"); buffer.appendLineSeparator(); if (DecompilerContext.getOption(IFernflowerPreferences.DUMP_EXCEPTION_ON_ERROR)) { - List lines = new ArrayList<>(); - lines.addAll(KotlinWriter.getErrorComment()); + List lines = new ArrayList<>(KotlinWriter.getErrorComment()); collectErrorLines(t, lines); for (String line : lines) { buffer.append("//"); @@ -216,6 +214,7 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { ConstantPool pool = cl.getPool(); KotlinChooser.setContextVariables(cl); + KotlinDecompilationContext.KotlinType current = KotlinDecompilationContext.getCurrentType(); DecompilerContext.getLogger().startWriteClass(cl.qualifiedName); @@ -223,6 +222,18 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { Map functions = KFunction.parse(node); KConstructor.Data constructorData = KConstructor.parse(node); + ProtoBuf.Class proto = KotlinDecompilationContext.getCurrentClass(); + + ProtobufFlags.Class kotlinFlags; + if (proto != null) { + kotlinFlags = new ProtobufFlags.Class(proto.getFlags()); + } else { + if (KotlinDecompilationContext.getCurrentType() == null) { + appendComment(buffer, "Class flags could not be determined", indent); + } + kotlinFlags = new ProtobufFlags.Class(0); + } + if (DecompilerContext.getOption(IFernflowerPreferences.SOURCE_FILE_COMMENTS)) { StructSourceFileAttribute sourceFileAttr = node.classStruct .getAttribute(StructGeneralAttribute.ATTRIBUTE_SOURCE_FILE); @@ -237,25 +248,74 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { } } - if (cl.hasModifier(CodeConstants.ACC_ANNOTATION)) { + if (kotlinFlags.kind == ProtoBuf.Class.Kind.ANNOTATION_CLASS || cl.hasModifier(CodeConstants.ACC_ANNOTATION)) { // Kotlin's annotation classes are treated quite differently from other classes writeAnnotationDefinition(node, buffer, indent, propertyData, functions, constructorData); return; } - if (KotlinDecompilationContext.getCurrentType() == KotlinDecompilationContext.KotlinType.FILE) { + if (current == KotlinDecompilationContext.KotlinType.FILE) { writeKotlinFile(node, buffer, indent, propertyData, functions); // no constructors in top level file return; } + Optional companion; + if (current == KotlinDecompilationContext.KotlinType.CLASS && KotlinDecompilationContext.getCurrentClass().hasCompanionObjectName()) { + String name = KotlinDecompilationContext.getNameResolver().resolve(KotlinDecompilationContext.getCurrentClass().getCompanionObjectName()); + companion = node.nested.stream() + .filter(n -> n.simpleName.equals(name)) + .findAny(); + } else { + companion = Optional.empty(); + } + // write class definition - writeClassDefinition(node, buffer, indent, constructorData); + writeClassDefinition(node, buffer, indent, constructorData, kotlinFlags); + + TextBuffer innerBuffer = new TextBuffer(); boolean hasContent = false; boolean enumFields = false; List components = cl.getRecordComponents(); + Set fieldsToIgnore = new HashSet<>(); + Set methodsToIgnore = new HashSet<>(); + + if (propertyData != null) { + fieldsToIgnore.addAll(propertyData.associatedFields()); + methodsToIgnore.addAll(propertyData.associatedMethods()); + } + + for (KFunction function : functions.values()) { + if (function.defaultArgs().getDefaultMethod() != null) { + methodsToIgnore.add(function.defaultArgs().getDefaultMethod()); + } + } + + if (constructorData != null) { + for (KConstructor constructor : constructorData.constructors().values()) { + if (constructor.defaultArgs().getDefaultMethod() != null) { + methodsToIgnore.add(constructor.defaultArgs().getDefaultMethod()); + } + } + } + + if (companion.isPresent()) { + ClassNode companionNode = companion.get(); + KotlinChooser.setContextVariables(companionNode.classStruct); + + KProperty.Data companionPropertyData = KProperty.parse(companionNode); + Map companionFunctions = KFunction.parse(companionNode); + + if (companionPropertyData != null) { + fieldsToIgnore.addAll(companionPropertyData.associatedFields()); + methodsToIgnore.addAll(companionPropertyData.associatedMethods()); + } + + methodsToIgnore.addAll(companionFunctions.keySet()); + } + // FIXME: fields don't have line mappings // fields @@ -283,7 +343,9 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { for (StructField fd : cl.getFields()) { boolean hide = fd.isSynthetic() && DecompilerContext.getOption(IFernflowerPreferences.REMOVE_SYNTHETIC) || - wrapper.getHiddenMembers().contains(InterpreterUtil.makeUniqueKey(fd.getName(), fd.getDescriptor())) || deferredEnumFields.contains(fd); + wrapper.getHiddenMembers().contains(InterpreterUtil.makeUniqueKey(fd.getName(), fd.getDescriptor())) || + deferredEnumFields.contains(fd) || + fieldsToIgnore.contains(fd); if (hide) continue; if (components != null && fd.getAccessFlags() == (CodeConstants.ACC_FINAL | CodeConstants.ACC_PRIVATE) && @@ -295,56 +357,65 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { boolean isEnum = fd.hasModifier(CodeConstants.ACC_ENUM) && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); if (isEnum) { if (enumFields) { - buffer.append(',').appendLineSeparator(); + innerBuffer.append(',').appendLineSeparator(); } enumFields = true; } else if (enumFields) { - buffer.append(';'); - buffer.appendLineSeparator(); - buffer.appendLineSeparator(); + innerBuffer.append(';'); + innerBuffer.appendLineSeparator(); + innerBuffer.appendLineSeparator(); enumFields = false; - - // If the fields after are non enum, readd the fields found scattered throughout the enum - for (StructField fd2 : deferredEnumFields) { - TextBuffer fieldBuffer = new TextBuffer(); - writeField(wrapper, cl, fd2, fieldBuffer, indent + 1); - fieldBuffer.clearUnassignedBytecodeMappingData(); - buffer.append(fieldBuffer); - } } - if (propertyData == null || !propertyData.associatedFields.contains(fd.getName())) { + if (propertyData == null || enumFields) { // Enum fields are not considered Kotlin properties TextBuffer fieldBuffer = new TextBuffer(); writeField(wrapper, cl, fd, fieldBuffer, indent + 1); fieldBuffer.clearUnassignedBytecodeMappingData(); - buffer.append(fieldBuffer); + innerBuffer.append(fieldBuffer); hasContent = true; } } - if (enumFields) { - buffer.append(';').appendLineSeparator(); + if (propertyData != null) { + // Any deferred fields that are property fields should be removed to prevent duplication + deferredEnumFields.removeAll(propertyData.associatedFields()); - // If we end with enum fields, readd the fields found mixed in - for (StructField fd2 : deferredEnumFields) { - TextBuffer fieldBuffer = new TextBuffer(); - writeField(wrapper, cl, fd2, fieldBuffer, indent + 1); - fieldBuffer.clearUnassignedBytecodeMappingData(); - buffer.append(fieldBuffer); - } - } + boolean addedLineAtEnd = false; + for (KProperty prop : propertyData.properties()) { + if (hasContent) { + innerBuffer.appendLineSeparator(); + } - if (propertyData != null && !propertyData.properties.isEmpty()) { - if (hasContent) { - buffer.appendLineSeparator(); + TextBuffer propBuffer = prop.stringify(indent + 1); + + boolean isMultiline = propBuffer.countLines() >= 1; // countLines() counts occurrences of the newline separator, so it's one less than the actual number of lines + + if (isMultiline && hasContent && !addedLineAtEnd) { + innerBuffer.appendLineSeparator(); + } + + innerBuffer.append(propBuffer); + + if (isMultiline) { + innerBuffer.appendLineSeparator(); + } + + addedLineAtEnd = isMultiline; + hasContent = true; } - for (KProperty prop : propertyData.properties) { - buffer.append(prop.stringify(indent + 1)); + if (!addedLineAtEnd && !propertyData.properties().isEmpty()) { + innerBuffer.appendLineSeparator(); } + } - hasContent = true; + // If any fields remaining were deferred but not enum fields, re-add them + for (StructField fd2 : deferredEnumFields) { + TextBuffer fieldBuffer = new TextBuffer(); + writeField(wrapper, cl, fd2, fieldBuffer, indent + 1); + fieldBuffer.clearUnassignedBytecodeMappingData(); + innerBuffer.append(fieldBuffer); } // methods @@ -355,27 +426,34 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { mt.hasModifier(CodeConstants.ACC_BRIDGE) && DecompilerContext.getOption(IFernflowerPreferences.REMOVE_BRIDGE) || wrapper.getHiddenMembers().contains(InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor())) || mt.getName().equals("") && mt.getDescriptor().equals("(Lkotlin/jvm/internal/DefaultConstructorMarker;)V") || - propertyData != null && propertyData.associatedMethods.contains(InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor())); + companion.map(c -> c.getWrapper().getMethods().containsKey(InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()))).orElse(false) && mt.hasModifier(CodeConstants.ACC_STATIC) || + methodsToIgnore.contains(mt); if (hide) continue; KFunction function = functions.get(mt); if (function != null) { if (hasContent) { - buffer.appendLineSeparator(); + innerBuffer.appendLineSeparator(); } hasContent = true; - buffer.append(function.stringify(indent + 1)); + innerBuffer.append(function.stringify(indent + 1)); continue; } if (constructorData != null) { - KConstructor constructor = constructorData.constructors.get(mt); + KConstructor constructor = constructorData.constructors().get(mt); if (constructor != null) { - if (hasContent) { - buffer.appendLineSeparator(); + TextBuffer ctorBuffer = new TextBuffer(); + boolean ctorSkipped = !constructor.stringify(ctorBuffer, indent + 1); + if (!ctorSkipped) { + if (hasContent) { + innerBuffer.appendLineSeparator(); + } + hasContent = true; + innerBuffer.append(ctorBuffer); } - hasContent |= constructor.stringify(buffer, indent + 1); - continue; + + continue; // Skip writing the constructor as a method, even if nothing was written } } @@ -383,10 +461,10 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { boolean methodSkipped = !writeMethod(node, mt, i, methodBuffer, indent + 1); if (!methodSkipped) { if (hasContent) { - buffer.appendLineSeparator(); + innerBuffer.appendLineSeparator(); } hasContent = true; - buffer.append(methodBuffer); + innerBuffer.append(methodBuffer); } } @@ -400,18 +478,27 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { if (hide) continue; if (hasContent) { - buffer.appendLineSeparator(); + innerBuffer.appendLineSeparator(); } - writeClass(inner, buffer, indent + 1); + writeClass(inner, innerBuffer, indent + 1); hasContent = true; } } - buffer.appendIndent(indent).append('}'); + if (!innerBuffer.containsOnlyWhitespaces()) { + // Only add braces if a class body is present + buffer.append(" {") + .appendLineSeparator() + .append(innerBuffer) + .appendIndent(indent) + .append("}"); + } + + buffer.appendLineSeparator(); if (node.type != ClassNode.Type.ANONYMOUS) { - buffer.appendLineSeparator(); + innerBuffer.appendLineSeparator(); } } finally { DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, outerNode); @@ -422,13 +509,41 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { private void writeKotlinFile(ClassNode node, TextBuffer buffer, int indent, KProperty.Data propertyData, Map functions) { ClassWrapper wrapper = node.getWrapper(); StructClass cl = wrapper.getClassStruct(); + + boolean hasContent = false; + + if (propertyData != null && !propertyData.properties().isEmpty()) { + boolean addedLineAtEnd = false; + for (KProperty prop : propertyData.properties()) { + if (hasContent) { + buffer.appendLineSeparator(); + } + + TextBuffer propBuffer = prop.stringify(indent); + + boolean isMultiline = propBuffer.countLines() >= 1; - for (KProperty property : propertyData.properties) { - buffer.append(property.stringify(indent)); + if (!addedLineAtEnd && isMultiline && hasContent) { + buffer.appendLineSeparator(); + } + + buffer.append(propBuffer); + + if (isMultiline) { + buffer.appendLineSeparator(); + } + + addedLineAtEnd = isMultiline; + hasContent = true; + } + + if (!addedLineAtEnd) { + buffer.appendLineSeparator(); + } } for (StructField fd : cl.getFields()) { - if (propertyData.associatedFields.contains(fd.getName())) continue; + if (propertyData.associatedFields().contains(fd)) continue; TextBuffer fieldBuffer = new TextBuffer(); writeField(wrapper, cl, fd, fieldBuffer, indent); @@ -436,26 +551,32 @@ private void writeKotlinFile(ClassNode node, TextBuffer buffer, int indent, KPro buffer.append(fieldBuffer); } - if (!cl.getFields().isEmpty()) { - buffer.appendLineSeparator(); - } - for (int i = 0; i < cl.getMethods().size(); i++) { StructMethod mt = cl.getMethods().get(i); if (functions.containsKey(mt)) { + if (hasContent) { + buffer.appendLineSeparator(); + } + hasContent = true; + buffer.append(functions.get(mt).stringify(indent)); - buffer.appendLineSeparator(); continue; } - String key = InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()); - if (mt.getName().equals("") || propertyData.associatedMethods.contains(key)) continue; + if (mt.getName().equals("") || propertyData.associatedMethods().contains(mt)) continue; TextBuffer methodBuffer = new TextBuffer(); - writeMethod(node, mt, i, methodBuffer, indent); - methodBuffer.clearUnassignedBytecodeMappingData(); - buffer.append(methodBuffer, node.simpleName, mt.getName() + " " + mt.getDescriptor()); - buffer.appendLineSeparator(); + boolean written = writeMethod(node, mt, i, methodBuffer, indent); + + if (written) { + if (hasContent) { + buffer.appendLineSeparator(); + } + + methodBuffer.clearUnassignedBytecodeMappingData(); + buffer.append(methodBuffer, node.simpleName, mt.getName() + " " + mt.getDescriptor()); + hasContent = true; + } } for (ClassNode inner : node.nested) { @@ -465,6 +586,7 @@ private void writeKotlinFile(ClassNode node, TextBuffer buffer, int indent, KPro } } + //TODO update this to use Kotlin's metadata private void writeAnnotationDefinition(ClassNode node, TextBuffer buffer, int indent, KProperty.Data propertyData, Map functions, KConstructor.Data constructorData) { ClassWrapper wrapper = node.getWrapper(); StructClass cl = wrapper.getClassStruct(); @@ -495,31 +617,31 @@ private void writeAnnotationDefinition(ClassNode node, TextBuffer buffer, int in .append("(") .appendLineSeparator(); - List nonParameterProperties = new ArrayList<>(propertyData.properties); + List nonParameterProperties = new ArrayList<>(propertyData.properties()); boolean first = true; - for (KParameter param : constructorData.primary.parameters) { + for (KParameter param : constructorData.primary().parameters()) { if (!first) { buffer.append(",").appendLineSeparator(); } first = false; buffer.appendIndent(indent + 1) .append("val ") - .append(KotlinWriter.toValidKotlinIdentifier(param.name)) + .append(KotlinWriter.toValidKotlinIdentifier(param.name())) .append(": ") - .append(param.type.stringify(indent + 1)); + .append(param.type().stringify(indent + 1)); // Because Kotlin really doesn't like making this easy for us, defaults are still passed directly via attributes - KProperty prop = propertyData.properties.stream() - .filter(p -> p.name.equals(param.name)) + KProperty prop = propertyData.properties().stream() + .filter(p -> p.name().equals(param.name())) .findFirst() .orElseThrow(); nonParameterProperties.remove(prop); - KPropertyAccessor getter = prop.getter; + KPropertyAccessor getter = prop.getter(); if (getter != null) { - StructMethod mt = getter.underlyingMethod.methodStruct; + StructMethod mt = getter.underlyingMethod().methodStruct; StructAnnDefaultAttribute paramAttr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_ANNOTATION_DEFAULT); if (paramAttr != null) { Exprent kExpr = KUtils.replaceExprent(paramAttr.getDefaultValue()); @@ -582,11 +704,7 @@ private void writeAnnotationDefinition(ClassNode node, TextBuffer buffer, int in buffer.appendLineSeparator(); } - private static boolean isGenerated(int flags) { - return (flags & (CodeConstants.ACC_SYNTHETIC | CodeConstants.ACC_MANDATED)) != 0; - } - - private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, KConstructor.Data constructorData) { + private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, KConstructor.Data constructorData, ProtobufFlags.Class kotlinFlags) { if (node.type == ClassNode.Type.ANONYMOUS) { buffer.append(" {").appendLineSeparator(); return; @@ -597,16 +715,9 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, int flags = node.type == ClassNode.Type.ROOT ? cl.getAccessFlags() : node.access; boolean isDeprecated = cl.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED); - boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || cl.hasAttribute(StructGeneralAttribute.ATTRIBUTE_SYNTHETIC); boolean isEnum = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM) && (flags & CodeConstants.ACC_ENUM) != 0; boolean isInterface = (flags & CodeConstants.ACC_INTERFACE) != 0; boolean isAnnotation = (flags & CodeConstants.ACC_ANNOTATION) != 0; - boolean isModuleInfo = (flags & CodeConstants.ACC_MODULE) != 0 && cl.hasAttribute(StructGeneralAttribute.ATTRIBUTE_MODULE); - StructPermittedSubclassesAttribute permittedSubClassesAttr = cl.getAttribute(StructGeneralAttribute.ATTRIBUTE_PERMITTED_SUBCLASSES); - List permittedSubClasses = permittedSubClassesAttr != null ? permittedSubClassesAttr.getClasses() : Collections.emptyList(); - boolean isSealed = permittedSubClassesAttr != null && !permittedSubClasses.isEmpty(); - boolean isFinal = (flags & CodeConstants.ACC_FINAL) != 0; - boolean isNonSealed = !isSealed && !isFinal && cl.getVersion().hasSealedClasses() && isSuperClassSealed(cl); if (isDeprecated) { if (!containsDeprecatedAnnotation(cl)) { @@ -627,18 +738,9 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, appendJvmAnnotations(buffer, indent, cl, isInterface, cl.getPool(), TypeAnnotation.CLASS_TYPE_PARAMETER); - ProtoBuf.Class proto = KotlinDecompilationContext.getCurrentClass(); - ProtobufFlags.Class kotlinFlags; - if (proto != null) { - kotlinFlags = new ProtobufFlags.Class(proto.getFlags()); - } else { - appendComment(buffer, "Class flags could not be determined", indent); - kotlinFlags = new ProtobufFlags.Class(0); - } - buffer.appendIndent(indent); - if (kotlinFlags.visibility != ProtoBuf.Visibility.PUBLIC) { + if (kotlinFlags.visibility != ProtoBuf.Visibility.PUBLIC || DecompilerContext.getOption(KotlinOptions.SHOW_PUBLIC_VISIBILITY)) { buffer.append(ProtobufFlags.toString(kotlinFlags.visibility)).append(' '); } @@ -667,22 +769,33 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, } if (isEnum) { - buffer.append("enum class "); + buffer.append("enum class"); } else if (isInterface) { - buffer.append("interface "); + buffer.append("interface"); } else if (isAnnotation) { buffer.append("annotation class"); } else if (kotlinFlags.kind == ProtoBuf.Class.Kind.OBJECT) { - buffer.append("object "); + buffer.append("object"); } else if (kotlinFlags.kind == ProtoBuf.Class.Kind.COMPANION_OBJECT) { - buffer.append("companion object "); + buffer.append("companion object"); } else { - buffer.append("class "); + buffer.append("class"); } - buffer.append(toValidKotlinIdentifier(node.simpleName)); + if (kotlinFlags.kind != ProtoBuf.Class.Kind.COMPANION_OBJECT || !node.simpleName.equals("Companion")) { + buffer.append(" ").append(toValidKotlinIdentifier(node.simpleName)); + } GenericClassDescriptor descriptor = cl.getSignature(); + if (descriptor != null) { + VarType superclass = new VarType(cl.superClass.getString(), true); + List interfaces = Arrays.stream(cl.getInterfaceNames()) + .map(s -> new VarType(s, true)) + .toList(); + + descriptor.verifyTypes(superclass, interfaces); + } + if (descriptor != null && !descriptor.fparameters.isEmpty()) { appendTypeParameters(buffer, descriptor.fparameters, descriptor.fbounds); } @@ -690,17 +803,15 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, buffer.pushNewlineGroup(indent, 1); boolean appendedColon = false; - if (!isEnum && !isInterface && cl.superClass != null) { - if (constructorData != null && constructorData.primary != null && constructorData.primary.writePrimaryConstructor(buffer, indent)) { + if (constructorData != null && constructorData.primary() != null && constructorData.primary().writePrimaryConstructor(buffer, indent)) { + appendedColon = true; + } else if (!isEnum && !isInterface && cl.superClass != null) { + VarType supertype = new VarType(cl.superClass.getString(), true); + if (!VarType.VARTYPE_OBJECT.equals(supertype)) { + buffer.appendPossibleNewline(" "); + buffer.append(": "); + buffer.append(ExprProcessor.getCastTypeName(descriptor == null ? supertype : descriptor.superclass)); appendedColon = true; - } else { - VarType supertype = new VarType(cl.superClass.getString(), true); - if (!VarType.VARTYPE_OBJECT.equals(supertype)) { - buffer.appendPossibleNewline(" "); - buffer.append(": "); - buffer.append(ExprProcessor.getCastTypeName(descriptor == null ? supertype : descriptor.superclass)); - appendedColon = true; - } } } @@ -724,24 +835,6 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent, } buffer.popNewlineGroup(); - - buffer.append(" {").appendLineSeparator(); - } - - private static boolean isSuperClassSealed(StructClass cl) { - if (cl.superClass != null) { - StructClass superClass = DecompilerContext.getStructContext().getClass((String) cl.superClass.value); - if (superClass != null && superClass.hasAttribute(StructGeneralAttribute.ATTRIBUTE_PERMITTED_SUBCLASSES)) { - return true; - } - } - for (String iface : cl.getInterfaceNames()) { - StructClass ifaceClass = DecompilerContext.getStructContext().getClass(iface); - if (ifaceClass != null && ifaceClass.hasAttribute(StructGeneralAttribute.ATTRIBUTE_PERMITTED_SUBCLASSES)) { - return true; - } - } - return false; } public void writeField(ClassWrapper wrapper, StructClass cl, StructField fd, TextBuffer buffer, int indent) { @@ -788,6 +881,9 @@ public void writeField(ClassWrapper wrapper, StructClass cl, StructField fd, Tex Map.Entry fieldTypeData = getFieldTypeData(fd); VarType fieldType = fieldTypeData.getKey(); GenericFieldDescriptor descriptor = fieldTypeData.getValue(); + if (descriptor != null) { + descriptor.verifyType(cl.getSignature(), fieldType); + } if (!isEnum) { buffer.append(ExprProcessor.getCastTypeName(descriptor == null ? fieldType : descriptor.type)); @@ -804,10 +900,9 @@ public void writeField(ClassWrapper wrapper, StructClass cl, StructField fd, Tex } if (initializer != null) { - if (isEnum && initializer instanceof NewExprent) { - NewExprent expr = (NewExprent) initializer; - expr.setEnumConst(true); - buffer.append(expr.toJava(indent)); + if (isEnum && initializer instanceof NewExprent newExpr) { + newExpr.setEnumConst(true); + buffer.append(newExpr.toJava(indent)); } else { buffer.append(" = "); @@ -973,6 +1068,41 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex } GenericMethodDescriptor descriptor = mt.getSignature(); + if (descriptor != null) { + List params = new ArrayList<>(Arrays.asList(mt.methodDescriptor().params)); + if ((node.access & CodeConstants.ACC_ENUM) != 0 && init) { + // Signatures skip enum parameters, the checker must as well + params.remove(0); + params.remove(0); + } + + StructExceptionsAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_EXCEPTIONS); + List exceptions = new ArrayList<>(); + if (attr != null) { + for (int i = 0; i < attr.getThrowsExceptions().size(); i++) { + exceptions.add(new VarType(attr.getExcClassname(i, node.classStruct.getPool()), true)); + } + } + + GenericClassDescriptor classSig = (mt.getAccessFlags() & CodeConstants.ACC_STATIC) == 0 ? node.classStruct.getSignature() : null; + GenericsChecker checker = null; + if (classSig != null) { + checker = classSig.getChecker(); + + ClassNode currentParent = node.parent; + while (currentParent != null) { + GenericClassDescriptor parentSignature = currentParent.classStruct.getSignature(); + if (parentSignature != null) { + checker = checker.copy(parentSignature.getChecker()); + } + + currentParent = currentParent.parent; + } + } + + descriptor.verifyTypes(checker, params, mt.methodDescriptor().ret, exceptions); + } + boolean throwsExceptions = false; int paramCount = 0; @@ -992,7 +1122,7 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex boolean extension = varprocName != null && varprocName.startsWith("$this$"); if (extension) { - VarType paramType = descriptor != null && descriptor.parameterTypes.size() > 0 ? descriptor.parameterTypes.get(0) : md.params[0]; + VarType paramType = descriptor != null && !descriptor.parameterTypes.isEmpty() ? descriptor.parameterTypes.get(0) : md.params[0]; String typeName = KTypes.getKotlinType(paramType); boolean isNullable = processParameterAnnotations(buffer, mt, 0); @@ -1039,7 +1169,7 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex } boolean hasDescriptor = descriptor != null; - //mask should now have the Outer.this in it... so this *shouldn't* be nessasary. + //mask should now have the Outer.this in it... so this *shouldn't* be necessary. //if (init && !isEnum && ((node.access & CodeConstants.ACC_STATIC) == 0) && node.type == ClassNode.CLASS_MEMBER) // index++; @@ -1163,9 +1293,7 @@ public static boolean writeMethodBody(ClassNode node, MethodWrapper methodWrappe if (root != null && methodWrapper.decompileError == null) { // check for existence try { // Avoid generating imports for ObjectMethods during root.toJava(...) - if (RecordHelper.isHiddenRecordMethod(cl, mt, root)) { - hideMethod = true; - } else { + if (!RecordHelper.isHiddenRecordMethod(cl, mt, root)) { TextBuffer code = root.toJava(indent + 1); code.addBytecodeMapping(root.getDummyExit().bytecode); hideMethod = code.length() == 0 && hideIfInit; @@ -1253,7 +1381,7 @@ public static void collectErrorLines(Throwable error, List lines) { } private static void collectBytecode(MethodWrapper wrapper, List lines) throws IOException { - ClassNode classNode = (ClassNode) DecompilerContext.getContextProperty(DecompilerContext.CURRENT_CLASS_NODE); + ClassNode classNode = DecompilerContext.getContextProperty(DecompilerContext.CURRENT_CLASS_NODE); StructMethod method = wrapper.methodStruct; InstructionSequence instructions = method.getInstructionSequence(); if (instructions == null) { @@ -1270,14 +1398,14 @@ private static void collectBytecode(MethodWrapper wrapper, List lines) t Instruction instr = instructions.getInstr(idx); StringBuilder sb = new StringBuilder(); String offHex = Integer.toHexString(offset); - for (int i = offHex.length(); i < digits; i++) sb.append('0'); + sb.append("0".repeat(Math.max(0, digits - offHex.length()))); sb.append(offHex).append(": "); if (instr.wide) { sb.append("wide "); } sb.append(TextUtil.getInstructionName(instr.opcode)); switch (instr.group) { - case CodeConstants.GROUP_INVOCATION: { + case CodeConstants.GROUP_INVOCATION -> { sb.append(' '); if (instr.opcode == CodeConstants.opc_invokedynamic && bootstrap != null) { appendBootstrapCall(sb, pool.getLinkConstant(instr.operand(0)), bootstrap); @@ -1287,29 +1415,22 @@ private static void collectBytecode(MethodWrapper wrapper, List lines) t for (int i = 1; i < instr.operandsCount(); i++) { sb.append(' ').append(instr.operand(i)); } - break; } - case CodeConstants.GROUP_FIELDACCESS: { + case CodeConstants.GROUP_FIELDACCESS -> { sb.append(' '); appendConstant(sb, pool.getConstant(instr.operand(0))); - break; } - case CodeConstants.GROUP_JUMP: { + case CodeConstants.GROUP_JUMP -> { sb.append(' '); int dest = offset + instr.operand(0); String destHex = Integer.toHexString(dest); - for (int i = destHex.length(); i < digits; i++) sb.append('0'); + sb.append("0".repeat(Math.max(0, digits - destHex.length()))); sb.append(destHex); - break; } - default: { + default -> { switch (instr.opcode) { - case CodeConstants.opc_new: - case CodeConstants.opc_checkcast: - case CodeConstants.opc_instanceof: - case CodeConstants.opc_ldc: - case CodeConstants.opc_ldc_w: - case CodeConstants.opc_ldc2_w: { + case CodeConstants.opc_new, CodeConstants.opc_checkcast, CodeConstants.opc_instanceof, + CodeConstants.opc_ldc, CodeConstants.opc_ldc_w, CodeConstants.opc_ldc2_w -> { sb.append(' '); PooledConstant constant = pool.getConstant(instr.operand(0)); if (constant.type == CodeConstants.CONSTANT_Dynamic && bootstrap != null) { @@ -1317,9 +1438,8 @@ private static void collectBytecode(MethodWrapper wrapper, List lines) t } else { appendConstant(sb, constant); } - break; } - default: { + default -> { for (int i = 0; i < instr.operandsCount(); i++) { sb.append(' ').append(instr.operand(i)); } @@ -1354,8 +1474,7 @@ private static void appendConstant(StringBuilder sb, PooledConstant constant) { sb.append(""); return; } - if (constant instanceof PrimitiveConstant) { - PrimitiveConstant prim = ((PrimitiveConstant) constant); + if (constant instanceof PrimitiveConstant prim) { Object value = prim.value; String stringValue = String.valueOf(value); if (prim.type == CodeConstants.CONSTANT_Class) { @@ -1365,8 +1484,7 @@ private static void appendConstant(StringBuilder sb, PooledConstant constant) { } else { sb.append(stringValue); } - } else if (constant instanceof LinkConstant) { - LinkConstant linkConstant = (LinkConstant) constant; + } else if (constant instanceof LinkConstant linkConstant) { sb.append(linkConstant.classname).append('.').append(linkConstant.elementname).append(' ').append(linkConstant.descriptor); } } @@ -1476,7 +1594,7 @@ private static String getTypePrintOut(VarType type) { } public static List getErrorComment() { - return Arrays.stream(((String) DecompilerContext.getProperty(IFernflowerPreferences.ERROR_MESSAGE)).split("\n")).filter(s -> !s.isEmpty()).collect(Collectors.toList()); + return Arrays.stream(((String) DecompilerContext.getProperty(IFernflowerPreferences.ERROR_MESSAGE)).split("\n")).filter(s -> !s.isEmpty()).toList(); } private static void appendComment(TextBuffer buffer, String comment, int indent) { @@ -1575,7 +1693,7 @@ public static void appendJvmAnnotations(TextBuffer buffer, int indent, StructMem } } - if (mb.hasModifier(CodeConstants.ACC_STATIC) && targetType != TypeAnnotation.CLASS_TYPE_PARAMETER && KotlinDecompilationContext.getCurrentType() != KotlinDecompilationContext.KotlinType.FILE) { + if (mb.hasModifier(CodeConstants.ACC_STATIC) && targetType != TypeAnnotation.CLASS_TYPE_PARAMETER && KotlinDecompilationContext.getCurrentType() != KotlinDecompilationContext.KotlinType.FILE && !mb.hasModifier(CodeConstants.ACC_ENUM)) { buffer.appendIndent(indent).append("@JvmStatic").appendLineSeparator(); } if (mb.hasModifier(CodeConstants.ACC_STRICT)) { @@ -1588,7 +1706,7 @@ public static void appendJvmAnnotations(TextBuffer buffer, int indent, StructMem static boolean isNullable(StructMember mb) { for (Key key : ANNOTATION_ATTRIBUTES) { - StructAnnotationAttribute attribute = (StructAnnotationAttribute) mb.getAttribute((Key) key); + StructAnnotationAttribute attribute = mb.getAttribute((Key) key); if (attribute != null) { return attribute.getAnnotations().stream().anyMatch(annotation -> annotation.getClassName().equals(NULLABLE_ANN_NAME)); } @@ -1647,7 +1765,7 @@ public static boolean processParameterAnnotations(TextBuffer buffer, StructMetho boolean ret = false; for (Key key : PARAMETER_ANNOTATION_ATTRIBUTES) { - StructAnnotationParameterAttribute attribute = (StructAnnotationParameterAttribute) mt.getAttribute((Key) key); + StructAnnotationParameterAttribute attribute = mt.getAttribute((Key) key); if (attribute != null) { List> annotations = attribute.getParamAnnotations(); if (param < annotations.size()) { @@ -1672,7 +1790,7 @@ public static boolean processParameterAnnotations(TextBuffer buffer, StructMetho private static void appendTypeAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType, int index, Set filter) { for (Key key : TYPE_ANNOTATION_ATTRIBUTES) { - StructTypeAnnotationAttribute attribute = (StructTypeAnnotationAttribute) mb.getAttribute((Key) key); + StructTypeAnnotationAttribute attribute = mb.getAttribute((Key) key); if (attribute != null) { for (TypeAnnotation annotation : attribute.getAnnotations()) { if (annotation.isTopLevel() && annotation.getTargetType() == targetType && (index < 0 || annotation.getIndex() == index)) { @@ -1735,10 +1853,6 @@ private static void appendModifiers(TextBuffer buffer, int flags, int allowed, b } } - public static String getModifiers(int flags) { - return MODIFIERS.entrySet().stream().filter(e -> (e.getKey() & flags) != 0).map(Map.Entry::getValue).collect(Collectors.joining(" ")); - } - public static void appendTypeParameters(TextBuffer buffer, List parameters, List> bounds) { buffer.append('<'); @@ -1762,14 +1876,4 @@ public static void appendTypeParameters(TextBuffer buffer, List paramete buffer.append('>'); } - - private static void appendFQClassNames(TextBuffer buffer, List names) { - for (int i = 0; i < names.size(); i++) { - String name = names.get(i); - buffer.appendIndent(2).append(name); - if (i < names.size() - 1) { - buffer.append(',').appendLineSeparator(); - } - } - } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KAnnotationExprent.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KAnnotationExprent.java index c7432ca7b8..d8ab0bfd14 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KAnnotationExprent.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KAnnotationExprent.java @@ -47,12 +47,12 @@ public TextBuffer toJava(int indent) { buffer.append(KTypes.getKotlinType(type)); switch (getAnnotationType()) { - case SINGLE_ELEMENT: + case SINGLE_ELEMENT -> { buffer.append('(').appendPossibleNewline(); writeAnnotationValue(getParValues().get(0), buffer); buffer.append(')'); - break; - case NORMAL: + } + case NORMAL -> { buffer.append('(').appendPossibleNewline(); boolean first = true; for (int i = 0; i < getParValues().size(); i++) { @@ -67,16 +67,15 @@ public TextBuffer toJava(int indent) { writeAnnotationValue(getParValues().get(i), buffer); } buffer.append(')'); - break; + } } return buffer; } public static void writeAnnotationValue(Exprent expr, TextBuffer buffer) { - if (expr instanceof FieldExprent) { + if (expr instanceof FieldExprent fieldExprent) { // Enum value - FieldExprent fieldExprent = (FieldExprent) expr; VarType type = new VarType(fieldExprent.getClassname(), true); DecompilerContext.getImportCollector().getShortName(fieldExprent.getClassname(), true); @@ -84,9 +83,8 @@ public static void writeAnnotationValue(Exprent expr, TextBuffer buffer) { .append(KTypes.getKotlinType(type)) .append(".") .append(fieldExprent.getName()); - } else if (expr instanceof NewExprent) { + } else if (expr instanceof NewExprent newExprent) { // Array value - NewExprent newExprent = (NewExprent) expr; buffer.append('['); boolean first = true; for (Exprent exprent : newExprent.getLstArrayElements()) { @@ -98,19 +96,18 @@ public static void writeAnnotationValue(Exprent expr, TextBuffer buffer) { writeAnnotationValue(exprent, buffer); } buffer.append(']'); - } else if (expr instanceof AnnotationExprent) { - AnnotationExprent annotationExprent = (AnnotationExprent) expr; + } else if (expr instanceof AnnotationExprent annotationExprent) { buffer.append('@'); VarType type = new VarType(annotationExprent.getClassName(), true); buffer.append(KTypes.getKotlinType(type)); switch (annotationExprent.getAnnotationType()) { - case SINGLE_ELEMENT: + case SINGLE_ELEMENT -> { buffer.append('('); writeAnnotationValue(annotationExprent.getParValues().get(0), buffer); buffer.append(')'); - break; - case NORMAL: + } + case NORMAL -> { buffer.append('('); boolean first = true; for (int i = 0; i < annotationExprent.getParValues().size(); i++) { @@ -125,10 +122,9 @@ public static void writeAnnotationValue(Exprent expr, TextBuffer buffer) { writeAnnotationValue(annotationExprent.getParValues().get(i), buffer); } buffer.append(')'); - break; + } } - } else if (expr instanceof ConstExprent) { - ConstExprent constExprent = (ConstExprent) expr; + } else if (expr instanceof ConstExprent constExprent) { if (constExprent.getConstType().equals(VarType.VARTYPE_CLASS)) { VarType type = new VarType((String) constExprent.getValue(), true); DecompilerContext.getImportCollector().getShortName((String) constExprent.getValue(), true); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KConstExprent.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KConstExprent.java index 42d38585ac..7ca5793b9b 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KConstExprent.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KConstExprent.java @@ -4,6 +4,8 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.ExprUtil; import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.util.TextBuffer; +import org.vineflower.kotlin.util.KTypes; +import org.vineflower.kotlin.util.KUtils; public class KConstExprent extends ConstExprent implements KExprent { public KConstExprent(ConstExprent exprent) { @@ -12,6 +14,17 @@ public KConstExprent(ConstExprent exprent) { @Override public TextBuffer toJava(int indent) { + if (getValue() == null) { + if (getConstType().equals(VarType.VARTYPE_NULL)) { + return super.toJava(indent); + } + + TextBuffer buf = new TextBuffer(); + buf.addBytecodeMapping(bytecode); + buf.append(KTypes.getKotlinType(getConstType())); + return buf; + } + if (!getConstType().equals(VarType.VARTYPE_CLASS)) { return super.toJava(indent); } @@ -19,11 +32,6 @@ public TextBuffer toJava(int indent) { TextBuffer buf = new TextBuffer(); buf.addBytecodeMapping(bytecode); - if (getValue() == null) { - //TODO figure out why this happens here instead of elsewhere - return buf.append("Class<*>"); - } - String value = getValue().toString(); VarType type = new VarType(value, !value.startsWith("[")); buf.appendCastTypeName(type).append("::class.java"); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KFunctionExprent.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KFunctionExprent.java index b6f8553d6e..abd7adace6 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KFunctionExprent.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KFunctionExprent.java @@ -1,5 +1,8 @@ package org.vineflower.kotlin.expr; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; +import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.modules.decompiler.exps.*; import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult; import org.jetbrains.java.decompiler.struct.gen.CodeType; @@ -13,6 +16,7 @@ import java.util.ArrayList; import java.util.BitSet; import java.util.List; +import java.util.Objects; public class KFunctionExprent extends FunctionExprent implements KExprent { private KFunctionType kType = KFunctionType.NONE; @@ -23,6 +27,7 @@ public enum KFunctionType implements Typed { EQUALS3, IF_NULL, GET_KCLASS, + STR_TEMPLATE } public KFunctionExprent(KFunctionType funcType, List operands, BitSet bytecodeOffsets) { @@ -65,30 +70,30 @@ public TextBuffer toJava(int indent) { List lstOperands = getLstOperands(); optimizeType(); - - switch(getFuncType()) { - case OTHER: + + switch (getFuncType()) { + case OTHER -> { switch (kType) { - case EQUALS3: + case EQUALS3 -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)) .append(" === ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case IF_NULL: + } + case IF_NULL -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)) .append(" ?: ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case GET_KCLASS: + } + case GET_KCLASS -> { Exprent operand = lstOperands.get(0); - if (operand instanceof VarExprent) { - VarExprent varExprent = ((VarExprent) operand); + if (operand instanceof VarExprent varExprent) { if (!varExprent.getVarType().equals(VarType.VARTYPE_CLASS)) { throw new IllegalArgumentException("Variable accessing KClass is not a Class"); } return buf.append(varExprent.toJava()).append(".kotlin"); - } else if (operand instanceof ConstExprent) { - ConstExprent constExprent = (ConstExprent) operand; + } else if (operand instanceof ConstExprent constExprent) { String value = constExprent.getValue().toString(); VarType type = new VarType(value, !value.startsWith("[")); buf.append(KTypes.getKotlinType(type)); @@ -99,27 +104,58 @@ public TextBuffer toJava(int indent) { buf.append(KTypes.getKotlinType(type)); } return buf.append("::class"); + } + case STR_TEMPLATE -> { + buf.append('"'); + for (Exprent expr : lstOperands) { + if (expr instanceof ConstExprent constExpr) { + // Strings can be directly placed into the resulting string, but other constants are a little more touchy. + // Kotlin will inline any primitive constants. If any are found, warn on the presence of such cases as that + // implies that either the compiler or decompiler is not working as expected. + if (VarType.VARTYPE_STRING.equals(constExpr.getConstType())) { + boolean ascii = DecompilerContext.getOption(IFernflowerPreferences.ASCII_STRING_CHARACTERS); + String value = ConstExprent.convertStringToJava((String) constExpr.getValue(), ascii); + buf.append(value.replace("$", "\\$")); + } else if (VarType.VARTYPE_CHAR.equals(constExpr.getConstType())) { + // The compiler uses `StringBuilder.append(char)` on single characters when using StringBuilder + // instead of makeConcatWithConstants. Inline the character directly - intentional behavior. + buf.append((char) (int) constExpr.getValue()); + } else { + if (VarType.isPrimitive(constExpr.getConstType())) { + DecompilerContext.getLogger().writeMessage("Primitive constant type in string concatenation: " + constExpr.getConstType(), IFernflowerLogger.Severity.WARN); + } + buf.append("${").append(constExpr.toJava(indent)).append("}"); + } + } else if (expr instanceof VarExprent var) { + buf.append("$").append(var.toJava(indent)); + } else { + buf.append("${").append(expr.toJava(indent)).append("}"); + } + } + buf.append('"'); + return buf; + } } throw new IllegalStateException("Unknown function type: " + kType); - case TERNARY: + } + case TERNARY -> { Exprent condition = lstOperands.get(0); Exprent ifTrue = lstOperands.get(1); Exprent ifFalse = lstOperands.get(2); if ( condition instanceof KFunctionExprent && ((KFunctionExprent) condition).getFuncType() == FunctionType.INSTANCEOF - && ifTrue instanceof KFunctionExprent && ((KFunctionExprent) ifTrue).getFuncType() == FunctionType.CAST - && ifFalse.getExprType() == VarType.VARTYPE_NULL + && ifTrue instanceof KFunctionExprent cast && ((KFunctionExprent) ifTrue).getFuncType() == FunctionType.CAST + && ifFalse.getExprType() == VarType.VARTYPE_NULL ) { // Safe cast - KFunctionExprent cast = (KFunctionExprent) ifTrue; buf.append(cast.getLstOperands().get(0).toJava(indent)); buf.append(" as? "); buf.append(cast.getLstOperands().get(1).toJava(indent)); return buf; } - + buf.pushNewlineGroup(indent, 1); buf.append("if ("); buf.append(wrapOperandString(condition, true, indent)) @@ -131,60 +167,69 @@ public TextBuffer toJava(int indent) { .appendPossibleNewline(" ") .append(wrapOperandString(ifFalse, true, indent)); buf.popNewlineGroup(); - + return buf; - case INSTANCEOF: + } + case INSTANCEOF -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)) .append(" is ") .append(wrapOperandString(lstOperands.get(1), true, indent)); - + return buf; - case BOOL_NOT: + } + case BOOL_NOT -> { // Special cases for `is` and `!is` // TODO: do the same for `in` and `!in` - if (lstOperands.get(0) instanceof KFunctionExprent) { - KFunctionExprent func = (KFunctionExprent) lstOperands.get(0); - if (func.getFuncType() == FunctionExprent.FunctionType.INSTANCEOF) { + if (lstOperands.get(0) instanceof KFunctionExprent func) { + if (func.getFuncType() == FunctionType.INSTANCEOF) { buf.append(wrapOperandString(func.getLstOperands().get(0), true, indent)) .append(" !is ") .append(wrapOperandString(func.getLstOperands().get(1), true, indent)); return buf; } } - break; - case CAST: + } + case CAST -> { if (!doesCast()) { return buf.append(lstOperands.get(0).toJava(indent)); } buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" as ").append(lstOperands.get(1).toJava(indent)); return buf; - case BIT_NOT: + } + case BIT_NOT -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)); return buf.append(".inv()"); - case AND: // Bitwise AND + } + case AND -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" and ") .append(wrapOperandString(lstOperands.get(1), true, indent)); - return buf; - case OR: + return buf; // Bitwise AND + } + case OR -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" or ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case XOR: + } + case XOR -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" xor ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case SHL: + } + case SHL -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" shl ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case SHR: + } + case SHR -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" shr ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; - case USHR: + } + case USHR -> { buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" ushr ") .append(wrapOperandString(lstOperands.get(1), true, indent)); return buf; + } } return buf.append(super.toJava(indent)); @@ -192,25 +237,20 @@ public TextBuffer toJava(int indent) { @Override public VarType getExprType() { - switch (kType) { - case EQUALS3: - return VarType.VARTYPE_BOOLEAN; - case IF_NULL: + return switch (kType) { + case EQUALS3 -> VarType.VARTYPE_BOOLEAN; + case IF_NULL -> { Exprent param1 = getLstOperands().get(0); Exprent param2 = getLstOperands().get(1); VarType supertype = VarType.getCommonSupertype(param1.getExprType(), param2.getExprType()); - if (supertype != null) { - return supertype; - } else { - // TODO: Needs a better default! - return VarType.VARTYPE_OBJECT; - } - case GET_KCLASS: - return VarType.VARTYPE_CLASS; - } - - return super.getExprType(); + // TODO: Needs a better default! + yield Objects.requireNonNullElse(supertype, VarType.VARTYPE_OBJECT); + } + case GET_KCLASS -> VarType.VARTYPE_CLASS; + case STR_TEMPLATE -> VarType.VARTYPE_STRING; + case NONE -> super.getExprType(); + }; } @Override @@ -228,27 +268,25 @@ public CheckTypesResult checkExprTypeBounds() { } switch (kType) { - case IF_NULL: + case IF_NULL -> { VarType supertype = getExprType(); result.addMinTypeExprent(param1, VarType.getMinTypeInFamily(supertype.typeFamily)); result.addMinTypeExprent(param2, VarType.getMinTypeInFamily(supertype.typeFamily)); - break; - case EQUALS3: { + } + case EQUALS3 -> { if (type1.type == CodeType.BOOLEAN) { if (type2.isStrictSuperset(type1)) { result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR); - } - else { // both are booleans - boolean param1_false_boolean = (param1 instanceof ConstExprent && !((ConstExprent)param1).hasBooleanValue()); - boolean param2_false_boolean = (param2 instanceof ConstExprent && !((ConstExprent)param2).hasBooleanValue()); + } else { // both are booleans + boolean param1_false_boolean = (param1 instanceof ConstExprent && !((ConstExprent) param1).hasBooleanValue()); + boolean param2_false_boolean = (param2 instanceof ConstExprent && !((ConstExprent) param2).hasBooleanValue()); if (param1_false_boolean || param2_false_boolean) { result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR); result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR); } } - } - else if (type2.type == CodeType.BOOLEAN) { + } else if (type2.type == CodeType.BOOLEAN) { if (type1.isStrictSuperset(type2)) { result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR); } @@ -306,18 +344,13 @@ public void setFuncType(Typed typed) { @Override public int getPrecedence() { - switch (kType) { - case EQUALS3: - return 6; - case IF_NULL: - return 11; - case GET_KCLASS: - return 1; - case NONE: - break; - } - - return super.getPrecedence(); + return switch (kType) { + case EQUALS3 -> 6; + case IF_NULL -> 11; + case GET_KCLASS -> 1; + case STR_TEMPLATE -> FunctionType.STR_CONCAT.precedence; + case NONE -> super.getPrecedence(); + }; } @Override diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KInvocationExprent.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KInvocationExprent.java index 342509e396..e9e504e489 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KInvocationExprent.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KInvocationExprent.java @@ -20,6 +20,6 @@ public void setShadowStaticBase(boolean shadowStaticBase) { @Override public Exprent copy() { - return new KInvocationExprent((InvocationExprent) super.copy()); + return new KInvocationExprent(this); } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KVarExprent.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KVarExprent.java index b6afd16e6e..d03de6cb4d 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KVarExprent.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/expr/KVarExprent.java @@ -3,6 +3,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor; +import org.jetbrains.java.decompiler.modules.decompiler.vars.VarTypeProcessor; import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.util.TextBuffer; import org.vineflower.kotlin.KotlinWriter; @@ -11,6 +12,8 @@ import java.util.BitSet; public class KVarExprent extends VarExprent implements KExprent { + private boolean isExceptionType; + public KVarExprent(int index, VarType varType, VarProcessor processor, BitSet bytecode) { super(index, varType, processor, bytecode); } @@ -44,14 +47,18 @@ public TextBuffer toJava(int indent) { buffer.addBytecodeMapping(bytecode); boolean definition = isDefinition(); - if (definition) { - // TODO: inference of var/val - buffer.append("var "); + if (definition && !isExceptionType) { + VarProcessor processor = getProcessor(); + + boolean isFinal = isEffectivelyFinal() || + (processor != null && processor.getVarFinal(getVarVersionPair()) != VarTypeProcessor.FinalType.NON_FINAL); + + buffer.append(isFinal ? "val " : "var "); } buffer.append(getName()); - if (definition) { + if (definition || isExceptionType) { buffer.append(": "); buffer.append(KTypes.getKotlinType(getDefinitionVarType())); } @@ -59,6 +66,10 @@ public TextBuffer toJava(int indent) { return buffer; } + public void setExceptionType(boolean isExceptionType) { + this.isExceptionType = isExceptionType; + } + @Override public Exprent copy() { return new KVarExprent((VarExprent) super.copy()); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/metadata/MetadataNameResolver.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/metadata/MetadataNameResolver.java index 9108149bc5..73cdb59b81 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/metadata/MetadataNameResolver.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/metadata/MetadataNameResolver.java @@ -55,18 +55,17 @@ public String resolve(int idx) { } var operation = record.getOperation() == null ? JvmProtoBuf.StringTableTypes.Record.Operation.NONE : record.getOperation(); - switch (operation) { - case INTERNAL_TO_CLASS_ID: - string = string.replace('$', '.'); - break; - case DESC_TO_CLASS_ID: + string = switch (operation) { + case INTERNAL_TO_CLASS_ID -> string.replace('$', '.'); + case DESC_TO_CLASS_ID -> { if (string.length() >= 2) { string = string.substring(1, string.length() - 1); } - string = string.replace('$', '.'); - break; - } + yield string.replace('$', '.'); + } + default -> string; + }; return string; } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/CollapseStringConcatPass.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/CollapseStringConcatPass.java new file mode 100644 index 0000000000..6ef8923a85 --- /dev/null +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/CollapseStringConcatPass.java @@ -0,0 +1,75 @@ +package org.vineflower.kotlin.pass; + +import org.jetbrains.java.decompiler.api.plugin.pass.Pass; +import org.jetbrains.java.decompiler.api.plugin.pass.PassContext; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; +import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent; +import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; +import org.vineflower.kotlin.KotlinOptions; +import org.vineflower.kotlin.expr.KFunctionExprent; + +import java.util.ArrayList; +import java.util.List; + +public class CollapseStringConcatPass implements Pass { + @Override + public boolean run(PassContext ctx) { + return run(ctx.getRoot()); + } + + private static boolean run(Statement stat) { + if (!DecompilerContext.getOption(KotlinOptions.COLLAPSE_STRING_CONCATENATION)) { + return false; + } + + boolean res = false; + + for (Statement st : stat.getStats()) { + res |= run(st); + } + + List exprs = List.of(); + if (stat instanceof BasicBlockStatement) { + exprs = stat.getExprents(); + } else if (stat instanceof IfStatement) { + exprs = ((IfStatement)stat).getHeadexprentList(); + } + + for (Exprent ex : exprs) { + res |= run(ex); + } + + return res; + } + + private static boolean isStringConcat(KFunctionExprent kex) { + return kex.getAnyFunctionType() == FunctionExprent.FunctionType.STR_CONCAT || + kex.getAnyFunctionType() == KFunctionExprent.KFunctionType.STR_TEMPLATE; + } + + private static boolean run(Exprent ex) { + boolean res = false; + + for (Exprent e : ex.getAllExprents()) { + res |= run(e); + } + + if (ex instanceof KFunctionExprent kex && isStringConcat(kex)) { + List operands = new ArrayList<>(kex.getLstOperands()); + List lstOperands = kex.getLstOperands(); + for (Exprent child : operands) { + if (child instanceof KFunctionExprent childKex && isStringConcat(childKex)) { + lstOperands.addAll(lstOperands.indexOf(child), childKex.getLstOperands()); + lstOperands.remove(child); + } + } + kex.setFuncType(KFunctionExprent.KFunctionType.STR_TEMPLATE); + res = true; + } + + return res; + } +} diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/EliminateDeadVarsPass.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/EliminateDeadVarsPass.java index 824badcbf9..fc3049c263 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/EliminateDeadVarsPass.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/EliminateDeadVarsPass.java @@ -40,14 +40,11 @@ private static boolean eliminate(RootStatement root, StructMethod mt) { for (int i = 0; i < exprents.size(); i++) { Exprent ex = exprents.get(i); - if (ex instanceof AssignmentExprent) { - AssignmentExprent aex = (AssignmentExprent) ex; + if (ex instanceof AssignmentExprent aex) { Exprent left = aex.getLeft(); Exprent right = aex.getRight(); - if (left instanceof VarExprent) { - VarExprent var = (VarExprent) left; - + if (left instanceof VarExprent var) { VarVersionPair vvp = var.getVarVersionPair(); if (isPureToReplace(right)) { if (!ssu.nodes.getWithKey(vvp).hasAnySuccessors()) { @@ -75,9 +72,7 @@ private static boolean isPureToReplace(Exprent expr) { return true; } - if (expr instanceof FieldExprent) { - FieldExprent field = (FieldExprent) expr; - + if (expr instanceof FieldExprent field) { return field.isStatic() && field.getClassname().equals("kotlin/Unit"); } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/KMergePass.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/KMergePass.java index 7e11eb64bd..9b9a837f3a 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/KMergePass.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/KMergePass.java @@ -46,24 +46,22 @@ private static boolean enhanceLoop(DoStatement stat) { DoStatement.Type oldloop = stat.getLooptype(); switch (oldloop) { - case INFINITE: - + case INFINITE -> { // identify a while loop if (matchWhile(stat)) { if (!matchForEach(stat)) { matchFor(stat); } - } - else { + } else { // identify a do{}while loop //matchDoWhile(stat); } - - break; - case WHILE: + } + case WHILE -> { if (!matchForEach(stat)) { matchFor(stat); } + } } return (stat.getLooptype() != oldloop); @@ -126,8 +124,7 @@ protected static boolean matchForEach(DoStatement stat) { return false; } - if (!isHasNextCall(drillNots(stat.getConditionExprent())) || - !(firstDoExprent instanceof AssignmentExprent)) { + if (!isHasNextCall(drillNots(stat.getConditionExprent()))) { return false; } @@ -148,8 +145,7 @@ protected static boolean matchForEach(DoStatement stat) { // Casted foreach Exprent right = initExprents[0].getRight(); - if (right instanceof FunctionExprent) { - FunctionExprent fRight = (FunctionExprent) right; + if (right instanceof FunctionExprent fRight) { if (fRight.getFuncType() == FunctionExprent.FunctionType.CAST) { right = fRight.getLstOperands().get(0); } @@ -183,10 +179,8 @@ protected static boolean matchForEach(DoStatement stat) { preData.getExprents().remove(initExprents[0]); firstData.getExprents().remove(firstDoExprent); - if (initExprents[1] != null && initExprents[1].getLeft() instanceof VarExprent && - holder.getInstance() instanceof VarExprent) { - VarExprent copy = (VarExprent)initExprents[1].getLeft(); - VarExprent inc = (VarExprent)holder.getInstance(); + if (initExprents[1] != null && initExprents[1].getLeft() instanceof VarExprent copy && + holder.getInstance() instanceof VarExprent inc) { if (copy.getIndex() == inc.getIndex() && copy.getVersion() == inc.getVersion() && !inc.isVarReferenced(stat.getTopParent(), copy) && !isNextCall(initExprents[1].getRight())) { preData.getExprents().remove(initExprents[1]); @@ -206,43 +200,36 @@ protected static boolean matchForEach(DoStatement stat) { return true; } else if (initExprents[1] != null) { - if (!(firstDoExprent.getRight() instanceof ArrayExprent) || !(firstDoExprent.getLeft() instanceof VarExprent)) { + if (!(firstDoExprent.getRight() instanceof ArrayExprent arr) || !(firstDoExprent.getLeft() instanceof VarExprent)) { return false; } - if (!(lastExprent instanceof FunctionExprent)) { + if (!(lastExprent instanceof FunctionExprent funcInc)) { return false; } // Kotlin: Inverted indices 0 and 1 as kotlinc inverts the cases if (!(initExprents[1].getRight() instanceof ConstExprent) || - !(initExprents[0].getRight() instanceof FunctionExprent) || + !(initExprents[0].getRight() instanceof FunctionExprent funcRight) || !(stat.getConditionExprent() instanceof FunctionExprent)) { return false; } //FunctionExprent funcCond = (FunctionExprent)drillNots(stat.getConditionExprent()); //TODO: Verify this is counter < copy.length - FunctionExprent funcRight = (FunctionExprent)initExprents[0].getRight(); - FunctionExprent funcInc = (FunctionExprent)lastExprent; - ArrayExprent arr = (ArrayExprent)firstDoExprent.getRight(); FunctionExprent.FunctionType incType = funcInc.getFuncType(); if (funcRight.getFuncType() != FunctionExprent.FunctionType.ARRAY_LENGTH || (incType != FunctionExprent.FunctionType.PPI && incType != FunctionExprent.FunctionType.IPP) || - !(arr.getIndex() instanceof VarExprent) || - !(arr.getArray() instanceof VarExprent)) { + !(arr.getIndex() instanceof VarExprent index) || + !(arr.getArray() instanceof VarExprent array)) { return false; } - VarExprent index = (VarExprent)arr.getIndex(); - VarExprent array = (VarExprent)arr.getArray(); Exprent countExpr = funcInc.getLstOperands().get(0); // Foreach over multi dimensional array initializers can cause this to not be a var exprent - if (countExpr instanceof VarExprent) { - VarExprent counter = (VarExprent) countExpr; - + if (countExpr instanceof VarExprent counter) { if (counter.getIndex() != index.getIndex() || counter.getVersion() != index.getVersion()) { return false; @@ -273,9 +260,7 @@ protected static boolean matchForEach(DoStatement stat) { firstData.getExprents().remove(firstDoExprent); lastData.getExprents().remove(lastExprent); - if (initExprents[2] != null && initExprents[2].getLeft() instanceof VarExprent) { - VarExprent copy = (VarExprent)initExprents[2].getLeft(); - + if (initExprents[2] != null && initExprents[2].getLeft() instanceof VarExprent copy) { if (copy.getIndex() == array.getIndex() && copy.getVersion() == array.getVersion()) { preData.getExprents().remove(initExprents[2]); initExprents[2].getRight().addBytecodeOffsets(initExprents[2].bytecode); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/ReplaceExprentsPass.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/ReplaceExprentsPass.java index 285131846a..89e5c3e266 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/ReplaceExprentsPass.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/pass/ReplaceExprentsPass.java @@ -2,10 +2,10 @@ import org.jetbrains.java.decompiler.api.plugin.pass.Pass; import org.jetbrains.java.decompiler.api.plugin.pass.PassContext; +import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.modules.decompiler.exps.*; -import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement; -import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement; -import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.*; +import org.vineflower.kotlin.expr.KVarExprent; import org.vineflower.kotlin.util.KUtils; import java.util.List; @@ -28,9 +28,17 @@ private static boolean replace(Statement stat) { exprs = stat.getExprents(); } else if (stat instanceof IfStatement) { exprs = ((IfStatement)stat).getHeadexprentList(); + } else if (stat instanceof CatchAllStatement || stat instanceof CatchStatement) { + List vars = stat instanceof CatchAllStatement ? ((CatchAllStatement)stat).getVars() : ((CatchStatement)stat).getVars(); + for (int i = 0; i < vars.size(); i++) { + VarExprent expr = vars.get(i); + KVarExprent map = new KVarExprent(expr); + map.setExceptionType(true); + vars.set(i, map); + } } - - if (exprs.size() > 0) { + + if (!exprs.isEmpty()) { for(int i = 0; i < exprs.size(); i++){ Exprent expr = exprs.get(i); Exprent map = KUtils.replaceExprent(expr); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/DefaultArgsMap.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/DefaultArgsMap.java new file mode 100644 index 0000000000..090b08f347 --- /dev/null +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/DefaultArgsMap.java @@ -0,0 +1,164 @@ +package org.vineflower.kotlin.struct; + +import org.jetbrains.java.decompiler.code.CodeConstants; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.main.rels.MethodWrapper; +import org.jetbrains.java.decompiler.modules.decompiler.exps.*; +import org.jetbrains.java.decompiler.modules.decompiler.flow.DirectGraph; +import org.jetbrains.java.decompiler.modules.decompiler.flow.DirectNode; +import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; +import org.jetbrains.java.decompiler.struct.StructMethod; +import org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTableAttribute; +import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.util.TextBuffer; +import org.vineflower.kotlin.KotlinOptions; +import org.vineflower.kotlin.util.KUtils; + +import java.util.HashMap; +import java.util.Map; + +public class DefaultArgsMap { + private final Map map; + private final StructMethod defaultMethod; + + private DefaultArgsMap(Map map, StructMethod defaultMethod) { + this.map = map; + this.defaultMethod = defaultMethod; + } + + public static DefaultArgsMap from(MethodWrapper defaults, MethodWrapper calling, KParameter[] params) { + if (defaults == null) { + return new DefaultArgsMap(Map.of(), null); + } + + /* + * Kotlin's method to define default arguments is a bit odd. The default values are stored in a separate method + * which is called in place of the actual method when defaults are needed. The method containing the defaults + * contains two extra arguments, a bitmask and a value that is always null. The bitmask specifies which arguments + * should be replaced with defaults, and it corresponds one-to-one with all the parameters of the actual method, + * including non-defaulted ones. Constructors follow the same pattern, but the null extra parameter has a type of + * `DefaultConstructorMarker` instead of `Object`, and the default wrappers are true constructors. + * + * In the case of 32 or more parameters, additional bitmask fields are created as needed. + * + * For a method defined as `fun foo(arg1: Int = 42, arg2: String, arg3: Any? = null)`, + * the method containing its default values would look like this: + * + * String foo$default(int arg1, String arg2, Object arg3, int bitmask, Object alwaysNull) { + * if ((bitmask & 0b001) != 0) { + * arg1 = 42; + * } + * + * if ((bitmask & 0b100) != 0) { + * arg3 = null; + * } + * + * return foo(arg1, arg2, arg3); + * } + * + * To parse this, the method graph is traversed, and for each if statement, the condition of the statement is + * checked to see if it matches the pattern Kotlin uses, and the if-true branch is checked to see if it is a + * simple assignment. If both are true, it assumes that the assignment is a default value check and extracts + * the assigned value. + * + * This can get most defaults, but it may fail with very complex defaults, such as a `run` block or other + * inlined blocks. + */ + + Map map = new HashMap<>(); + + int startOfBitmasks = 0; + + if (!calling.methodStruct.hasModifier(CodeConstants.ACC_STATIC)) { + // "this" fills the first variable slot + startOfBitmasks++; + } + + for (VarType var : calling.desc().params) { + startOfBitmasks += var.stackSize; + } + + DirectGraph graph = defaults.getOrBuildGraph(); + for (DirectNode node : graph.nodes) { + Statement statement = node.statement; + if (statement instanceof IfStatement ifStatement) { + Exprent condition = ifStatement.getHeadexprent().getCondition(); + if ( + !(condition instanceof FunctionExprent function) || + !(function.getLstOperands().get(0) instanceof FunctionExprent bitmask) || + bitmask.getLstOperands().size() != 2 + ) { + continue; + } + + Exprent check = bitmask.getLstOperands().get(0); + Exprent mask = bitmask.getLstOperands().get(1); + + if (!(check instanceof VarExprent var) || !(mask instanceof ConstExprent)) { + continue; + } + + int maskValue = ((ConstExprent) mask).getIntValue(); + int maskIndex = (var.getIndex() - startOfBitmasks) * 32; + for (int i = 0; i < 32; i++) { + if ((maskValue & (1 << i)) != 0) { + maskIndex += i; + break; + } + } + + Exprent expr = ifStatement.getIfstat().getExprents().get(0); + if (expr instanceof AssignmentExprent assignment) { + Exprent right = assignment.getRight().copy(); + updateExprent(right, calling); + KParameter param = params[maskIndex]; + map.put(param, right); + } + } + } + + if (KUtils.assertionsEnabled()) { + for (KParameter param : params) { + assert map.containsKey(param) == param.flags().declaresDefault : "Parameter " + param.name() + " has default value but no default value was found"; + } + } + + return new DefaultArgsMap(map, defaults.methodStruct); + } + + public TextBuffer toJava(KParameter parameter, int indent) { + TextBuffer buffer = new TextBuffer(); + String argString = DecompilerContext.getProperty(KotlinOptions.UNKNOWN_DEFAULT_ARG_STRING).toString(); + + Exprent expr = map.get(parameter); + if (expr == null) { + if (!argString.isEmpty()) { + buffer.append(" = ").append(argString); + } + + return buffer; + } + + buffer.append(" = ").append(expr.toJava(indent)); + + return buffer; + } + + private static void updateExprent(Exprent expr, MethodWrapper calling) { + if (expr instanceof VarExprent varExpr) { + StructLocalVariableTableAttribute attr = calling.methodStruct.getLocalVariableAttr(); + if (attr != null) { + calling.varproc.findLVT(varExpr, 0); + } + } + + for (Exprent child : expr.getAllExprents()) { + updateExprent(child, calling); + } + } + + public StructMethod getDefaultMethod() { + return defaultMethod; + } +} diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KConstructor.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KConstructor.java index 6143c53eb9..b7c75c566d 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KConstructor.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KConstructor.java @@ -28,29 +28,17 @@ import java.util.List; import java.util.Map; -public class KConstructor { +public record KConstructor( + KParameter[] parameters, + ProtobufFlags.Constructor flags, + MethodWrapper method, + boolean isPrimary, + DefaultArgsMap defaultArgs, + ClassesProcessor.ClassNode node, + ProtobufFlags.Class classFlags +) { private static final VarType DEFAULT_CONSTRUCTOR_MARKER = new VarType("kotlin/jvm/internal/DefaultConstructorMarker", true); - public final ProtobufFlags.Constructor flags; - public final KParameter[] parameters; - public final boolean isPrimary; - - public final MethodWrapper method; - private final ClassesProcessor.ClassNode node; - - private KConstructor( - KParameter[] parameters, - ProtobufFlags.Constructor flags, - MethodWrapper method, - boolean isPrimary, - ClassesProcessor.ClassNode node) { - this.parameters = parameters; - this.flags = flags; - this.method = method; - this.isPrimary = isPrimary; - this.node = node; - } - public static Data parse(ClassesProcessor.ClassNode node) { MetadataNameResolver resolver = KotlinDecompilationContext.getNameResolver(); ClassWrapper wrapper = node.getWrapper(); @@ -89,7 +77,7 @@ public static Data parse(ClassesProcessor.ClassNode node) { if (method == null) { if (classFlags.kind == ProtoBuf.Class.Kind.ANNOTATION_CLASS) { // Annotation classes are very odd and don't actually have a constructor under the hood - KConstructor kConstructor = new KConstructor(parameters, flags, null, false, node); + KConstructor kConstructor = new KConstructor(parameters, flags, null, false, null, node, classFlags); return new Data(null, kConstructor); } @@ -99,7 +87,22 @@ public static Data parse(ClassesProcessor.ClassNode node) { boolean isPrimary = !flags.isSecondary; - KConstructor kConstructor = new KConstructor(parameters, flags, method, isPrimary, node); + StringBuilder defaultArgsDesc = new StringBuilder("("); + if (classFlags.kind == ProtoBuf.Class.Kind.ENUM_CLASS) { + // Kotlin drops hidden name/ordinal parameters for enum constructors in its metadata + defaultArgsDesc.append("Ljava/lang/String;").append("I"); + } + + for (KParameter parameter : parameters) { + defaultArgsDesc.append(parameter.type()); + } + + defaultArgsDesc.append("I".repeat(parameters.length / 32 + 1)); + defaultArgsDesc.append("Lkotlin/jvm/internal/DefaultConstructorMarker;)V"); + + DefaultArgsMap defaultArgs = DefaultArgsMap.from(wrapper.getMethodWrapper("", defaultArgsDesc.toString()), method, parameters); + + KConstructor kConstructor = new KConstructor(parameters, flags, method, isPrimary, defaultArgs, node, classFlags); constructors.put(method.methodStruct, kConstructor); if (isPrimary) { @@ -118,6 +121,8 @@ public boolean stringify(TextBuffer buffer, int indent) { TextBuffer buf = new TextBuffer(); RootStatement root = method.root; + String methodKey = InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor()); + if (!isPrimary) { if (flags.hasAnnotations) { KotlinWriter.appendAnnotations(buf, indent, method.methodStruct, TypeAnnotation.METHOD_RETURN_TYPE); @@ -143,6 +148,10 @@ public boolean stringify(TextBuffer buffer, int indent) { first = false; parameter.stringify(indent + 1, buf); + + if (parameter.flags().declaresDefault) { + buf.append(defaultArgs.toJava(parameter, indent + 1), node.classStruct.qualifiedName, methodKey); + } } buf.appendPossibleNewline("", true).popNewlineGroup(); @@ -165,8 +174,7 @@ public boolean stringify(TextBuffer buffer, int indent) { } else { buf.append(": "); - InvocationExprent invocation = (InvocationExprent) firstExpr; - buf.append(invocation.toJava(indent + 1), node.classStruct.qualifiedName, InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor())); + buf.append(firstExpr.toJava(indent + 1), node.classStruct.qualifiedName, methodKey); method.getOrBuildGraph().first.exprents.remove(0); } @@ -189,8 +197,7 @@ public boolean stringify(TextBuffer buffer, int indent) { TextBuffer body = root.toJava(indent + 1); body.addBytecodeMapping(root.getDummyExit().bytecode); - StructMethod mt = method.methodStruct; - buf.append(body, node.classStruct.qualifiedName, InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor())); + buf.append(body, node.classStruct.qualifiedName, methodKey); buf.appendIndent(indent).append("}").appendLineSeparator(); @@ -204,43 +211,52 @@ public boolean writePrimaryConstructor(TextBuffer buffer, int indent) { TextBuffer buf = new TextBuffer(); boolean appended = false; - if (flags.hasAnnotations) { - buf.append(" "); - // -1 for indent indicates inline - KotlinWriter.appendAnnotations(buf, -1, method.methodStruct, TypeAnnotation.METHOD_RETURN_TYPE); - KotlinWriter.appendJvmAnnotations(buf, -1, method.methodStruct, false, method.classStruct.getPool(), TypeAnnotation.METHOD_RETURN_TYPE); - appended = true; - } + String methodKey = InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor()); - // For cleanliness, public primary constructors are not forced public by the config option - if (flags.visibility != ProtoBuf.Visibility.PUBLIC || (appended && DecompilerContext.getOption(KotlinOptions.SHOW_PUBLIC_VISIBILITY))) { - buf.append(" "); - KUtils.appendVisibility(buf, flags.visibility); - appended = true; - } + if (classFlags.kind != ProtoBuf.Class.Kind.OBJECT && classFlags.kind != ProtoBuf.Class.Kind.COMPANION_OBJECT) { + if (flags.hasAnnotations) { + buf.append(" "); + // -1 for indent indicates inline + KotlinWriter.appendAnnotations(buf, -1, method.methodStruct, TypeAnnotation.METHOD_RETURN_TYPE); + KotlinWriter.appendJvmAnnotations(buf, -1, method.methodStruct, false, method.classStruct.getPool(), TypeAnnotation.METHOD_RETURN_TYPE); + appended = true; + } - if (appended) { - buf.append("constructor"); - } + // For cleanliness, public primary constructors are not forced public by the config option + if ((flags.visibility != ProtoBuf.Visibility.PUBLIC || (appended && DecompilerContext.getOption(KotlinOptions.SHOW_PUBLIC_VISIBILITY))) && + classFlags.kind != ProtoBuf.Class.Kind.ENUM_CLASS // Enum constructors are always private implicitly + ) { + buf.append(" "); + KUtils.appendVisibility(buf, flags.visibility); + appended = true; + } - if (parameters.length > 0 || appended) { - buf.append("(").pushNewlineGroup(indent, 1); + if (appended) { + buf.append("constructor"); + } - boolean first = true; - for (KParameter parameter : parameters) { - if (!first) { - buf.append(",").appendPossibleNewline(" "); - } + if (parameters.length > 0 || appended) { + buf.append("(").pushNewlineGroup(indent, 1); - first = false; + boolean first = true; + for (KParameter parameter : parameters) { + if (!first) { + buf.append(",").appendPossibleNewline(" "); + } - parameter.stringify(indent + 1, buf); - } + first = false; + + parameter.stringify(indent + 1, buf); + + if (parameter.flags().declaresDefault) { + buf.append(defaultArgs.toJava(parameter, indent + 1), node.classStruct.qualifiedName, methodKey); + } + } - buf.appendPossibleNewline("", true).popNewlineGroup().append(")"); + buf.appendPossibleNewline("", true).popNewlineGroup().append(")"); + } } - RootStatement root = method.root; if (method.getOrBuildGraph().first.exprents.isEmpty()) { // No ability to declare super constructor call buffer.append(buf); @@ -248,15 +264,14 @@ public boolean writePrimaryConstructor(TextBuffer buffer, int indent) { } Exprent firstExpr = method.getOrBuildGraph().first.exprents.get(0); - if (!(firstExpr instanceof InvocationExprent) || !((InvocationExprent) firstExpr).getName().equals("")) { + if (!(firstExpr instanceof InvocationExprent invocation) || !invocation.getName().equals("")) { // no detected super constructor call buffer.append(buf); return false; // throw new IllegalStateException("First expression of constructor is not InvocationExprent"); } - InvocationExprent invocation = (InvocationExprent) firstExpr; - if (invocation.getClassname().equals("java/lang/Object")) { + if (invocation.getClassname().equals("java/lang/Object") || classFlags.kind == ProtoBuf.Class.Kind.ENUM_CLASS) { // No need to declare super constructor call buffer.append(buf); return false; @@ -278,17 +293,10 @@ public boolean writePrimaryConstructor(TextBuffer buffer, int indent) { method.getOrBuildGraph().first.exprents.remove(0); - buffer.append(buf, node.classStruct.qualifiedName, InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor())); + buffer.append(buf, node.classStruct.qualifiedName, methodKey); return true; } - public static class Data { - public final Map constructors; - public final KConstructor primary; - - public Data(Map constructors, KConstructor primary) { - this.constructors = constructors; - this.primary = primary; - } + public record Data(Map constructors, KConstructor primary) { } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KContract.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KContract.java index 813361b7aa..7c552e386b 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KContract.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KContract.java @@ -81,7 +81,7 @@ public void stringify(TextBuffer buf, int indent) { case CALLS: buf.append("callsInPlace("); KExpression func = expressions.get(0); - String name = func.valueParameterReference.name; + String name = func.valueParameterReference.name(); buf.append(KotlinWriter.toValidKotlinIdentifier(name)); if (kind != null) { buf.append(", ") @@ -109,38 +109,17 @@ public void stringify(TextBuffer buf, int indent) { } } - public static class KExpression { + public record KExpression( + @NotNull ProtobufFlags.Expression flags, + @Nullable KParameter valueParameterReference, + @Nullable ProtoBuf.Expression.ConstantValue constantValue, + @Nullable KType instanceofType, + @NotNull List andArguments, + @NotNull List orArguments + ) { // Placeholder type for receiver type private static final KParameter THIS_TYPE = new KParameter(new ProtobufFlags.ValueParameter(0), "this", KType.NOTHING, null, 0); - @NotNull - public final ProtobufFlags.Expression flags; - @Nullable - public final KParameter valueParameterReference; - @Nullable - public final ProtoBuf.Expression.ConstantValue constantValue; - @Nullable - public final KType instanceofType; // isInstanceType - @NotNull - public final List andArguments; - @NotNull - public final List orArguments; - - private KExpression( - @NotNull ProtobufFlags.Expression flags, - @Nullable KParameter valueParameterReference, - @Nullable ProtoBuf.Expression.ConstantValue constantValue, - @Nullable KType instanceofType, - @NotNull List andArguments, - @NotNull List orArguments) { - this.flags = flags; - this.valueParameterReference = valueParameterReference; - this.constantValue = constantValue; - this.instanceofType = instanceofType; - this.andArguments = andArguments; - this.orArguments = orArguments; - } - static KExpression from(ProtoBuf.Expression proto, List params, MetadataNameResolver nameResolver) { ProtobufFlags.Expression flags = new ProtobufFlags.Expression(proto.getFlags()); KParameter valueParameterReference = null; @@ -173,7 +152,7 @@ public void stringify(TextBuffer buf, int indent, boolean partOfOr) { if (valueParameterReference == THIS_TYPE) { paramName = "this"; } else if (valueParameterReference != null) { - paramName = KotlinWriter.toValidKotlinIdentifier(valueParameterReference.name); + paramName = KotlinWriter.toValidKotlinIdentifier(valueParameterReference.name()); } if (instanceofType != null) { @@ -189,14 +168,14 @@ public void stringify(TextBuffer buf, int indent, boolean partOfOr) { .append(' ') .append("null"); } else if (constantValue != null) { - if (valueParameterReference != null && valueParameterReference.type.isNullable) { + if (valueParameterReference != null && valueParameterReference.type().isNullable) { buf.append(paramName) .append(' ') .append(flags.isNegated ? "!=" : "==") .append(' ') .append(constantValue.name().toLowerCase()); } else { - String output = valueParameterReference != null && "kotlin/Boolean".equals(valueParameterReference.type.kotlinType) + String output = valueParameterReference != null && "kotlin/Boolean".equals(valueParameterReference.type().kotlinType) ? paramName : constantValue.name().toLowerCase(); @@ -207,7 +186,7 @@ public void stringify(TextBuffer buf, int indent, boolean partOfOr) { buf.append(output); } } else if (valueParameterReference != null) { - if (!valueParameterReference.type.kotlinType.equals("kotlin/Boolean")) { + if (!valueParameterReference.type().kotlinType.equals("kotlin/Boolean")) { //TODO figure out why this happens } if (flags.isNegated) { diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KFunction.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KFunction.java index dd481661b9..627e74faa6 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KFunction.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KFunction.java @@ -2,7 +2,9 @@ import kotlinx.metadata.internal.metadata.ProtoBuf; import kotlinx.metadata.internal.metadata.jvm.JvmProtoBuf; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.main.ClassesProcessor; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; @@ -26,53 +28,21 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Function; import java.util.stream.Collectors; -public class KFunction { - public final String name; - public final ProtobufFlags.Function flags; - public final List contextReceiverTypes; - public final KParameter[] parameters; - public final List typeParameters; - public final KType returnType; - - public final MethodWrapper method; - - @Nullable - public final KType receiverType; - - @Nullable - public final KContract contract; - - public final boolean knownOverride; - - private final ClassesProcessor.ClassNode node; - - private KFunction( - String name, - KParameter[] parameters, - List typeParameters, - KType returnType, - ProtobufFlags.Function flags, - List contextReceiverTypes, MethodWrapper method, - @Nullable KType receiverType, - @Nullable KContract contract, - boolean knownOverride, - ClassesProcessor.ClassNode node) { - this.name = name; - this.parameters = parameters; - this.typeParameters = typeParameters; - this.returnType = returnType; - this.flags = flags; - this.contextReceiverTypes = contextReceiverTypes; - this.method = method; - this.receiverType = receiverType; - this.contract = contract; - this.knownOverride = knownOverride; - this.node = node; - } - +public record KFunction( + String name, + KParameter[] parameters, + List typeParameters, + KType returnType, + ProtobufFlags.Function flags, + List contextReceiverTypes, MethodWrapper method, + @Nullable KType receiverType, + @Nullable KContract contract, + boolean knownOverride, + @NotNull DefaultArgsMap defaultArgs, + ClassesProcessor.ClassNode node +) { public static Map parse(ClassesProcessor.ClassNode node) { MetadataNameResolver resolver = KotlinDecompilationContext.getNameResolver(); ClassWrapper wrapper = node.getWrapper(); @@ -83,23 +53,12 @@ public static Map parse(ClassesProcessor.ClassNode node KotlinDecompilationContext.KotlinType type = KotlinDecompilationContext.getCurrentType(); if (type == null) return Map.of(); - switch (type) { - case CLASS: - protoFunctions = KotlinDecompilationContext.getCurrentClass().getFunctionList(); - break; - case FILE: - protoFunctions = KotlinDecompilationContext.getFilePackage().getFunctionList(); - break; - case MULTIFILE_CLASS: - protoFunctions = KotlinDecompilationContext.getMultifilePackage().getFunctionList(); - break; - case SYNTHETIC_CLASS: - // indicating lambdas and such - protoFunctions = Collections.singletonList(KotlinDecompilationContext.getSyntheticClass()); - break; - default: - throw new IllegalStateException("Unexpected value: " + type); - } + protoFunctions = switch (type) { + case CLASS -> KotlinDecompilationContext.getCurrentClass().getFunctionList(); + case FILE -> KotlinDecompilationContext.getFilePackage().getFunctionList(); + case MULTIFILE_CLASS -> KotlinDecompilationContext.getMultifilePackage().getFunctionList(); + case SYNTHETIC_CLASS -> Collections.singletonList(KotlinDecompilationContext.getSyntheticClass()); // Lambdas and similar + }; Map functions = new HashMap<>(protoFunctions.size(), 1f); @@ -142,10 +101,9 @@ public static Map parse(ClassesProcessor.ClassNode node } for (KParameter parameter : parameters) { - desc.append(parameter.type); + desc.append(parameter.type()); } - int endOfParams = desc.length(); desc.append(")").append(returnType); method = wrapper.getMethodWrapper(lookupName, desc.toString()); @@ -163,6 +121,35 @@ public static Map parse(ClassesProcessor.ClassNode node .map(ctxType -> KType.from(ctxType, resolver)) .collect(Collectors.toList()); + boolean isStatic = (method.methodStruct.getAccessFlags() & CodeConstants.ACC_STATIC) != 0; + String defaultArgsName = name + "$default"; + StringBuilder defaultArgsDesc = new StringBuilder("("); + if (!isStatic) { + defaultArgsDesc.append("L").append(struct.qualifiedName).append(";"); + } + if (receiverType != null) { + defaultArgsDesc.append(receiverType); + } + for (KParameter parameter : parameters) { + if (parameter.type().typeParameterName != null) { + typeParameters.stream() + .filter(typeParameter -> typeParameter.name().equals(parameter.type().typeParameterName)) + .findAny() + .map(KTypeParameter::upperBounds) + .filter(bounds -> bounds.size() == 1) + .map(bounds -> bounds.get(0)) + .ifPresentOrElse(defaultArgsDesc::append, () -> defaultArgsDesc.append("Ljava/lang/Object;")); + } else { + defaultArgsDesc.append(parameter.type()); + } + } + + defaultArgsDesc.append("I".repeat(parameters.length / 32 + 1)); + defaultArgsDesc.append("Ljava/lang/Object;)"); + defaultArgsDesc.append(returnType); + + DefaultArgsMap defaultArgs = DefaultArgsMap.from(wrapper.getMethodWrapper(defaultArgsName, defaultArgsDesc.toString()), method, parameters); + boolean knownOverride = flags.visibility != ProtoBuf.Visibility.PRIVATE && flags.visibility != ProtoBuf.Visibility.PRIVATE_TO_THIS && flags.visibility != ProtoBuf.Visibility.LOCAL @@ -170,7 +157,22 @@ public static Map parse(ClassesProcessor.ClassNode node KContract contract = function.hasContract() ? KContract.from(function.getContract(), List.of(parameters), resolver) : null; - functions.put(method.methodStruct, new KFunction(name, parameters, typeParameters, returnType, flags, contextReceiverTypes, method, receiverType, contract, knownOverride, node)); + KFunction kFunction = new KFunction( + name, + parameters, + typeParameters, + returnType, + flags, + contextReceiverTypes, + method, + receiverType, + contract, + knownOverride, + defaultArgs, + node + ); + + functions.put(method.methodStruct, kFunction); } return functions; @@ -181,6 +183,8 @@ public TextBuffer stringify(int indent) { KotlinWriter.appendAnnotations(buf, indent, method.methodStruct, TypeAnnotation.METHOD_RETURN_TYPE); KotlinWriter.appendJvmAnnotations(buf, indent, method.methodStruct, false, method.classStruct.getPool(), TypeAnnotation.METHOD_RETURN_TYPE); + String methodKey = InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor()); + buf.appendIndent(indent); if (!contextReceiverTypes.isEmpty()) { @@ -243,11 +247,8 @@ public TextBuffer stringify(int indent) { buf.append("fun "); List complexTypeParams = typeParameters.stream() - .filter(typeParameter -> typeParameter.upperBounds.size() > 1) - .collect(Collectors.toList()); - - Map typeParamsById = typeParameters.stream() - .collect(Collectors.toMap(typeParameter -> typeParameter.id, Function.identity())); + .filter(typeParameter -> typeParameter.upperBounds().size() > 1) + .toList(); if (!typeParameters.isEmpty()) { buf.append('<'); @@ -255,14 +256,14 @@ public TextBuffer stringify(int indent) { for (int i = 0; i < typeParameters.size(); i++) { KTypeParameter typeParameter = typeParameters.get(i); - if (typeParameter.reified) { + if (typeParameter.reified()) { buf.append("reified "); } - buf.append(KotlinWriter.toValidKotlinIdentifier(typeParameter.name)); + buf.append(KotlinWriter.toValidKotlinIdentifier(typeParameter.name())); - if (typeParameter.upperBounds.size() == 1) { - buf.append(" : ").append(typeParameter.upperBounds.get(0).stringify(indent + 1)); + if (typeParameter.upperBounds().size() == 1) { + buf.append(" : ").append(typeParameter.upperBounds().get(0).stringify(indent + 1)); } if (i < typeParameters.size() - 1) { @@ -301,6 +302,9 @@ public TextBuffer stringify(int indent) { first = false; parameter.stringify(indent + 1, buf); + if (parameter.flags().declaresDefault) { + buf.append(defaultArgs.toJava(parameter, indent + 1), node.classStruct.qualifiedName, methodKey); + } } buf.appendPossibleNewline("", true) @@ -321,12 +325,12 @@ public TextBuffer stringify(int indent) { first = true; for (KTypeParameter typeParameter : complexTypeParams) { - for (KType upperBound : typeParameter.upperBounds) { + for (KType upperBound : typeParameter.upperBounds()) { if (!first) { buf.appendPossibleNewline(",").appendPossibleNewline(" "); } - buf.append(KotlinWriter.toValidKotlinIdentifier(typeParameter.name)) + buf.append(KotlinWriter.toValidKotlinIdentifier(typeParameter.name())) .append(" : ") .append(upperBound.stringify(indent + 1)); @@ -353,7 +357,7 @@ public TextBuffer stringify(int indent) { buf.appendLineSeparator(); } - buf.append(body, node.classStruct.qualifiedName, InterpreterUtil.makeUniqueKey(method.methodStruct.getName(), method.methodStruct.getDescriptor())); + buf.append(body, node.classStruct.qualifiedName, methodKey); } catch (Throwable t) { String message = "Method " + method.methodStruct.getName() + " " + method.desc() + " in class " + node.classStruct.qualifiedName + " couldn't be written."; DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN, t); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KParameter.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KParameter.java index cd4eb4af9b..5ff14420b6 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KParameter.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KParameter.java @@ -4,21 +4,7 @@ import org.vineflower.kotlin.KotlinWriter; import org.vineflower.kotlin.util.ProtobufFlags; -public class KParameter { - public final ProtobufFlags.ValueParameter flags; - public final String name; - public final KType type; - public final KType varargType; - public final int typeId; - - KParameter(ProtobufFlags.ValueParameter flags, String name, KType type, KType varargType, int typeId) { - this.flags = flags; - this.name = name; - this.type = type; - this.varargType = varargType; - this.typeId = typeId; - } - +public record KParameter(ProtobufFlags.ValueParameter flags, String name, KType type, KType varargType, int typeId) { public void stringify(int indent, TextBuffer buf) { if (flags.isCrossinline) { buf.append("crossinline "); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KProperty.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KProperty.java index aed36a8be6..4f4afdc915 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KProperty.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KProperty.java @@ -2,17 +2,20 @@ import kotlinx.metadata.internal.metadata.ProtoBuf; import kotlinx.metadata.internal.metadata.jvm.JvmProtoBuf; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.main.ClassesProcessor; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.rels.ClassWrapper; import org.jetbrains.java.decompiler.main.rels.MethodWrapper; +import org.jetbrains.java.decompiler.modules.decompiler.exps.AnnotationExprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.ConstExprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; import org.jetbrains.java.decompiler.struct.StructClass; import org.jetbrains.java.decompiler.struct.StructField; import org.jetbrains.java.decompiler.struct.StructMethod; +import org.jetbrains.java.decompiler.struct.attr.StructAnnotationAttribute; import org.jetbrains.java.decompiler.struct.attr.StructConstantValueAttribute; import org.jetbrains.java.decompiler.struct.attr.StructGeneralAttribute; import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant; @@ -30,52 +33,41 @@ import java.util.*; -public final class KProperty { - public final String name; - public final KType type; - - public final ProtobufFlags.Property flags; - - @Nullable - public final KPropertyAccessor getter; - - @Nullable - public final KPropertyAccessor setter; - - @Nullable - public final String setterParamName; - - @Nullable - public final StructField underlyingField; - - @Nullable - public final Exprent initializer; - - private final ClassesProcessor.ClassNode node; - - private KProperty( - String name, - KType type, - ProtobufFlags.Property flags, - KPropertyAccessor getter, - KPropertyAccessor setter, - @Nullable String setterParamName, StructField underlyingField, - Exprent initializer, - ClassesProcessor.ClassNode node) { - this.name = name; - this.type = type; - this.flags = flags; - this.getter = getter; - this.setter = setter; - this.setterParamName = setterParamName; - this.underlyingField = underlyingField; - this.initializer = initializer; - this.node = node; - } +public record KProperty( + String name, + KType type, + ProtobufFlags.Property flags, + @Nullable KPropertyAccessor getter, + @Nullable KPropertyAccessor setter, + @Nullable String setterParamName, + @Nullable StructField underlyingField, + @Nullable Exprent initializer, + @Nullable List annotations, + ClassesProcessor.ClassNode node +) { + private static final AnnotationExprent DEPRECATED_ANNOTATION = new AnnotationExprent( + new VarType("kotlin/Deprecated").value, + List.of("message"), + List.of(new ConstExprent(VarType.VARTYPE_STRING, "Deprecated by attribute.", null)) + ); public TextBuffer stringify(int indent) { TextBuffer buf = new TextBuffer(); + if (flags.hasAnnotations) { + if (annotations != null) { + for (AnnotationExprent anno : annotations) { + buf.appendIndent(indent) + .append(anno.toJava(indent)) + .appendLineSeparator(); + } + } else { + buf.appendIndent(indent) + .append("// $VF: failed to identify property annotations") + .appendLineSeparator(); + } + } + buf.appendIndent(indent); // Modifiers in the order that Kotlin's coding conventions specify @@ -121,50 +113,50 @@ public TextBuffer stringify(int indent) { } // Custom getters and setters, and possible modifier differences - if (getter != null && getter.flags.isNotDefault) { + if (getter != null && getter.flags().isNotDefault) { buf.pushNewlineGroup(indent, 1) .appendLineSeparator() .appendIndent(indent + 1); - KUtils.appendVisibility(buf, getter.flags.visibility); + KUtils.appendVisibility(buf, getter.flags().visibility); - buf.append(getter.flags.modality.name().toLowerCase()) + buf.append(getter.flags().modality.name().toLowerCase()) .append(' '); - if (getter.flags.isExternal) { + if (getter.flags().isExternal) { buf.append("external "); } - if (getter.flags.isInline) { + if (getter.flags().isInline) { buf.append("inline "); } buf.append("get() "); - KotlinWriter.writeMethodBody(node, getter.underlyingMethod, buf, indent + 1, false); + KotlinWriter.writeMethodBody(node, getter.underlyingMethod(), buf, indent + 1, false); buf.popNewlineGroup(); - } else if (getter != null && getter.flags.isExternal) { + } else if (getter != null && getter.flags().isExternal) { buf.appendLineSeparator() .appendIndent(indent + 1) .append("external get"); } - if (setter != null && setter.flags.isNotDefault) { + if (setter != null && setter.flags().isNotDefault) { buf.pushNewlineGroup(indent, 1) .appendLineSeparator() .appendIndent(indent + 1); - KUtils.appendVisibility(buf, getter.flags.visibility); + KUtils.appendVisibility(buf, getter.flags().visibility); - buf.append(setter.flags.modality.name().toLowerCase()) + buf.append(setter.flags().modality.name().toLowerCase()) .append(' '); - if (setter.flags.isExternal) { + if (setter.flags().isExternal) { buf.append("external "); } - if (setter.flags.isInline) { + if (setter.flags().isInline) { buf.append("inline "); } @@ -172,22 +164,22 @@ public TextBuffer stringify(int indent) { .append(setterParamName) .append(") "); - KotlinWriter.writeMethodBody(node, setter.underlyingMethod, buf, indent + 1, false); + KotlinWriter.writeMethodBody(node, setter.underlyingMethod(), buf, indent + 1, false); buf.popNewlineGroup(); - } else if (setter != null && (setter.flags.isExternal || setter.flags.visibility != flags.visibility || setter.flags.modality != flags.modality)) { + } else if (setter != null && (setter.flags().isExternal || setter.flags().visibility != flags.visibility || setter.flags().modality != flags.modality)) { buf.appendLineSeparator().appendIndent(indent + 1); - if (setter.flags.visibility != flags.visibility) { - KUtils.appendVisibility(buf, setter.flags.visibility); + if (setter.flags().visibility != flags.visibility) { + KUtils.appendVisibility(buf, setter.flags().visibility); } - if (setter.flags.modality != flags.modality) { - buf.append(setter.flags.modality.name().toLowerCase()) + if (setter.flags().modality != flags.modality) { + buf.append(setter.flags().modality.name().toLowerCase()) .append(' '); } - if (setter.flags.isExternal) { + if (setter.flags().isExternal) { buf.append("external "); } @@ -198,29 +190,21 @@ public TextBuffer stringify(int indent) { .append("private set"); } - buf.appendLineSeparator(); - return buf; } private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibility) { switch (visibility) { - case LOCAL: - buf.append("// QF: local property") - .appendLineSeparator() - .append("internal "); - break; - case PRIVATE_TO_THIS: - buf.append("private "); - break; - case PUBLIC: + case LOCAL -> buf.append("// QF: local property") + .appendLineSeparator() + .append("internal "); + case PRIVATE_TO_THIS -> buf.append("private "); + case PUBLIC -> { if (DecompilerContext.getOption(KotlinOptions.SHOW_PUBLIC_VISIBILITY)) { buf.append("public "); } - break; - default: - buf.append(visibility.name().toLowerCase()) - .append(' '); + } + default -> buf.append(visibility.name().toLowerCase()).append(' '); } } @@ -229,35 +213,47 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil ClassWrapper wrapper = node.getWrapper(); StructClass structClass = wrapper.getClassStruct(); - List protoProperties; - KotlinDecompilationContext.KotlinType currentType = KotlinDecompilationContext.getCurrentType(); if (currentType == null) return null; - switch (currentType) { - case CLASS: - protoProperties = KotlinDecompilationContext.getCurrentClass().getPropertyList(); - break; - case FILE: - protoProperties = KotlinDecompilationContext.getFilePackage().getPropertyList(); - break; - case MULTIFILE_CLASS: - protoProperties = KotlinDecompilationContext.getMultifilePackage().getPropertyList(); - break; - case SYNTHETIC_CLASS: - return null; // No property information in synthetic classes - default: - throw new IllegalStateException("Unexpected value: " + KotlinDecompilationContext.getCurrentType()); - } + List protoProperties = switch (currentType) { + case CLASS -> KotlinDecompilationContext.getCurrentClass().getPropertyList(); + case FILE -> KotlinDecompilationContext.getFilePackage().getPropertyList(); + case MULTIFILE_CLASS -> KotlinDecompilationContext.getMultifilePackage().getPropertyList(); + case SYNTHETIC_CLASS -> null; + }; + + if (protoProperties == null) return null; List properties = new ArrayList<>(); - Set associatedFields = new HashSet<>(); - Set associatedMethods = new HashSet<>(); + Set associatedFields = new HashSet<>(); + Set associatedMethods = new HashSet<>(); for (ProtoBuf.Property property : protoProperties) { + ProtobufFlags.Property flags = new ProtobufFlags.Property(property.getFlags()); + JvmProtoBuf.JvmPropertySignature jvmProp = property.getExtension(JvmProtoBuf.propertySignature); - ProtobufFlags.Property flags = new ProtobufFlags.Property(property.getFlags()); + List annotations = new ArrayList<>(); + if (jvmProp.hasSyntheticMethod()) { + // Properties containing annotations receive a synthetic method which has the annotations in place of the property. + // https://github.com/JetBrains/kotlin/blob/master/core/metadata.jvm/src/jvm_metadata.proto#L84 + JvmProtoBuf.JvmMethodSignature syntheticMethod = jvmProp.getSyntheticMethod(); + String methodName = nameResolver.resolve(syntheticMethod.getName()); + String desc = nameResolver.resolve(syntheticMethod.getDesc()); + StructMethod method = structClass.getMethod(methodName, desc); + if (method != null) { + associatedMethods.add(method); + if (method.hasAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS)) { + StructAnnotationAttribute attribute = method.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS); + annotations = attribute.getAnnotations(); + } + if (method.hasAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS)) { + StructAnnotationAttribute attribute = method.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS); + annotations.addAll(attribute.getAnnotations()); + } + } + } String name = nameResolver.resolve(property.getName()); @@ -275,7 +271,7 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil String delegateDesc = nameResolver.resolve(jvmProp.getField().getDesc()); StructField delegateField = structClass.getField(delegateFieldName, delegateDesc); if (delegateField != null) { - associatedFields.add(delegateFieldName); + associatedFields.add(delegateField); String key = InterpreterUtil.makeUniqueKey(delegateFieldName, delegateDesc); if (delegateField.hasModifier(CodeConstants.ACC_STATIC)) { delegateExprent = wrapper.getStaticFieldInitializers().getWithKey(key); @@ -293,7 +289,7 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil if (method != null) { MethodWrapper methodWrapper = wrapper.getMethodWrapper(methodName, desc); getter = new KPropertyAccessor(new ProtobufFlags.PropertyAccessor(property.getGetterFlags()), methodWrapper); - associatedMethods.add(InterpreterUtil.makeUniqueKey(methodName, desc)); + associatedMethods.add(method); if (propDesc == null) { propDesc = method.getDescriptor().substring(method.getDescriptor().indexOf(')') + 1); @@ -310,7 +306,7 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil if (method != null) { MethodWrapper methodWrapper = wrapper.getMethodWrapper(methodName, desc); setter = new KPropertyAccessor(new ProtobufFlags.PropertyAccessor(property.getSetterFlags()), methodWrapper); - associatedMethods.add(InterpreterUtil.makeUniqueKey(methodName, desc)); + associatedMethods.add(method); setterParamName = nameResolver.resolve(property.getSetterValueParameter().getName()); } } @@ -319,7 +315,7 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil if (propDesc != null) { field = structClass.getField(name, propDesc); if (field != null) { - associatedFields.add(name); + associatedFields.add(field); } } else { VBStyleCollection fields = structClass.getFields(); @@ -327,12 +323,28 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil if (f.getName().equals(name)) { field = f; propDesc = f.getDescriptor(); - associatedFields.add(name); + associatedFields.add(field); break; } } } + if (flags.hasAnnotations && annotations == null && field != null) { + annotations = new ArrayList<>(); + + if (field.hasAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS)) { + StructAnnotationAttribute attribute = field.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_VISIBLE_ANNOTATIONS); + annotations.addAll(attribute.getAnnotations()); + } + if (field.hasAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS)) { + StructAnnotationAttribute attribute = field.getAttribute(StructGeneralAttribute.ATTRIBUTE_RUNTIME_INVISIBLE_ANNOTATIONS); + annotations.addAll(attribute.getAnnotations()); + } + if (field.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED)) { + annotations.add(DEPRECATED_ANNOTATION); + } + } + VarType varType = propDesc != null ? new VarType(propDesc) : VarType.VARTYPE_OBJECT; String key = InterpreterUtil.makeUniqueKey(name, varType.toString()); @@ -352,21 +364,15 @@ private static void appendVisibility(TextBuffer buf, ProtoBuf.Visibility visibil initializer = wrapper.getDynamicFieldInitializers().getWithKey(key); } - properties.add(new KProperty(name, type, flags, getter, setter, setterParamName, field, initializer, node)); + properties.add(new KProperty(name, type, flags, getter, setter, setterParamName, field, initializer, annotations, node)); } return new Data(properties, associatedFields, associatedMethods); } - public static class Data { - public final List properties; - public final Set associatedFields; - public final Set associatedMethods; - - public Data(List properties, Set associatedFields, Set associatedMethods) { - this.properties = properties; - this.associatedFields = associatedFields; - this.associatedMethods = associatedMethods; - } - } + public record Data( + @NotNull List properties, + @NotNull Set associatedFields, + @NotNull Set associatedMethods + ) { } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KPropertyAccessor.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KPropertyAccessor.java index d6dd8510dc..fb4f619264 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KPropertyAccessor.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KPropertyAccessor.java @@ -1,15 +1,7 @@ package org.vineflower.kotlin.struct; import org.jetbrains.java.decompiler.main.rels.MethodWrapper; -import org.jetbrains.java.decompiler.struct.StructMethod; import org.vineflower.kotlin.util.ProtobufFlags; -public class KPropertyAccessor { - public final ProtobufFlags.PropertyAccessor flags; - public final MethodWrapper underlyingMethod; - - public KPropertyAccessor(ProtobufFlags.PropertyAccessor flags, MethodWrapper underlyingMethod) { - this.flags = flags; - this.underlyingMethod = underlyingMethod; - } +public record KPropertyAccessor(ProtobufFlags.PropertyAccessor flags, MethodWrapper underlyingMethod) { } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KType.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KType.java index 5d6f4728bb..5adc46803f 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KType.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KType.java @@ -81,23 +81,12 @@ public static KType from(ProtoBuf.Type type, MetadataNameResolver nameResolver) } public static KType from(int tableIndex, MetadataNameResolver resolver) { - ProtoBuf.TypeTable table; - switch (KotlinDecompilationContext.getCurrentType()) { - case CLASS: - table = KotlinDecompilationContext.getCurrentClass().getTypeTable(); - break; - case SYNTHETIC_CLASS: - table = KotlinDecompilationContext.getSyntheticClass().getTypeTable(); - break; - case FILE: - table = KotlinDecompilationContext.getFilePackage().getTypeTable(); - break; - case MULTIFILE_CLASS: - table = KotlinDecompilationContext.getMultifilePackage().getTypeTable(); - break; - default: - throw new IllegalStateException("No decompilation context found"); - } + ProtoBuf.TypeTable table = switch (KotlinDecompilationContext.getCurrentType()) { + case CLASS -> KotlinDecompilationContext.getCurrentClass().getTypeTable(); + case SYNTHETIC_CLASS -> KotlinDecompilationContext.getSyntheticClass().getTypeTable(); + case FILE -> KotlinDecompilationContext.getFilePackage().getTypeTable(); + case MULTIFILE_CLASS -> KotlinDecompilationContext.getMultifilePackage().getTypeTable(); + }; return from(table.getType(tableIndex), resolver); } @@ -163,29 +152,18 @@ public TextBuffer stringify(int indent) { return buf; } - public static class TypeArgument { - public final KType type; - public final ProtoBuf.Type.Argument.Projection typeProjection; - - public TypeArgument(KType type, ProtoBuf.Type.Argument.Projection typeProjection) { - this.type = type; - this.typeProjection = typeProjection; - } - + public record TypeArgument(KType type, ProtoBuf.Type.Argument.Projection typeProjection) { public TextBuffer stringify(int indent) { TextBuffer buf = new TextBuffer(); switch (typeProjection) { - case IN: - buf.append("in "); - break; - case OUT: - buf.append("out "); - break; - case STAR: + case IN -> buf.append("in "); + case OUT -> buf.append("out "); + case STAR -> { buf.append("*"); return buf; - case INV: - break; + } + case INV -> { + } } buf.append(type.stringify(indent)); return buf; diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KTypeParameter.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KTypeParameter.java index e802a58088..8b04749e06 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KTypeParameter.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/struct/KTypeParameter.java @@ -6,26 +6,13 @@ import java.util.List; import java.util.stream.Collectors; -public class KTypeParameter { - public final boolean reified; - public final ProtoBuf.TypeParameter.Variance variance; - public final List upperBounds; - public final String name; - public final int id; - - private KTypeParameter( - boolean reified, - ProtoBuf.TypeParameter.Variance variance, - List upperBounds, - String name, - int id) { - this.reified = reified; - this.variance = variance; - this.upperBounds = upperBounds; - this.name = name; - this.id = id; - } - +public record KTypeParameter( + boolean reified, + ProtoBuf.TypeParameter.Variance variance, + List upperBounds, + String name, + int id +) { public static KTypeParameter from(ProtoBuf.TypeParameter proto, MetadataNameResolver resolver) { return new KTypeParameter( proto.getReified(), diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KTypes.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KTypes.java index 8d698c3cfd..c93ee44502 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KTypes.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KTypes.java @@ -168,42 +168,24 @@ public static String getKotlinType(VarType type, boolean includeOuterClasses) { private static String mapJavaTypeToKotlin(String type) { if (type.endsWith("[]")) { String baseType = type.substring(0, type.length() - 2); - switch (baseType) { - case "boolean": - case "byte": - case "char": - case "short": - case "int": - case "long": - case "float": - case "double": - return mapJavaTypeToKotlin(baseType) + "Array"; - default: - return "Array<" + mapJavaTypeToKotlin(baseType) + ">"; - } + return switch (baseType) { + case "boolean", "byte", "char", "short", "int", "long", "float", "double" -> + mapJavaTypeToKotlin(baseType) + "Array"; + default -> "Array<" + mapJavaTypeToKotlin(baseType) + ">"; + }; } - switch (type) { - case "boolean": - return "Boolean"; - case "byte": - return "Byte"; - case "char": - return "Char"; - case "short": - return "Short"; - case "int": - return "Int"; - case "long": - return "Long"; - case "float": - return "Float"; - case "double": - return "Double"; - case "void": - return "Unit"; - - default: + return switch (type) { + case "boolean" -> "Boolean"; + case "byte" -> "Byte"; + case "char" -> "Char"; + case "short" -> "Short"; + case "int" -> "Int"; + case "long" -> "Long"; + case "float" -> "Float"; + case "double" -> "Double"; + case "void" -> "Unit"; + default -> { String[] parts = type.split("\\."); StringBuilder sb = new StringBuilder(); boolean appendDot = false; @@ -229,8 +211,9 @@ private static String mapJavaTypeToKotlin(String type) { appendDot = true; } } - return sb.toString(); - } + yield sb.toString(); + } + }; } public static boolean isFunctionType(VarType type) { @@ -243,7 +226,7 @@ private static String functionTypeToKotlin(VarType type) { } String paramCount = type.value.substring("kotlin/jvm/functions/Function".length()); - if (paramCount.equals("N") || !(type instanceof GenericType)) { + if (paramCount.equals("N") || !(type instanceof GenericType genericType)) { // TODO: support FunctionN properly String typeStr = ExprProcessor.getCastTypeName(type); if (ExprProcessor.UNDEFINED_TYPE_STRING.equals(typeStr)) { @@ -251,8 +234,7 @@ private static String functionTypeToKotlin(VarType type) { } return mapJavaTypeToKotlin(typeStr); } - - GenericType genericType = (GenericType) type; + List params = genericType.getArguments(); int paramCountInt = Integer.parseInt(paramCount); diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KUtils.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KUtils.java index ca0879d7d2..d8c0afca6f 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KUtils.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/KUtils.java @@ -107,4 +107,13 @@ public static void removeArguments(InvocationExprent expr, VarType toRemove, Var expr.setStringDescriptor(newDesc); } + + public static boolean assertionsEnabled() { + try { + assert false; + return false; + } catch (AssertionError e) { + return true; + } + } } diff --git a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/ProtobufFlags.java b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/ProtobufFlags.java index 8a32ad4edf..4cee41e4e8 100644 --- a/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/ProtobufFlags.java +++ b/plugins/kotlin/src/main/java/org/vineflower/kotlin/util/ProtobufFlags.java @@ -222,30 +222,20 @@ public Expression(int flags) { //endregion static String toString(ProtoBuf.Visibility visibility) { - switch (visibility) { - case PRIVATE: - case PRIVATE_TO_THIS: - return "private"; - case PROTECTED: - return "protected"; - case INTERNAL: - return "internal"; - default: - return "public"; - } + return switch (visibility) { + case PRIVATE, PRIVATE_TO_THIS -> "private"; + case PROTECTED -> "protected"; + case INTERNAL -> "internal"; + default -> "public"; + }; } static String toString(ProtoBuf.Modality modality) { - switch (modality) { - case FINAL: - return "final"; - case OPEN: - return "open"; - case ABSTRACT: - return "abstract"; - case SEALED: - return "sealed"; - } - throw new IllegalStateException("Unknown modality: " + modality); + return switch (modality) { + case FINAL -> "final"; + case OPEN -> "open"; + case ABSTRACT -> "abstract"; + case SEALED -> "sealed"; + }; } } diff --git a/plugins/kotlin/src/test/java/org/vineflower/kotlin/KotlinTests.java b/plugins/kotlin/src/test/java/org/vineflower/kotlin/KotlinTests.java index cb6d438fa3..17c606deb6 100644 --- a/plugins/kotlin/src/test/java/org/vineflower/kotlin/KotlinTests.java +++ b/plugins/kotlin/src/test/java/org/vineflower/kotlin/KotlinTests.java @@ -7,6 +7,7 @@ import java.nio.file.Path; import static org.jetbrains.java.decompiler.SingleClassesTestBase.TestDefinition.Version.KOTLIN; +import static org.jetbrains.java.decompiler.SingleClassesTestBase.TestDefinition.Version.KOTLIN_OLD; public class KotlinTests extends SingleClassesTestBase { @@ -85,5 +86,9 @@ private void registerKotlinTests() { register(KOTLIN, "TestReflection"); register(KOTLIN, "TestConstructors"); register(KOTLIN, "TestContracts"); + register(KOTLIN, "TestStringInterpolation"); + register(KOTLIN_OLD, "TestClassicStringInterpolation"); + register(KOTLIN, "TestCompanionObject"); + register(KOTLIN, "TestEnumClass"); } } diff --git a/plugins/kotlin/testData/results/pkg/TestAnnotations.dec b/plugins/kotlin/testData/results/pkg/TestAnnotations.dec index 9fea29d521..0657c713c3 100644 --- a/plugins/kotlin/testData/results/pkg/TestAnnotations.dec +++ b/plugins/kotlin/testData/results/pkg/TestAnnotations.dec @@ -3,7 +3,7 @@ package pkg import java.lang.annotation.Retention import java.lang.annotation.RetentionPolicy -class TestAnnotations { +public class TestAnnotations { @TestAnnotations.TestAnnotation(first = "test", second = 1) public fun test() { }// 16 diff --git a/plugins/kotlin/testData/results/pkg/TestAnyType.dec b/plugins/kotlin/testData/results/pkg/TestAnyType.dec index 40e0f17498..ea18ff3bc9 100644 --- a/plugins/kotlin/testData/results/pkg/TestAnyType.dec +++ b/plugins/kotlin/testData/results/pkg/TestAnyType.dec @@ -1,6 +1,6 @@ package pkg -class TestAnyType { +public class TestAnyType { public fun test(param: Any): Int { if (param is java.lang.String) {// 5 return (param as java.lang.String).length();// 6 @@ -18,6 +18,8 @@ class 'pkg/TestAnyType' { 8 4 9 4 a 4 + b 4 + c 4 d 5 e 5 f 5 diff --git a/plugins/kotlin/testData/results/pkg/TestBitwiseFunctions.dec b/plugins/kotlin/testData/results/pkg/TestBitwiseFunctions.dec index ecec103da9..2d9c456acc 100644 --- a/plugins/kotlin/testData/results/pkg/TestBitwiseFunctions.dec +++ b/plugins/kotlin/testData/results/pkg/TestBitwiseFunctions.dec @@ -1,6 +1,6 @@ package pkg -class TestBitwiseFunctions { +public class TestBitwiseFunctions { public fun and(a: Int, b: Int): Int { return a and b;// 5 } diff --git a/plugins/kotlin/testData/results/pkg/TestClassDec.dec b/plugins/kotlin/testData/results/pkg/TestClassDec.dec index 05fc5b7a6b..1f9de863de 100644 --- a/plugins/kotlin/testData/results/pkg/TestClassDec.dec +++ b/plugins/kotlin/testData/results/pkg/TestClassDec.dec @@ -1,25 +1,23 @@ package pkg -class TestClassDec { +public class TestClassDec { public fun pkg.TestClassDec.Vec2iVal.dot(v: pkg.TestClassDec.Vec2iVal): Int { return `$this$dot`.getX() * v.getX() + `$this$dot`.getY() * v.getY();// 11 } public fun test() { new TestClassDec.EmptyDec(); - var vec: TestClassDec.Vec2iVal = new TestClassDec.Vec2iVal(1, 2);// 16 - var vec1: TestClassDec.Vec2iVal = new TestClassDec.Vec2iVal(2, 4);// 17 + val vec: TestClassDec.Vec2iVal = new TestClassDec.Vec2iVal(1, 2);// 16 + val vec1: TestClassDec.Vec2iVal = new TestClassDec.Vec2iVal(2, 4);// 17 System.out.println(vec.getX());// 19 System.out.println(this.dot(vec, vec1));// 20 }// 21 - class EmptyDec { - } + public class EmptyDec - class Vec2i(x: Int, y: Int) { - } + public class Vec2i(x: Int, y: Int) - class Vec2iVal(x: Int, y: Int) { + public class Vec2iVal(x: Int, y: Int) { public final val x: Int public final val y: Int @@ -29,9 +27,10 @@ class TestClassDec { } } - class Vec2iVar(x: Int, y: Int) { + public class Vec2iVar(x: Int, y: Int) { public final var x: Int internal set + public final var y: Int internal set @@ -105,39 +104,39 @@ class 'pkg/TestClassDec' { class 'pkg/TestClassDec$Vec2iVal' { method ' (II)V' { - 4 26 - 5 26 - 6 26 - 7 26 - 8 26 - 9 27 - a 27 - b 27 - c 27 - d 27 - e 28 + 4 24 + 5 24 + 6 24 + 7 24 + 8 24 + 9 25 + a 25 + b 25 + c 25 + d 25 + e 26 } } class 'pkg/TestClassDec$Vec2iVar' { method ' (II)V' { - 4 38 - 5 38 - 6 38 - 7 38 - 8 38 - 9 39 - a 39 - b 39 - c 39 - d 39 - e 40 + 4 37 + 5 37 + 6 37 + 7 37 + 8 37 + 9 38 + a 38 + b 38 + c 38 + d 38 + e 39 } } Lines mapping: -6 <-> 39 -7 <-> 27 +6 <-> 38 +7 <-> 25 11 <-> 5 16 <-> 10 17 <-> 11 diff --git a/plugins/kotlin/testData/results/pkg/TestClassicStringInterpolation.dec b/plugins/kotlin/testData/results/pkg/TestClassicStringInterpolation.dec new file mode 100644 index 0000000000..3db3470b98 --- /dev/null +++ b/plugins/kotlin/testData/results/pkg/TestClassicStringInterpolation.dec @@ -0,0 +1,117 @@ +package pkg + +public class TestClassicStringInterpolation { + public final val x: Int = 5 + + public fun stringInterpolation(x: Int, y: String) { + System.out.println("$x $y");// 5 + }// 6 + + public fun testConstant(x: Int) { + System.out.println("$x 5");// 9 + }// 10 + + public fun testExpression(x: Int) { + System.out.println("$x ${x + 1}");// 13 + }// 14 + + public fun testProperty() { + System.out.println("${this.x}!");// 18 + }// 19 + + public fun testLiteralClass() { + System.out.println("${TestClassicStringInterpolation::class.java}!");// 22 + }// 23 +} + +class 'pkg/TestClassicStringInterpolation' { + method 'stringInterpolation (ILjava/lang/String;)V' { + d 6 + 16 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 21 6 + 22 6 + 23 6 + 24 7 + } + + method 'testConstant (I)V' { + 7 10 + 10 10 + 11 10 + 12 10 + 13 10 + 14 10 + 15 10 + 17 10 + 18 10 + 19 10 + 1a 11 + } + + method 'testExpression (I)V' { + 7 14 + 10 14 + 11 14 + 12 14 + 16 14 + 17 14 + 18 14 + 19 14 + 1a 14 + 1b 14 + 1d 14 + 1e 14 + 1f 14 + 20 15 + } + + method 'testProperty ()V' { + 7 18 + 8 18 + 9 18 + a 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 1a 18 + 1b 18 + 1c 18 + 1d 19 + } + + method 'testLiteralClass ()V' { + 7 22 + 8 22 + 11 22 + 12 22 + 13 22 + 14 22 + 15 22 + 16 22 + 18 22 + 19 22 + 1a 22 + 1b 23 + } +} + +Lines mapping: +5 <-> 7 +6 <-> 8 +9 <-> 11 +10 <-> 12 +13 <-> 15 +14 <-> 16 +18 <-> 19 +19 <-> 20 +22 <-> 23 +23 <-> 24 diff --git a/plugins/kotlin/testData/results/pkg/TestCompanionObject.dec b/plugins/kotlin/testData/results/pkg/TestCompanionObject.dec new file mode 100644 index 0000000000..52c7a9b094 --- /dev/null +++ b/plugins/kotlin/testData/results/pkg/TestCompanionObject.dec @@ -0,0 +1,97 @@ +package pkg + +public class TestCompanionObject { + public fun notInCompanion() { + System.out.println("notInCompanion");// 5 + }// 6 + + @JvmStatic + @JvmSynthetic + fun `access$getCompanionVal$cp`(): java.lang.String { + return companionVal; + } + + @JvmStatic + @JvmSynthetic + fun `access$getCompanionValJvmStatic$cp`(): java.lang.String { + return companionValJvmStatic;// 3 + } + + public companion object { + public final val companionVal: String + + @JvmStatic + public final val companionValJvmStatic: String + + public fun inCompanion() { + System.out.println("inCompanion");// 15 + }// 16 + + public fun inCompanionJvmStatic() { + System.out.println("inCompanionJvmStatic");// 20 + }// 21 + } +} + +class 'pkg/TestCompanionObject' { + method 'notInCompanion ()V' { + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 6 4 + 7 4 + 8 4 + 9 5 + } + + method 'access$getCompanionVal$cp ()Ljava/lang/String;' { + 0 10 + 1 10 + 2 10 + 3 10 + } + + method 'access$getCompanionValJvmStatic$cp ()Ljava/lang/String;' { + 0 16 + 1 16 + 2 16 + 3 16 + } +} + +class 'pkg/TestCompanionObject$Companion' { + method 'inCompanion ()V' { + 0 26 + 1 26 + 2 26 + 3 26 + 4 26 + 6 26 + 7 26 + 8 26 + 9 27 + } + + method 'inCompanionJvmStatic ()V' { + 0 30 + 1 30 + 2 30 + 3 30 + 4 30 + 6 30 + 7 30 + 8 30 + 9 31 + } +} + +Lines mapping: +3 <-> 17 +5 <-> 5 +6 <-> 6 +15 <-> 27 +16 <-> 28 +20 <-> 31 +21 <-> 32 diff --git a/plugins/kotlin/testData/results/pkg/TestComparison.dec b/plugins/kotlin/testData/results/pkg/TestComparison.dec index deae0a7218..2c26a37fb3 100644 --- a/plugins/kotlin/testData/results/pkg/TestComparison.dec +++ b/plugins/kotlin/testData/results/pkg/TestComparison.dec @@ -1,6 +1,6 @@ package pkg -class TestComparison { +public class TestComparison { public fun test2(a: Any, b: Any): Boolean { return a == b;// 5 } @@ -37,18 +37,24 @@ class 'pkg/TestComparison' { c 8 d 8 e 8 + f 8 + 10 8 16 8 } method 'testNull2 (Ljava/lang/Object;)Z' { 0 12 1 12 + 2 12 + 3 12 9 12 } method 'testNull3 (Ljava/lang/Object;)Z' { 0 16 1 16 + 2 16 + 3 16 9 16 } @@ -62,6 +68,8 @@ class 'pkg/TestComparison' { 0 24 1 24 2 24 + 3 24 + 4 24 a 24 } } diff --git a/plugins/kotlin/testData/results/pkg/TestCompileTimeErrors.dec b/plugins/kotlin/testData/results/pkg/TestCompileTimeErrors.dec index b39d3dee40..e22882c8cc 100644 --- a/plugins/kotlin/testData/results/pkg/TestCompileTimeErrors.dec +++ b/plugins/kotlin/testData/results/pkg/TestCompileTimeErrors.dec @@ -1,24 +1,20 @@ package pkg -import org.jetbrains.annotations.Nullable - -class TestCompileTimeErrors { +public class TestCompileTimeErrors { public fun test(i: I): O where O : I, O : pkg.TestCompileTimeErrors.Test { throw new NotImplementedError(null, 1, null);// 10 } public fun test2(i: Int?): pkg.TestCompileTimeErrors.Test? { return if (i == null) null else new TestCompileTimeErrors.Test(i) { - @Nullable private final Integer testValue; { - this.testValue = `$i`; + this.testValue = `$i`;// 16 }// 14 - @Nullable public Integer getTestValue() { - return this.testValue;// 16 + return this.testValue;// 15 } /** @deprecated */ @@ -28,53 +24,58 @@ class TestCompileTimeErrors { }; } - interface Test { + public interface Test { public val testValue: Int } } class 'pkg/TestCompileTimeErrors' { method 'test (Ljava/lang/Object;)Ljava/lang/Object;' { - 4 6 - 5 6 - 6 6 - a 6 + 4 4 + 5 4 + 6 4 + a 4 } method 'test2 (Ljava/lang/Integer;)Lpkg/TestCompileTimeErrors$Test;' { - 0 10 - 1 10 - 4 10 - c 10 - 10 10 - 13 10 + 0 8 + 1 8 + 2 8 + 3 8 + 4 8 + c 8 + 10 8 + 11 8 + 12 8 + 13 8 } } class 'pkg/TestCompileTimeErrors$test2$1' { method ' (Ljava/lang/Integer;)V' { - 4 15 - 5 15 - 6 15 - 7 15 - 8 15 - 9 16 + 4 12 + 5 12 + 6 12 + 7 12 + 8 12 + 9 13 } method 'getTestValue ()Ljava/lang/Integer;' { - 0 20 - 1 20 - 2 20 - 3 20 - 4 20 + 0 16 + 1 16 + 2 16 + 3 16 + 4 16 } method 'getTestValue$annotations ()V' { - 0 26 + 0 22 } } Lines mapping: -10 <-> 7 -14 <-> 17 -16 <-> 21 +10 <-> 5 +14 <-> 14 +15 <-> 17 +16 <-> 13 diff --git a/plugins/kotlin/testData/results/pkg/TestConstructors.dec b/plugins/kotlin/testData/results/pkg/TestConstructors.dec index 734acf7b17..507ed2a96d 100644 --- a/plugins/kotlin/testData/results/pkg/TestConstructors.dec +++ b/plugins/kotlin/testData/results/pkg/TestConstructors.dec @@ -1,12 +1,12 @@ package pkg -class TestConstructors private constructor() { +public class TestConstructors private constructor() { public constructor(a: Int) : this() {// 4 - System.out.println("a = " + a);// 5 + System.out.println("a = $a");// 5 }// 6 public constructor(a: Int, b: Int) : this(a) {// 8 - System.out.println("b = " + b);// 9 + System.out.println("b = $b");// 9 }// 10 } diff --git a/plugins/kotlin/testData/results/pkg/TestContracts.dec b/plugins/kotlin/testData/results/pkg/TestContracts.dec index 4025e8953b..7a5c0a0972 100644 --- a/plugins/kotlin/testData/results/pkg/TestContracts.dec +++ b/plugins/kotlin/testData/results/pkg/TestContracts.dec @@ -1,8 +1,10 @@ package pkg import kotlin.contracts.InvocationKind +import kotlin.jvm.internal.SourceDebugExtension -class TestContracts { +@SourceDebugExtension(["SMAP\nTestContracts.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestContracts.kt\npkg/TestContracts\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,56:1\n1#2:57\n*E\n"]) +public class TestContracts { public fun testSimpleContract(x: Int?): Int { contract { returns() implies (x != null) @@ -30,7 +32,7 @@ class TestContracts { returns() implies (x is Int) } - if (x !is Integer) {// 31 + if (x !is Int) {// 31 throw new IllegalStateException("x is not Int".toString()); } else { return (x as java.lang.Number).intValue();// 32 @@ -58,12 +60,12 @@ class TestContracts { callsInPlace(f) } - var var3: java.lang.Iterable = (new IntRange(0, i)) as java.lang.Iterable; + val var3: java.lang.Iterable = (new IntRange(0, i)) as java.lang.Iterable; var var4: Int = 0; - var var5: java.util.Iterator = var3.iterator(); + val var5: java.util.Iterator = var3.iterator(); while (var5.hasNext()) { - var var6: Int = (var5 as IntIterator).nextInt(); + val var6: Int = (var5 as IntIterator).nextInt(); var4 += (f.invoke() as java.lang.Number).intValue(); } @@ -73,160 +75,170 @@ class TestContracts { class 'pkg/TestContracts' { method 'testSimpleContract (Ljava/lang/Integer;)I' { - 1 10 - 2 10 - 9 11 - a 11 - b 11 - c 11 - d 11 - 11 11 - 12 13 - 13 13 - 14 13 - 15 13 - 16 13 + 0 12 + 1 12 + 2 12 + 3 12 + 8 13 + 9 13 + a 13 + b 13 + c 13 + 10 13 + 11 15 + 12 15 + 13 15 + 14 15 + 15 15 } method 'testBooleanContract (ZZ)Ljava/lang/Boolean;' { - 1 24 - 2 24 - 5 24 - 6 24 - 9 24 - d 24 - e 24 - 11 24 - 12 24 - 1a 24 - 1d 24 + 0 26 + 1 26 + 2 26 + 3 26 + 4 26 + 5 26 + 6 26 + 7 26 + 8 26 + c 26 + d 26 + e 26 + f 26 + 10 26 + 11 26 + 12 26 + 13 26 + 19 26 + 1a 26 + 1b 26 + 1c 26 } method 'testTypeContract (Ljava/lang/Object;)I' { - 1 32 - 5 32 - c 33 - d 33 - e 33 - f 33 - 10 33 - 14 33 - 15 35 - 16 35 - 17 35 - 18 35 - 19 35 - 1a 35 - 1b 35 - 1c 35 + 0 34 + 4 34 + 5 34 + 6 34 + b 35 + c 35 + d 35 + e 35 + f 35 + 13 35 + 14 37 + 15 37 + 16 37 + 17 37 + 18 37 + 19 37 + 1a 37 + 1b 37 } method 'testFunctionalContract (Lkotlin/jvm/functions/Function0;)I' { - 7 44 - 8 44 - 9 44 - a 44 - b 44 - c 44 - d 44 - e 44 - f 44 - 10 44 - 11 44 - 12 44 - 13 44 + 6 46 + 7 46 + 8 46 + 9 46 + a 46 + b 46 + c 46 + d 46 + e 46 + f 46 + 10 46 + 11 46 + 12 46 } method 'testFunctionalContract2 (Lkotlin/jvm/functions/Function0;Z)I' { - 7 52 - 8 52 - b 52 - c 52 - d 52 - e 52 - f 52 - 10 52 - 11 52 - 12 52 - 13 52 - 14 52 - 15 52 - 16 52 - 1a 52 - 1b 52 + 6 54 + 7 54 + 8 54 + 9 54 + a 54 + b 54 + c 54 + d 54 + e 54 + f 54 + 10 54 + 11 54 + 12 54 + 13 54 + 14 54 + 15 54 + 19 54 + 1a 54 } method 'testFunctionalContract3 (Lkotlin/jvm/functions/Function0;I)I' { - b 60 - c 60 - 10 60 - 11 60 - 12 60 - 13 60 - 14 61 - 15 61 - 16 61 - 17 62 - 18 62 - 19 62 - 1a 62 - 1b 62 - 1c 62 - 1d 62 - 1e 62 - 1f 64 - 20 64 - 21 64 - 22 64 - 23 64 - 24 64 - 25 64 - 29 65 - 2a 65 - 2b 65 - 2c 65 - 2d 65 - 2e 65 - 2f 65 - 30 65 - 31 65 - 32 65 - 3e 66 - 3f 66 - 40 66 - 41 66 - 42 66 - 43 66 - 44 66 - 45 66 - 46 66 - 47 66 - 48 66 - 49 66 - 4e 66 - 4f 66 - 51 66 - 52 66 - 56 69 - 57 69 - 58 69 + a 62 + b 62 + f 62 + 10 62 + 11 62 + 12 62 + 13 63 + 14 63 + 15 63 + 16 64 + 17 64 + 18 64 + 19 64 + 1a 64 + 1b 64 + 1c 64 + 1d 64 + 1e 66 + 1f 66 + 20 66 + 21 66 + 22 66 + 23 66 + 24 66 + 28 67 + 29 67 + 2a 67 + 2b 67 + 2c 67 + 2d 67 + 2e 67 + 2f 67 + 30 67 + 31 67 + 3d 68 + 3e 68 + 3f 68 + 40 68 + 41 68 + 42 68 + 43 68 + 44 68 + 45 68 + 46 68 + 47 68 + 48 68 + 4d 68 + 4e 68 + 50 68 + 51 68 + 55 71 + 56 71 + 57 71 } } Lines mapping: -13 <-> 11 -14 <-> 14 -24 <-> 25 -31 <-> 33 -32 <-> 36 -39 <-> 45 -46 <-> 53 -53 <-> 70 +13 <-> 13 +14 <-> 16 +24 <-> 27 +31 <-> 35 +32 <-> 38 +39 <-> 47 +46 <-> 55 +53 <-> 72 Not mapped: -10 -18 -28 -36 -43 -50 57 diff --git a/plugins/kotlin/testData/results/pkg/TestConvertedK2JOps.dec b/plugins/kotlin/testData/results/pkg/TestConvertedK2JOps.dec index 8e0855be92..90296c1415 100644 --- a/plugins/kotlin/testData/results/pkg/TestConvertedK2JOps.dec +++ b/plugins/kotlin/testData/results/pkg/TestConvertedK2JOps.dec @@ -1,11 +1,10 @@ package pkg -class TestConvertedK2JOps { - public final val any: Any = new Object() +public class TestConvertedK2JOps { public final val list: List = CollectionsKt.listOf(new java.lang.String[]{"a", "b", "c"}) - public final val map: Map = MapsKt.mapOf(new Pair[]{TuplesKt.to("a", "b"), TuplesKt.to("c", "d")}) public final val set: Set = SetsKt.setOf(new java.lang.String[]{"a", "b", "c"}) - + public final val map: Map = MapsKt.mapOf(new Pair[]{TuplesKt.to("a", "b"), TuplesKt.to("c", "d")}) + public final val any: Any = new Object() public fun codeConstructs() { System.out.println("Hello, world!");// 10 @@ -14,20 +13,20 @@ class TestConvertedK2JOps { class 'pkg/TestConvertedK2JOps' { method 'codeConstructs ()V' { - 0 10 - 1 10 - 2 10 - 3 10 - 4 10 - 6 10 - 7 10 - 8 10 - c 11 + 0 9 + 1 9 + 2 9 + 3 9 + 4 9 + 6 9 + 7 9 + 8 9 + c 10 } } Lines mapping: -10 <-> 11 -12 <-> 12 +10 <-> 10 +12 <-> 11 Not mapped: 11 diff --git a/plugins/kotlin/testData/results/pkg/TestDataClass.dec b/plugins/kotlin/testData/results/pkg/TestDataClass.dec index 29e6c123f9..4bbd2835e7 100644 --- a/plugins/kotlin/testData/results/pkg/TestDataClass.dec +++ b/plugins/kotlin/testData/results/pkg/TestDataClass.dec @@ -1,10 +1,10 @@ package pkg -data class TestDataClass(dataClassVal: Regex, variableWithVeryLongName: Int, requestLineWrapsIfTheParamListIsTooLong: List, nullability: String?) { +public data class TestDataClass(dataClassVal: Regex, variableWithVeryLongName: Int, requestLineWrapsIfTheParamListIsTooLong: List, nullability: String?) { public final val dataClassVal: Regex - public final val nullability: String? - public final val requestLineWrapsIfTheParamListIsTooLong: List public final val variableWithVeryLongName: Int + public final val requestLineWrapsIfTheParamListIsTooLong: List + public final val nullability: String? init { this.dataClassVal = dataClassVal;// 4 @@ -29,42 +29,17 @@ data class TestDataClass(dataClassVal: Regex, variableWithVeryLongName: Int, req return this.nullability; } - public fun copy(dataClassVal: Regex, variableWithVeryLongName: Int, requestLineWrapsIfTheParamListIsTooLong: List, nullability: String?): TestDataClass { + public fun copy( + dataClassVal: Regex = this.dataClassVal, + variableWithVeryLongName: Int = this.variableWithVeryLongName, + requestLineWrapsIfTheParamListIsTooLong: List = this.requestLineWrapsIfTheParamListIsTooLong, + nullability: String? = this.nullability + ): TestDataClass { return new TestDataClass(dataClassVal, variableWithVeryLongName, requestLineWrapsIfTheParamListIsTooLong, nullability); } - @JvmStatic - @JvmSynthetic - fun `copy$default`(var0: TestDataClass, var1: Regex, var2: Int, var3: java.util.List, var4: java.lang.String, var5: Int, var6: Any): TestDataClass { - if ((var5 and 1) != 0) { - var1 = var0.dataClassVal; - } - - if ((var5 and 2) != 0) { - var2 = var0.variableWithVeryLongName; - } - - if ((var5 and 4) != 0) { - var3 = var0.requestLineWrapsIfTheParamListIsTooLong; - } - - if ((var5 and 8) != 0) { - var4 = var0.nullability; - } - - return var0.copy(var1, var2, var3, var4); - } - public open fun toString(): String { - return "TestDataClass(dataClassVal=" - + this.dataClassVal - + ", variableWithVeryLongName=" - + this.variableWithVeryLongName - + ", requestLineWrapsIfTheParamListIsTooLong=" - + this.requestLineWrapsIfTheParamListIsTooLong - + ", nullability=" - + this.nullability - + ")"; + return "TestDataClass(dataClassVal=${this.dataClassVal}, variableWithVeryLongName=${this.variableWithVeryLongName}, requestLineWrapsIfTheParamListIsTooLong=${this.requestLineWrapsIfTheParamListIsTooLong}, nullability=${this.nullability})"; } public open fun hashCode(): Int { @@ -82,7 +57,7 @@ data class TestDataClass(dataClassVal: Regex, variableWithVeryLongName: Int, req } else if (other !is TestDataClass) { return false; } else { - var var2: TestDataClass = other as TestDataClass; + val var2: TestDataClass = other as TestDataClass; if (!(this.dataClassVal == (other as TestDataClass).dataClassVal)) { return false; } else if (this.variableWithVeryLongName != var2.variableWithVeryLongName) { @@ -155,202 +130,177 @@ class 'pkg/TestDataClass' { } method 'copy (Lkotlin/text/Regex;ILjava/util/List;Ljava/lang/String;)Lpkg/TestDataClass;' { - 10 32 - 11 32 - 12 32 - 13 32 - 14 32 - 18 32 + 7 32 + 8 32 + 9 32 + a 32 + 10 37 + 11 37 + 12 37 + 13 33 + 14 33 + 15 33 + 16 33 + 18 37 + 1f 34 + 20 34 + 21 34 + 22 34 + 2c 35 + 2d 35 + 2e 35 + 2f 35 + } + + method 'toString ()Ljava/lang/String;' { + 0 41 + 1 41 + 2 41 + 3 41 + 4 41 + 5 41 + 6 41 + 7 41 + 8 41 + 9 41 + a 41 + b 41 + c 41 + d 41 + e 41 + f 41 + 10 41 + 11 41 + 12 41 + 13 41 + 14 41 + 15 41 } - method 'copy$default (Lpkg/TestDataClass;Lkotlin/text/Regex;ILjava/util/List;Ljava/lang/String;ILjava/lang/Object;)Lpkg/TestDataClass;' { - 0 38 - 1 38 - 2 38 - 3 38 - 4 38 - 7 39 - 8 39 - 9 39 - a 39 - b 39 - c 42 - d 42 - e 42 - f 42 - 10 42 - 13 43 - 14 43 - 15 43 - 16 43 - 17 43 + method 'hashCode ()I' { + 0 46 + 1 46 + 2 46 + 3 46 + 4 46 + 5 46 + 6 46 + 8 46 + 9 46 + a 46 + b 46 + c 46 + d 46 + e 46 + f 46 + 10 46 + 11 46 + 12 46 + 13 46 + 15 46 + 16 46 + 17 46 18 46 - 19 46 - 1a 46 - 1b 46 - 1c 46 + 19 47 + 1a 47 + 1b 47 + 1c 47 + 1d 47 + 1e 47 1f 47 - 20 47 - 21 47 - 22 47 - 23 47 - 24 50 - 25 50 + 20 46 + 22 46 + 23 49 + 24 49 + 25 45 26 50 27 50 28 50 29 50 - 2c 51 - 2d 51 - 2e 51 - 2f 51 - 30 51 - 31 51 - 32 54 - 33 54 - 34 54 - 35 54 - 36 54 - 37 54 - 38 54 - 39 54 - 3a 54 - 3b 54 - } - - method 'toString ()Ljava/lang/String;' { - 0 59 - 1 59 - 2 59 - 3 59 - 4 61 - 5 61 - 6 61 - 7 61 - 8 63 - 9 63 - a 63 - b 63 - c 65 - d 65 - e 65 - f 65 - 10 58 - 11 58 - 12 58 - 13 58 - 14 58 - 15 58 - } - - method 'hashCode ()I' { - 0 71 - 1 71 - 2 71 - 3 71 - 4 71 - 5 71 - 6 71 - 8 71 - 9 71 - a 71 - b 71 - c 71 - d 71 - e 71 - f 71 - 10 71 - 11 71 - 12 71 - 13 71 - 15 71 - 16 71 - 17 71 - 18 71 - 19 72 - 1a 72 - 1b 72 - 1c 72 - 1d 72 - 1e 72 - 1f 72 - 20 71 - 22 71 - 23 74 - 24 74 - 25 70 - 26 75 - 27 75 - 28 75 - 29 75 - 2a 75 - 2d 75 - 31 75 - 32 75 - 33 75 - 34 75 - 35 75 - 38 70 - 3b 70 + 2a 50 + 2b 50 + 2c 50 + 2d 50 + 31 50 + 32 50 + 33 50 + 34 50 + 35 50 + 36 50 + 37 50 + 38 45 + 3b 45 } method 'equals (Ljava/lang/Object;)Z' { - 0 79 - 1 79 - 2 79 - 5 80 - 6 80 - 7 81 - b 81 - e 82 - f 82 - 10 84 - 11 84 - 12 84 - 13 84 - 14 84 - 15 85 - 16 85 - 17 85 - 18 85 - 19 85 - 1a 85 - 1b 85 - 1c 85 - 20 85 - 23 86 - 24 86 - 25 87 - 26 87 - 27 87 - 28 87 - 29 87 - 2a 87 - 2b 87 - 2c 87 - 2d 87 - 30 88 - 31 88 - 32 89 - 33 89 - 34 89 - 35 89 - 36 89 - 37 89 - 38 89 - 39 89 - 3d 89 - 40 90 - 41 90 - 42 92 - 43 92 - 44 92 - 45 92 - 46 92 - 47 92 - 48 92 - 49 92 - 4d 92 + 0 54 + 1 54 + 2 54 + 3 54 + 4 54 + 5 55 + 6 55 + 7 56 + b 56 + c 56 + d 56 + e 57 + f 57 + 10 59 + 11 59 + 12 59 + 13 59 + 14 59 + 15 60 + 16 60 + 17 60 + 18 60 + 19 60 + 1a 60 + 1b 60 + 1c 60 + 20 60 + 21 60 + 22 60 + 23 61 + 24 61 + 25 62 + 26 62 + 27 62 + 28 62 + 29 62 + 2a 62 + 2b 62 + 2c 62 + 2d 62 + 2e 62 + 2f 62 + 30 63 + 31 63 + 32 64 + 33 64 + 34 64 + 35 64 + 36 64 + 37 64 + 38 64 + 39 64 + 3d 64 + 3e 64 + 3f 64 + 40 65 + 41 65 + 42 67 + 43 67 + 44 67 + 45 67 + 46 67 + 47 67 + 48 67 + 49 67 + 4d 67 + 4e 67 + 4f 67 } } diff --git a/plugins/kotlin/testData/results/pkg/TestDestructors.dec b/plugins/kotlin/testData/results/pkg/TestDestructors.dec index cf9eb96cff..8d10f146af 100644 --- a/plugins/kotlin/testData/results/pkg/TestDestructors.dec +++ b/plugins/kotlin/testData/results/pkg/TestDestructors.dec @@ -1,376 +1,358 @@ package pkg import kotlin.jvm.functions.Function0 +import kotlin.jvm.internal.SourceDebugExtension -class TestDestructors { +@SourceDebugExtension(["SMAP\nTestDestructors.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestDestructors.kt\npkg/TestDestructors\n*L\n1#1,71:1\n68#1,3:72\n68#1,3:75\n*S KotlinDebug\n*F\n+ 1 TestDestructors.kt\npkg/TestDestructors\n*L\n49#1:72,3\n54#1:75,3\n*E\n"]) +public class TestDestructors { public fun destructDataClasses(x: Pair, y: Triple) { - System.out.println(x.component1() as java.lang.String + " " + x.component2() as Integer);// 8 9 - System.out.println(y.component1() as java.lang.Number + " " + y.component2() as java.lang.Boolean + " " + y.component3() as java.lang.String);// 11 12 + System.out.println("${x.component1() as java.lang.String} ${x.component2() as Int}");// 8 9 + System.out.println("${y.component1() as java.lang.Number} ${y.component2() as java.lang.Boolean} ${y.component3() as java.lang.String}");// 11 12 }// 13 public fun destructDataClassesSpecial(x: Pair, y: Triple, Nothing?, Unit>) { - System.out.println((x.component1() as java.lang.Number).intValue() + " " + x.component2() as java.lang.String);// 19 20 - var c: java.util.List = y.component1() as java.util.List;// 22 - var d: Void = y.component2() as Void; + System.out.println("${(x.component1() as java.lang.Number).intValue()} ${x.component2() as java.lang.String}");// 19 20 + val c: java.util.List = y.component1() as java.util.List;// 22 + val d: Void = y.component2() as Void; y.component3(); - System.out.println(c + " " + d + " " + Unit.INSTANCE);// 23 + System.out.println("$c $d ${Unit.INSTANCE}");// 23 }// 24 public fun destructDataClassesSkip(x: Triple, y: Triple) { - System.out.println(x.component2() as Integer);// 30 31 - System.out.println(y.component1() as java.lang.Number + " " + y.component3() as java.lang.String);// 33 34 + System.out.println(x.component2() as Int);// 30 31 + System.out.println("${y.component1() as java.lang.Number} ${y.component3() as java.lang.String}");// 33 34 }// 35 public fun destructorImpossible(x: Pair): String { - var a: java.lang.String = x.component1() as java.lang.String;// 38 + val a: java.lang.String = x.component1() as java.lang.String;// 38 x.component2(); throw new KotlinNothingValueException(); } public fun destructExtensionFunction(x: Int) { - System.out.println("" + this.component1(x) + this.component2(x) + this.component3(x));// 44 45 + System.out.println("${this.component1(x)}${this.component2(x)}${this.component3(x)}");// 44 45 }// 46 - public inline fun destructInlineLambda(x: () -> Int) { - System.out - .println( - "" - + this.component1((x.invoke() as java.lang.Number).intValue())// 49 50 85 - + this.component2((x.invoke() as java.lang.Number).intValue())// 86 - + this.component3((x.invoke() as java.lang.Number).intValue())// 87 - ); - }// 51 - - public fun callDestructInlineLambda() { - System.out.println("" + this.component1(123) + this.component2(123) + this.component3(123));// 54 88 89 90 91 92 - }// 55 - - public fun callDestructInlineLambdaWithControlFlow(x: Int) { - if (100 <= x && x < 1000) { - var `a$iv`: Int = this.component1(x);// 95 - if (100 <= x && x < 1000) {// 96 - var `b$iv`: Int = this.component2(x); - if (100 <= x && x < 1000) {// 58 97 - System.out.println("" + `a$iv` + `b$iv` + this.component3(x));// 94 98 - } - } - } - }// 99 - public fun destructInlineLambdaNoInline(x: () -> Int) { System.out .println( - "" - + this.component1((x.invoke() as java.lang.Number).intValue())// 62 63 100 - + this.component2((x.invoke() as java.lang.Number).intValue())// 101 - + this.component3((x.invoke() as java.lang.Number).intValue())// 102 + "${this.component1((x.invoke() as java.lang.Number).intValue())}${this.component2((x.invoke() as java.lang.Number).intValue())}${this.component3(// 49 50 72 73 74 + (x.invoke() as java.lang.Number).intValue() + )}" ); - }// 64 + }// 51 public fun destructLambdaInline(x: Int) { - var var2: Function0 = new (x);// 67 + val var2: Function0 = TestDestructors::destructLambdaInline$lambda$0; System.out .println( - "" - + this.component1((var2.invoke() as java.lang.Number).intValue())// 68 103 - + this.component2((var2.invoke() as java.lang.Number).intValue())// 104 - + this.component3((var2.invoke() as java.lang.Number).intValue())// 105 + "${this.component1((var2.invoke() as java.lang.Number).intValue())}${this.component2((var2.invoke() as java.lang.Number).intValue())}${this.component3(// 55 75 76 77 + (var2.invoke() as java.lang.Number).intValue() + )}" ); - }// 69 + }// 56 public operator fun Int.component1(): Int { - return java.lang.String.valueOf(`$this$component1`).charAt(0) - 48;// 77 + return java.lang.String.valueOf(`$this$component1`).charAt(0) - 48;// 64 } public operator fun Int.component2(): Int { - return java.lang.String.valueOf(`$this$component2`).charAt(1) - 48;// 78 + return java.lang.String.valueOf(`$this$component2`).charAt(1) - 48;// 65 } public operator fun Int.component3(): Int { - return java.lang.String.valueOf(`$this$component3`).charAt(2) - 48;// 79 + return java.lang.String.valueOf(`$this$component3`).charAt(2) - 48;// 66 } public inline operator fun (() -> Int).component1(): Int { - return this.component1((`$this$component1`.invoke() as java.lang.Number).intValue());// 81 + return this.component1((`$this$component1`.invoke() as java.lang.Number).intValue());// 68 } public inline operator fun (() -> Int).component2(): Int { - return this.component2((`$this$component2`.invoke() as java.lang.Number).intValue());// 82 + return this.component2((`$this$component2`.invoke() as java.lang.Number).intValue());// 69 } public inline operator fun (() -> Int).component3(): Int { - return this.component3((`$this$component3`.invoke() as java.lang.Number).intValue());// 83 + return this.component3((`$this$component3`.invoke() as java.lang.Number).intValue());// 70 + } + + @JvmStatic + fun `destructLambdaInline$lambda$0`(`$x`: Int): Int { + return `$x`;// 54 } } class 'pkg/TestDestructors' { method 'destructDataClasses (Lkotlin/Pair;Lkotlin/Triple;)V' { - c 6 - d 6 - e 6 - f 6 - 10 6 - 11 6 - 12 6 - 14 6 - 15 6 - 16 6 - 17 6 - 18 6 - 19 6 - 1a 6 - 1d 6 - 1e 6 - 1f 6 - 20 6 - 21 6 - 22 6 - 23 6 - 24 6 - 25 6 - 26 6 - 27 6 - 29 6 - 2a 6 - 2b 6 - 2c 7 - 2d 7 - 2e 7 - 2f 7 - 30 7 - 31 7 - 32 7 - 35 7 - 36 7 - 37 7 - 38 7 - 39 7 - 3a 7 - 3b 7 - 3e 7 - 3f 7 - 40 7 - 41 7 - 42 7 - 43 7 - 44 7 - 47 7 - 48 7 - 49 7 - 4a 7 - 4b 7 - 4c 7 - 4d 7 - 4e 7 - 4f 7 - 50 7 - 51 7 - 52 7 - 53 7 - 54 7 - 56 7 - 57 7 - 58 7 - 59 8 + c 8 + d 8 + e 8 + f 8 + 10 8 + 11 8 + 12 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 + 24 8 + 25 8 + 26 8 + 27 8 + 29 8 + 2a 8 + 2b 8 + 2c 9 + 2d 9 + 2e 9 + 2f 9 + 30 9 + 31 9 + 32 9 + 35 9 + 36 9 + 37 9 + 38 9 + 39 9 + 3a 9 + 3b 9 + 3e 9 + 3f 9 + 40 9 + 41 9 + 42 9 + 43 9 + 44 9 + 47 9 + 48 9 + 49 9 + 4a 9 + 4b 9 + 4c 9 + 4d 9 + 4e 9 + 4f 9 + 50 9 + 51 9 + 52 9 + 53 9 + 54 9 + 56 9 + 57 9 + 58 9 + 59 10 } method 'destructDataClassesSpecial (Lkotlin/Pair;Lkotlin/Triple;)V' { - c 11 - d 11 - e 11 - f 11 - 10 11 - 11 11 - 12 11 - 13 11 - 14 11 - 15 11 - 17 11 - 18 11 - 19 11 - 1a 11 - 1b 11 - 1c 11 - 1d 11 - 20 11 - 21 11 - 22 11 - 23 11 - 24 11 - 25 11 - 26 11 - 27 11 - 28 11 - 29 11 - 2a 11 - 2c 11 - 2d 11 - 2e 11 - 2f 12 - 30 12 - 31 12 - 32 12 - 33 12 - 34 12 - 35 12 - 36 12 - 37 12 - 38 13 - 39 13 - 3a 13 - 3b 13 - 3c 13 - 3d 13 - 3e 13 - 3f 13 - 40 13 - 41 14 - 42 14 - 43 14 - 44 14 - 46 15 - 47 15 - 48 15 - 4b 15 - 4c 15 - 4d 15 - 4e 15 - 4f 15 - 50 15 - 51 15 - 52 15 - 53 15 - 54 15 - 55 15 - 56 15 - 57 15 - 58 15 - 5a 15 - 5b 15 - 5c 15 - 5d 16 + c 13 + d 13 + e 13 + f 13 + 10 13 + 11 13 + 12 13 + 13 13 + 14 13 + 15 13 + 17 13 + 18 13 + 19 13 + 1a 13 + 1b 13 + 1c 13 + 1d 13 + 20 13 + 21 13 + 22 13 + 23 13 + 24 13 + 25 13 + 26 13 + 27 13 + 28 13 + 29 13 + 2a 13 + 2c 13 + 2d 13 + 2e 13 + 2f 14 + 30 14 + 31 14 + 32 14 + 33 14 + 34 14 + 35 14 + 36 14 + 37 14 + 38 15 + 39 15 + 3a 15 + 3b 15 + 3c 15 + 3d 15 + 3e 15 + 3f 15 + 40 15 + 41 16 + 42 16 + 43 16 + 44 16 + 46 17 + 47 17 + 48 17 + 4b 17 + 4c 17 + 4d 17 + 4e 17 + 4f 17 + 50 17 + 51 17 + 52 17 + 53 17 + 54 17 + 55 17 + 56 17 + 57 17 + 58 17 + 5a 17 + 5b 17 + 5c 17 + 5d 18 } method 'destructDataClassesSkip (Lkotlin/Triple;Lkotlin/Triple;)V' { - c 19 - d 19 - e 19 - f 19 - 10 19 - 11 19 - 12 19 - 14 19 - 15 19 - 16 19 - 17 19 - 18 19 - 19 19 - 1a 19 - 1b 20 - 1c 20 - 1d 20 - 1e 20 - 1f 20 - 20 20 - 21 20 - 24 20 - 25 20 - 26 20 - 27 20 - 28 20 - 29 20 - 2a 20 - 2d 20 - 2e 20 - 2f 20 - 30 20 - 31 20 - 32 20 - 33 20 - 34 20 - 35 20 - 36 20 - 37 20 - 38 20 - 3a 20 - 3b 20 - 3c 20 - 3d 21 + c 21 + d 21 + e 21 + f 21 + 10 21 + 11 21 + 12 21 + 14 21 + 15 21 + 16 21 + 17 21 + 18 21 + 19 21 + 1a 21 + 1b 22 + 1c 22 + 1d 22 + 1e 22 + 1f 22 + 20 22 + 21 22 + 24 22 + 25 22 + 26 22 + 27 22 + 28 22 + 29 22 + 2a 22 + 2d 22 + 2e 22 + 2f 22 + 30 22 + 31 22 + 32 22 + 33 22 + 34 22 + 35 22 + 36 22 + 37 22 + 38 22 + 3a 22 + 3b 22 + 3c 22 + 3d 23 } method 'destructorImpossible (Lkotlin/Pair;)Ljava/lang/String;' { - 6 24 - 7 24 - 8 24 - 9 24 - a 24 - b 24 - c 24 - d 24 - e 25 - f 25 - 10 25 - 11 25 - 1a 26 + 6 26 + 7 26 + 8 26 + 9 26 + a 26 + b 26 + c 26 + d 26 + e 27 + f 27 + 10 27 + 11 27 + 1a 28 } method 'destructExtensionFunction (I)V' { - 0 30 - 1 30 - 2 30 - 3 30 - 4 30 - 6 30 - 7 30 - 8 30 - 9 30 - a 30 - c 30 - d 30 - e 30 - f 30 - 10 30 - 13 30 - 14 30 - 15 30 - 16 30 - 17 30 - 18 30 - 19 30 - 1a 30 - 1b 30 - 1c 30 - 1d 30 - 1e 30 - 20 30 - 21 30 - 22 30 - 23 31 + 0 32 + 1 32 + 2 32 + 3 32 + 4 32 + 6 32 + 7 32 + 8 32 + 9 32 + a 32 + c 32 + d 32 + e 32 + f 32 + 10 32 + 13 32 + 14 32 + 15 32 + 16 32 + 17 32 + 18 32 + 19 32 + 1a 32 + 1b 32 + 1c 32 + 1d 32 + 1e 32 + 20 32 + 21 32 + 22 32 + 23 33 } - method 'destructInlineLambda (Lkotlin/jvm/functions/Function0;)V' { - 8 37 - b 37 - 11 37 - 12 37 - 13 37 - 14 37 - 15 37 - 16 37 - 17 37 - 18 37 - 19 37 - 1a 37 - 1b 37 - 1c 37 - 1d 37 - 1e 37 - 1f 37 - 20 37 - 21 37 - 22 37 - 24 38 - 27 38 + method 'destructInlineLambdaNoInline (Lkotlin/jvm/functions/Function0;)V' { + 6 38 + 8 38 + e 38 + f 38 + 10 38 + 11 38 + 12 38 + 13 38 + 14 38 + 15 38 + 16 38 + 17 38 + 18 38 + 19 38 + 1a 38 + 1b 38 + 1c 38 + 1d 38 + 1e 38 + 20 38 + 23 38 + 29 38 + 2a 38 + 2b 38 + 2c 38 2d 38 2e 38 2f 38 @@ -385,12 +367,13 @@ class 'pkg/TestDestructors' { 38 38 39 38 3a 38 - 3b 38 3c 38 - 3d 38 - 3e 38 - 41 39 - 44 39 + 3f 39 + 45 38 + 46 38 + 47 39 + 48 39 + 49 39 4a 39 4b 39 4c 39 @@ -401,508 +384,254 @@ class 'pkg/TestDestructors' { 51 39 52 39 53 39 - 54 39 - 55 39 - 56 39 - 57 39 - 58 39 - 59 39 - 5a 39 - 5b 39 - 5e 37 + 54 38 + 55 38 + 56 38 + 59 38 + 5a 38 + 5b 38 + 5c 38 + 5d 38 + 5e 38 5f 38 60 38 - 61 39 - 62 39 + 61 38 + 62 36 63 36 64 36 - 65 36 - 66 36 - 67 36 - 68 34 - 69 34 - 6a 34 - 6c 35 - 6d 35 - 6e 35 - 6f 41 - } - - method 'callDestructInlineLambda ()V' { - 0 44 - 4 44 - 9 44 - f 44 - 10 44 - 13 44 - 14 44 - 15 44 - 16 44 - 17 44 - 18 44 - 19 44 - 1c 44 - 22 44 - 23 44 - 29 44 - 2a 44 - 2d 44 - 2e 44 - 2f 44 - 30 44 - 31 44 - 32 44 - 33 44 - 35 44 - 3b 44 - 3c 44 - 42 44 - 43 44 - 46 44 - 47 44 - 48 44 - 49 44 - 4a 44 - 4b 44 - 4c 44 - 4f 44 - 50 44 - 51 44 - 52 44 - 53 44 - 54 44 - 55 44 - 56 44 - 57 44 - 58 44 - 59 44 - 5a 44 - 5b 44 - 5d 44 - 5e 44 - 5f 44 - 61 45 + 66 37 + 67 37 + 68 37 + 69 42 } - method 'callDestructInlineLambdaWithControlFlow (I)V' { - 0 49 - 4 49 - a 49 - b 49 + method 'destructLambdaInline (I)V' { + 6 45 + 7 48 + a 48 + 10 48 11 48 12 48 13 48 14 48 + 15 48 + 16 48 17 48 18 48 19 48 1a 48 1b 48 - 27 48 - 2a 49 - 2e 57 - 2f 49 - 30 49 - 31 49 - 32 49 - 33 49 - 34 49 - 35 49 - 36 49 - 37 49 - 38 51 - 39 51 - 3e 51 - 3f 51 - 45 50 - 46 50 - 47 50 - 48 50 - 49 50 - 4d 50 - 4e 50 - 4f 50 - 50 50 - 51 50 - 5d 50 - 60 51 - 64 57 - 65 51 - 66 51 - 67 51 - 68 51 - 69 51 - 6a 51 - 6b 51 - 6c 51 - 6d 51 - 6e 53 - 6f 53 - 74 53 - 75 53 - 7b 52 - 7c 52 - 7d 52 - 7e 52 - 7f 52 - 83 52 - 84 52 - 85 52 - 86 52 - 87 52 - 93 52 - 96 53 - 9a 57 - 9b 53 - 9c 53 - 9d 53 - 9e 53 - 9f 53 - a0 53 - a4 53 - a5 53 - a6 53 - a7 53 - a8 53 - a9 53 - aa 53 - ab 53 - ac 53 - ad 53 - ae 53 - af 53 - b0 53 - b4 53 - b8 57 - } - - method 'destructInlineLambdaNoInline (Lkotlin/jvm/functions/Function0;)V' { - 6 63 - 8 63 - e 63 - f 63 - 10 63 - 11 63 - 12 63 - 13 63 - 14 63 - 15 63 - 16 63 - 17 63 - 18 63 - 19 63 - 1a 63 - 1b 63 - 1c 63 - 1d 63 - 1e 63 - 20 64 - 23 64 - 29 64 - 2a 64 - 2b 64 - 2c 64 - 2d 64 - 2e 64 - 2f 64 - 30 64 - 31 64 - 32 64 - 33 64 - 34 64 - 35 64 - 36 64 - 37 64 - 38 64 - 39 64 - 3a 64 - 3c 65 - 3f 65 - 45 65 - 46 65 - 47 65 - 48 65 - 49 65 - 4a 65 - 4b 65 - 4c 65 - 4d 65 - 4e 65 - 4f 65 - 50 65 - 51 65 - 52 65 - 53 65 - 54 65 - 55 65 - 56 65 - 59 63 - 5a 64 - 5b 65 - 5c 65 - 5d 62 - 5e 62 - 5f 62 - 60 62 - 61 62 - 62 60 - 63 60 - 64 60 - 66 61 - 67 61 - 68 61 - 69 67 - } - - method 'destructLambdaInline (I)V' { - 4 70 - 8 70 - 9 70 - a 70 - b 70 - c 74 - f 74 - 15 74 - 16 74 - 17 74 - 18 74 - 19 74 - 1a 74 - 1b 74 - 1c 74 - 1d 74 - 1e 74 - 1f 74 - 20 74 - 21 74 - 22 74 - 23 74 - 24 74 - 25 74 - 26 74 - 28 75 - 2b 75 - 31 75 - 32 75 - 33 75 - 34 75 - 35 75 - 36 75 - 37 75 - 38 75 - 39 75 - 3a 75 - 3b 75 - 3c 75 - 3d 75 - 3e 75 - 3f 75 - 40 75 - 41 75 - 42 75 - 45 76 - 48 76 - 4e 76 - 4f 76 - 50 76 - 51 76 - 52 76 - 53 76 - 54 76 - 55 76 - 56 76 - 57 76 - 58 76 - 59 76 - 5a 76 - 5b 76 - 5c 76 - 5d 76 - 5e 76 - 5f 76 - 62 74 - 63 75 - 64 75 - 65 76 - 66 76 - 67 73 - 68 73 - 69 73 - 6a 73 - 6b 73 - 6c 71 - 6d 71 - 6e 71 - 70 72 - 71 72 - 72 72 - 73 78 + 1c 48 + 1d 48 + 1e 48 + 1f 48 + 20 48 + 21 48 + 23 48 + 26 48 + 2c 48 + 2d 48 + 2e 48 + 2f 48 + 30 48 + 31 48 + 32 48 + 33 48 + 34 48 + 35 48 + 36 48 + 37 48 + 38 48 + 39 48 + 3a 48 + 3b 48 + 3c 48 + 3d 48 + 40 48 + 43 49 + 49 48 + 4a 48 + 4b 49 + 4c 49 + 4d 49 + 4e 49 + 4f 49 + 50 49 + 51 49 + 52 49 + 53 49 + 54 49 + 55 49 + 56 49 + 57 49 + 58 48 + 59 48 + 5a 48 + 5d 48 + 5e 48 + 5f 48 + 60 48 + 61 48 + 62 48 + 63 48 + 64 48 + 65 48 + 66 48 + 67 46 + 68 46 + 69 46 + 6b 47 + 6c 47 + 6d 47 + 6e 52 } method 'component1 (I)I' { - 0 81 - 1 81 - 2 81 - 3 81 - 4 81 - 5 81 - 6 81 - 7 81 - 8 81 - 9 81 - a 81 - b 81 + 0 55 + 1 55 + 2 55 + 3 55 + 4 55 + 5 55 + 6 55 + 7 55 + 8 55 + 9 55 + a 55 + b 55 } method 'component2 (I)I' { - 0 85 - 1 85 - 2 85 - 3 85 - 4 85 - 5 85 - 6 85 - 7 85 - 8 85 - 9 85 - a 85 - b 85 + 0 59 + 1 59 + 2 59 + 3 59 + 4 59 + 5 59 + 6 59 + 7 59 + 8 59 + 9 59 + a 59 + b 59 } method 'component3 (I)I' { - 0 89 - 1 89 - 2 89 - 3 89 - 4 89 - 5 89 - 6 89 - 7 89 - 8 89 - 9 89 - a 89 - b 89 + 0 63 + 1 63 + 2 63 + 3 63 + 4 63 + 5 63 + 6 63 + 7 63 + 8 63 + 9 63 + a 63 + b 63 } method 'component1 (Lkotlin/jvm/functions/Function0;)I' { - 8 93 - 9 93 - a 93 - b 93 - c 93 - d 93 - e 93 - f 93 - 10 93 - 11 93 - 12 93 - 13 93 - 14 93 - 15 93 - 16 93 - 17 93 - 18 93 + 8 67 + 9 67 + a 67 + b 67 + c 67 + d 67 + e 67 + f 67 + 10 67 + 11 67 + 12 67 + 13 67 + 14 67 + 15 67 + 16 67 + 17 67 + 18 67 } method 'component2 (Lkotlin/jvm/functions/Function0;)I' { - 8 97 - 9 97 - a 97 - b 97 - c 97 - d 97 - e 97 - f 97 - 10 97 - 11 97 - 12 97 - 13 97 - 14 97 - 15 97 - 16 97 - 17 97 - 18 97 + 8 71 + 9 71 + a 71 + b 71 + c 71 + d 71 + e 71 + f 71 + 10 71 + 11 71 + 12 71 + 13 71 + 14 71 + 15 71 + 16 71 + 17 71 + 18 71 } method 'component3 (Lkotlin/jvm/functions/Function0;)I' { - 8 101 - 9 101 - a 101 - b 101 - c 101 - d 101 - e 101 - f 101 - 10 101 - 11 101 - 12 101 - 13 101 - 14 101 - 15 101 - 16 101 - 17 101 - 18 101 + 8 75 + 9 75 + a 75 + b 75 + c 75 + d 75 + e 75 + f 75 + 10 75 + 11 75 + 12 75 + 13 75 + 14 75 + 15 75 + 16 75 + 17 75 + 18 75 + } + + method 'destructLambdaInline$lambda$0 (I)I' { + 0 80 + 1 80 } } Lines mapping: -8 <-> 7 -9 <-> 7 -11 <-> 8 -12 <-> 8 -13 <-> 9 -19 <-> 12 -20 <-> 12 -22 <-> 13 -23 <-> 16 -24 <-> 17 -30 <-> 20 -31 <-> 20 -33 <-> 21 -34 <-> 21 -35 <-> 22 -38 <-> 25 -44 <-> 31 -45 <-> 31 -46 <-> 32 -49 <-> 38 -50 <-> 38 -51 <-> 42 -54 <-> 45 -55 <-> 46 -58 <-> 53 -62 <-> 64 -63 <-> 64 -64 <-> 68 -67 <-> 71 -68 <-> 75 -69 <-> 79 -77 <-> 82 -78 <-> 86 -79 <-> 90 -81 <-> 94 -82 <-> 98 -83 <-> 102 -85 <-> 38 -86 <-> 39 -87 <-> 40 -88 <-> 45 -89 <-> 45 -90 <-> 45 -91 <-> 45 -92 <-> 45 -94 <-> 54 -95 <-> 50 -96 <-> 51 -97 <-> 53 -98 <-> 54 -99 <-> 58 -100 <-> 64 -101 <-> 65 -102 <-> 66 -103 <-> 75 -104 <-> 76 -105 <-> 77 -Not mapped: -59 -93 +8 <-> 9 +9 <-> 9 +11 <-> 10 +12 <-> 10 +13 <-> 11 +19 <-> 14 +20 <-> 14 +22 <-> 15 +23 <-> 18 +24 <-> 19 +30 <-> 22 +31 <-> 22 +33 <-> 23 +34 <-> 23 +35 <-> 24 +38 <-> 27 +44 <-> 33 +45 <-> 33 +46 <-> 34 +49 <-> 39 +50 <-> 39 +51 <-> 43 +54 <-> 81 +55 <-> 49 +56 <-> 53 +64 <-> 56 +65 <-> 60 +66 <-> 64 +68 <-> 68 +69 <-> 72 +70 <-> 76 +72 <-> 39 +73 <-> 39 +74 <-> 39 +75 <-> 49 +76 <-> 49 +77 <-> 49 diff --git a/plugins/kotlin/testData/results/pkg/TestEnumClass.dec b/plugins/kotlin/testData/results/pkg/TestEnumClass.dec new file mode 100644 index 0000000000..2c18eebd20 --- /dev/null +++ b/plugins/kotlin/testData/results/pkg/TestEnumClass.dec @@ -0,0 +1,79 @@ +package pkg + +import kotlin.enums.EnumEntries + +public enum class TestEnumClass(number: Int = 4) { + A(0, 1, null), + B(0, 1, null), + C(3), + D(5); + + + public final val number: Int + + init { + this.number = number;// 3 + } + + public fun foo(): Int { + return this.number;// 7 + } + + @JvmStatic + fun getEntries(): EnumEntries { + return $ENTRIES;// 8 + } + + @JvmStatic + @JvmSynthetic + fun `$values`(): Array { + return new TestEnumClass[]{A, B, C, D}; + } +} + +class 'pkg/TestEnumClass' { + method ' (Ljava/lang/String;II)V' { + 6 14 + 7 4 + 8 14 + 9 14 + a 14 + b 15 + } + + method 'foo ()I' { + 0 18 + 1 18 + 2 18 + 3 18 + 4 18 + } + + method 'getEntries ()Lkotlin/enums/EnumEntries;' { + 0 23 + 1 23 + 2 23 + 3 23 + } + + method '$values ()[Lpkg/TestEnumClass;' { + 7 29 + 8 29 + 9 29 + d 29 + e 29 + f 29 + 13 29 + 14 29 + 15 29 + 19 29 + 1a 29 + 1b 29 + 1e 29 + } +} + +Lines mapping: +3 <-> 15 +7 <-> 19 +8 <-> 24 diff --git a/plugins/kotlin/testData/results/pkg/TestExtensionFun.dec b/plugins/kotlin/testData/results/pkg/TestExtensionFun.dec index 1439805c84..4cea416076 100644 --- a/plugins/kotlin/testData/results/pkg/TestExtensionFun.dec +++ b/plugins/kotlin/testData/results/pkg/TestExtensionFun.dec @@ -1,6 +1,6 @@ package pkg -class TestExtensionFun { +public class TestExtensionFun { public fun CharSequence.repeat2(n: Int): String { return StringsKt.repeat(`$this$repeat2`, n);// 5 } diff --git a/plugins/kotlin/testData/results/pkg/TestForRange.dec b/plugins/kotlin/testData/results/pkg/TestForRange.dec index c09d5857d9..440ecbc777 100644 --- a/plugins/kotlin/testData/results/pkg/TestForRange.dec +++ b/plugins/kotlin/testData/results/pkg/TestForRange.dec @@ -2,7 +2,7 @@ package pkg import kotlin.internal.ProgressionUtilKt -class TestForRange { +public class TestForRange { public fun testInt() { for (int i = 1; i < 11; i++) {// 5 System.out.println(i);// 6 @@ -17,7 +17,7 @@ class TestForRange { public fun testIntStep() { var i: Int = 1; - var var2: Int = ProgressionUtilKt.getProgressionLastElement(1, 10, 2); + val var2: Int = ProgressionUtilKt.getProgressionLastElement(1, 10, 2); if (1 <= var2) { while (true) { System.out.println(i);// 18 @@ -32,10 +32,10 @@ class TestForRange { public fun testIntStepX(x: Int) { if (x <= 0) { - throw new IllegalArgumentException("Step must be positive, was: " + x + "."); + throw new IllegalArgumentException("Step must be positive, was: $x."); } else { var i: Int = 1; - var var3: Int = ProgressionUtilKt.getProgressionLastElement(1, 100, x); + val var3: Int = ProgressionUtilKt.getProgressionLastElement(1, 100, x); if (1 <= var3) { while (true) { System.out.println(i);// 24 @@ -57,7 +57,7 @@ class TestForRange { public fun testIntDownToStep() { var i: Int = 10; - var var2: Int = ProgressionUtilKt.getProgressionLastElement(10, 1, -2); + val var2: Int = ProgressionUtilKt.getProgressionLastElement(10, 1, -2); if (var2 <= 10) { while (true) { System.out.println(i);// 36 @@ -72,11 +72,11 @@ class TestForRange { public fun testIntDownToStepX(x: Int) { if (x <= 0) { - throw new IllegalArgumentException("Step must be positive, was: " + x + "."); + throw new IllegalArgumentException("Step must be positive, was: $x."); } else { - var var2: Int = -x; + val var2: Int = -x; var i: Int = 100; - var var4: Int = ProgressionUtilKt.getProgressionLastElement(100, 1, var2); + val var4: Int = ProgressionUtilKt.getProgressionLastElement(100, 1, var2); if (var4 <= 100) { while (true) { System.out.println(i);// 42 @@ -97,10 +97,10 @@ class TestForRange { }// 50 public fun testUntilStep() { - var var1: IntProgression = RangesKt.step(RangesKt.until(1, 100) as IntProgression, 2); + val var1: IntProgression = RangesKt.step(RangesKt.until(1, 100) as IntProgression, 2); var i: Int = var1.getFirst(); - var var3: Int = var1.getLast(); - var var4: Int = var1.getStep(); + val var3: Int = var1.getLast(); + val var4: Int = var1.getStep(); if (var4 > 0 && i <= var3 || var4 < 0 && var3 <= i) { while (true) { System.out.println(i);// 54 @@ -114,10 +114,10 @@ class TestForRange { }// 56 public fun testUntilStepX(x: Int) { - var var2: IntProgression = RangesKt.step(RangesKt.until(1, 100) as IntProgression, x); + val var2: IntProgression = RangesKt.step(RangesKt.until(1, 100) as IntProgression, x); var i: Int = var2.getFirst(); - var var4: Int = var2.getLast(); - var var5: Int = var2.getStep(); + val var4: Int = var2.getLast(); + val var5: Int = var2.getStep(); if (var5 > 0 && i <= var4 || var5 < 0 && var4 <= i) { while (true) { System.out.println(i);// 60 @@ -146,7 +146,7 @@ class TestForRange { public fun testIntYStep(x: Int, y: Int) { var i: Int = x; - var var4: Int = ProgressionUtilKt.getProgressionLastElement(x, y, 2); + val var4: Int = ProgressionUtilKt.getProgressionLastElement(x, y, 2); if (x <= var4) { while (true) { System.out.println(i);// 72 @@ -161,10 +161,10 @@ class TestForRange { public fun testIntYStepX(x: Int, y: Int, z: Int) { if (z <= 0) { - throw new IllegalArgumentException("Step must be positive, was: " + z + "."); + throw new IllegalArgumentException("Step must be positive, was: $z."); } else { var i: Int = x; - var var5: Int = ProgressionUtilKt.getProgressionLastElement(x, y, z); + val var5: Int = ProgressionUtilKt.getProgressionLastElement(x, y, z); if (x <= var5) { while (true) { System.out.println(i);// 78 @@ -187,6 +187,8 @@ class 'pkg/TestForRange' { 3 6 4 6 5 6 + 6 6 + 7 6 8 7 9 7 a 7 @@ -208,6 +210,8 @@ class 'pkg/TestForRange' { 4 12 5 12 6 12 + 7 12 + 8 12 9 13 a 13 b 13 @@ -234,6 +238,8 @@ class 'pkg/TestForRange' { a 20 b 20 c 20 + d 20 + e 20 f 22 10 22 11 22 @@ -244,6 +250,8 @@ class 'pkg/TestForRange' { 16 23 17 23 18 23 + 19 23 + 1a 23 1b 27 1c 27 1d 27 @@ -253,6 +261,8 @@ class 'pkg/TestForRange' { method 'testIntStepX (I)V' { 0 33 1 33 + 2 33 + 3 33 8 34 9 34 a 34 @@ -273,6 +283,8 @@ class 'pkg/TestForRange' { 1c 38 1d 38 1e 38 + 1f 38 + 20 38 21 40 22 40 23 40 @@ -283,6 +295,8 @@ class 'pkg/TestForRange' { 28 41 29 41 2a 41 + 2b 41 + 2c 41 2e 45 30 45 34 49 @@ -295,6 +309,8 @@ class 'pkg/TestForRange' { 3 52 4 52 5 52 + 6 52 + 7 52 8 53 9 53 a 53 @@ -324,6 +340,8 @@ class 'pkg/TestForRange' { c 60 d 60 e 60 + f 60 + 10 60 11 62 12 62 13 62 @@ -334,6 +352,8 @@ class 'pkg/TestForRange' { 18 63 19 63 1a 63 + 1b 63 + 1c 63 1d 67 1e 67 1f 67 @@ -343,6 +363,8 @@ class 'pkg/TestForRange' { method 'testIntDownToStepX (I)V' { 0 73 1 73 + 2 73 + 3 73 8 74 9 74 a 74 @@ -369,6 +391,8 @@ class 'pkg/TestForRange' { 22 79 23 79 24 79 + 25 79 + 26 79 27 81 28 81 29 81 @@ -380,6 +404,8 @@ class 'pkg/TestForRange' { 2f 82 30 82 31 82 + 32 82 + 33 82 35 86 37 86 3b 90 @@ -392,6 +418,8 @@ class 'pkg/TestForRange' { 3 93 4 93 5 93 + 6 93 + 7 93 8 94 9 94 a 94 @@ -439,15 +467,23 @@ class 'pkg/TestForRange' { 1e 103 1f 103 20 103 + 21 103 + 22 103 23 103 24 103 25 103 + 26 103 + 27 103 28 103 29 103 2a 103 + 2b 103 + 2c 103 2d 103 2e 103 2f 103 + 30 103 + 31 103 32 105 33 105 34 105 @@ -458,6 +494,8 @@ class 'pkg/TestForRange' { 39 106 3a 106 3b 106 + 3c 106 + 3d 106 3f 110 40 110 42 110 @@ -499,17 +537,25 @@ class 'pkg/TestForRange' { 1f 120 20 120 21 120 + 22 120 + 23 120 24 120 25 120 26 120 27 120 + 28 120 + 29 120 2a 120 2b 120 2c 120 + 2d 120 + 2e 120 2f 120 30 120 31 120 32 120 + 33 120 + 34 120 35 122 36 122 37 122 @@ -521,6 +567,8 @@ class 'pkg/TestForRange' { 3d 123 3e 123 3f 123 + 40 123 + 41 123 43 127 44 127 46 127 @@ -533,6 +581,8 @@ class 'pkg/TestForRange' { 2 134 3 134 4 134 + 5 134 + 6 134 7 136 8 136 9 136 @@ -543,6 +593,8 @@ class 'pkg/TestForRange' { e 137 f 137 10 137 + 11 137 + 12 137 13 141 14 141 15 141 @@ -564,6 +616,8 @@ class 'pkg/TestForRange' { b 149 c 149 d 149 + e 149 + f 149 10 151 11 151 12 151 @@ -575,6 +629,8 @@ class 'pkg/TestForRange' { 18 152 19 152 1a 152 + 1b 152 + 1c 152 1d 156 1e 156 1f 156 @@ -584,6 +640,8 @@ class 'pkg/TestForRange' { method 'testIntYStepX (III)V' { 0 162 1 162 + 2 162 + 3 162 8 163 9 163 a 163 @@ -607,6 +665,8 @@ class 'pkg/TestForRange' { 1f 167 20 167 21 167 + 22 167 + 23 167 24 169 25 169 26 169 @@ -620,6 +680,8 @@ class 'pkg/TestForRange' { 2e 170 2f 170 30 170 + 31 170 + 32 170 35 174 37 174 38 174 diff --git a/plugins/kotlin/testData/results/pkg/TestFunVarargs.dec b/plugins/kotlin/testData/results/pkg/TestFunVarargs.dec index 84b88115fd..d242fe5ea7 100644 --- a/plugins/kotlin/testData/results/pkg/TestFunVarargs.dec +++ b/plugins/kotlin/testData/results/pkg/TestFunVarargs.dec @@ -2,7 +2,7 @@ package pkg import java.util.Arrays -class TestFunVarargs { +public class TestFunVarargs { public fun printAll(vararg messages: String) { for (java.lang.String m : messages) {// 5 System.out.println(m); @@ -16,7 +16,7 @@ class TestFunVarargs { }// 10 public fun log(vararg entries: String) { - this.printAll(Arrays.copyOf(entries, entries.length) as java.lang.String[]);// 13 + this.printAll(Arrays.copyOf(entries, entries.length) as Array);// 13 this.printAllArray(entries);// 14 }// 15 diff --git a/plugins/kotlin/testData/results/pkg/TestFuncRef.dec b/plugins/kotlin/testData/results/pkg/TestFuncRef.dec index b9060c2077..939d71b7a5 100644 --- a/plugins/kotlin/testData/results/pkg/TestFuncRef.dec +++ b/plugins/kotlin/testData/results/pkg/TestFuncRef.dec @@ -12,7 +12,6 @@ public fun test() { accept(.INSTANCE);// 10 }// 11 - class 'pkg/TestFuncRefKt' { method 'accept (Lkotlin/jvm/functions/Function1;)V' { 6 3 diff --git a/plugins/kotlin/testData/results/pkg/TestGenerics.dec b/plugins/kotlin/testData/results/pkg/TestGenerics.dec index 7a8687b667..bff16cc26c 100644 --- a/plugins/kotlin/testData/results/pkg/TestGenerics.dec +++ b/plugins/kotlin/testData/results/pkg/TestGenerics.dec @@ -1,6 +1,6 @@ package pkg -class TestGenerics { +public class TestGenerics { public fun genericFun(v: T): T { return (T)v;// 5 } diff --git a/plugins/kotlin/testData/results/pkg/TestIfRange.dec b/plugins/kotlin/testData/results/pkg/TestIfRange.dec index b1b89609e5..082516b9db 100644 --- a/plugins/kotlin/testData/results/pkg/TestIfRange.dec +++ b/plugins/kotlin/testData/results/pkg/TestIfRange.dec @@ -1,6 +1,6 @@ package pkg -class TestIfRange { +public class TestIfRange { public fun testInt(x: Int) { if (1 <= x && x < 11) {// 5 System.out.println(x);// 6 @@ -79,16 +79,24 @@ class 'pkg/TestIfRange' { 0 4 1 4 2 4 + 3 4 + 4 4 5 4 6 4 7 4 8 4 + 9 4 + a 4 14 4 + 15 4 + 16 4 17 5 18 5 19 5 1a 5 1b 5 + 1c 5 + 1d 5 1e 7 } @@ -97,16 +105,24 @@ class 'pkg/TestIfRange' { 1 10 2 10 3 10 + 4 10 + 5 10 6 10 7 10 8 10 9 10 + a 10 + b 10 15 10 + 16 10 + 17 10 18 11 19 11 1a 11 1b 11 1c 11 + 1d 11 + 1e 11 1f 13 } @@ -114,16 +130,24 @@ class 'pkg/TestIfRange' { 0 16 1 16 2 16 + 3 16 + 4 16 5 16 6 16 7 16 8 16 + 9 16 + a 16 14 16 + 15 16 + 16 16 17 17 18 17 19 17 1a 17 1b 17 + 1c 17 + 1d 17 1e 19 } @@ -149,11 +173,15 @@ class 'pkg/TestIfRange' { 19 22 1a 22 1b 22 + 1c 22 + 1d 22 1e 23 1f 23 20 23 21 23 22 23 + 23 23 + 24 23 25 25 } @@ -179,11 +207,15 @@ class 'pkg/TestIfRange' { 19 28 1a 28 1b 28 + 1c 28 + 1d 28 1e 29 1f 29 20 29 21 29 22 29 + 23 29 + 24 29 25 31 } @@ -191,15 +223,23 @@ class 'pkg/TestIfRange' { 0 34 1 34 2 34 + 3 34 + 4 34 5 34 6 34 7 34 + 8 34 + 9 34 13 34 + 14 34 + 15 34 16 35 17 35 18 35 19 35 1a 35 + 1b 35 + 1c 35 1d 37 } @@ -221,11 +261,15 @@ class 'pkg/TestIfRange' { e 40 f 40 10 40 + 11 40 + 12 40 13 41 14 41 15 41 16 41 17 41 + 18 41 + 19 41 1a 43 } @@ -251,11 +295,15 @@ class 'pkg/TestIfRange' { 12 46 13 46 14 46 + 15 46 + 16 46 17 47 18 47 19 47 1a 47 1b 47 + 1c 47 + 1d 47 1e 49 } @@ -263,16 +311,24 @@ class 'pkg/TestIfRange' { 0 52 1 52 2 52 + 3 52 + 4 52 5 52 6 52 7 52 8 52 + 9 52 + a 52 14 52 + 15 52 + 16 52 17 53 18 53 19 53 1a 53 1b 53 + 1c 53 + 1d 53 1e 55 } @@ -301,11 +357,15 @@ class 'pkg/TestIfRange' { 15 58 16 58 17 58 + 18 58 + 19 58 1a 59 1b 59 1c 59 1d 59 1e 59 + 1f 59 + 20 59 21 61 } @@ -313,15 +373,23 @@ class 'pkg/TestIfRange' { 0 64 1 64 2 64 + 3 64 + 4 64 5 64 6 64 7 64 + 8 64 + 9 64 13 64 + 14 64 + 15 64 16 65 17 65 18 65 19 65 1a 65 + 1b 65 + 1c 65 1d 67 } @@ -329,15 +397,23 @@ class 'pkg/TestIfRange' { 0 70 1 70 2 70 + 3 70 + 4 70 5 70 6 70 7 70 + 8 70 + 9 70 13 70 + 14 70 + 15 70 16 71 17 71 18 71 19 71 1a 71 + 1b 71 + 1c 71 1d 73 } } diff --git a/plugins/kotlin/testData/results/pkg/TestInfixFun.dec b/plugins/kotlin/testData/results/pkg/TestInfixFun.dec index abfe471ee7..593a13dee6 100644 --- a/plugins/kotlin/testData/results/pkg/TestInfixFun.dec +++ b/plugins/kotlin/testData/results/pkg/TestInfixFun.dec @@ -1,6 +1,6 @@ package pkg -class TestInfixFun { +public class TestInfixFun { public fun test() { System.out.println(test$times(2, "Bye "));// 7 }// 8 diff --git a/plugins/kotlin/testData/results/pkg/TestKotlinTypes.dec b/plugins/kotlin/testData/results/pkg/TestKotlinTypes.dec index 4f22fe26c0..b5b06ce218 100644 --- a/plugins/kotlin/testData/results/pkg/TestKotlinTypes.dec +++ b/plugins/kotlin/testData/results/pkg/TestKotlinTypes.dec @@ -1,21 +1,31 @@ package pkg -import kotlin.jvm.functions.Function1 - -class TestKotlinTypes { - public final val consumer: (Int) -> Unit = .INSTANCE as Function1 - +public class TestKotlinTypes { + public final val consumer: (Int) -> Unit = TestKotlinTypes::consumer$lambda$0 public fun throwAlways(): Nothing { throw new Exception();// 5 } + + @JvmStatic + fun `consumer$lambda$0`(it: Int): Unit { + return Unit.INSTANCE;// 8 + } } class 'pkg/TestKotlinTypes' { method 'throwAlways ()Ljava/lang/Void;' { - 7 9 + 7 6 + } + + method 'consumer$lambda$0 (I)Lkotlin/Unit;' { + 0 11 + 1 11 + 2 11 + 3 11 } } Lines mapping: -5 <-> 10 +5 <-> 7 +8 <-> 12 diff --git a/plugins/kotlin/testData/results/pkg/TestKt.dec b/plugins/kotlin/testData/results/pkg/TestKt.dec index df4e6f6630..8079039cb1 100644 --- a/plugins/kotlin/testData/results/pkg/TestKt.dec +++ b/plugins/kotlin/testData/results/pkg/TestKt.dec @@ -1,6 +1,6 @@ package pkg -class TestKt { +public class TestKt { public fun test() { System.out.println("Hello, world!");// 5 }// 6 diff --git a/plugins/kotlin/testData/results/pkg/TestLabeledJumps.dec b/plugins/kotlin/testData/results/pkg/TestLabeledJumps.dec index b6d221b59c..b7e7d0440e 100644 --- a/plugins/kotlin/testData/results/pkg/TestLabeledJumps.dec +++ b/plugins/kotlin/testData/results/pkg/TestLabeledJumps.dec @@ -1,6 +1,6 @@ package pkg -class TestLabeledJumps { +public class TestLabeledJumps { public fun testContinue(tester: (Int) -> Boolean) { label24: for (int i = 1; i < 101; i++) {// 5 @@ -9,7 +9,7 @@ class TestLabeledJumps { continue label24; } - System.out.println(j + " " + i);// 11 + System.out.println("$j $i");// 11 } System.out.println("loop");// 14 @@ -24,7 +24,7 @@ class TestLabeledJumps { break label22; } - System.out.println(j + " " + i);// 25 + System.out.println("$j $i");// 25 } } @@ -40,12 +40,16 @@ class 'pkg/TestLabeledJumps' { 9 5 a 5 b 5 + c 5 + d 5 e 6 f 6 10 6 11 6 12 6 13 6 + 14 6 + 15 6 16 7 17 7 18 7 @@ -63,6 +67,8 @@ class 'pkg/TestLabeledJumps' { 24 7 25 7 26 7 + 27 7 + 28 7 2c 11 2d 11 2e 11 @@ -85,6 +91,8 @@ class 'pkg/TestLabeledJumps' { 43 14 44 14 46 14 + 47 14 + 48 14 49 5 4a 5 4b 5 @@ -98,12 +106,16 @@ class 'pkg/TestLabeledJumps' { 9 20 a 20 b 20 + c 20 + d 20 e 21 f 21 10 21 11 21 12 21 13 21 + 14 21 + 15 21 16 22 17 22 18 22 @@ -121,6 +133,8 @@ class 'pkg/TestLabeledJumps' { 24 22 25 22 26 22 + 27 22 + 28 22 2c 26 2d 26 2e 26 diff --git a/plugins/kotlin/testData/results/pkg/TestNonInlineLambda.dec b/plugins/kotlin/testData/results/pkg/TestNonInlineLambda.dec index 5854635b22..acde601823 100644 --- a/plugins/kotlin/testData/results/pkg/TestNonInlineLambda.dec +++ b/plugins/kotlin/testData/results/pkg/TestNonInlineLambda.dec @@ -3,599 +3,1074 @@ package pkg import kotlin.jvm.internal.Ref.IntRef import kotlin.jvm.internal.Ref.ObjectRef -open class TestNonInlineLambda { +public open class TestNonInlineLambda { public final var intField: Int internal set - private final var privateIntField: Int - private final var privateStringField: String = "" + public final var stringField: String = "" internal set + private final var privateIntField: Int + private final var privateStringField: String = "" public fun testCaptureInt(x: Int) { - this.execute(new (x));// 7 8 + this.execute(TestNonInlineLambda::testCaptureInt$lambda$0);// 8 }// 11 public fun testCaptureObject(x: String) { - this.execute(new (x));// 14 15 + this.execute(TestNonInlineLambda::testCaptureObject$lambda$1);// 15 }// 18 public fun testCaptureIntIterationValue(x: Iterable) { - var var2: java.util.Iterator = x.iterator();// 21 + val var2: java.util.Iterator = x.iterator();// 21 while (var2.hasNext()) { - this.execute(new ((var2.next() as java.lang.Number).intValue()));// 22 + this.execute(TestNonInlineLambda::testCaptureIntIterationValue$lambda$2);// 22 } }// 26 public fun testCaptureObjectIterationValue(x: Iterable) { for (java.lang.String i : x) {// 29 - this.execute(new (i));// 30 + this.execute(TestNonInlineLambda::testCaptureObjectIterationValue$lambda$3);// 30 } }// 34 public fun testCaptureMutableInt(x: Int) { - var y: IntRef = new IntRef();// 37 + val y: IntRef = new IntRef();// 37 y.element = x; - this.execute(new (y));// 38 - var var3: Int = y.element++;// 41 - this.execute(new (y));// 42 + this.execute(TestNonInlineLambda::testCaptureMutableInt$lambda$4);// 38 + val var3: Int = y.element++;// 41 + this.execute(TestNonInlineLambda::testCaptureMutableInt$lambda$5);// 42 y.element *= 500;// 45 - this.execute(new (y));// 46 + this.execute(TestNonInlineLambda::testCaptureMutableInt$lambda$6);// 46 y.element = 100;// 49 - this.execute(new (y));// 50 + this.execute(TestNonInlineLambda::testCaptureMutableInt$lambda$7);// 50 y.element += x;// 53 - this.execute(new (y));// 54 + this.execute(TestNonInlineLambda::testCaptureMutableInt$lambda$8);// 54 }// 57 public fun testCaptureMutableObject(x: String) { - var y: ObjectRef = new ObjectRef();// 60 + val y: ObjectRef = new ObjectRef();// 60 y.element = x; - this.execute(new (y));// 61 - y.element = y.element + "!!";// 64 - this.execute(new (y));// 65 - y.element = "" + y.element + y.element + y.element;// 68 - this.execute(new (y));// 69 + this.execute(TestNonInlineLambda::testCaptureMutableObject$lambda$9);// 61 + y.element = "${y.element}!!";// 64 + this.execute(TestNonInlineLambda::testCaptureMutableObject$lambda$10);// 65 + y.element = "${y.element}${y.element}${y.element}";// 68 + this.execute(TestNonInlineLambda::testCaptureMutableObject$lambda$11);// 69 y.element = "Hello: ";// 72 - this.execute(new (y));// 73 - y.element = y.element + x;// 76 - this.execute(new (y));// 77 + this.execute(TestNonInlineLambda::testCaptureMutableObject$lambda$12);// 73 + y.element = "${y.element}$x";// 76 + this.execute(TestNonInlineLambda::testCaptureMutableObject$lambda$13);// 77 }// 80 public fun testCaptureAndMutateInt(x: Int) { - var y: IntRef = new IntRef();// 83 - this.execute(new (y));// 84 + val y: IntRef = new IntRef();// 83 + this.execute(TestNonInlineLambda::testCaptureAndMutateInt$lambda$14);// 84 y.element = 5 + x;// 89 - this.execute(new (y));// 90 + this.execute(TestNonInlineLambda::testCaptureAndMutateInt$lambda$15);// 90 }// 95 public fun testCaptureAndMutateString(x: String) { - var y: ObjectRef = new ObjectRef();// 98 + val y: ObjectRef = new ObjectRef();// 98 y.element = ""; - this.execute(new (y));// 99 - y.element = "Hello: " + x;// 105 - this.execute(new (y));// 106 + this.execute(TestNonInlineLambda::testCaptureAndMutateString$lambda$16);// 99 + y.element = "Hello: $x";// 105 + this.execute(TestNonInlineLambda::testCaptureAndMutateString$lambda$17);// 106 }// 112 public fun testCapturePublicMutableIntField() { - this.execute(new (this));// 117 + this.execute(TestNonInlineLambda::testCapturePublicMutableIntField$lambda$18); }// 118 public fun testCapturePublicMutableStringField() { - this.execute(new (this));// 123 + this.execute(TestNonInlineLambda::testCapturePublicMutableStringField$lambda$19); }// 124 public fun testCapturePrivateMutableIntField() { - this.execute(new (this));// 129 + this.execute(TestNonInlineLambda::testCapturePrivateMutableIntField$lambda$20); }// 130 public fun testCapturePrivateMutableStringField() { - this.execute(new (this));// 135 + this.execute(TestNonInlineLambda::testCapturePrivateMutableStringField$lambda$21); }// 136 public open fun execute(block: () -> Unit) { }// 141 @JvmStatic - @JvmSynthetic - fun `access$getPrivateIntField$p`(`$this`: TestNonInlineLambda): Int { - return `$this`.privateIntField; + fun `testCaptureInt$lambda$0`(`$y`: Int): Unit { + System.out.println(`$y`);// 9 + return Unit.INSTANCE;// 10 + } + + @JvmStatic + fun `testCaptureObject$lambda$1`(`$y`: java.lang.String): Unit { + System.out.println(`$y`);// 16 + return Unit.INSTANCE;// 17 + } + + @JvmStatic + fun `testCaptureIntIterationValue$lambda$2`(`$i`: Int): Unit { + System.out.println(`$i`);// 23 + return Unit.INSTANCE;// 24 + } + + @JvmStatic + fun `testCaptureObjectIterationValue$lambda$3`(`$i`: java.lang.String): Unit { + System.out.println(`$i`);// 31 + return Unit.INSTANCE;// 32 + } + + @JvmStatic + fun `testCaptureMutableInt$lambda$4`(`$y`: IntRef): Unit { + System.out.println(`$y`.element);// 39 + return Unit.INSTANCE;// 40 + } + + @JvmStatic + fun `testCaptureMutableInt$lambda$5`(`$y`: IntRef): Unit { + System.out.println(`$y`.element);// 43 + return Unit.INSTANCE;// 44 + } + + @JvmStatic + fun `testCaptureMutableInt$lambda$6`(`$y`: IntRef): Unit { + System.out.println(`$y`.element);// 47 + return Unit.INSTANCE;// 48 + } + + @JvmStatic + fun `testCaptureMutableInt$lambda$7`(`$y`: IntRef): Unit { + System.out.println(`$y`.element);// 51 + return Unit.INSTANCE;// 52 } @JvmStatic - @JvmSynthetic - fun `access$setPrivateIntField$p`(`$this`: TestNonInlineLambda, var1: Int) { - `$this`.privateIntField = var1; + fun `testCaptureMutableInt$lambda$8`(`$y`: IntRef): Unit { + System.out.println(`$y`.element);// 55 + return Unit.INSTANCE;// 56 } @JvmStatic - @JvmSynthetic - fun `access$setPrivateStringField$p`(`$this`: TestNonInlineLambda, var1: java.lang.String) { - `$this`.privateStringField = var1; + fun `testCaptureMutableObject$lambda$9`(`$y`: ObjectRef): Unit { + System.out.println(`$y`.element);// 62 + return Unit.INSTANCE;// 63 } @JvmStatic - @JvmSynthetic - fun `access$getPrivateStringField$p`(`$this`: TestNonInlineLambda): java.lang.String { - return `$this`.privateStringField;// 3 + fun `testCaptureMutableObject$lambda$10`(`$y`: ObjectRef): Unit { + System.out.println(`$y`.element);// 66 + return Unit.INSTANCE;// 67 + } + + @JvmStatic + fun `testCaptureMutableObject$lambda$11`(`$y`: ObjectRef): Unit { + System.out.println(`$y`.element);// 70 + return Unit.INSTANCE;// 71 + } + + @JvmStatic + fun `testCaptureMutableObject$lambda$12`(`$y`: ObjectRef): Unit { + System.out.println(`$y`.element);// 74 + return Unit.INSTANCE;// 75 + } + + @JvmStatic + fun `testCaptureMutableObject$lambda$13`(`$y`: ObjectRef): Unit { + System.out.println(`$y`.element);// 78 + return Unit.INSTANCE;// 79 + } + + @JvmStatic + fun `testCaptureAndMutateInt$lambda$14`(`$y`: IntRef): Unit { + while ($y.element < 10) {// 85 + System.out.println(`$y`.element++);// 86 + } + + return Unit.INSTANCE;// 88 + } + + @JvmStatic + fun `testCaptureAndMutateInt$lambda$15`(`$y`: IntRef): Unit { + while ($y.element > 0) {// 91 + val var1: Int = `$y`.element;// 92 + `$y`.element += -1; + System.out.println(var1); + } + + return Unit.INSTANCE;// 94 + } + + @JvmStatic + fun `testCaptureAndMutateString$lambda$16`(`$y`: ObjectRef): Unit { + while (((java.lang.String)$y.element).length() < 10) {// 100 + `$y`.element = " ${`$y`.element}";// 101 + System.out.println(`$y`.element);// 102 + } + + return Unit.INSTANCE;// 104 + } + + @JvmStatic + fun `testCaptureAndMutateString$lambda$17`(`$y`: ObjectRef): Unit { + while (!StringsKt.isBlank((java.lang.CharSequence)$y.element)) {// 107 + System.out.println();// 108 + `$y`.element = StringsKt.drop(`$y`.element as java.lang.String, 1);// 109 + } + + return Unit.INSTANCE;// 111 + } + + @JvmStatic + fun `testCapturePublicMutableIntField$lambda$18`(`this$0`: TestNonInlineLambda): Unit { + val var1: Int = `this$0`.intField++;// 117 + return Unit.INSTANCE; + } + + @JvmStatic + fun `testCapturePublicMutableStringField$lambda$19`(`this$0`: TestNonInlineLambda): Unit { + `this$0`.stringField = "${`this$0`.stringField}!";// 123 + return Unit.INSTANCE; + } + + @JvmStatic + fun `testCapturePrivateMutableIntField$lambda$20`(`this$0`: TestNonInlineLambda): Unit { + val var1: Int = `this$0`.privateIntField++;// 129 + return Unit.INSTANCE; + } + + @JvmStatic + fun `testCapturePrivateMutableStringField$lambda$21`(`this$0`: TestNonInlineLambda): Unit { + `this$0`.privateStringField = "${`this$0`.privateStringField}!";// 135 + return Unit.INSTANCE; } } class 'pkg/TestNonInlineLambda' { method 'testCaptureInt (I)V' { - 0 15 - 2 15 - 7 15 - b 15 - c 15 - d 15 - e 15 - f 15 - 10 15 - 11 16 + 2 16 + 9 16 + a 16 + b 16 + c 17 } method 'testCaptureObject (Ljava/lang/String;)V' { - 6 19 - 8 19 - d 19 - 11 19 - 12 19 - 13 19 - 14 19 - 15 19 - 16 19 - 17 20 + 8 20 + f 20 + 10 20 + 11 20 + 12 21 } method 'testCaptureIntIterationValue (Ljava/lang/Iterable;)V' { - 6 23 - 7 23 - 8 23 - 9 23 - a 23 - b 23 - c 23 - d 25 - e 25 - f 25 - 10 25 - 11 25 - 12 25 - 16 26 - 17 26 - 18 26 - 19 26 - 1a 26 - 1b 26 - 1c 26 - 1d 26 - 1e 26 - 1f 26 - 20 26 - 21 26 - 23 26 - 28 26 - 2c 26 - 2d 26 - 2e 26 - 2f 26 - 30 26 - 31 26 - 35 28 + 6 24 + 7 24 + 8 24 + 9 24 + a 24 + b 24 + c 24 + d 26 + e 26 + f 26 + 10 26 + 11 26 + 12 26 + 23 27 + 2a 27 + 2b 27 + 2c 27 + 30 29 } method 'testCaptureObjectIterationValue (Ljava/lang/Iterable;)V' { - 6 31 - 7 31 - 8 31 - 9 31 - a 31 - b 31 - c 31 - 16 31 - 17 31 - 18 31 - 19 31 - 1a 31 - 1b 31 - 1c 31 - 1d 31 - 1e 31 - 1f 31 - 20 32 - 25 32 - 29 32 - 2a 32 - 2b 32 - 2c 32 - 2d 32 - 2e 32 - 32 34 + 6 32 + 7 32 + 8 32 + 9 32 + a 32 + b 32 + c 32 + 16 32 + 17 32 + 18 32 + 19 32 + 1a 32 + 1b 32 + 1c 32 + 1d 32 + 1e 32 + 1f 32 + 20 33 + 27 33 + 28 33 + 29 33 + 2d 35 } method 'testCaptureMutableInt (I)V' { - 7 37 - 8 38 - 9 38 - a 38 - b 38 - c 38 - d 39 - 12 39 - 16 39 - 17 39 - 18 39 - 19 39 - 1a 39 - 1b 39 - 1c 40 - 1d 40 - 1e 40 - 1f 40 - 20 40 - 24 40 - 28 41 - 2d 41 - 31 41 - 32 41 - 33 41 - 34 41 - 35 41 - 36 41 - 37 42 - 3c 42 - 3d 42 - 3e 42 - 40 42 - 41 42 - 42 42 - 43 43 - 48 43 - 4c 43 - 4d 43 - 4e 43 - 4f 43 - 50 43 - 51 43 - 52 44 - 53 44 - 54 44 - 55 44 - 56 44 - 57 44 - 58 45 - 5d 45 - 61 45 - 62 45 - 63 45 - 64 45 - 65 45 - 66 45 - 67 46 - 6c 46 - 6e 46 - 6f 46 - 70 46 - 71 47 - 76 47 - 7a 47 - 7b 47 - 7c 47 - 7d 47 - 7e 47 - 7f 47 - 80 48 + 7 38 + 8 39 + 9 39 + a 39 + b 39 + c 39 + d 40 + 14 40 + 15 40 + 16 40 + 17 41 + 18 41 + 19 41 + 1a 41 + 1b 41 + 1f 41 + 23 42 + 2a 42 + 2b 42 + 2c 42 + 2d 43 + 32 43 + 33 43 + 34 43 + 36 43 + 37 43 + 38 43 + 39 44 + 40 44 + 41 44 + 42 44 + 43 45 + 44 45 + 45 45 + 46 45 + 47 45 + 48 45 + 49 46 + 50 46 + 51 46 + 52 46 + 53 47 + 58 47 + 5a 47 + 5b 47 + 5c 47 + 5d 48 + 64 48 + 65 48 + 66 48 + 67 49 } method 'testCaptureMutableObject (Ljava/lang/String;)V' { - d 51 - e 52 - f 52 - 10 52 - 11 52 - 12 52 - 13 53 - 18 53 - 1c 53 - 1d 53 - 1e 53 - 1f 53 - 20 53 - 21 53 - 22 54 - 23 54 - 24 54 - 25 54 - 26 54 - 27 54 - 28 54 - 29 54 - 2a 54 - 2b 54 - 2c 54 - 2d 54 - 2e 54 - 2f 55 - 34 55 - 38 55 - 39 55 - 3a 55 - 3b 55 - 3c 55 - 3d 55 - 3e 56 - 3f 56 - 40 56 - 41 56 - 42 56 - 43 56 - 44 56 - 45 56 - 46 56 - 47 56 - 48 56 - 49 56 - 4a 56 - 4b 56 - 4c 56 - 4d 56 - 4e 56 - 4f 56 - 50 56 - 51 56 - 52 56 - 53 57 - 58 57 - 5c 57 - 5d 57 - 5e 57 - 5f 57 - 60 57 - 61 57 - 62 58 - 63 58 - 64 58 - 65 58 - 66 58 - 67 58 - 68 59 - 6d 59 - 71 59 - 72 59 - 73 59 - 74 59 - 75 59 - 76 59 - 77 60 - 78 60 - 79 60 - 7a 60 - 7b 60 - 7c 60 - 7d 60 - 7e 60 - 7f 60 - 80 60 - 81 60 - 82 60 - 83 60 - 84 60 - 85 61 - 8a 61 - 8e 61 - 8f 61 - 90 61 - 91 61 - 92 61 - 93 61 - 94 62 + d 52 + e 53 + f 53 + 10 53 + 11 53 + 12 53 + 13 54 + 1a 54 + 1b 54 + 1c 54 + 1d 55 + 1e 55 + 1f 55 + 20 55 + 21 55 + 22 55 + 23 55 + 24 55 + 25 55 + 26 55 + 27 55 + 28 55 + 29 55 + 2a 56 + 31 56 + 32 56 + 33 56 + 34 57 + 35 57 + 36 57 + 37 57 + 38 57 + 39 57 + 3a 57 + 3b 57 + 3c 57 + 3d 57 + 3e 57 + 3f 57 + 40 57 + 41 57 + 42 57 + 43 57 + 44 57 + 45 57 + 46 57 + 47 57 + 48 57 + 49 58 + 50 58 + 51 58 + 52 58 + 53 59 + 54 59 + 55 59 + 56 59 + 57 59 + 58 59 + 59 60 + 60 60 + 61 60 + 62 60 + 63 61 + 64 61 + 65 61 + 66 61 + 67 61 + 68 61 + 69 61 + 6a 61 + 6b 61 + 6c 61 + 6d 61 + 6e 61 + 6f 61 + 70 61 + 71 62 + 78 62 + 79 62 + 7a 62 + 7b 63 } method 'testCaptureAndMutateInt (I)V' { - 7 65 - 8 66 - d 66 - 11 66 - 12 66 - 13 66 - 14 66 - 15 66 - 16 66 - 17 67 - 18 67 - 19 67 - 1a 67 - 1b 67 - 1c 67 - 1d 67 - 1e 68 - 23 68 - 27 68 - 28 68 - 29 68 - 2a 68 - 2b 68 - 2c 68 - 2d 69 + 7 66 + 8 67 + f 67 + 10 67 + 11 67 + 12 68 + 13 68 + 14 68 + 15 68 + 16 68 + 17 68 + 18 68 + 19 69 + 20 69 + 21 69 + 22 69 + 23 70 } method 'testCaptureAndMutateString (Ljava/lang/String;)V' { - d 72 - e 73 - f 73 - 10 73 - 11 73 - 12 73 - 13 73 - 14 74 - 19 74 - 1d 74 - 1e 74 - 1f 74 - 20 74 - 21 74 - 22 74 - 23 75 - 24 75 - 25 75 - 26 75 - 27 75 - 28 75 - 29 75 - 2a 75 - 2b 75 - 2c 75 - 2d 76 - 32 76 - 36 76 - 37 76 - 38 76 - 39 76 - 3a 76 - 3b 76 - 3c 77 + d 73 + e 74 + f 74 + 10 74 + 11 74 + 12 74 + 13 74 + 14 75 + 1b 75 + 1c 75 + 1d 75 + 1e 76 + 1f 76 + 20 76 + 21 76 + 22 76 + 23 76 + 24 76 + 25 76 + 26 76 + 27 76 + 28 77 + 2f 77 + 30 77 + 31 77 + 32 78 } method 'testCapturePublicMutableIntField ()V' { - 0 80 - 5 80 - 9 80 - a 80 - b 80 - c 80 - d 80 - e 80 - f 81 + 0 81 + 7 81 + 8 81 + 9 81 + a 82 } method 'testCapturePublicMutableStringField ()V' { - 0 84 - 5 84 - 9 84 - a 84 - b 84 - c 84 - d 84 - e 84 - f 85 + 0 85 + 7 85 + 8 85 + 9 85 + a 86 } method 'testCapturePrivateMutableIntField ()V' { - 0 88 - 5 88 - 9 88 - a 88 - b 88 - c 88 - d 88 - e 88 - f 89 + 0 89 + 7 89 + 8 89 + 9 89 + a 90 } method 'testCapturePrivateMutableStringField ()V' { - 0 92 - 5 92 - 9 92 - a 92 - b 92 - c 92 - d 92 - e 92 - f 93 + 0 93 + 7 93 + 8 93 + 9 93 + a 94 } method 'execute (Lkotlin/jvm/functions/Function0;)V' { - 6 96 + 7 97 } - method 'access$getPrivateIntField$p (Lpkg/TestNonInlineLambda;)I' { + method 'testCaptureInt$lambda$0 (I)Lkotlin/Unit;' { 0 101 1 101 2 101 3 101 4 101 + 5 101 + 6 101 + 7 102 + 8 102 + 9 102 + a 102 } - method 'access$setPrivateIntField$p (Lpkg/TestNonInlineLambda;I)V' { - 0 107 - 1 107 - 2 107 - 3 107 - 4 107 - 5 108 + method 'testCaptureObject$lambda$1 (Ljava/lang/String;)Lkotlin/Unit;' { + 7 107 + 8 107 + 9 107 + a 107 + b 107 + c 107 + d 107 + e 108 + f 108 + 10 108 + 11 108 } - method 'access$setPrivateStringField$p (Lpkg/TestNonInlineLambda;Ljava/lang/String;)V' { + method 'testCaptureIntIterationValue$lambda$2 (I)Lkotlin/Unit;' { 0 113 1 113 2 113 3 113 4 113 - 5 114 + 5 113 + 6 113 + 7 114 + 8 114 + 9 114 + a 114 + } + + method 'testCaptureObjectIterationValue$lambda$3 (Ljava/lang/String;)Lkotlin/Unit;' { + 7 119 + 8 119 + 9 119 + a 119 + b 119 + c 119 + d 119 + e 120 + f 120 + 10 120 + 11 120 + } + + method 'testCaptureMutableInt$lambda$4 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 125 + 8 125 + 9 125 + a 125 + c 125 + d 125 + e 125 + f 125 + 10 125 + 11 125 + 12 125 + 13 126 + 14 126 + 15 126 + 16 126 + } + + method 'testCaptureMutableInt$lambda$5 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 131 + 8 131 + 9 131 + a 131 + c 131 + d 131 + e 131 + f 131 + 10 131 + 11 131 + 12 131 + 13 132 + 14 132 + 15 132 + 16 132 + } + + method 'testCaptureMutableInt$lambda$6 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 137 + 8 137 + 9 137 + a 137 + c 137 + d 137 + e 137 + f 137 + 10 137 + 11 137 + 12 137 + 13 138 + 14 138 + 15 138 + 16 138 + } + + method 'testCaptureMutableInt$lambda$7 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 143 + 8 143 + 9 143 + a 143 + c 143 + d 143 + e 143 + f 143 + 10 143 + 11 143 + 12 143 + 13 144 + 14 144 + 15 144 + 16 144 + } + + method 'testCaptureMutableInt$lambda$8 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 149 + 8 149 + 9 149 + a 149 + c 149 + d 149 + e 149 + f 149 + 10 149 + 11 149 + 12 149 + 13 150 + 14 150 + 15 150 + 16 150 + } + + method 'testCaptureMutableObject$lambda$9 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 155 + 8 155 + 9 155 + a 155 + b 155 + c 155 + d 155 + f 155 + 10 155 + 11 155 + 12 156 + 13 156 + 14 156 + 15 156 + } + + method 'testCaptureMutableObject$lambda$10 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 161 + 8 161 + 9 161 + a 161 + b 161 + c 161 + d 161 + f 161 + 10 161 + 11 161 + 12 162 + 13 162 + 14 162 + 15 162 + } + + method 'testCaptureMutableObject$lambda$11 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 167 + 8 167 + 9 167 + a 167 + b 167 + c 167 + d 167 + f 167 + 10 167 + 11 167 + 12 168 + 13 168 + 14 168 + 15 168 + } + + method 'testCaptureMutableObject$lambda$12 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 173 + 8 173 + 9 173 + a 173 + b 173 + c 173 + d 173 + f 173 + 10 173 + 11 173 + 12 174 + 13 174 + 14 174 + 15 174 + } + + method 'testCaptureMutableObject$lambda$13 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 179 + 8 179 + 9 179 + a 179 + b 179 + c 179 + d 179 + f 179 + 10 179 + 11 179 + 12 180 + 13 180 + 14 180 + 15 180 + } + + method 'testCaptureAndMutateInt$lambda$14 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 185 + 8 185 + 9 185 + a 185 + b 185 + c 185 + d 185 + e 185 + f 185 + 10 186 + 11 186 + 12 186 + 13 186 + 18 186 + 1c 186 + 1e 186 + 1f 186 + 20 186 + 21 186 + 22 186 + 23 186 + 24 186 + 28 189 + 29 189 + 2a 189 + 2b 189 + } + + method 'testCaptureAndMutateInt$lambda$15 (Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/Unit;' { + 7 194 + 8 194 + 9 194 + a 194 + b 194 + c 194 + d 194 + e 195 + f 195 + 10 195 + 11 195 + 12 195 + 13 196 + 15 196 + 17 196 + 18 196 + 19 196 + 1a 197 + 1c 197 + 1d 197 + 1e 197 + 1f 197 + 20 197 + 21 197 + 22 197 + 26 200 + 27 200 + 28 200 + 29 200 + } + + method 'testCaptureAndMutateString$lambda$16 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 205 + 8 205 + 9 205 + a 205 + b 205 + c 205 + d 205 + e 205 + f 205 + 10 205 + 11 205 + 12 205 + 13 205 + 14 205 + 15 205 + 16 206 + 17 206 + 18 206 + 19 206 + 1a 206 + 1b 206 + 1c 206 + 1d 206 + 1e 206 + 1f 206 + 20 206 + 21 206 + 22 206 + 23 207 + 24 207 + 25 207 + 26 207 + 27 207 + 28 207 + 29 207 + 2b 207 + 2c 207 + 2d 207 + 31 210 + 32 210 + 33 210 + 34 210 + } + + method 'testCaptureAndMutateString$lambda$17 (Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/Unit;' { + 7 215 + 8 215 + 9 215 + a 215 + b 215 + c 215 + d 215 + e 215 + f 215 + 10 215 + 11 215 + 12 215 + 13 215 + 1c 216 + 1d 216 + 1e 216 + 1f 216 + 20 216 + 21 216 + 22 217 + 23 217 + 24 217 + 25 217 + 26 217 + 27 217 + 28 217 + 29 217 + 2a 217 + 2b 217 + 2c 217 + 2d 217 + 2e 217 + 2f 217 + 30 217 + 34 220 + 35 220 + 36 220 + 37 220 + } + + method 'testCapturePublicMutableIntField$lambda$18 (Lpkg/TestNonInlineLambda;)Lkotlin/Unit;' { + 7 225 + 8 225 + 9 225 + a 225 + b 225 + f 225 + 13 226 + 14 226 + 15 226 + 16 226 + } + + method 'testCapturePublicMutableStringField$lambda$19 (Lpkg/TestNonInlineLambda;)Lkotlin/Unit;' { + 7 231 + 8 231 + 9 231 + a 231 + b 231 + c 231 + d 231 + e 231 + f 231 + 10 231 + 11 231 + 12 231 + 13 231 + 14 232 + 15 232 + 16 232 + 17 232 + } + + method 'testCapturePrivateMutableIntField$lambda$20 (Lpkg/TestNonInlineLambda;)Lkotlin/Unit;' { + 7 237 + 8 237 + 9 237 + a 237 + b 237 + f 237 + 13 238 + 14 238 + 15 238 + 16 238 } - method 'access$getPrivateStringField$p (Lpkg/TestNonInlineLambda;)Ljava/lang/String;' { - 0 119 - 1 119 - 2 119 - 3 119 - 4 119 + method 'testCapturePrivateMutableStringField$lambda$21 (Lpkg/TestNonInlineLambda;)Lkotlin/Unit;' { + 7 243 + 8 243 + 9 243 + a 243 + b 243 + c 243 + d 243 + e 243 + f 243 + 10 243 + 11 243 + 12 243 + 13 243 + 14 244 + 15 244 + 16 244 + 17 244 } } Lines mapping: -3 <-> 120 -7 <-> 16 -8 <-> 16 -11 <-> 17 -14 <-> 20 -15 <-> 20 -18 <-> 21 -21 <-> 24 -22 <-> 27 -26 <-> 29 -29 <-> 32 -30 <-> 33 -34 <-> 35 -37 <-> 38 -38 <-> 40 -41 <-> 41 -42 <-> 42 -45 <-> 43 -46 <-> 44 -49 <-> 45 -50 <-> 46 -53 <-> 47 -54 <-> 48 -57 <-> 49 -60 <-> 52 -61 <-> 54 -64 <-> 55 -65 <-> 56 -68 <-> 57 -69 <-> 58 -72 <-> 59 -73 <-> 60 -76 <-> 61 -77 <-> 62 -80 <-> 63 -83 <-> 66 -84 <-> 67 -89 <-> 68 -90 <-> 69 -95 <-> 70 -98 <-> 73 -99 <-> 75 -105 <-> 76 -106 <-> 77 -112 <-> 78 -117 <-> 81 -118 <-> 82 -123 <-> 85 -124 <-> 86 -129 <-> 89 -130 <-> 90 -135 <-> 93 -136 <-> 94 -141 <-> 97 +8 <-> 17 +9 <-> 102 +10 <-> 103 +11 <-> 18 +15 <-> 21 +16 <-> 108 +17 <-> 109 +18 <-> 22 +21 <-> 25 +22 <-> 28 +23 <-> 114 +24 <-> 115 +26 <-> 30 +29 <-> 33 +30 <-> 34 +31 <-> 120 +32 <-> 121 +34 <-> 36 +37 <-> 39 +38 <-> 41 +39 <-> 126 +40 <-> 127 +41 <-> 42 +42 <-> 43 +43 <-> 132 +44 <-> 133 +45 <-> 44 +46 <-> 45 +47 <-> 138 +48 <-> 139 +49 <-> 46 +50 <-> 47 +51 <-> 144 +52 <-> 145 +53 <-> 48 +54 <-> 49 +55 <-> 150 +56 <-> 151 +57 <-> 50 +60 <-> 53 +61 <-> 55 +62 <-> 156 +63 <-> 157 +64 <-> 56 +65 <-> 57 +66 <-> 162 +67 <-> 163 +68 <-> 58 +69 <-> 59 +70 <-> 168 +71 <-> 169 +72 <-> 60 +73 <-> 61 +74 <-> 174 +75 <-> 175 +76 <-> 62 +77 <-> 63 +78 <-> 180 +79 <-> 181 +80 <-> 64 +83 <-> 67 +84 <-> 68 +85 <-> 186 +86 <-> 187 +88 <-> 190 +89 <-> 69 +90 <-> 70 +91 <-> 195 +92 <-> 196 +94 <-> 201 +95 <-> 71 +98 <-> 74 +99 <-> 76 +100 <-> 206 +101 <-> 207 +102 <-> 208 +104 <-> 211 +105 <-> 77 +106 <-> 78 +107 <-> 216 +108 <-> 217 +109 <-> 218 +111 <-> 221 +112 <-> 79 +117 <-> 226 +118 <-> 83 +123 <-> 232 +124 <-> 87 +129 <-> 238 +130 <-> 91 +135 <-> 244 +136 <-> 95 +141 <-> 98 +Not mapped: +7 +14 diff --git a/plugins/kotlin/testData/results/pkg/TestNothingReturns.dec b/plugins/kotlin/testData/results/pkg/TestNothingReturns.dec index 26e29647a7..6f9994490d 100644 --- a/plugins/kotlin/testData/results/pkg/TestNothingReturns.dec +++ b/plugins/kotlin/testData/results/pkg/TestNothingReturns.dec @@ -1,6 +1,6 @@ package pkg -class TestNothingReturns { +public class TestNothingReturns { public fun loop(): Nothing { while (true) { System.out.println("loop");// 6 @@ -78,6 +78,8 @@ class 'pkg/TestNothingReturns' { method 'test3 (I)I' { 0 20 1 20 + 2 20 + 3 20 4 21 5 21 6 21 @@ -122,6 +124,8 @@ class 'pkg/TestNothingReturns' { method 'test6 (Ljava/lang/String;)Ljava/lang/String;' { 0 40 2 40 + 3 40 + 4 40 6 41 7 41 8 41 diff --git a/plugins/kotlin/testData/results/pkg/TestNullable.dec b/plugins/kotlin/testData/results/pkg/TestNullable.dec index 5cda97427b..3abd08d7e6 100644 --- a/plugins/kotlin/testData/results/pkg/TestNullable.dec +++ b/plugins/kotlin/testData/results/pkg/TestNullable.dec @@ -1,6 +1,6 @@ package pkg -class TestNullable { +public class TestNullable { public fun nullableParams(v: String, vn: String?) { }// 6 diff --git a/plugins/kotlin/testData/results/pkg/TestNullableOperator.dec b/plugins/kotlin/testData/results/pkg/TestNullableOperator.dec index a8636ad41c..4a42bb2ef5 100644 --- a/plugins/kotlin/testData/results/pkg/TestNullableOperator.dec +++ b/plugins/kotlin/testData/results/pkg/TestNullableOperator.dec @@ -1,6 +1,6 @@ package pkg -class TestNullableOperator { +public class TestNullableOperator { public fun test(x: Int?): Int { return x ?: 0;// 5 } @@ -47,22 +47,16 @@ class TestNullableOperator { }// 26 public fun test5(x: Exception?) { - var var10000: Unit; if (x != null) {// 29 x.printStackTrace(); - var10000 = Unit.INSTANCE; } else { - var10000 = null; - } - - if (var10000 == null) { throw new Exception(); } - }// 30 + } public fun test6(x: Int?): Int { if (x != null) {// 33 - var y: Int = x; + val y: Int = x; System.out.println(y);// 35 return y;// 37 } else { @@ -87,47 +81,50 @@ class 'pkg/TestNullableOperator' { method 'test2 (Ljava/lang/String;)Ljava/lang/String;' { 0 8 2 9 + 3 9 + 4 9 6 10 + 7 10 8 13 } method 'test2_1 (Ljava/lang/Object;)Ljava/lang/Object;' { 0 17 2 18 + 3 18 + 4 18 6 19 + 7 19 8 22 } method 'test2_2 (Ljava/lang/Object;)Ljava/lang/Object;' { 0 26 2 27 + 3 27 + 4 27 6 28 + 7 28 8 31 } method 'test3 (Ljava/lang/Integer;)I' { 0 35 2 35 + 3 35 + 4 35 5 36 6 36 7 36 8 36 - 9 36 - a 36 - b 36 - c 36 - d 36 - e 36 - f 36 - 10 36 - 11 36 - 12 36 - 13 36 + 13 38 } method 'test4 (Ljava/lang/Exception;)V' { 0 43 2 43 + 3 43 + 4 43 5 44 6 44 7 44 @@ -135,58 +132,52 @@ class 'pkg/TestNullableOperator' { } method 'test5 (Ljava/lang/Exception;)V' { - 0 50 - 2 50 - 5 51 - 6 51 - 7 51 - 8 52 - 9 52 - a 52 - f 54 - 10 57 - 1a 58 - 1b 60 + 0 49 + 2 49 + 3 49 + 4 49 + 5 50 + 6 50 + 7 50 + 8 54 + 13 52 } method 'test6 (Ljava/lang/Integer;)I' { - 0 63 - 2 63 - 5 64 - 6 64 - 7 64 - 8 64 - 9 64 - a 64 - b 64 - c 64 - d 64 - e 65 - f 65 - 10 65 - 11 65 - 12 65 - 13 66 - 14 66 - 15 66 - 16 66 + 0 57 + 2 57 + 3 57 + 4 57 + 5 58 + 6 58 + 7 58 + 8 58 + c 62 + d 62 + e 59 + f 59 + 10 59 + 12 59 + 13 59 + 14 59 + 16 60 } method 'test6_1 (Ljava/lang/Integer;)V' { - 0 73 - 2 73 - 5 74 - 6 74 - 7 74 - c 76 - d 74 - e 74 - f 74 - 10 74 - 11 74 - 12 76 - 13 76 - 14 76 + 0 67 + 2 67 + 3 67 + 4 67 + 5 68 + 6 68 + 7 68 + c 70 + d 68 + e 68 + f 68 + 11 68 + 12 68 + 13 68 } } @@ -198,12 +189,12 @@ Lines mapping: 21 <-> 36 25 <-> 44 26 <-> 47 -29 <-> 51 -30 <-> 61 -33 <-> 64 -35 <-> 66 -37 <-> 67 -41 <-> 74 -43 <-> 75 +29 <-> 50 +33 <-> 58 +35 <-> 60 +37 <-> 61 +41 <-> 68 +43 <-> 69 Not mapped: +30 44 diff --git a/plugins/kotlin/testData/results/pkg/TestObject.dec b/plugins/kotlin/testData/results/pkg/TestObject.dec index 3e7e6e42c7..bedcb7eaf3 100644 --- a/plugins/kotlin/testData/results/pkg/TestObject.dec +++ b/plugins/kotlin/testData/results/pkg/TestObject.dec @@ -1,13 +1,9 @@ package pkg -object TestObject private constructor() { - @JvmStatic - public TestObject INSTANCE = new TestObject(); - - public const val objectConstVal: Int = 926 - public final val objectVal: Regex = new Regex("") +public object TestObject { private final var objectVar: Int = 42 - + public final val objectVal: Regex = new Regex("") + public const val objectConstVal: Int = 926 public fun objectFun() { objectVar += -1;// 5 @@ -15,31 +11,31 @@ object TestObject private constructor() { @JvmStatic public fun objectJvmStaticFun() { - var var0: Int = objectVar++;// 16 + val var0: Int = objectVar++;// 16 }// 17 } class 'pkg/TestObject' { method 'objectFun ()V' { - 5 12 - 7 12 - 8 12 - 9 12 - a 13 + 5 8 + 7 8 + 8 8 + 9 8 + a 9 } method 'objectJvmStaticFun ()V' { - 4 17 - 5 17 - 6 17 - 7 17 - a 17 - e 18 + 0 13 + 1 13 + 2 13 + 3 13 + a 13 + e 14 } } Lines mapping: -5 <-> 13 -6 <-> 14 -16 <-> 18 -17 <-> 19 +5 <-> 9 +6 <-> 10 +16 <-> 14 +17 <-> 15 diff --git a/plugins/kotlin/testData/results/pkg/TestParams.dec b/plugins/kotlin/testData/results/pkg/TestParams.dec index d35e235e6b..0630550fe9 100644 --- a/plugins/kotlin/testData/results/pkg/TestParams.dec +++ b/plugins/kotlin/testData/results/pkg/TestParams.dec @@ -1,6 +1,6 @@ package pkg -class TestParams { +public class TestParams { public fun printMessageUnit(message: String) { System.out.println(message);// 5 }// 6 @@ -17,20 +17,10 @@ class TestParams { return x * y;// 15 } - public fun printMessageWithPrefix(message: String, prefix: String) { - System.out.println("[" + prefix + "] " + message);// 19 + public fun printMessageWithPrefix(message: String, prefix: String = "Info") { + System.out.println("[$prefix] $message");// 19 }// 20 - @JvmStatic - @JvmSynthetic - fun `printMessageWithPrefix$default`(var0: TestParams, var1: java.lang.String, var2: java.lang.String, var3: Int, var4: Any) { - if ((var3 and 2) != 0) {// 18 - var2 = "Info"; - } - - var0.printMessageWithPrefix(var1, var2); - } - public fun callPrintMessage() { printMessageWithPrefix$default(this, "Test", null, 2, null);// 23 this.printMessageWithPrefix("Test", "Debug");// 24 @@ -75,6 +65,8 @@ class 'pkg/TestParams' { } method 'printMessageWithPrefix (Ljava/lang/String;Ljava/lang/String;)V' { + 6 19 + 7 19 c 20 d 20 e 20 @@ -91,42 +83,25 @@ class 'pkg/TestParams' { 1a 21 } - method 'printMessageWithPrefix$default (Lpkg/TestParams;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)V' { - 0 26 - 1 26 - 2 26 - 3 26 - 6 27 - 7 27 - 8 27 - 9 30 - a 30 - b 30 - c 30 - d 30 - e 30 - f 31 - } - method 'callPrintMessage ()V' { - 0 34 - 1 34 - 2 34 - 3 34 - 4 34 - 5 34 - 6 34 - 7 34 - 8 34 - 9 35 - a 35 - b 35 - c 35 - d 35 - e 35 - f 35 - 10 35 - 11 36 + 0 24 + 1 24 + 2 24 + 3 24 + 4 24 + 5 24 + 6 24 + 7 24 + 8 24 + 9 25 + a 25 + b 25 + c 25 + d 25 + e 25 + f 25 + 10 25 + 11 26 } } @@ -137,9 +112,8 @@ Lines mapping: 10 <-> 10 12 <-> 13 15 <-> 17 -18 <-> 27 19 <-> 21 20 <-> 22 -23 <-> 35 -24 <-> 36 -25 <-> 37 +23 <-> 25 +24 <-> 26 +25 <-> 27 diff --git a/plugins/kotlin/testData/results/pkg/TestPoorNames.dec b/plugins/kotlin/testData/results/pkg/TestPoorNames.dec index 2af7540612..a3b46aed08 100644 --- a/plugins/kotlin/testData/results/pkg/TestPoorNames.dec +++ b/plugins/kotlin/testData/results/pkg/TestPoorNames.dec @@ -1,9 +1,8 @@ package pkg -class TestPoorNames { - public final val `Dangerous property name?!`: String = "test" +public class TestPoorNames { public final val `Property with spaces`: Int = 42 - + public final val `Dangerous property name?!`: String = "test" public fun `Function with spaces`() { }// 5 @@ -23,51 +22,50 @@ class TestPoorNames { this.functionWithParameters(42, "test");// 24 }// 25 - class `Class with spaces` { - } + public class `Class with spaces` } class 'pkg/TestPoorNames' { method 'Function with spaces ()V' { - 0 8 + 0 7 } method 'Dangerous function name?! ()V' { - 0 11 + 0 10 } method 'functionWith$Dollar ()V' { - 0 14 + 0 13 } method 'functionWithParameters (ILjava/lang/String;)V' { - 6 17 + 6 16 } method 'test ()V' { - 8 21 - 9 21 - a 21 - b 21 - c 22 - d 22 - e 22 - f 22 - 10 22 - 11 22 - 12 22 - 13 22 - 14 23 + 8 20 + 9 20 + a 20 + b 20 + c 21 + d 21 + e 21 + f 21 + 10 21 + 11 21 + 12 21 + 13 21 + 14 22 } } Lines mapping: -5 <-> 9 -8 <-> 12 -14 <-> 15 -17 <-> 18 -23 <-> 22 -24 <-> 23 -25 <-> 24 +5 <-> 8 +8 <-> 11 +14 <-> 14 +17 <-> 17 +23 <-> 21 +24 <-> 22 +25 <-> 23 Not mapped: 22 diff --git a/plugins/kotlin/testData/results/pkg/TestReflection.dec b/plugins/kotlin/testData/results/pkg/TestReflection.dec index 9126567a5b..d5f6d31a16 100644 --- a/plugins/kotlin/testData/results/pkg/TestReflection.dec +++ b/plugins/kotlin/testData/results/pkg/TestReflection.dec @@ -3,7 +3,7 @@ package pkg import kotlin.jvm.functions.Function1 import kotlin.reflect.KFunction -class TestReflection { +public class TestReflection { public fun testClassReference() { System.out.println(TestReflection::class);// 5 System.out.println(TestReflection::class.java);// 6 @@ -23,7 +23,7 @@ class TestReflection { }// 20 public fun testFunctionReference() { - var f: KFunction = .INSTANCE as KFunction;// 23 + val f: KFunction = .INSTANCE as KFunction;// 23 System.out.println(.INSTANCE as KFunction);// 24 (f as Function1).invoke(new TestReflection());// 25 }// 26 @@ -39,14 +39,13 @@ class 'pkg/TestReflection' { c 7 d 8 e 8 + f 8 10 8 11 8 - 12 8 13 8 14 8 15 8 - 16 8 - 17 9 + 16 9 } method 'testPrimitiveWrapper ()V' { @@ -58,34 +57,33 @@ class 'pkg/TestReflection' { d 12 e 13 f 13 + 10 13 11 13 12 13 - 13 13 14 13 15 13 16 13 - 17 13 - 18 14 + 17 14 } method 'testPrimitiveType ()V' { + 3 17 4 17 5 17 - 6 17 + 7 17 8 17 9 17 - a 17 - b 18 + a 18 } method 'testInferredPrimitive ()V' { + 3 21 4 21 5 21 - 6 21 + 7 21 8 21 9 21 - a 21 - b 22 + a 22 } method 'testFunctionReference ()V' { diff --git a/plugins/kotlin/testData/results/pkg/TestSafeCasts.dec b/plugins/kotlin/testData/results/pkg/TestSafeCasts.dec index f8429bc7fe..1c39df0139 100644 --- a/plugins/kotlin/testData/results/pkg/TestSafeCasts.dec +++ b/plugins/kotlin/testData/results/pkg/TestSafeCasts.dec @@ -1,9 +1,9 @@ package pkg -class TestSafeCasts { +public class TestSafeCasts { public fun test(obj: Any): Boolean { - var t: Int = obj as? Integer;// 5 - if ((obj as? Integer) != null) {// 7 + val t: Int = obj as? Int;// 5 + if ((obj as? Int) != null) {// 7 if (t == 1) { return true; } @@ -13,11 +13,11 @@ class TestSafeCasts { } public fun testTestBefore(obj: Any): Boolean? { - if (obj !is Integer) {// 11 + if (obj !is Int) {// 11 return null;// 12 } else { - var t: Int = obj as? Integer;// 15 - if ((obj as? Integer) != null) {// 17 + val t: Int = obj as? Int;// 15 + if ((obj as? Int) != null) {// 17 if (t == 1) { return true; } @@ -32,12 +32,12 @@ class TestSafeCasts { } public fun testSmartCastIncompatible(obj: Any): Boolean { - return obj is Integer && (obj as? java.lang.String) == "1";// 27 31 33 + return obj is Int && (obj as? java.lang.String) == "1";// 27 31 33 } public fun testCastNonNullToNullable(obj: Any): Boolean { - var t: Int = obj as? Integer;// 37 - if ((obj as? Integer) != null) {// 39 + val t: Int = obj as? Int;// 37 + if ((obj as? Int) != null) {// 39 if (t == 1) { return true; } @@ -47,11 +47,11 @@ class TestSafeCasts { } public fun testBeforeNonNullToNullable(obj: Any): Boolean? { - if (obj !is Integer) {// 43 + if (obj !is Int) {// 43 return null;// 44 } else { - var t: Int = obj as? Integer;// 47 - if ((obj as? Integer) != null) {// 49 + val t: Int = obj as? Int;// 47 + if ((obj as? Int) != null) {// 49 if (t == 1) { return true; } @@ -62,8 +62,8 @@ class TestSafeCasts { } public fun testCastNullableToNullable(obj: Any?): Boolean { - var t: Int = obj as? Integer;// 53 - if ((obj as? Integer) != null) {// 55 + val t: Int = obj as? Int;// 53 + if ((obj as? Int) != null) {// 55 if (t == 1) { return true; } @@ -73,11 +73,11 @@ class TestSafeCasts { } public fun testBeforeNullableToNullable(obj: Any?): Boolean? { - if (obj != null && obj !is Integer) {// 59 + if (obj != null && obj !is Int) {// 59 return null;// 60 } else { - var t: Int = obj as? Integer;// 63 - if ((obj as? Integer) != null) {// 65 + val t: Int = obj as? Int;// 63 + if ((obj as? Int) != null) {// 65 if (t == 1) { return true; } @@ -91,16 +91,22 @@ class TestSafeCasts { class 'pkg/TestSafeCasts' { method 'test (Ljava/lang/Object;)Z' { a 4 + b 4 + c 4 d 4 15 4 16 5 17 6 1a 5 + 1b 5 + 1c 5 21 6 22 6 23 6 24 6 25 6 + 26 6 + 27 6 28 7 2c 11 2d 7 @@ -109,29 +115,40 @@ class 'pkg/TestSafeCasts' { method 'testTestBefore (Ljava/lang/Object;)Ljava/lang/Boolean;' { 6 15 a 15 + b 15 + c 15 d 16 e 16 - 13 18 + f 18 + 15 18 16 18 - 1e 18 - 1f 19 - 20 20 - 23 19 - 2a 20 - 2b 20 + 17 18 + 18 18 + 20 18 + 21 19 + 22 20 + 25 19 + 26 19 + 27 19 2c 20 2d 20 2e 20 - 31 21 - 35 25 - 36 21 - 37 21 + 2f 20 + 30 20 + 31 20 + 32 20 + 33 21 + 37 25 38 21 39 21 + 3a 21 + 3b 21 } method 'testHardIncompatible (I)Z' { 7 30 + 8 30 + 9 30 a 30 b 30 c 30 @@ -148,25 +165,36 @@ class 'pkg/TestSafeCasts' { 8 34 9 34 a 34 - 13 34 + b 34 + c 34 + f 34 + 15 34 16 34 - 1f 34 - 20 34 + 17 34 + 18 34 21 34 + 22 34 + 23 34 } method 'testCastNonNullToNullable (Ljava/lang/Object;)Z' { a 38 + b 38 + c 38 d 38 15 38 16 39 17 40 1a 39 + 1b 39 + 1c 39 21 40 22 40 23 40 24 40 25 40 + 26 40 + 27 40 28 41 2c 45 2d 41 @@ -175,39 +203,54 @@ class 'pkg/TestSafeCasts' { method 'testBeforeNonNullToNullable (Ljava/lang/Object;)Ljava/lang/Boolean;' { 6 49 a 49 + b 49 + c 49 d 50 e 50 - 13 52 + f 52 + 15 52 16 52 - 1e 52 - 1f 53 - 20 54 - 23 53 - 2a 54 - 2b 54 + 17 52 + 18 52 + 20 52 + 21 53 + 22 54 + 25 53 + 26 53 + 27 53 2c 54 2d 54 2e 54 - 31 55 - 35 59 - 36 55 - 37 55 + 2f 54 + 30 54 + 31 54 + 32 54 + 33 55 + 37 59 38 55 39 55 + 3a 55 + 3b 55 } method 'testCastNullableToNullable (Ljava/lang/Object;)Z' { 4 64 + 5 64 + 6 64 7 64 f 64 10 65 11 66 14 65 + 15 65 + 16 65 1b 66 1c 66 1d 66 1e 66 1f 66 + 20 66 + 21 66 22 67 26 71 27 67 @@ -216,27 +259,40 @@ class 'pkg/TestSafeCasts' { method 'testBeforeNullableToNullable (Ljava/lang/Object;)Ljava/lang/Boolean;' { 0 75 2 75 + 3 75 + 4 75 a 75 + b 75 + c 75 d 75 + e 75 + f 75 10 76 11 76 - 16 78 + 12 78 + 18 78 19 78 - 21 78 - 22 79 - 23 80 - 26 79 - 2d 80 - 2e 80 + 1a 78 + 1b 78 + 23 78 + 24 79 + 25 80 + 28 79 + 29 79 + 2a 79 2f 80 30 80 31 80 - 34 81 - 38 85 - 39 81 - 3a 81 + 32 80 + 33 80 + 34 80 + 35 80 + 36 81 + 3a 85 3b 81 3c 81 + 3d 81 + 3e 81 } } diff --git a/plugins/kotlin/testData/results/pkg/TestSealedHierarchy.dec b/plugins/kotlin/testData/results/pkg/TestSealedHierarchy.dec index 2e488973aa..d1f883b898 100644 --- a/plugins/kotlin/testData/results/pkg/TestSealedHierarchy.dec +++ b/plugins/kotlin/testData/results/pkg/TestSealedHierarchy.dec @@ -1,7 +1,7 @@ package pkg -sealed class TestSealedHierarchy protected constructor() { - class TestClass(x: Int) : TestSealedHierarchy() {// 5 +public sealed class TestSealedHierarchy protected constructor() { + public class TestClass(x: Int) : TestSealedHierarchy() {// 5 public final val x: Int init { @@ -9,11 +9,7 @@ sealed class TestSealedHierarchy protected constructor() { } } - object TestObject private constructor() : TestSealedHierarchy() {// 4 - @JvmStatic - public TestSealedHierarchy.TestObject INSTANCE = new TestSealedHierarchy.TestObject(); - - } + public object TestObject : TestSealedHierarchy()// 4 } class 'pkg/TestSealedHierarchy$TestClass' { diff --git a/plugins/kotlin/testData/results/pkg/TestShadowParam.dec b/plugins/kotlin/testData/results/pkg/TestShadowParam.dec index ac3433aacf..85a7ea66ee 100644 --- a/plugins/kotlin/testData/results/pkg/TestShadowParam.dec +++ b/plugins/kotlin/testData/results/pkg/TestShadowParam.dec @@ -1,8 +1,8 @@ package pkg -class TestShadowParam { +public class TestShadowParam { public fun test(x: Int) { - var xx: Int = x - 1;// 5 6 + val xx: Int = x - 1;// 5 6 System.out.println(x - 1);// 7 if (xx < 0) {// 8 System.out.println(xx);// 9 @@ -25,11 +25,15 @@ class 'pkg/TestShadowParam' { b 5 c 6 d 6 + e 6 + f 6 10 7 11 7 12 7 13 7 14 7 + 15 7 + 16 7 17 9 } } diff --git a/plugins/kotlin/testData/results/pkg/TestSmartCasts.dec b/plugins/kotlin/testData/results/pkg/TestSmartCasts.dec index 0d58d4ecce..5e7f5b1e71 100644 --- a/plugins/kotlin/testData/results/pkg/TestSmartCasts.dec +++ b/plugins/kotlin/testData/results/pkg/TestSmartCasts.dec @@ -1,38 +1,34 @@ package pkg -class TestSmartCasts { +public class TestSmartCasts { public fun testWhen(o: Any?): String { if (o is java.lang.String) {// 19 20 return o as java.lang.String;// 21 } else { if (o is TestSmartCasts.A.B) {// 24 - System.out.println("B: " + o); + System.out.println("B: $o"); } else { if (o !is TestSmartCasts.A.C) {// 25 if (o is Pair) {// 26 - return "<" + this.testWhen((o as Pair).getFirst()) + ", " + this.testWhen((o as Pair).getSecond()) + ">"; + return "<${this.testWhen((o as Pair).getFirst())}, ${this.testWhen((o as Pair).getSecond())}>"; } if (o == null) {// 27 return "null"; } - return "else: " + o;// 28 + return "else: $o";// 28 } - System.out.println("C: " + o); + System.out.println("C: $o"); } - if (o == null) {// 31 - throw new NullPointerException("null cannot be cast to non-null type pkg.TestSmartCasts.A"); - } else { - return (o as TestSmartCasts.A).test(); - } + return (o as TestSmartCasts.A).test();// 31 } } public fun testIf(a: Any?): String { - return if (a !is TestSmartCasts.A.B && a !is TestSmartCasts.A.C) "else: " + a else (a as TestSmartCasts.A).test();// 35 36 39 + return if (a !is TestSmartCasts.A.B && a !is TestSmartCasts.A.C) "else: $a" else (a as TestSmartCasts.A).test();// 35 36 39 } public fun testIf2(a: Any?): String { @@ -53,19 +49,15 @@ class TestSmartCasts { } } - return "else: " + a;// 60 + return "else: $a";// 60 } public fun testCast(a: Any?) { System.out.println(a);// 64 - if (a == null) {// 65 - throw new NullPointerException("null cannot be cast to non-null type kotlin.String"); - } else { - System.out.println("hello");// 66 - System.out.println(a);// 67 - (a as java.lang.String).charAt(0);// 68 - System.out.println((a as java.lang.String).charAt(0));// 69 - } + System.out.println("hello");// 66 + System.out.println(a);// 67 + (a as java.lang.String).charAt(0);// 68 + System.out.println((a as java.lang.String).charAt(0));// 69 }// 70 public fun testSealedIf(a: pkg.TestSmartCasts.A): String { @@ -77,35 +69,35 @@ class TestSmartCasts { } public fun testDoubleType(t: List): String { - return if (t is TestSmartCasts.X) (t as TestSmartCasts.X).woo(t as java.lang.Iterable) else t.get(0) as java.lang.String;// 83 84 87 + return if (t is TestSmartCasts.X) (t as TestSmartCasts.X).woo(t as MutableIterable<*>) else t.get(0) as java.lang.String;// 83 84 87 } - sealed class A protected constructor() { + public sealed class A protected constructor() { public fun test(): String { return "";// 15 } - class B : TestSmartCasts.A() {// 8 + public class B : TestSmartCasts.A() {// 8 public fun testB(): String { return "B";// 9 } } - class C : TestSmartCasts.A() {// 11 + public class C : TestSmartCasts.A() {// 11 public fun testC(): String { return "C";// 12 } } } - interface X { + public interface X { public open fun Iterable<*>.woo(): String { } // $VF: Class flags could not be determined internal class DefaultImpls { @JvmStatic - fun woo(var0: TestSmartCasts.X, receiver: MutableIterable<*>): java.lang.String { + fun woo(`$this`: TestSmartCasts.X, `$receiver`: MutableIterable<*>): java.lang.String { return "A";// 5 } } @@ -120,6 +112,8 @@ class 'pkg/TestSmartCasts' { 4 4 5 4 6 4 + 7 4 + 8 4 9 5 a 5 b 5 @@ -130,6 +124,8 @@ class 'pkg/TestSmartCasts' { 10 7 11 7 12 7 + 13 7 + 14 7 15 8 16 8 17 8 @@ -144,6 +140,8 @@ class 'pkg/TestSmartCasts' { 21 8 25 10 29 10 + 2a 10 + 2b 10 2c 22 2d 22 2e 22 @@ -161,6 +159,8 @@ class 'pkg/TestSmartCasts' { 3e 11 3f 11 40 11 + 41 11 + 42 11 43 12 44 12 45 12 @@ -191,6 +191,8 @@ class 'pkg/TestSmartCasts' { 5e 12 5f 15 60 15 + 61 15 + 62 15 63 16 64 16 65 16 @@ -202,310 +204,333 @@ class 'pkg/TestSmartCasts' { 6b 19 6c 19 6d 25 - 6f 25 - 77 26 - 78 26 - 7c 26 - 7d 28 - 7e 28 - 7f 28 - 80 28 - 81 28 - 82 28 - 83 28 + 74 25 + 75 25 + 76 25 + 77 25 + 78 25 + 79 25 + 7a 25 } method 'testIf (Ljava/lang/Object;)Ljava/lang/String;' { - 0 34 - 4 34 - 7 34 - b 34 - e 34 - f 34 - 10 34 - 11 34 - 12 34 - 13 34 - 14 34 - 16 34 - 17 34 - 18 34 - 19 34 - 1a 34 - 1b 34 + 0 30 + 4 30 + 5 30 + 6 30 + 7 30 + b 30 + c 30 + d 30 + e 30 + f 30 + 10 30 + 11 30 + 12 30 + 13 30 + 14 30 + 16 30 + 17 30 + 18 30 + 19 30 + 1a 30 + 1b 30 } method 'testIf2 (Ljava/lang/Object;)Ljava/lang/String;' { - 0 38 - 1 38 - 2 38 - 3 38 - 4 38 - 7 39 - 8 39 - 9 39 - a 39 - b 39 - e 39 - f 39 - 10 39 - 11 39 - 12 39 - 15 40 - 16 40 - 17 40 - 18 40 - 19 40 - 1a 40 - 1b 40 - 1c 40 - 1d 40 - 1e 40 - 20 40 - 23 43 - 24 43 - 25 43 - 26 43 - 27 43 - 2a 44 - 2b 44 - 2c 44 - 2d 44 - 2e 44 - 31 45 - 32 45 - 33 45 - 34 45 - 35 45 - 36 45 - 37 45 - 38 45 - 39 45 - 3a 45 - 3c 45 - 3d 45 - 3e 45 - 3f 46 - 40 46 - 41 46 - 42 46 - 43 46 - 44 46 - 45 46 - 46 46 - 47 46 - 48 46 - 4a 46 - 4d 49 - 4e 49 - 4f 49 - 50 49 - 51 49 - 54 49 - 55 49 - 56 49 - 57 49 - 58 49 - 59 49 - 5a 49 - 5b 49 - 5c 49 - 60 49 - 63 49 - 64 49 - 65 49 - 66 49 - 67 49 - 6a 50 - 6b 50 - 6c 50 - 6d 50 - 6e 50 - 6f 50 - 70 50 - 71 50 - 72 50 - 73 50 - 75 50 - 78 55 - 79 55 - 7a 55 - 7b 55 - 7c 55 - 7d 55 - 7e 55 + 0 34 + 1 34 + 2 34 + 3 34 + 4 34 + 5 34 + 6 34 + 7 35 + 8 35 + 9 35 + a 35 + b 35 + c 35 + d 35 + e 35 + f 35 + 10 35 + 11 35 + 12 35 + 13 35 + 14 35 + 15 36 + 16 36 + 17 36 + 18 36 + 19 36 + 1a 36 + 1b 36 + 1c 36 + 1d 36 + 1e 36 + 20 36 + 21 36 + 22 36 + 23 39 + 24 39 + 25 39 + 26 39 + 27 39 + 28 39 + 29 39 + 2a 40 + 2b 40 + 2c 40 + 2d 40 + 2e 40 + 2f 40 + 30 40 + 31 41 + 32 41 + 33 41 + 34 41 + 35 41 + 36 41 + 37 41 + 38 41 + 39 41 + 3a 41 + 3c 41 + 3d 41 + 3e 41 + 3f 42 + 40 42 + 41 42 + 42 42 + 43 42 + 44 42 + 45 42 + 46 42 + 47 42 + 48 42 + 4a 42 + 4b 42 + 4c 42 + 4d 45 + 4e 45 + 4f 45 + 50 45 + 51 45 + 52 45 + 53 45 + 54 45 + 55 45 + 56 45 + 57 45 + 58 45 + 59 45 + 5a 45 + 5b 45 + 5c 45 + 60 45 + 61 45 + 62 45 + 63 45 + 64 45 + 65 45 + 66 45 + 67 45 + 68 45 + 69 45 + 6a 46 + 6b 46 + 6c 46 + 6d 46 + 6e 46 + 6f 46 + 70 46 + 71 46 + 72 46 + 73 46 + 75 46 + 76 46 + 77 46 + 78 51 + 79 51 + 7a 51 + 7b 51 + 7c 51 + 7d 51 + 7e 51 } method 'testCast (Ljava/lang/Object;)V' { - 0 59 - 1 59 - 2 59 - 3 59 - 4 59 - 5 59 - 6 59 - 7 60 - 9 60 - 11 61 - 12 61 - 16 61 - 1b 63 - 1c 63 - 1d 63 - 1e 63 - 1f 63 - 21 63 - 22 63 - 23 63 - 24 64 - 25 64 - 26 64 - 27 64 - 28 64 - 29 64 - 2a 64 - 2b 65 - 2c 65 - 2d 65 - 2e 65 - 2f 65 - 30 65 - 31 65 - 32 65 - 34 66 - 35 66 - 36 66 - 37 66 - 38 66 - 39 66 - 3a 66 - 3b 66 - 3d 66 - 3e 66 - 3f 66 - 40 66 - 41 66 - 42 66 - 43 66 - 44 68 + 0 55 + 1 55 + 2 55 + 3 55 + 4 55 + 5 55 + 6 55 + 12 56 + 13 56 + 14 56 + 15 56 + 16 56 + 18 56 + 19 56 + 1a 56 + 1b 57 + 1c 57 + 1d 57 + 1e 57 + 20 57 + 21 57 + 22 57 + 23 58 + 24 58 + 25 58 + 26 58 + 27 58 + 28 58 + 29 58 + 2a 58 + 2c 59 + 2d 59 + 2e 59 + 2f 59 + 30 59 + 31 59 + 32 59 + 33 59 + 35 59 + 36 59 + 37 59 + 38 59 + 39 59 + 3a 59 + 3b 59 + 3c 60 } method 'testSealedIf (Lpkg/TestSmartCasts$A;)Ljava/lang/String;' { + 6 63 + 7 63 + 8 63 + 9 63 + a 63 + b 63 + c 63 + d 64 + e 64 + f 64 + 10 64 + 11 64 + 12 64 + 13 64 + 14 64 + 15 66 + 16 66 + 17 66 + 18 66 + 19 66 + 1a 66 + 1b 66 + 1c 66 + 1d 66 + 1e 66 + 1f 66 + 20 66 + 21 66 + 22 66 + 24 66 + 25 66 + 26 66 + 27 66 + } + + method 'testDoubleType (Ljava/util/List;)Ljava/lang/String;' { 6 71 7 71 8 71 9 71 a 71 - d 72 - e 72 - f 72 - 10 72 - 11 72 - 12 72 - 13 72 - 14 72 - 15 74 - 16 74 - 17 74 - 18 74 - 19 74 - 1c 74 - 1d 74 - 1e 74 - 1f 74 - 20 74 - 21 74 - 22 74 - 24 74 - 25 74 - 26 74 - 27 74 - } - - method 'testDoubleType (Ljava/util/List;)Ljava/lang/String;' { - 6 79 - 7 79 - 8 79 - 9 79 - a 79 - d 79 - 11 79 - 12 79 - 13 79 - 14 79 - 15 79 - 16 79 - 17 79 - 18 79 - 19 79 - 1a 79 - 1b 79 - 1c 79 - 1d 79 - 1f 79 - 20 79 - 21 79 - 22 79 - 23 79 - 24 79 - 25 79 - 26 79 - 27 79 - 28 79 + b 71 + c 71 + d 71 + 11 71 + 12 71 + 13 71 + 14 71 + 15 71 + 16 71 + 17 71 + 18 71 + 19 71 + 1a 71 + 1b 71 + 1c 71 + 1d 71 + 1f 71 + 20 71 + 21 71 + 22 71 + 23 71 + 24 71 + 25 71 + 26 71 + 27 71 + 28 71 } } class 'pkg/TestSmartCasts$A' { method 'test ()Ljava/lang/String;' { - 0 84 - 1 84 - 2 84 + 0 76 + 1 76 + 2 76 } } class 'pkg/TestSmartCasts$A$B' { method ' ()V' { - 2 87 - 3 87 - 4 87 + 2 79 + 3 79 + 4 79 } method 'testB ()Ljava/lang/String;' { - 0 89 - 1 89 - 2 89 + 0 81 + 1 81 + 2 81 } } class 'pkg/TestSmartCasts$A$C' { method ' ()V' { - 2 93 - 3 93 - 4 93 + 2 85 + 3 85 + 4 85 } method 'testC ()Ljava/lang/String;' { - 0 95 - 1 95 - 2 95 + 0 87 + 1 87 + 2 87 } } class 'pkg/TestSmartCasts$X$DefaultImpls' { method 'woo (Lpkg/TestSmartCasts$X;Ljava/lang/Iterable;)Ljava/lang/String;' { - 6 108 - 7 108 - 8 108 + 6 100 + 7 100 + 8 100 } } Lines mapping: -5 <-> 109 -8 <-> 88 -9 <-> 90 -11 <-> 94 -12 <-> 96 -15 <-> 85 +5 <-> 101 +8 <-> 80 +9 <-> 82 +11 <-> 86 +12 <-> 88 +15 <-> 77 19 <-> 5 20 <-> 5 21 <-> 6 @@ -515,31 +540,32 @@ Lines mapping: 27 <-> 16 28 <-> 20 31 <-> 26 -35 <-> 35 -36 <-> 35 -39 <-> 35 -43 <-> 39 -44 <-> 40 -45 <-> 41 -48 <-> 44 -49 <-> 45 -50 <-> 46 -51 <-> 47 -54 <-> 50 -55 <-> 51 -60 <-> 56 -64 <-> 60 -65 <-> 61 -66 <-> 64 -67 <-> 65 -68 <-> 66 -69 <-> 67 -70 <-> 69 -73 <-> 72 -74 <-> 73 -75 <-> 75 -76 <-> 75 -78 <-> 75 -83 <-> 80 -84 <-> 80 -87 <-> 80 +35 <-> 31 +36 <-> 31 +39 <-> 31 +43 <-> 35 +44 <-> 36 +45 <-> 37 +48 <-> 40 +49 <-> 41 +50 <-> 42 +51 <-> 43 +54 <-> 46 +55 <-> 47 +60 <-> 52 +64 <-> 56 +66 <-> 57 +67 <-> 58 +68 <-> 59 +69 <-> 60 +70 <-> 61 +73 <-> 64 +74 <-> 65 +75 <-> 67 +76 <-> 67 +78 <-> 67 +83 <-> 72 +84 <-> 72 +87 <-> 72 +Not mapped: +65 diff --git a/plugins/kotlin/testData/results/pkg/TestStringInterpolation.dec b/plugins/kotlin/testData/results/pkg/TestStringInterpolation.dec new file mode 100644 index 0000000000..7b85a0933b --- /dev/null +++ b/plugins/kotlin/testData/results/pkg/TestStringInterpolation.dec @@ -0,0 +1,127 @@ +package pkg + +public class TestStringInterpolation { + public final val x: Int = 5 + + public fun stringInterpolation(x: Int, y: String) { + System.out.println("$x $y");// 5 + }// 6 + + public fun testConstant(x: Int) { + System.out.println("$x 5");// 9 + }// 10 + + public fun testExpression(x: Int) { + System.out.println("$x ${x + 1}");// 13 + }// 14 + + public fun testProperty() { + System.out.println("${this.x}!");// 18 + }// 19 + + public fun testLiteralClass() { + System.out.println("${TestStringInterpolation::class.java}!");// 22 + }// 23 +} + +class 'pkg/TestStringInterpolation' { + method 'stringInterpolation (ILjava/lang/String;)V' { + 6 6 + 7 6 + 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 11 6 + 12 6 + 13 6 + 14 7 + } + + method 'testConstant (I)V' { + 0 10 + 1 10 + 2 10 + 3 10 + 4 10 + 5 10 + 6 10 + 7 10 + 8 10 + a 10 + b 10 + c 10 + d 11 + } + + method 'testExpression (I)V' { + 0 14 + 1 14 + 2 14 + 3 14 + 4 14 + 5 14 + 6 14 + 7 14 + 8 14 + 9 14 + a 14 + b 14 + d 14 + e 14 + f 14 + 10 15 + } + + method 'testProperty ()V' { + 0 18 + 1 18 + 2 18 + 3 18 + 4 18 + 5 18 + 6 18 + 7 18 + 8 18 + 9 18 + a 18 + b 18 + d 18 + e 18 + f 18 + 10 19 + } + + method 'testLiteralClass ()V' { + 0 22 + 1 22 + 2 22 + 3 22 + 4 22 + 5 22 + 6 22 + 7 22 + 8 22 + 9 22 + b 22 + c 22 + d 22 + e 23 + } +} + +Lines mapping: +5 <-> 7 +6 <-> 8 +9 <-> 11 +10 <-> 12 +13 <-> 15 +14 <-> 16 +18 <-> 19 +19 <-> 20 +22 <-> 23 +23 <-> 24 diff --git a/plugins/kotlin/testData/results/pkg/TestSynchronized.dec b/plugins/kotlin/testData/results/pkg/TestSynchronized.dec index 0d166bac19..919ae683a4 100644 --- a/plugins/kotlin/testData/results/pkg/TestSynchronized.dec +++ b/plugins/kotlin/testData/results/pkg/TestSynchronized.dec @@ -1,6 +1,6 @@ package pkg -class TestSynchronized { +public class TestSynchronized { public fun test() { synchronized (this) {// 5 System.out.println("Hello");// 6 @@ -22,13 +22,6 @@ class 'pkg/TestSynchronized' { e 5 f 5 17 7 - 18 7 - 19 7 - 1a 7 - 1b 7 - 1c 7 - 1d 7 - 1e 7 } } diff --git a/plugins/kotlin/testData/results/pkg/TestTailrecFunctions.dec b/plugins/kotlin/testData/results/pkg/TestTailrecFunctions.dec index 39e7eeff61..3fb041428d 100644 --- a/plugins/kotlin/testData/results/pkg/TestTailrecFunctions.dec +++ b/plugins/kotlin/testData/results/pkg/TestTailrecFunctions.dec @@ -1,48 +1,46 @@ package pkg -class TestTailrecFunctions { +public class TestTailrecFunctions { public tailrec fun sum(x: Long, sum: Long): Long { var var5: TestTailrecFunctions = this;// 4 - var var6: Long = x; - var var8: Long = sum; - while (var6 != 0L) {// 5 - var var15: Long = var6 - 1L;// 6 - var var17: Long = var8 + var6; - var5 = var5; - var6 = var15; - var8 = var17; + while (x != 0L) {// 5 + val var7: Long = x - 1L; + val var9: Long = sum + x; + var5 = var5;// 6 + x = var7; + sum = var9; } - return var8; + return sum; } public tailrec fun testFinally() { label12: { try { ; - } catch (java.lang.Throwable var2) { - this.testFinally();// 13 + } catch (var2: java.lang.Throwable) { + this.testFinally(); } - this.testFinally();// 12 14 + this.testFinally();// 13 } } public tailrec fun testFinallyReturn(): Int { try { ; - } catch (java.lang.Throwable var2) { - return this.testFinallyReturn();// 21 + } catch (var2: java.lang.Throwable) { + return this.testFinallyReturn(); } - return this.testFinallyReturn(); + return this.testFinallyReturn();// 21 } public tailrec fun fooTry() { try { this.fooTry();// 27 - } catch (java.lang.Throwable var2) {// 29 + } catch (var2: java.lang.Throwable) {// 29 } }// 31 @@ -53,14 +51,14 @@ class TestTailrecFunctions { try { this.testTryCatchFinally();// 35 break label32; - } catch (Exception var2) {// 36 + } catch (var2: Exception) {// 36 this.testTryCatchFinally();// 37 } - } catch (java.lang.Throwable var3) { - this.testTryCatchFinally();// 39 + } catch (var3: java.lang.Throwable) { + this.testTryCatchFinally(); } - this.testTryCatchFinally(); + this.testTryCatchFinally();// 39 return;// 41 } @@ -68,65 +66,50 @@ class TestTailrecFunctions { } } - public tailrec fun fastPow(x: Long, n: Long, acc: Long): Long { - var var7: TestTailrecFunctions = this; - var var8: Long = x; - var var10: Long = n; - var var12: Long = acc; + public tailrec fun fastPow(x: Long, n: Long, acc: Long = 1L): Long { + var var7: TestTailrecFunctions = this;// 43 - while (var10 != 0L) {// 44 - if (var10 % (long)2 == 0L) {// 45 - var var21: Long = var8 * var8; - var var23: Long = var10 / (long)2; + while (n != 0L) {// 44 + if (n % 2 == 0L) {// 45 + val var9: Long = x * x; + val var11: Long = n / 2; var7 = var7; - var8 = var21; - var10 = var23; - var12 = var12; + x = var9; + n = var11; + acc = acc; } else { - var var25: Long = var10 - 1L;// 46 - var var26: Long = var12 * var8; - var7 = var7; - var8 = var8; - var10 = var25; - var12 = var26; + val var15: Long = n - 1L; + val var13: Long = acc * x; + var7 = var7;// 46 + x = x; + n = var15; + acc = var13; } } - return var12; - } - - @JvmStatic - @JvmSynthetic - fun `fastPow$default`(var0: TestTailrecFunctions, var1: Long, var3: Long, var5: Long, var7: Int, var8: Any): Long { - if ((var7 and 4) != 0) {// 43 - var5 = 1L; - } - - return var0.fastPow(var1, var3, var5); + return acc; } public tailrec fun fastPow(x: Long, n: Long): Long { var var5: TestTailrecFunctions = this;// 49 - var var6: Long = x; - var var8: Long = n; var var10000: Long; while (true) { - if (var8 == 0L) {// 50 + if (n == 0L) {// 50 var10000 = 1L; break; } - if (var8 % (long)2 != 0L) {// 51 - var10000 = var6 * var5.fastPow(var6, var8 - 1L);// 52 + if (n % 2 != 0L) {// 51 + var10000 = x * var5.fastPow(x, n - 1L);// 52 break; } - var var15: Long = var6 * var6; - var var17: Long = var8 / (long)2; + val var7: Long = x * x; + val var9: Long = n / 2; var5 = var5; - var6 = var15; - var8 = var17; + x = var7; + n = var9; } return var10000;// 53 @@ -138,335 +121,260 @@ class 'pkg/TestTailrecFunctions' { 0 4 1 4 2 4 - 3 5 - 4 5 - 5 5 - 6 6 - 7 6 - 8 6 - 9 11 - a 11 - d 8 - e 8 - 11 10 - 12 10 + 3 6 + 4 6 + 5 6 + 9 14 + a 14 + b 9 + c 9 + f 7 + 10 7 + 11 7 + 12 7 + 13 7 + 14 8 15 8 16 8 17 8 18 8 - 1c 16 - 1d 16 - 1e 16 - 1f 9 - 20 9 - 21 9 - 22 9 - 23 9 - 24 9 - 25 10 - 26 10 - 27 10 - 28 10 - 29 10 - 2a 10 - 2b 10 - 2c 11 - 2d 11 - 2e 11 - 2f 11 - 30 12 - 31 12 - 32 12 - 33 12 - 34 13 - 35 13 - 36 13 - 37 13 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 10 + 1e 10 + 1f 10 + 20 11 + 21 11 + 22 11 } method 'testFinally ()V' { - 1 27 - 2 27 - 3 27 - 4 27 - 5 27 - 6 27 - 7 27 - 8 27 - 9 24 - a 24 - b 27 - c 27 - d 27 - e 27 + 1 25 + 2 25 + 3 25 + 4 25 + 9 22 + a 22 + b 22 + c 22 } method 'testFinallyReturn ()I' { - 1 38 - 2 38 - 3 38 - 4 38 - 5 38 - 7 35 - 8 35 - 9 35 - a 35 - b 35 + 1 36 + 2 36 + 3 36 + 4 36 + 5 36 + 7 33 + 8 33 + 9 33 + a 33 + b 33 } method 'fooTry ()V' { - 1 43 - 2 43 - 3 43 - 4 43 - 5 46 - 6 44 - 7 46 + 1 41 + 2 41 + 3 41 + 4 41 + 5 44 + 6 42 + 7 44 } method 'testTryCatchFinally ()V' { - 1 53 - 2 53 - 5 66 - 6 66 - 7 66 - 8 66 - c 55 - d 56 - e 56 - 11 62 - 12 62 - 13 62 - 14 62 - 19 59 - 1a 59 - 1f 63 + 1 51 + 2 51 + 3 51 + 4 51 + 5 64 + 6 64 + 7 64 + 8 64 + c 53 + d 54 + e 54 + f 54 + 10 54 + 11 60 + 12 60 + 13 60 + 14 60 + 19 57 + 1a 57 + 1b 57 + 1c 57 + 1f 61 } method 'fastPow (JJJ)J' { - 0 71 - 1 71 - 2 71 - 3 72 - 4 72 - 5 72 - 6 73 - 7 73 - 8 73 - 9 74 - a 74 - b 74 - c 74 - d 80 - e 80 - 11 78 - 12 78 - 15 76 - 16 76 - 19 83 - 1a 83 - 1d 76 - 1e 76 - 1f 76 - 20 76 - 24 94 - 25 94 - 26 94 - 27 77 - 28 77 - 29 77 - 2a 77 - 2b 77 - 2c 77 - 2d 77 - 2e 77 - 31 78 + 0 69 + 1 69 + 2 69 + 3 71 + 4 71 + 5 71 + 7 68 + 9 89 + a 89 + b 89 + c 72 + d 72 + e 72 + f 72 + 10 72 + 11 72 + 12 72 + 13 72 + 14 72 + 15 75 + 16 75 + 19 73 + 1a 73 + 1b 73 + 1c 73 + 1d 73 + 1e 74 + 1f 74 + 20 74 + 21 74 + 22 74 + 23 74 + 24 78 + 25 78 + 28 75 + 29 75 + 2a 75 + 2b 75 + 2c 76 + 2d 76 + 2e 76 + 2f 77 + 30 77 + 31 77 32 78 33 78 34 78 35 78 - 36 78 - 37 78 - 38 79 - 39 79 - 3a 79 - 3b 79 - 3c 79 - 3d 79 - 3e 79 - 3f 80 + 39 82 + 3a 82 + 3d 83 40 80 41 80 42 80 - 43 81 - 44 81 + 43 80 + 44 80 45 81 46 81 - 47 82 - 48 82 - 49 82 - 4a 82 - 4b 83 - 4c 83 - 4d 83 - 4e 83 - 52 85 - 53 85 - 54 85 + 47 81 + 48 81 + 49 81 + 4a 81 + 4b 82 + 4c 82 + 4d 82 + 4e 82 + 4f 83 + 50 83 + 51 83 + 52 84 + 53 84 + 54 84 55 85 56 85 57 85 - 58 86 - 59 86 - 5a 86 - 5b 86 - 5c 86 - 5d 86 - 5e 86 - 5f 87 - 60 87 - 61 87 - 62 87 - 63 88 - 64 88 - 65 88 - 66 88 - 67 89 - 68 89 - 69 89 - 6a 89 - 6b 90 - 6c 90 - 6d 90 - 6e 90 - } - - method 'fastPow$default (Lpkg/TestTailrecFunctions;JJJILjava/lang/Object;)J' { - 0 100 - 1 100 - 2 100 - 3 100 - 4 100 - 7 101 - 8 101 - 9 101 - a 104 - b 104 - c 104 - d 104 - e 104 - f 104 - 10 104 - 11 104 - 12 104 + 58 85 } method 'fastPow (JJ)J' { - 0 108 - 1 108 - 2 108 - 3 109 - 4 109 - 5 109 - 6 110 - 7 110 - 8 110 - 9 120 - a 120 - d 120 - e 120 - 11 114 - 12 114 - 15 114 - 16 114 - 17 114 - 18 114 - 19 114 - 1c 115 - 1d 116 - 20 119 - 21 119 - 22 119 - 23 119 - 24 119 - 25 119 - 26 119 - 27 119 - 2a 124 - 2b 124 - 2c 124 - 2d 124 - 2e 124 - 2f 124 - 30 124 - 31 125 - 32 125 - 33 125 - 34 125 - 35 125 - 36 125 - 37 125 - 38 126 - 39 126 - 3a 126 - 3b 126 - 3c 127 - 3d 127 - 3e 127 - 3f 127 - 40 128 - 41 128 - 42 128 - 43 128 - 47 120 - 48 120 - 49 120 - 4a 120 - 4b 120 - 4c 120 - 4d 120 - 4e 120 - 4f 120 - 50 120 - 51 120 - 52 120 - 53 120 - 54 120 - 55 131 + 0 93 + 1 93 + 2 93 + 3 97 + 4 97 + 5 97 + 6 97 + 7 97 + 8 97 + 9 98 + a 99 + d 102 + e 102 + f 102 + 10 102 + 11 102 + 12 102 + 13 102 + 14 102 + 15 102 + 16 109 + 17 109 + 1a 107 + 1b 107 + 1c 107 + 1d 107 + 1e 107 + 1f 108 + 20 108 + 21 108 + 22 108 + 23 108 + 24 108 + 25 109 + 26 109 + 27 109 + 28 109 + 29 110 + 2a 110 + 2b 110 + 2c 111 + 2d 111 + 2e 111 + 32 103 + 33 103 + 34 103 + 35 103 + 36 103 + 37 103 + 38 103 + 39 103 + 3a 103 + 3b 103 + 3c 103 + 3d 114 } } Lines mapping: 4 <-> 5 -5 <-> 9 +5 <-> 7 6 <-> 10 -12 <-> 28 -13 <-> 25 -14 <-> 28 -21 <-> 36 -27 <-> 44 -29 <-> 45 -31 <-> 47 -35 <-> 54 -36 <-> 56 -37 <-> 57 -39 <-> 60 -41 <-> 64 -43 <-> 101 -44 <-> 77 -45 <-> 78 -46 <-> 86 -49 <-> 109 -50 <-> 115 -51 <-> 120 -52 <-> 121 -53 <-> 132 +13 <-> 26 +21 <-> 37 +27 <-> 42 +29 <-> 43 +31 <-> 45 +35 <-> 52 +36 <-> 54 +37 <-> 55 +39 <-> 61 +41 <-> 62 +43 <-> 70 +44 <-> 72 +45 <-> 73 +46 <-> 83 +49 <-> 94 +50 <-> 98 +51 <-> 103 +52 <-> 104 +53 <-> 115 Not mapped: 10 +14 15 18 -20 26 34 -38 -40 \ No newline at end of file +40 diff --git a/plugins/kotlin/testData/results/pkg/TestTopLevelKt.dec b/plugins/kotlin/testData/results/pkg/TestTopLevelKt.dec index 6c4f34d637..5ad80d02c3 100644 --- a/plugins/kotlin/testData/results/pkg/TestTopLevelKt.dec +++ b/plugins/kotlin/testData/results/pkg/TestTopLevelKt.dec @@ -1,21 +1,55 @@ package pkg -public const val topLevelConstVal: Int = 926 -public final val topLevelVal: Regex = new Regex("") public final var topLevelVar: Int = 42 internal set +public final val topLevelVal: Regex = new Regex("") +public const val topLevelConstVal: Int = 926 + public fun topLevelFun() { }// 5 +public fun interpolateTopLevel() { + System.out.println("topLevelVar = ${topLevelVar}");// 14 + System.out.println("topLevelConstVal = 926");// 15 +}// 16 class 'pkg/TestTopLevelKt' { method 'topLevelFun ()V' { - 2 8 + 2 9 + } + + method 'interpolateTopLevel ()V' { + 0 12 + 1 12 + 2 12 + 3 12 + 4 12 + 5 12 + 6 12 + 7 12 + 8 12 + 9 12 + a 12 + c 12 + d 12 + e 12 + f 13 + 10 13 + 11 13 + 12 13 + 13 13 + 15 13 + 16 13 + 17 13 + 18 14 } } Lines mapping: -5 <-> 9 +5 <-> 10 +14 <-> 13 +15 <-> 14 +16 <-> 15 Not mapped: 4 diff --git a/plugins/kotlin/testData/results/pkg/TestTryCatchExpressions.dec b/plugins/kotlin/testData/results/pkg/TestTryCatchExpressions.dec index 53bf0f58a2..699e06cf0d 100644 --- a/plugins/kotlin/testData/results/pkg/TestTryCatchExpressions.dec +++ b/plugins/kotlin/testData/results/pkg/TestTryCatchExpressions.dec @@ -1,13 +1,15 @@ package pkg import java.io.IOException +import kotlin.jvm.internal.SourceDebugExtension -class TestTryCatchExpressions { +@SourceDebugExtension(["SMAP\nTestTryCatchExpressions.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestTryCatchExpressions.kt\npkg/TestTryCatchExpressions\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,59:1\n1#2:60\n*E\n"]) +public class TestTryCatchExpressions { public fun test0(s: String) { var var2: java.lang.String; try { var2 = StringsKt.repeat(s as java.lang.CharSequence, 5);// 9 - } catch (RuntimeException var4) {// 10 + } catch (var4: RuntimeException) {// 10 var var10000: java.lang.String = var4.getMessage();// 11 if (var10000 == null) { var10000 = "ERROR"; @@ -28,7 +30,7 @@ class TestTryCatchExpressions { try { var10000 = var6; var4 = StringsKt.repeat(x as java.lang.CharSequence, 5);// 20 - } catch (RuntimeException var9) {// 21 + } catch (var9: RuntimeException) {// 21 var10000 = this; x = b;// 22 var var10001: java.lang.String = var9.getMessage();// 23 @@ -39,7 +41,7 @@ class TestTryCatchExpressions { var4 = var10001; } - var var7: java.lang.String = var4;// 24 + val var7: java.lang.String = var4;// 24 var6 = var10000; var var13: java.lang.String; @@ -47,7 +49,7 @@ class TestTryCatchExpressions { var10000 = var6; var13 = var7; var4 = StringsKt.repeat(x as java.lang.CharSequence, 5);// 25 - } catch (RuntimeException var8) {// 26 + } catch (var8: RuntimeException) {// 26 var10000 = var10000; var13 = var4; var var10002: java.lang.String = var8.getMessage();// 27 @@ -58,7 +60,7 @@ class TestTryCatchExpressions { var4 = var10002; } - var10000.test0(var13 + var4);// 18 + var10000.test0("$var13$var4");// 18 }// 30 public fun test2(a: String, b: String) { @@ -76,18 +78,18 @@ class TestTryCatchExpressions { var15 = b;// 38 this.test0(b);// 39 var4 = b;// 40 - } catch (IOException var13) {// 41 + } catch (var13: IOException) {// 41 var10000 = this; var15 = a;// 42 this.test1(a, a);// 43 var4 = a;// 44 - } catch (RuntimeException var14) {// 46 + } catch (var14: RuntimeException) {// 46 var10000 = this;// 45 var15 = if (var15 == a) b else a;// 47 49 var4 = var15;// 51 } - var var8: java.lang.String = var4;// 52 + val var8: java.lang.String = var4;// 52 var7 = var10000; var var10001: java.lang.String; @@ -97,7 +99,7 @@ class TestTryCatchExpressions { var10000 = var7; var10001 = var8; var4 = var4;// 53 - } catch (RuntimeException var12) {// 54 + } catch (var12: RuntimeException) {// 54 var10000 = var10000; var10001 = var4; System.out.println(var15);// 55 @@ -106,7 +108,7 @@ class TestTryCatchExpressions { var10003 = ""; } - var4 = var15 + "!!" + var10003;// 56 + var4 = "$var15!!$var10003";// 56 } var10000.test1(var10001, var4);// 34 @@ -115,284 +117,300 @@ class TestTryCatchExpressions { class 'pkg/TestTryCatchExpressions' { method 'test0 (Ljava/lang/String;)V' { - 7 8 - 8 8 - 9 8 - a 8 - b 8 - c 8 - d 8 - e 8 - f 8 - 13 9 - 14 10 - 15 10 - 16 10 - 17 10 - 19 11 - 1d 12 - 1f 15 - 20 18 - 22 18 - 23 18 - 24 18 - 25 18 - 26 18 - 27 18 - 28 18 - 29 19 + 7 10 + 8 10 + 9 10 + a 10 + b 10 + c 10 + d 10 + e 10 + f 10 + 13 11 + 14 12 + 15 12 + 16 12 + 17 12 + 19 13 + 1a 13 + 1b 13 + 1d 14 + 1e 14 + 1f 17 + 20 20 + 22 20 + 23 20 + 24 20 + 25 20 + 26 20 + 27 20 + 28 20 + 29 21 } method 'test1 (Ljava/lang/String;Ljava/lang/String;)V' { - c 22 - d 22 - e 23 - f 23 - 10 23 - 12 28 - 13 28 - 14 29 - 15 29 - 16 29 - 17 29 - 18 29 - 19 29 - 1a 29 - 1b 29 - 1c 29 - 1d 29 - 21 30 - 23 31 - 24 31 - 25 32 - 26 32 - 27 33 - 28 33 - 29 33 - 2a 33 - 2b 33 - 2d 34 - 31 35 - 33 38 - 34 38 - 35 41 - 36 41 - 37 41 - 38 41 - 39 42 - 3a 42 - 3c 46 - 3d 46 - 3e 47 - 3f 47 - 40 48 - 41 48 - 42 48 - 43 48 - 44 48 - 45 48 - 46 48 - 47 48 - 48 48 - 49 48 - 4d 49 - 4f 50 - 50 50 - 51 51 - 52 51 - 53 52 - 54 52 - 55 52 - 56 52 - 57 52 - 59 53 - 5d 54 - 5f 57 - 60 57 - 61 60 - 62 60 - 63 60 - 64 60 - 65 60 - 66 60 - 67 60 - 68 60 - 69 60 - 6a 60 - 6b 61 + c 24 + d 24 + e 25 + f 25 + 10 25 + 12 30 + 13 30 + 14 31 + 15 31 + 16 31 + 17 31 + 18 31 + 19 31 + 1a 31 + 1b 31 + 1c 31 + 1d 31 + 21 32 + 23 33 + 24 33 + 25 34 + 26 34 + 27 35 + 28 35 + 29 35 + 2a 35 + 2b 35 + 2d 36 + 2e 36 + 2f 36 + 31 37 + 32 37 + 33 40 + 34 40 + 35 43 + 36 43 + 37 43 + 38 43 + 39 44 + 3a 44 + 3c 48 + 3d 48 + 3e 49 + 3f 49 + 40 50 + 41 50 + 42 50 + 43 50 + 44 50 + 45 50 + 46 50 + 47 50 + 48 50 + 49 50 + 4d 51 + 4f 52 + 50 52 + 51 53 + 52 53 + 53 54 + 54 54 + 55 54 + 56 54 + 57 54 + 59 55 + 5a 55 + 5b 55 + 5d 56 + 5e 56 + 5f 59 + 60 59 + 61 62 + 62 62 + 63 62 + 64 62 + 65 62 + 66 62 + 67 62 + 68 62 + 69 62 + 6a 62 + 6b 63 } method 'test2 (Ljava/lang/String;Ljava/lang/String;)V' { - e 64 - f 64 - 10 65 - 11 65 - 12 65 - 14 70 - 15 70 - 16 71 - 17 71 - 18 71 - 19 71 - 1a 71 - 1b 71 - 1c 71 - 1d 71 - 1e 71 - 21 72 - 22 75 - 23 75 - 24 76 - 25 76 - 26 76 - 27 76 - 28 76 - 29 77 - 2a 77 - 2b 77 - 2f 78 - 31 79 - 32 79 - 33 80 - 34 80 - 35 81 - 36 81 - 37 81 - 38 81 - 39 81 - 3a 81 - 3b 81 - 3c 81 - 3d 81 - 3e 82 - 3f 82 - 40 82 - 41 82 - 42 82 - 43 82 - 49 84 - 4a 84 - 4b 85 - 4c 85 - 50 85 - 53 85 - 57 85 - 58 83 - 59 86 - 5a 86 - 5b 86 - 5c 86 - 5d 86 - 5e 86 - 5f 89 - 60 89 - 61 89 - 62 89 - 63 90 - 64 90 - 66 96 - 67 96 - 68 97 - 69 97 - 6a 94 - 6b 94 - 6c 94 - 6d 94 - 6e 94 - 6f 94 - 70 94 - 71 94 - 72 94 - 73 94 - 74 95 - 75 95 - 7f 95 - 80 95 - 81 95 - 87 96 - 88 96 - 89 97 - 8a 97 - 8b 98 - 8c 98 - 8d 98 - 8e 98 - 92 99 - 94 100 - 95 100 - 96 101 - 97 101 - 98 102 - 99 102 - 9a 102 - 9b 102 - 9d 102 - 9e 102 - 9f 102 - a0 108 - a1 103 - a2 103 - a3 103 - a4 103 - a5 103 - a7 104 - ab 105 - ad 108 - ae 108 - af 108 - b0 108 - b1 108 - b2 108 - b3 108 - b4 111 - b5 111 - b6 111 - b7 111 - b8 111 - b9 112 + e 66 + f 66 + 10 67 + 11 67 + 12 67 + 14 72 + 15 72 + 16 73 + 17 73 + 18 73 + 19 73 + 1a 73 + 1b 73 + 1c 73 + 1d 73 + 1e 73 + 1f 73 + 20 73 + 21 74 + 22 77 + 23 77 + 24 78 + 25 78 + 26 78 + 27 78 + 28 78 + 29 79 + 2a 79 + 2b 79 + 2f 80 + 31 81 + 32 81 + 33 82 + 34 82 + 35 83 + 36 83 + 37 83 + 38 83 + 39 83 + 3a 83 + 3b 83 + 3c 83 + 3d 83 + 3e 84 + 3f 84 + 40 84 + 41 84 + 42 84 + 43 84 + 49 86 + 4a 86 + 4b 87 + 4c 87 + 50 87 + 51 87 + 52 87 + 53 87 + 57 87 + 58 85 + 59 88 + 5a 88 + 5b 88 + 5c 88 + 5d 88 + 5e 88 + 5f 91 + 60 91 + 61 91 + 62 91 + 63 92 + 64 92 + 66 98 + 67 98 + 68 99 + 69 99 + 6a 96 + 6b 96 + 6c 96 + 6d 96 + 6e 96 + 6f 96 + 70 96 + 71 96 + 72 96 + 73 96 + 74 97 + 75 97 + 7f 97 + 80 97 + 81 97 + 87 98 + 88 98 + 89 99 + 8a 99 + 8b 100 + 8c 100 + 8d 100 + 8e 100 + 92 101 + 94 102 + 95 102 + 96 103 + 97 103 + 98 104 + 99 104 + 9a 104 + 9b 104 + 9d 104 + 9e 104 + 9f 104 + a0 110 + a1 105 + a2 105 + a3 105 + a4 105 + a5 105 + a7 106 + a8 106 + a9 106 + ab 107 + ac 107 + ad 110 + ae 110 + af 110 + b0 110 + b1 110 + b2 110 + b3 110 + b4 113 + b5 113 + b6 113 + b7 113 + b8 113 + b9 114 } } Lines mapping: -7 <-> 19 -9 <-> 9 -10 <-> 10 -11 <-> 11 -14 <-> 20 -17 <-> 23 -18 <-> 61 -19 <-> 24 -20 <-> 30 -21 <-> 31 -22 <-> 33 -23 <-> 34 -24 <-> 42 -25 <-> 49 -26 <-> 50 -27 <-> 53 -30 <-> 62 -33 <-> 65 -34 <-> 112 -35 <-> 72 -36 <-> 73 -38 <-> 76 -39 <-> 77 -40 <-> 78 -41 <-> 79 -42 <-> 81 -43 <-> 82 -44 <-> 83 -45 <-> 85 -46 <-> 84 -47 <-> 86 -49 <-> 86 -51 <-> 87 -52 <-> 90 -53 <-> 99 -54 <-> 100 -55 <-> 103 -56 <-> 109 -58 <-> 113 +7 <-> 21 +9 <-> 11 +10 <-> 12 +11 <-> 13 +14 <-> 22 +17 <-> 25 +18 <-> 63 +19 <-> 26 +20 <-> 32 +21 <-> 33 +22 <-> 35 +23 <-> 36 +24 <-> 44 +25 <-> 51 +26 <-> 52 +27 <-> 55 +30 <-> 64 +33 <-> 67 +34 <-> 114 +35 <-> 74 +36 <-> 75 +38 <-> 78 +39 <-> 79 +40 <-> 80 +41 <-> 81 +42 <-> 83 +43 <-> 84 +44 <-> 85 +45 <-> 87 +46 <-> 86 +47 <-> 88 +49 <-> 88 +51 <-> 89 +52 <-> 92 +53 <-> 101 +54 <-> 102 +55 <-> 105 +56 <-> 111 +58 <-> 115 Not mapped: 8 60 diff --git a/plugins/kotlin/testData/results/pkg/TestTryFinallyExpressions.dec b/plugins/kotlin/testData/results/pkg/TestTryFinallyExpressions.dec index f90533dff6..b78b85e77b 100644 --- a/plugins/kotlin/testData/results/pkg/TestTryFinallyExpressions.dec +++ b/plugins/kotlin/testData/results/pkg/TestTryFinallyExpressions.dec @@ -1,17 +1,19 @@ package pkg import java.io.IOException +import kotlin.jvm.internal.SourceDebugExtension -class TestTryFinallyExpressions { +@SourceDebugExtension(["SMAP\nTestTryFinallyExpressions.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestTryFinallyExpressions.kt\npkg/TestTryFinallyExpressions\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,52:1\n1#2:53\n*E\n"]) +public class TestTryFinallyExpressions { public fun test0(s: String) { label15: { try { - var var2: java.lang.String = StringsKt.repeat(s as java.lang.CharSequence, 5);// 8 - } catch (java.lang.Throwable var4) { - System.out.println("bye");// 10 + val var2: java.lang.String = StringsKt.repeat(s as java.lang.CharSequence, 5);// 8 + } catch (var4: java.lang.Throwable) { + System.out.println("bye"); } - System.out.println("bye");// 7 9 11 + System.out.println("bye");// 10 } } @@ -20,20 +22,20 @@ class TestTryFinallyExpressions { var x: java.lang.String = a;// 15 try { - var var4: java.lang.String = StringsKt.repeat(x as java.lang.CharSequence, 5);// 17 - } catch (java.lang.Throwable var9) { + val var4: java.lang.String = StringsKt.repeat(x as java.lang.CharSequence, 5);// 17 + } catch (var9: java.lang.Throwable) { ; } - x = b;// 18 19 20 + x = b;// 19 try { - var var15: java.lang.String = StringsKt.repeat(x as java.lang.CharSequence, 5);// 21 - } catch (java.lang.Throwable var8) { - System.out.println(a);// 23 + val var15: java.lang.String = StringsKt.repeat(x as java.lang.CharSequence, 5);// 21 + } catch (var8: java.lang.Throwable) { + System.out.println(a); } - System.out.println(a);// 16 22 24 + System.out.println(a);// 23 } } @@ -53,12 +55,12 @@ class TestTryFinallyExpressions { var19 = b;// 33 this.test0(b);// 34 break label71; - } catch (IOException var11) {// 36 + } catch (var11: IOException) {// 36 var19 = a;// 37 this.test1(a, a);// 38 - var var4: java.lang.String = a;// 39 + val var4: java.lang.String = a;// 39 } - } catch (java.lang.Throwable var12) { + } catch (var12: java.lang.Throwable) { var19 = if (var19 == a) b else a;// 41 42 44 } @@ -71,11 +73,11 @@ class TestTryFinallyExpressions { try { var19 = StringsKt.repeat(var19 as java.lang.CharSequence, 5);// 47 - } catch (java.lang.Throwable var10) { - System.out.println(var19);// 49 + } catch (var10: java.lang.Throwable) { + System.out.println(var19); } - System.out.println(var19);// 29 48 50 + System.out.println(var19);// 49 } var19 = if (a == a) b else a; @@ -85,260 +87,203 @@ class TestTryFinallyExpressions { class 'pkg/TestTryFinallyExpressions' { method 'test0 (Ljava/lang/String;)V' { - 7 8 - 8 8 - 9 8 - a 8 - b 8 - c 8 - d 8 - e 8 - f 8 - 10 13 - 11 13 - 12 13 - 13 13 - 14 13 - 16 13 - 17 13 - 18 13 - 19 13 - 1a 13 - 1b 13 - 1c 13 - 1d 10 - 1e 10 - 1f 10 - 20 10 - 21 10 - 22 13 - 23 10 - 24 13 - 25 13 - 26 13 - 27 13 - 28 13 - 29 13 - 2a 13 - 2b 13 - 2c 13 - 2d 13 - 2e 13 - 2f 13 - 30 13 + 7 10 + 8 10 + 9 10 + a 10 + b 10 + c 10 + d 10 + e 10 + f 10 + 10 15 + 11 15 + 12 15 + 13 15 + 14 15 + 16 15 + 17 15 + 18 15 + 1d 12 + 1e 12 + 1f 12 + 20 12 + 21 12 + 23 12 + 24 12 + 25 12 } method 'test1 (Ljava/lang/String;Ljava/lang/String;)V' { - c 19 - d 19 - 14 22 - 15 22 - 16 22 - 17 22 - 18 22 - 19 22 - 1a 22 - 1b 22 - 1c 22 - 1d 22 - 1e 27 - 1f 27 - 20 27 - 21 27 - 22 27 - 23 27 - 24 27 - 25 27 - 26 27 - 27 27 - 28 27 - 29 27 - 2a 27 - 2b 27 - 2c 27 - 2d 27 - 35 30 - 36 30 - 37 30 - 38 30 - 39 30 - 3a 30 - 3b 30 - 3c 30 - 3d 30 - 3e 30 - 3f 35 - 40 35 - 41 35 - 42 35 - 43 35 - 44 35 - 45 35 - 46 35 - 47 35 - 48 35 - 49 35 - 4a 35 - 4b 32 - 4c 32 - 4d 32 - 4e 32 - 4f 32 - 50 35 - 51 35 - 52 35 - 53 35 - 54 35 - 55 35 - 56 35 - 57 35 - 58 35 - 59 35 - 5a 35 - 5b 35 - 5c 35 - 5d 35 - 5e 35 + c 21 + d 21 + 14 24 + 15 24 + 16 24 + 17 24 + 18 24 + 19 24 + 1a 24 + 1b 24 + 1c 24 + 1d 24 + 1e 29 + 1f 29 + 35 32 + 36 32 + 37 32 + 38 32 + 39 32 + 3a 32 + 3b 32 + 3c 32 + 3d 32 + 3e 32 + 3f 37 + 40 37 + 41 37 + 42 37 + 43 37 + 44 37 + 45 37 + 4b 34 + 4c 34 + 4d 34 + 4e 34 + 4f 34 + 50 34 + 51 34 } method 'test2 (Ljava/lang/String;Ljava/lang/String;)V' { - e 41 - f 41 - 16 48 - 17 48 - 1b 48 - 1f 80 - 20 80 - 24 80 - 27 80 - 2b 80 - 2c 80 - 2e 52 - 2f 52 - 30 53 - 31 53 - 32 53 - 33 53 - 34 53 - 38 68 - 39 68 - 3d 68 - 40 68 - 44 68 - 45 68 - 49 55 - 4d 56 - 4e 56 - 4f 57 - 50 57 - 51 57 - 52 57 - 53 57 - 54 57 - 55 57 - 56 57 - 57 57 - 58 58 - 59 58 - 5a 58 - 5b 58 - 5c 58 - 5d 58 - 5e 64 - 5f 64 - 63 64 - 66 64 - 6a 64 - 6b 64 - 6c 65 - 71 61 - 72 61 - 76 61 - 79 61 - 7d 61 - 7e 61 - 8d 72 - 8e 72 - 8f 72 - 90 72 - 91 72 - 92 72 - 93 72 - 94 72 - 97 72 - 98 72 - a2 72 - a3 72 - a4 72 - b2 77 - b3 77 - b4 77 - b5 77 - b7 77 - b8 77 - b9 77 - ba 77 - bb 77 - bc 77 - bd 77 - be 77 - bf 74 - c0 74 - c1 74 - c2 74 - c3 77 - c4 74 - c5 77 - c6 77 - c7 77 - c8 77 - c9 77 - ca 77 - cb 77 - cc 77 - cd 77 - ce 77 + e 43 + f 43 + 16 50 + 17 50 + 1b 50 + 1c 50 + 1d 50 + 1f 82 + 20 82 + 24 82 + 25 82 + 26 82 + 27 82 + 2b 82 + 2c 82 + 2e 54 + 2f 54 + 30 55 + 31 55 + 32 55 + 33 55 + 34 55 + 38 70 + 39 70 + 3d 70 + 3e 70 + 3f 70 + 40 70 + 44 70 + 45 70 + 49 57 + 4d 58 + 4e 58 + 4f 59 + 50 59 + 51 59 + 52 59 + 53 59 + 54 59 + 55 59 + 56 59 + 57 59 + 58 60 + 59 60 + 5a 60 + 5b 60 + 5c 60 + 5d 60 + 5e 66 + 5f 66 + 63 66 + 64 66 + 65 66 + 66 66 + 6a 66 + 6b 66 + 6c 67 + 71 63 + 72 63 + 76 63 + 77 63 + 78 63 + 79 63 + 7d 63 + 7e 63 + 8d 74 + 8e 74 + 8f 74 + 90 74 + 91 74 + 92 74 + 93 74 + 94 74 + 97 74 + 98 74 + a2 74 + a3 74 + a4 74 + b2 79 + b3 79 + b4 79 + b5 79 + b7 79 + b8 79 + b9 79 + bf 76 + c0 76 + c1 76 + c2 76 + c4 76 + c5 76 + c6 76 } } Lines mapping: -7 <-> 14 -8 <-> 9 -9 <-> 14 -10 <-> 11 -11 <-> 14 -15 <-> 20 -16 <-> 36 -17 <-> 23 -18 <-> 28 -19 <-> 28 -20 <-> 28 -21 <-> 31 -22 <-> 36 -23 <-> 33 -24 <-> 36 -28 <-> 42 -29 <-> 78 -30 <-> 49 -33 <-> 53 -34 <-> 54 -36 <-> 56 -37 <-> 57 -38 <-> 58 -39 <-> 59 -41 <-> 62 -42 <-> 62 -44 <-> 62 -46 <-> 66 -47 <-> 73 -48 <-> 78 -49 <-> 75 -50 <-> 78 +8 <-> 11 +10 <-> 16 +15 <-> 22 +17 <-> 25 +19 <-> 30 +21 <-> 33 +23 <-> 38 +28 <-> 44 +30 <-> 51 +33 <-> 55 +34 <-> 56 +36 <-> 58 +37 <-> 59 +38 <-> 60 +39 <-> 61 +41 <-> 64 +42 <-> 64 +44 <-> 64 +46 <-> 68 +47 <-> 75 +49 <-> 80 Not mapped: +7 +11 12 +16 +20 +24 25 +29 31 35 -40 +50 51 53 diff --git a/plugins/kotlin/testData/results/pkg/TestVars.dec b/plugins/kotlin/testData/results/pkg/TestVars.dec index e2eb7f5894..ee7505ef52 100644 --- a/plugins/kotlin/testData/results/pkg/TestVars.dec +++ b/plugins/kotlin/testData/results/pkg/TestVars.dec @@ -1,6 +1,6 @@ package pkg -class TestVars { +public class TestVars { public fun testVar() { System.out.println("initial");// 5 6 }// 9 @@ -10,7 +10,7 @@ class TestVars { }// 16 public fun testPhi(bl: Boolean) { - var var3: Byte; + val var3: Byte; if (bl) {// 21 var3 = 1;// 22 } else { @@ -55,6 +55,8 @@ class 'pkg/TestVars' { method 'testPhi (Z)V' { 2 13 3 13 + 4 13 + 5 13 6 14 7 14 b 16 @@ -72,6 +74,8 @@ class 'pkg/TestVars' { method 'testIfExpr (Z)V' { 0 23 1 23 + 2 23 + 3 23 4 23 8 23 a 23 @@ -107,3 +111,4 @@ Not mapped: 8 14 15 +19 diff --git a/plugins/kotlin/testData/results/pkg/TestWhen.dec b/plugins/kotlin/testData/results/pkg/TestWhen.dec index a29a8ffc73..ded4eb76db 100644 --- a/plugins/kotlin/testData/results/pkg/TestWhen.dec +++ b/plugins/kotlin/testData/results/pkg/TestWhen.dec @@ -1,6 +1,6 @@ package pkg -class TestWhen { +public class TestWhen { public fun testStatement(obj: Any) { if (obj == 1) {// 5 6 System.out.println("1"); @@ -24,7 +24,7 @@ class TestWhen { System.out.println("a == 15"); } else if (a == "!!") {// 27 System.out.println("a == !!"); - } else if (a is Integer) {// 28 + } else if (a is Int) {// 28 System.out.println("a is Int"); } else if (a is java.lang.String) {// 29 System.out.println("a is String"); @@ -63,6 +63,8 @@ class 'pkg/TestWhen' { b 4 c 4 10 4 + 11 4 + 12 4 13 5 14 5 15 5 @@ -75,6 +77,8 @@ class 'pkg/TestWhen' { 20 6 21 6 25 6 + 26 6 + 27 6 28 7 29 7 2a 7 @@ -88,6 +92,8 @@ class 'pkg/TestWhen' { 36 8 37 8 38 8 + 39 8 + 3a 8 3b 9 3c 9 3d 9 @@ -98,6 +104,8 @@ class 'pkg/TestWhen' { 43 9 47 10 4b 10 + 4c 10 + 4d 10 4e 11 4f 11 50 11 @@ -112,6 +120,8 @@ class 'pkg/TestWhen' { 5d 13 5e 13 60 13 + 61 13 + 62 13 63 15 } @@ -123,20 +133,28 @@ class 'pkg/TestWhen' { b 18 c 18 10 18 + 11 18 + 12 18 13 18 17 18 18 18 19 18 1a 18 1b 18 + 1c 18 + 1d 18 1e 18 22 18 23 18 24 18 28 18 + 29 18 + 2a 18 2b 18 2f 18 33 18 + 34 18 + 35 18 36 18 3a 18 3b 18 @@ -150,6 +168,8 @@ class 'pkg/TestWhen' { 11 22 12 22 16 22 + 17 22 + 18 22 19 23 1a 23 1b 23 @@ -162,6 +182,8 @@ class 'pkg/TestWhen' { 26 24 27 24 2b 24 + 2c 24 + 2d 24 2e 25 2f 25 30 25 @@ -175,6 +197,8 @@ class 'pkg/TestWhen' { 3c 26 3d 26 3e 26 + 3f 26 + 40 26 41 27 42 27 43 27 @@ -188,6 +212,8 @@ class 'pkg/TestWhen' { 4f 28 50 28 51 28 + 52 28 + 53 28 54 29 55 29 56 29 @@ -201,6 +227,8 @@ class 'pkg/TestWhen' { 62 30 63 30 64 30 + 65 30 + 66 30 67 31 68 31 69 31 @@ -214,6 +242,8 @@ class 'pkg/TestWhen' { 75 32 76 32 77 32 + 78 32 + 79 32 7a 33 7b 33 7c 33 @@ -228,6 +258,8 @@ class 'pkg/TestWhen' { 89 35 8a 35 8c 35 + 8d 35 + 8e 35 8f 37 } @@ -238,7 +270,11 @@ class 'pkg/TestWhen' { 5 40 6 40 7 40 + 8 40 + 9 40 f 40 + 10 40 + 11 40 12 41 13 41 14 41 @@ -251,10 +287,16 @@ class 'pkg/TestWhen' { 1f 42 20 42 21 42 + 22 42 + 23 42 24 42 25 42 26 42 + 27 42 + 28 42 2e 42 + 2f 42 + 30 42 31 43 32 43 33 43 @@ -267,10 +309,16 @@ class 'pkg/TestWhen' { 3e 44 3f 44 40 44 + 41 44 + 42 44 43 44 44 44 45 44 + 46 44 + 47 44 4d 44 + 4e 44 + 4f 44 50 45 51 45 52 45 @@ -282,6 +330,8 @@ class 'pkg/TestWhen' { 5c 46 5d 46 5e 46 + 5f 46 + 60 46 61 47 62 47 63 47 @@ -295,14 +345,22 @@ class 'pkg/TestWhen' { 6f 48 70 48 71 48 + 72 48 + 73 48 74 48 75 48 76 48 + 77 48 + 78 48 79 48 7a 48 7b 48 7c 48 + 7d 48 + 7e 48 84 48 + 85 48 + 86 48 87 49 88 49 89 49 @@ -317,6 +375,8 @@ class 'pkg/TestWhen' { 96 51 97 51 99 51 + 9a 51 + 9b 51 9c 53 } } diff --git a/plugins/kotlin/testData/results/pkg/TestWhenBoolean.dec b/plugins/kotlin/testData/results/pkg/TestWhenBoolean.dec index e288eca3d1..297a1d514c 100644 --- a/plugins/kotlin/testData/results/pkg/TestWhenBoolean.dec +++ b/plugins/kotlin/testData/results/pkg/TestWhenBoolean.dec @@ -1,6 +1,6 @@ package pkg -class TestWhenBoolean { +public class TestWhenBoolean { public fun testIf(a: Int, b: Int, c: Int, d: Int) { if (a == 1// 6 18 || b == 2// 7 @@ -19,70 +19,108 @@ class 'pkg/TestWhenBoolean' { 1 4 2 4 3 4 + 4 4 + 5 4 a 5 b 5 c 5 + d 5 + e 5 13 6 14 6 15 6 + 16 6 + 17 6 1c 8 1d 8 1e 8 + 1f 8 + 20 8 25 9 26 9 27 9 + 28 9 + 29 9 2a 9 2b 9 2c 9 + 2d 9 + 2e 9 38 9 + 39 9 + 3a 9 3f 9 40 9 41 9 42 9 43 9 + 44 9 + 45 9 46 9 47 9 48 9 49 9 4a 9 4b 9 + 4c 9 + 4d 9 56 9 57 9 58 9 59 9 + 5a 9 + 5b 9 5c 9 5d 9 + 5e 9 + 5f 9 64 9 65 9 66 9 67 9 + 68 9 + 69 9 6e 9 6f 9 70 9 71 9 72 9 + 73 9 + 74 9 75 9 76 9 77 9 78 9 + 79 9 + 7a 9 7b 9 7c 9 7d 9 7e 9 + 7f 9 + 80 9 8d 9 8e 9 8f 9 90 9 + 91 9 + 92 9 93 9 94 9 95 9 + 96 9 + 97 9 a1 4 + a2 4 + a3 4 a4 11 a5 11 a6 11 a7 11 a8 11 aa 11 + ab 11 + ac 11 ad 13 } } diff --git a/plugins/kotlin/testData/results/pkg/TestWhenControlFlow.dec b/plugins/kotlin/testData/results/pkg/TestWhenControlFlow.dec index 850f632e23..c7db826eba 100644 --- a/plugins/kotlin/testData/results/pkg/TestWhenControlFlow.dec +++ b/plugins/kotlin/testData/results/pkg/TestWhenControlFlow.dec @@ -1,8 +1,8 @@ package pkg -class TestWhenControlFlow { +public class TestWhenControlFlow { public fun test1(x: Int) { - var xx: Int = x;// 5 + val xx: Int = x;// 5 while (xx > 0) {// 7 if (--xx == 10) {// 8 9 10 @@ -26,6 +26,8 @@ class 'pkg/TestWhenControlFlow' { 1 4 2 6 3 6 + 4 6 + 5 6 6 7 7 7 8 7 @@ -34,16 +36,26 @@ class 'pkg/TestWhenControlFlow' { c 7 d 7 e 7 + f 7 + 10 7 11 11 12 11 13 11 + 14 11 + 15 11 16 12 17 12 18 12 + 19 12 + 1a 12 1b 12 1c 12 1d 12 + 1e 12 + 1f 12 29 12 + 2a 12 + 2b 12 2c 13 2d 16 2e 16 diff --git a/plugins/kotlin/testData/src/kt/pkg/TestCompanionObject.kt b/plugins/kotlin/testData/src/kt/pkg/TestCompanionObject.kt new file mode 100644 index 0000000000..610ce42896 --- /dev/null +++ b/plugins/kotlin/testData/src/kt/pkg/TestCompanionObject.kt @@ -0,0 +1,23 @@ +package pkg + +class TestCompanionObject { + fun notInCompanion() { + println("notInCompanion") + } + + companion object { + val companionVal = "inCompanion" + + @JvmStatic + val companionValJvmStatic = "inCompanionJvmStatic" + + fun inCompanion() { + println("inCompanion") + } + + @JvmStatic + fun inCompanionJvmStatic() { + println("inCompanionJvmStatic") + } + } +} \ No newline at end of file diff --git a/plugins/kotlin/testData/src/kt/pkg/TestDestructors.kt b/plugins/kotlin/testData/src/kt/pkg/TestDestructors.kt index 7f6b67229f..ccb067170b 100644 --- a/plugins/kotlin/testData/src/kt/pkg/TestDestructors.kt +++ b/plugins/kotlin/testData/src/kt/pkg/TestDestructors.kt @@ -45,19 +45,6 @@ class TestDestructors { println("$a$b$c") } - inline fun destructInlineLambda(x: () -> Int) { - val (a, b, c) = x - println("$a$b$c") - } - - fun callDestructInlineLambda() { - destructInlineLambda { 123 } - } - - fun callDestructInlineLambdaWithControlFlow(x: Int) { - destructInlineLambda { if (x in 100..999) x else return } - } - fun destructInlineLambdaNoInline(x: () -> Int) { val (a, b, c) = x println("$a$b$c") diff --git a/plugins/kotlin/testData/src/kt/pkg/TestEnumClass.kt b/plugins/kotlin/testData/src/kt/pkg/TestEnumClass.kt new file mode 100644 index 0000000000..081322b28f --- /dev/null +++ b/plugins/kotlin/testData/src/kt/pkg/TestEnumClass.kt @@ -0,0 +1,8 @@ +package pkg + +enum class TestEnumClass(val number: Int = 4) { + A, B, C(3), D(5) + ; + + fun foo() = number +} \ No newline at end of file diff --git a/plugins/kotlin/testData/src/kt/pkg/TestStringInterpolation.kt b/plugins/kotlin/testData/src/kt/pkg/TestStringInterpolation.kt new file mode 100644 index 0000000000..6e0a3dbbec --- /dev/null +++ b/plugins/kotlin/testData/src/kt/pkg/TestStringInterpolation.kt @@ -0,0 +1,24 @@ +package pkg + +class TestStringInterpolation { + fun stringInterpolation(x: Int, y: String) { + println("$x $y") + } + + fun testConstant(x: Int) { + println("$x ${5}") + } + + fun testExpression(x: Int) { + println("$x ${x + 1}") + } + + val x = 5 + fun testProperty() { + println("$x!") + } + + fun testLiteralClass() { + println("${TestStringInterpolation::class.java}!") + } +} diff --git a/plugins/kotlin/testData/src/kt/pkg/TestTopLevel.kt b/plugins/kotlin/testData/src/kt/pkg/TestTopLevel.kt index 74b94d49f6..94a0ff6793 100644 --- a/plugins/kotlin/testData/src/kt/pkg/TestTopLevel.kt +++ b/plugins/kotlin/testData/src/kt/pkg/TestTopLevel.kt @@ -9,3 +9,8 @@ var topLevelVar = 42 val topLevelVal = Regex("") const val topLevelConstVal = 926 + +fun interpolateTopLevel() { + println("topLevelVar = $topLevelVar") + println("topLevelConstVal = $topLevelConstVal") +} diff --git a/plugins/kotlin/testData/src/ktold/pkg/TestClassicStringInterpolation.kt b/plugins/kotlin/testData/src/ktold/pkg/TestClassicStringInterpolation.kt new file mode 100644 index 0000000000..5ed50b57fa --- /dev/null +++ b/plugins/kotlin/testData/src/ktold/pkg/TestClassicStringInterpolation.kt @@ -0,0 +1,24 @@ +package pkg + +class TestClassicStringInterpolation { + fun stringInterpolation(x: Int, y: String) { + println("$x $y") + } + + fun testConstant(x: Int) { + println("$x ${5}") + } + + fun testExpression(x: Int) { + println("$x ${x + 1}") + } + + val x = 5 + fun testProperty() { + println("$x!") + } + + fun testLiteralClass() { + println("${TestClassicStringInterpolation::class.java}!") + } +} diff --git a/plugins/variable-renaming/build.gradle b/plugins/variable-renaming/build.gradle index 18767f6c97..acf766a461 100644 --- a/plugins/variable-renaming/build.gradle +++ b/plugins/variable-renaming/build.gradle @@ -1,6 +1,6 @@ import org.vineflower.build.TestDataRuntimesProvider -archivesBaseName = 'vineflower-variable-renaming' +base.archivesName = 'vineflower-variable-renaming' dependencies { implementation project(":") diff --git a/plugins/variable-renaming/src/main/java/org/vineflower/variablerenaming/VariableRenamingOptions.java b/plugins/variable-renaming/src/main/java/org/vineflower/variablerenaming/VariableRenamingOptions.java index d3d92dad40..a71e0203bc 100644 --- a/plugins/variable-renaming/src/main/java/org/vineflower/variablerenaming/VariableRenamingOptions.java +++ b/plugins/variable-renaming/src/main/java/org/vineflower/variablerenaming/VariableRenamingOptions.java @@ -1,28 +1,28 @@ package org.vineflower.variablerenaming; +import org.jetbrains.java.decompiler.api.DecompilerOption; import org.jetbrains.java.decompiler.api.plugin.PluginOptions; -import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences.*; public interface VariableRenamingOptions { @Name("Variable Renaming") @Description("Use a custom renamer for variable names. Built-in options include \"jad\" and \"tiny\".") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String VARIABLE_RENAMER = "variable-renaming"; @Name("Rename Parameters") @Description("Use the custom renamer for parameters in addition to locals.") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String RENAME_PARAMETERS = "rename-parameters"; @Name("[Deprecated] JAD-Style Variable Naming") @Description("Use JAD-style variable naming. Deprecated, set \"variable-renamer=jad\" instead.") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String USE_JAD_VARNAMING = "jad-style-variable-naming"; @Name("[Deprecated] JAD-Style Parameter Naming") @Description("Alias for \"rename-parameters\". Deprecated, use that option instead.") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String USE_JAD_PARAMETER_NAMING = "jad-style-parameter-naming"; static void addDefaults(PluginOptions.AddDefaults cons) { diff --git a/plugins/variable-renaming/src/test/java/org/vineflower/variablerenaming/VariableRenamingTest.java b/plugins/variable-renaming/src/test/java/org/vineflower/variablerenaming/VariableRenamingTest.java index ab969a6907..9e8118912d 100644 --- a/plugins/variable-renaming/src/test/java/org/vineflower/variablerenaming/VariableRenamingTest.java +++ b/plugins/variable-renaming/src/test/java/org/vineflower/variablerenaming/VariableRenamingTest.java @@ -13,6 +13,7 @@ protected void registerAll() { register(JAVA_8, "TestJADNaming"); // TODO: loop part fails registerRaw(CUSTOM, "TestJadLvtCollision"); // created by placing a class in java8 sources and remapping its param using tinyremapper + register(JAVA_8, "TestJADLocalClasses"); }, IFernflowerPreferences.BYTECODE_SOURCE_MAPPING, "1", IFernflowerPreferences.DUMP_ORIGINAL_LINES, "1", IFernflowerPreferences.DUMP_EXCEPTION_ON_ERROR, "0", diff --git a/plugins/variable-renaming/testData/results/TestJadLvtCollision.dec b/plugins/variable-renaming/testData/results/TestJadLvtCollision.dec index f215f8dabc..b8a7c00aa5 100644 --- a/plugins/variable-renaming/testData/results/TestJadLvtCollision.dec +++ b/plugins/variable-renaming/testData/results/TestJadLvtCollision.dec @@ -91,4 +91,4 @@ Lines mapping: 16 <-> 13 20 <-> 16 Not mapped: -15 \ No newline at end of file +15 diff --git a/plugins/variable-renaming/testData/results/pkg/TestJADLocalClasses.dec b/plugins/variable-renaming/testData/results/pkg/TestJADLocalClasses.dec new file mode 100644 index 0000000000..117c32ede0 --- /dev/null +++ b/plugins/variable-renaming/testData/results/pkg/TestJADLocalClasses.dec @@ -0,0 +1,38 @@ +package pkg; + +public class TestJADLocalClasses { + public void function() { + int i = 0;// 5 + + class Test { + Test() { + int j = 0;// 8 + }// 9 + } + + }// 11 +} + +class 'pkg/TestJADLocalClasses' { + method 'function ()V' { + 0 4 + 1 4 + 2 12 + } +} + +class 'pkg/TestJADLocalClasses$1Test' { + method ' (Lpkg/TestJADLocalClasses;)V' { + 9 8 + a 8 + b 9 + } +} + +Lines mapping: +5 <-> 5 +8 <-> 9 +9 <-> 10 +11 <-> 13 +Not mapped: +7 diff --git a/plugins/variable-renaming/testData/results/pkg/TestJADNaming.dec b/plugins/variable-renaming/testData/results/pkg/TestJADNaming.dec index a8429c1090..c5c96930e5 100644 --- a/plugins/variable-renaming/testData/results/pkg/TestJADNaming.dec +++ b/plugins/variable-renaming/testData/results/pkg/TestJADNaming.dec @@ -69,10 +69,14 @@ class 'pkg/TestJADNaming' { 11 8 12 8 13 8 + 14 8 + 15 8 16 8 17 8 18 8 19 8 + 1a 8 + 1b 8 1c 11 1d 11 1e 11 @@ -90,11 +94,15 @@ class 'pkg/TestJADNaming' { 2a 15 2b 15 2c 15 + 2d 15 + 2e 15 2f 15 30 15 31 15 32 15 33 15 + 34 15 + 35 15 36 17 } @@ -208,4 +216,4 @@ Lines mapping: 37 <-> 44 39 <-> 45 40 <-> 46 -41 <-> 47 \ No newline at end of file +41 <-> 47 diff --git a/plugins/variable-renaming/testData/results/pkg/TestTinyNaming.dec b/plugins/variable-renaming/testData/results/pkg/TestTinyNaming.dec index f068b961e8..00a00350e4 100644 --- a/plugins/variable-renaming/testData/results/pkg/TestTinyNaming.dec +++ b/plugins/variable-renaming/testData/results/pkg/TestTinyNaming.dec @@ -833,4 +833,4 @@ Lines mapping: 181 <-> 177 182 <-> 178 183 <-> 179 -184 <-> 180 \ No newline at end of file +184 <-> 180 diff --git a/plugins/variable-renaming/testData/src/java8/pkg/TestJADLocalClasses.java b/plugins/variable-renaming/testData/src/java8/pkg/TestJADLocalClasses.java new file mode 100644 index 0000000000..baa49e221b --- /dev/null +++ b/plugins/variable-renaming/testData/src/java8/pkg/TestJADLocalClasses.java @@ -0,0 +1,12 @@ +package pkg; + +public class TestJADLocalClasses { + public void function() { + int a = 0; + class Test { + Test() { + int b = 0; + } + } + } +} diff --git a/settings.gradle b/settings.gradle index 5efe867adb..1ec4b18cad 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.6.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } rootProject.name = 'vineflower' diff --git a/src/org/jetbrains/java/decompiler/api/DecompilerOption.java b/src/org/jetbrains/java/decompiler/api/DecompilerOption.java new file mode 100644 index 0000000000..79e9e3155f --- /dev/null +++ b/src/org/jetbrains/java/decompiler/api/DecompilerOption.java @@ -0,0 +1,194 @@ +package org.jetbrains.java.decompiler.api; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.java.decompiler.api.plugin.Plugin; +import org.jetbrains.java.decompiler.api.plugin.PluginOptions; +import org.jetbrains.java.decompiler.main.Fernflower; +import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler; +import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; +import org.jetbrains.java.decompiler.main.plugins.PluginContext; + +import java.lang.reflect.Field; +import java.util.*; + +/** + * Represents a decompiler option. These can be passed from command line or as + * a map into a {@link BaseDecompiler} or {@link Fernflower} constructor. + *

+ * As plugins might not provide all information, some fields are nullable. + * + * @param id The unique identifier of the option. This is what is passed to the decompiler. + * @param name A human-readable name for the option. + * @param description A human-readable description of the option. + * @param type The type of the option. + * @param plugin The plugin that provides this option. If {@code null}, it comes from the core decompiler. + * @param defaultValue The default value of the option. + */ +public record DecompilerOption( + @NotNull String id, + @NotNull String name, + @NotNull String description, + @NotNull Type type, + @Nullable String plugin, + @Nullable String defaultValue +) implements Comparable { + public enum Type { + BOOLEAN("bool"), + STRING("string"), + INTEGER("int"), + + ; + + private final String friendlyName; + + Type(String friendlyName) { + this.friendlyName = friendlyName; + } + + public String toString() { + return friendlyName; + } + } + + /** + * Compares this option to another option. The order is set first by the plugin, then by the id. + * Core decompiler options come first. + */ + @Override + public int compareTo(@NotNull DecompilerOption decompilerOption) { + if (!Objects.equals(decompilerOption.plugin, plugin)) { + if (plugin == null) { + return -1; + } + if (decompilerOption.plugin == null) { + return 1; + } + return plugin.compareTo(decompilerOption.plugin); + } + return id.compareTo(decompilerOption.id); + } + + /** + * Get all decompiler options from all plugins and the core decompiler. + * @return A list of all decompiler options, sorted by plugin and id, with core decompiler options first. + */ + public static List getAll() { + List options = new ArrayList<>(); + + List fields = Arrays.stream(IFernflowerPreferences.class.getDeclaredFields()) + .filter(field -> field.getType() == String.class) + .toList(); + + Map defaults = IFernflowerPreferences.DEFAULTS; + addOptions(fields, options, defaults, null); + + PluginContext ctx = new PluginContext(); + ctx.findPlugins(); + + for (Plugin plugin : ctx.getPlugins()) { + PluginOptions opt = plugin.getPluginOptions(); + + if (opt != null) { + var opts = opt.provideOptions(); + + List pluginFields = Arrays.stream(opts.a.getDeclaredFields()) + .filter(field -> field.getType() == String.class) + .toList(); + + Map pluginDefaults = new HashMap<>(); + opts.b.accept(pluginDefaults::put); + + addOptions(pluginFields, options, pluginDefaults, plugin); + } + } + + options.sort(DecompilerOption::compareTo); + + return options; + } + + /** + * Get all decompiler options from all plugins and the core decompiler, grouped by plugin. + * Calling {@link Map#get} with {@code null} will return the core decompiler options. + * @return A map of plugins to their decompiler options, sorted by id within each plugin. + */ + public static Map> getAllByPlugin() { + Map> options = new HashMap<>(); + + List fields = Arrays.stream(IFernflowerPreferences.class.getDeclaredFields()) + .filter(field -> field.getType() == String.class) + .toList(); + + Map defaults = IFernflowerPreferences.DEFAULTS; + List coreOptions = new ArrayList<>(); + addOptions(fields, coreOptions, defaults, null); + coreOptions.sort(DecompilerOption::compareTo); + options.put(null, coreOptions); + + PluginContext ctx = new PluginContext(); + ctx.findPlugins(); + + for (Plugin plugin : ctx.getPlugins()) { + PluginOptions opt = plugin.getPluginOptions(); + + if (opt != null) { + var opts = opt.provideOptions(); + + List pluginFields = Arrays.stream(opts.a.getDeclaredFields()) + .filter(field -> field.getType() == String.class) + .toList(); + + Map pluginDefaults = new HashMap<>(); + opts.b.accept(pluginDefaults::put); + + List pluginOptions = new ArrayList<>(); + addOptions(pluginFields, pluginOptions, pluginDefaults, plugin); + + pluginOptions.sort(DecompilerOption::compareTo); + + options.put(plugin, pluginOptions); + } + } + + return options; + } + + private static void addOptions(List fields, List options, Map defaults, Plugin plugin) { + for (Field field : fields) { + IFernflowerPreferences.Name name = field.getAnnotation(IFernflowerPreferences.Name.class); + IFernflowerPreferences.Description description = field.getAnnotation(IFernflowerPreferences.Description.class); + IFernflowerPreferences.Type type = field.getAnnotation(IFernflowerPreferences.Type.class); + + String paramName; + try { + paramName = (String) field.get(null); + } catch (IllegalAccessException e) { + IFernflowerPreferences.ShortName shortName = field.getAnnotation(IFernflowerPreferences.ShortName.class); + if (shortName == null) { + continue; + } + paramName = shortName.value(); + } + + if (name == null || description == null || type == null) { + continue; + } + + String friendlyName = name.value(); + String friendlyDescription = description.value(); + Type friendlyType = type.value(); + Object defaultValue = defaults.get(paramName); + String defaultValueString = defaultValue != null ? defaultValue.toString() : null; + + options.add(new DecompilerOption( + paramName, + friendlyName, + friendlyDescription, + friendlyType, + plugin != null ? plugin.id() : null, + defaultValueString + )); + } + } +} diff --git a/src/org/jetbrains/java/decompiler/api/plugin/LanguageSpec.java b/src/org/jetbrains/java/decompiler/api/plugin/LanguageSpec.java index 77a3d6cf7b..8f5082b5c7 100644 --- a/src/org/jetbrains/java/decompiler/api/plugin/LanguageSpec.java +++ b/src/org/jetbrains/java/decompiler/api/plugin/LanguageSpec.java @@ -8,12 +8,14 @@ public final class LanguageSpec { public final GraphParser graphParser; public final StatementWriter writer; public final Pass pass; + public final String extension; - public LanguageSpec(String name, LanguageChooser chooser, GraphParser graphParser, StatementWriter writer, Pass pass) { + public LanguageSpec(String name, LanguageChooser chooser, GraphParser graphParser, StatementWriter writer, Pass pass, String extension) { this.name = name; this.chooser = chooser; this.graphParser = graphParser; this.writer = writer; this.pass = pass; + this.extension = extension; } } diff --git a/src/org/jetbrains/java/decompiler/code/BytecodeVersion.java b/src/org/jetbrains/java/decompiler/code/BytecodeVersion.java index ba919b14c3..1f4dc105ba 100644 --- a/src/org/jetbrains/java/decompiler/code/BytecodeVersion.java +++ b/src/org/jetbrains/java/decompiler/code/BytecodeVersion.java @@ -42,7 +42,11 @@ public boolean hasSwitchExpressions() { } public boolean hasSwitchPatternMatch() { - return previewFrom(MAJOR_17); + return previewReleased(MAJOR_17, MAJOR_21); + } + + public boolean hasRecordPatternMatching() { + return major >= MAJOR_21; } public boolean hasSealedClasses() { @@ -112,4 +116,8 @@ public int hashCode() { public static final int MAJOR_15 = 59; public static final int MAJOR_16 = 60; public static final int MAJOR_17 = 61; + public static final int MAJOR_18 = 62; + public static final int MAJOR_19 = 63; + public static final int MAJOR_20 = 64; + public static final int MAJOR_21 = 65; } diff --git a/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/src/org/jetbrains/java/decompiler/main/ClassWriter.java index 22e9ca34eb..09d4fc3d5a 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -1,6 +1,7 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.main; +import java.util.concurrent.atomic.AtomicBoolean; import net.fabricmc.fernflower.api.IFabricJavadocProvider; import org.jetbrains.java.decompiler.api.plugin.StatementWriter; import org.jetbrains.java.decompiler.code.CodeConstants; @@ -36,6 +37,7 @@ import org.jetbrains.java.decompiler.struct.gen.generics.GenericClassDescriptor; import org.jetbrains.java.decompiler.struct.gen.generics.GenericFieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.generics.GenericMethodDescriptor; +import org.jetbrains.java.decompiler.struct.gen.generics.GenericsChecker; import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.Key; import org.jetbrains.java.decompiler.util.TextBuffer; @@ -284,7 +286,7 @@ public void classLambdaToJava(ClassNode node, TextBuffer buffer, Exprent method_ MethodWrapper outerWrapper = (MethodWrapper)DecompilerContext.getContextProperty(DecompilerContext.CURRENT_METHOD_WRAPPER); DecompilerContext.setProperty(DecompilerContext.CURRENT_METHOD_WRAPPER, methodWrapper); try { - TextBuffer codeBuffer = firstExpr.toJava(indent + 1); + TextBuffer codeBuffer = firstExpr.toJava(indent); if (firstExpr instanceof ExitExprent) codeBuffer.setStart(6); // skip return @@ -308,6 +310,9 @@ public void classLambdaToJava(ClassNode node, TextBuffer buffer, Exprent method_ DecompilerContext.setProperty(DecompilerContext.CURRENT_METHOD_WRAPPER, outerWrapper); } } + } else if (firstStat instanceof BasicBlockStatement && firstStat.getExprents() != null && firstStat.getExprents().isEmpty()) { + buffer.append(" {}"); + simpleLambda = true; } } } @@ -374,7 +379,19 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) { // write class definition writeClassDefinition(node, buffer, indent); - boolean hasContent = false; + final AtomicBoolean hasContent = new AtomicBoolean(false); + // writeClassDefinition will skip adding a trailing newline for anonymous classes. + // This allows us to only add it if we end up writing any content for the class, so something + // like `new Object() {}` will not have a newline in between `{` and `}`. + // The runnable should be executed immediately before writing any anonymous class content to the buffer. + // hasContent also fills a similar purpose, determining whether elements need an extra newline prepended due to previous content being written. + final Runnable haveContent = () -> { + if (!hasContent.get() && node.type == ClassNode.Type.ANONYMOUS) { + buffer.appendLineSeparator(); + } + hasContent.set(true); + }; + boolean enumFields = false; List components = cl.getRecordComponents(); @@ -440,9 +457,8 @@ else if (enumFields) { TextBuffer fieldBuffer = new TextBuffer(); writeField(wrapper, cl, fd, fieldBuffer, indent + 1); fieldBuffer.clearUnassignedBytecodeMappingData(); + haveContent.run(); buffer.append(fieldBuffer); - - hasContent = true; } if (enumFields) { @@ -469,10 +485,10 @@ else if (enumFields) { TextBuffer methodBuffer = new TextBuffer(); boolean methodSkipped = !writeMethod(node, mt, i, methodBuffer, indent + 1); if (!methodSkipped) { - if (hasContent) { + if (hasContent.get()) { buffer.appendLineSeparator(); } - hasContent = true; + haveContent.run(); buffer.append(methodBuffer); } } @@ -486,16 +502,21 @@ else if (enumFields) { wrapper.getHiddenMembers().contains(innerCl.qualifiedName); if (hide) continue; - if (hasContent) { + if (hasContent.get()) { buffer.appendLineSeparator(); } - writeClass(inner, buffer, indent + 1); - - hasContent = true; + TextBuffer clsBuffer = new TextBuffer(); + writeClass(inner, clsBuffer, indent + 1); + haveContent.run(); + buffer.append(clsBuffer); } } - buffer.appendIndent(indent).append('}'); + if (hasContent.get() || node.type != ClassNode.Type.ANONYMOUS) { + // Skip indent for anonymous classes with no content, since we also skipped the newline in the cls definition + buffer.appendIndent(indent); + } + buffer.append('}'); if (node.type != ClassNode.Type.ANONYMOUS) { buffer.appendLineSeparator(); @@ -619,7 +640,8 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent) if (markSynthetics) { appendSyntheticClassComment(cl, buffer); } - buffer.append(" {").appendLineSeparator(); + buffer.append(" {"); + // Omit trailing newline, will be added by the caller if there is any content in the class return; } @@ -673,8 +695,9 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent) List components = cl.getRecordComponents(); if (components != null) { - // records are implicitly final + // records are implicitly static and final flags &= ~CodeConstants.ACC_FINAL; + flags &= ~CodeConstants.ACC_STATIC; } appendModifiers(buffer, flags, CLASS_ALLOWED, isInterface, CLASS_EXCLUDED); @@ -712,6 +735,15 @@ else if (components != null) { buffer.appendClass(node.simpleName, true, cl.qualifiedName); GenericClassDescriptor descriptor = cl.getSignature(); + if (descriptor != null) { + VarType superclass = new VarType(cl.superClass.getString(), true); + List interfaces = Arrays.stream(cl.getInterfaceNames()) + .map(s -> new VarType(s, true)) + .toList(); + + descriptor.verifyTypes(superclass, interfaces); + } + if (descriptor != null && !descriptor.fparameters.isEmpty()) { appendTypeParameters(buffer, descriptor.fparameters, descriptor.fbounds); } @@ -835,6 +867,9 @@ public void writeField(ClassWrapper wrapper, StructClass cl, StructField fd, Tex Map.Entry fieldTypeData = getFieldTypeData(fd); VarType fieldType = fieldTypeData.getKey(); GenericFieldDescriptor descriptor = fieldTypeData.getValue(); + if (descriptor != null) { + descriptor.verifyType(cl.getSignature(), fieldType); + } if (!isEnum) { buffer.appendCastTypeName(descriptor == null ? fieldType : descriptor.type); @@ -1121,6 +1156,48 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex } GenericMethodDescriptor descriptor = mt.getSignature(); + if (descriptor != null) { + List params = new ArrayList<>(Arrays.asList(mt.methodDescriptor().params)); + + if (init && node.classStruct.hasModifier(CodeConstants.ACC_ENUM)) { + // Enum name and ordinal parameters need to be explicitly excluded + params.remove(0); + params.remove(0); + } + + // Exclude any parameters that the signature itself won't contain + List mask = methodWrapper.synthParameters; + if (mask != null) { + for (int i = 0, j = 0; i < mask.size(); i++, j++) { + if (mask.get(i) != null) { + params.remove(j--); + } + } + } + + StructExceptionsAttribute attr = mt.getAttribute(StructGeneralAttribute.ATTRIBUTE_EXCEPTIONS); + List exceptions = new ArrayList<>(); + if (attr != null) { + for (int i = 0; i < attr.getThrowsExceptions().size(); i++) { + exceptions.add(new VarType(attr.getExcClassname(i, node.classStruct.getPool()), true)); + } + } + + GenericsChecker checker = new GenericsChecker(); + + ClassNode currentNode = node; + while (currentNode != null) { + GenericClassDescriptor parentSignature = currentNode.classStruct.getSignature(); + if (parentSignature != null) { + checker = checker.copy(parentSignature.getChecker()); + } + + currentNode = currentNode.parent; + } + + descriptor.verifyTypes(checker, params, mt.methodDescriptor().ret, exceptions); + } + boolean throwsExceptions = false; int paramCount = 0; @@ -1170,8 +1247,9 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex buffer.pushNewlineGroup(indent, 0); for (int i = start; i < md.params.length; i++) { - VarType parameterType = hasDescriptor && paramCount < descriptor.parameterTypes.size() ? descriptor.parameterTypes.get(paramCount) : md.params[i]; - if (mask == null || mask.get(i) == null) { + boolean real = mask == null || mask.get(i) == null; + VarType parameterType = real && hasDescriptor && paramCount < descriptor.parameterTypes.size() ? descriptor.parameterTypes.get(paramCount) : md.params[i]; + if (real) { if (paramCount > 0) { buffer.append(","); buffer.appendPossibleNewline(" "); @@ -1208,7 +1286,7 @@ else if (methodWrapper.varproc.getVarFinal(new VarVersionPair(index, 0)) == VarT String clashingName = methodWrapper.varproc.getClashingName(new VarVersionPair(index, 0)); if (clashingName != null) { parameterName = clashingName; - } else if (methodParameters != null && i < methodParameters.size()) { + } else if (methodParameters != null && i < methodParameters.size() && methodParameters.get(i).myName != null) { parameterName = methodParameters.get(i).myName; } else { parameterName = methodWrapper.varproc.getVarName(new VarVersionPair(index, 0)); diff --git a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java index 287ce0f5cd..3252b57772 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java @@ -36,6 +36,8 @@ import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class ClassesProcessor implements CodeConstants { public static final int AVERAGE_CLASS_SIZE = 16 * 1024; @@ -94,8 +96,31 @@ public void loadClasses(IIdentifierRenamer renamer) { boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER); boolean verifyAnonymousClasses = DecompilerContext.getOption(IFernflowerPreferences.VERIFY_ANONYMOUS_CLASSES); + Matcher excludedMatcher = null; + String excludedRegex = DecompilerContext.getProperty(IFernflowerPreferences.EXCLUDED_CLASSES).toString(); + if (!excludedRegex.isEmpty()) { + excludedMatcher = Pattern.compile(excludedRegex).matcher(""); + } + + // Filter any duplicate classes + + List ownClasses = context.getOwnClasses(); + List classes = new ArrayList<>(); + Set names = new LinkedHashSet<>(); + + for (StructClass cl : ownClasses) { + if (names.add(cl.qualifiedName)) { + classes.add(cl); + } else { + DecompilerContext.getLogger().writeMessage("Skipping processing already existing class: " + cl.qualifiedName, IFernflowerLogger.Severity.ERROR); + } + } + // create class nodes - for (StructClass cl : context.getOwnClasses()) { + for (StructClass cl : classes) { + if (excludedMatcher != null && excludedMatcher.reset(cl.qualifiedName).matches()) { + continue; + } if (!mapRootClasses.containsKey(cl.qualifiedName)) { if (bDecompileInner) { StructInnerClassesAttribute inner = cl.getAttribute(StructGeneralAttribute.ATTRIBUTE_INNER_CLASSES); @@ -165,7 +190,8 @@ else if (simpleName != null && if (enclClassName == null || innerName.equals(enclClassName)) { continue; // invalid name or self reference } - if (rec.type == ClassNode.Type.MEMBER && !innerName.equals(enclClassName + '$' + entry.simpleName)) { + if (DecompilerContext.getOption(IFernflowerPreferences.VALIDATE_INNER_CLASSES_NAMES) && + rec.type == ClassNode.Type.MEMBER && !innerName.equals(enclClassName + '$' + entry.simpleName)) { continue; // not a real inner class } @@ -563,9 +589,8 @@ private static void destroyWrappers(ClassNode node) { node.classStruct.releaseResources(); node.classStruct.getMethods().forEach(m -> m.clearVariableNamer()); - for (ClassNode nd : node.nested) { - destroyWrappers(nd); - } + // Don't destroy inner node wrappers, they may still be needed to process constructor + // invocations etc. from other classes. } public Map getMapRootClasses() { diff --git a/src/org/jetbrains/java/decompiler/main/Fernflower.java b/src/org/jetbrains/java/decompiler/main/Fernflower.java index 5c5f2e171c..6cbc768fe7 100644 --- a/src/org/jetbrains/java/decompiler/main/Fernflower.java +++ b/src/org/jetbrains/java/decompiler/main/Fernflower.java @@ -2,6 +2,8 @@ package org.jetbrains.java.decompiler.main; import java.io.IOException; + +import org.jetbrains.java.decompiler.api.plugin.LanguageSpec; import org.jetbrains.java.decompiler.api.plugin.Plugin; import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode; import org.jetbrains.java.decompiler.main.decompiler.OptionParser; @@ -160,20 +162,23 @@ public void clearContext() { @Override public String getClassEntryName(StructClass cl, String entryName) { + LanguageSpec spec = PluginContext.getCurrentContext().getLanguageSpec(cl); + String extension = spec == null ? "java" : spec.extension; + ClassNode node = classProcessor.getMapRootClasses().get(cl.qualifiedName); if (node == null || node.type != ClassNode.Type.ROOT) { return null; } else if (converter != null) { String simpleClassName = cl.qualifiedName.substring(cl.qualifiedName.lastIndexOf('/') + 1); - return entryName.substring(0, entryName.lastIndexOf('/') + 1) + simpleClassName + ".java"; + return entryName.substring(0, entryName.lastIndexOf('/') + 1) + simpleClassName + "." + extension; } else { final int clazzIdx = entryName.lastIndexOf(".class"); if (clazzIdx == -1) { - return entryName + ".java"; + return entryName + "." + extension; } else { - return entryName.substring(0, clazzIdx) + ".java"; + return entryName.substring(0, clazzIdx) + "." + extension; } } } diff --git a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java index c6f1410a89..d7697009f7 100644 --- a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java @@ -420,7 +420,7 @@ private static boolean isExprentIndependent(FieldExprent field, Exprent exprent, VarVersionPair varPair = new VarVersionPair((VarExprent)expr); if (!method.varproc.getExternalVars().contains(varPair)) { String varName = method.varproc.getVarName(varPair); - if (!varName.equals("this") && !varName.endsWith(".this")) { // FIXME: remove direct comparison with strings + if (varName == null || !varName.equals("this") && !varName.endsWith(".this")) { // FIXME: remove direct comparison with strings return false; } } diff --git a/src/org/jetbrains/java/decompiler/main/RecordHelper.java b/src/org/jetbrains/java/decompiler/main/RecordHelper.java index eb1b591ff1..cfa73a014e 100644 --- a/src/org/jetbrains/java/decompiler/main/RecordHelper.java +++ b/src/org/jetbrains/java/decompiler/main/RecordHelper.java @@ -3,7 +3,6 @@ import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.main.rels.MethodWrapper; import org.jetbrains.java.decompiler.modules.decompiler.exps.*; -import org.jetbrains.java.decompiler.modules.decompiler.flow.DirectGraph; import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.RootStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; @@ -201,7 +200,10 @@ private static void recordComponentToJava(TextBuffer buffer, StructClass cl, Str VarType fieldType = new VarType(cd.getDescriptor(), false); GenericFieldDescriptor descriptor = cd.getSignature(); - if (descriptor != null) fieldType = descriptor.type; + if (descriptor != null) { + descriptor.verifyType(cl.getSignature(), fieldType); + fieldType = descriptor.type; + } buffer.appendCastTypeName(varArgComponent ? fieldType.decreaseArrayDim() : fieldType); if (varArgComponent) { diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleHelp.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleHelp.java index fc7c600a25..43991e7549 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleHelp.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleHelp.java @@ -1,5 +1,6 @@ package org.jetbrains.java.decompiler.main.decompiler; +import org.jetbrains.java.decompiler.api.DecompilerOption; import org.jetbrains.java.decompiler.api.plugin.Plugin; import org.jetbrains.java.decompiler.api.plugin.PluginOptions; import org.jetbrains.java.decompiler.main.Init; @@ -51,104 +52,55 @@ static void printHelp() { System.out.println(line); } - List fields = Arrays.stream(IFernflowerPreferences.class.getDeclaredFields()) - .filter(field -> field.getType() == String.class) - .collect(Collectors.toList()); + Map> options = DecompilerOption.getAllByPlugin(); - Map defaults = IFernflowerPreferences.DEFAULTS; - - writeOptions(fields, defaults); - - PluginContext ctx = new PluginContext(); - - ctx.findPlugins(); - - for (Plugin plugin : ctx.getPlugins()) { - PluginOptions opt = plugin.getPluginOptions(); - - if (opt != null) { - var opts = opt.provideOptions(); - - List pluginFields = Arrays.stream(opts.a.getDeclaredFields()) - .filter(field -> field.getType() == String.class) - .collect(Collectors.toList()); - - Map pluginDefaults = new HashMap<>(); - opts.b.accept(pluginDefaults::put); - - if (!pluginFields.isEmpty()) { - System.out.println(); - System.out.println("====== Options for plugin '" + plugin.id() + "' ======"); - writeOptions(pluginFields, pluginDefaults); - } - } + List coreOptions = options.remove(null); + if (coreOptions != null) { + writeOptions(coreOptions); } - } - - private static void writeOptions(List fields, Map defaults) { - fields.sort(Comparator.comparing((Field a) -> { - try { - return a.get(null).toString(); - } catch (IllegalAccessException e) { - return ""; - } - })); - - for (Field field : fields) { - IFernflowerPreferences.Name name = field.getAnnotation(IFernflowerPreferences.Name.class); - IFernflowerPreferences.Description description = field.getAnnotation(IFernflowerPreferences.Description.class); - IFernflowerPreferences.Type type = field.getAnnotation(IFernflowerPreferences.Type.class); - - String paramName; - boolean isShortName = false; - try { - paramName = (String) field.get(null); - } catch (IllegalAccessException e) { - IFernflowerPreferences.ShortName shortName = field.getAnnotation(IFernflowerPreferences.ShortName.class); - if (shortName == null) { - continue; - } - paramName = shortName.value(); - isShortName = true; - } - if (name == null || description == null || type == null) { + for (Map.Entry> entry : options.entrySet()) { + if (entry.getValue().isEmpty()) { continue; } + System.out.println(); + System.out.println("====== Options from " + entry.getKey().id() + " ======"); + writeOptions(entry.getValue()); + } + } + + private static void writeOptions(List options) { + for (DecompilerOption option : options) { StringBuilder sb = new StringBuilder(); - sb.append(isShortName ? "-" : "--") - .append(paramName) - .append(" ".repeat(Math.max(40 - paramName.length(), 0))) + sb.append("--") + .append(option.id()) + .append(" ".repeat(Math.max(40 - option.id().length(), 0))) .append("[") - .append(type.value()) + .append(option.type()) .append("]") - .append(" ".repeat(Math.max(8 - type.value().length(), 0))) - .append(name.value()) - .append(" ".repeat(Math.max(50 - name.value().length(), 0))) - .append(":"); + .append(" ".repeat(Math.max(8 - option.type().toString().length(), 0))) + .append(option.name()) + .append(" ".repeat(Math.max(50 - option.name().length(), 0))) + .append(": "); StringBuilder sb2 = new StringBuilder(); - if (defaults.containsKey(paramName)) { - sb2.append(" (default: "); - Object value = defaults.get(paramName); - switch (type.value()) { - case IFernflowerPreferences.Type.BOOLEAN: - sb2.append(value.equals("1")); - break; - case IFernflowerPreferences.Type.STRING: - sb2.append('"').append(value).append('"'); - break; - default: - sb2.append(value); - break; + if (option.defaultValue() != null) { + sb2.append("(default: "); + String value = option.defaultValue(); + switch (option.type()) { + case BOOLEAN -> sb2.append(value.equals("1")); + case STRING -> sb2.append('"').append(value).append('"'); + case INTEGER -> sb2.append(value); } sb2.append(")"); sb2.append(" ".repeat(Math.max(18 - sb2.length(), 1))); sb.append(sb2); } - sb.append(description.value()); + if (option.description() != null) { + sb.append(option.description()); + } System.out.println(sb); } diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/SingleFileSaver.java b/src/org/jetbrains/java/decompiler/main/decompiler/SingleFileSaver.java index e5fbd7702b..5d1a315ad9 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/SingleFileSaver.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/SingleFileSaver.java @@ -53,11 +53,11 @@ public void copyFile(String source, String path, String entryName) { @Override public void saveClassFile(String path, String qualifiedName, String entryName, String content, int[] mapping) { - if (!checkEntry(qualifiedName + ".java")) + if (!checkEntry(entryName)) return; try { - output.putNextEntry(new ZipEntry(qualifiedName + ".java")); + output.putNextEntry(new ZipEntry(entryName)); if (content != null) { output.write(content.getBytes(StandardCharsets.UTF_8)); diff --git a/src/org/jetbrains/java/decompiler/main/extern/IContextSource.java b/src/org/jetbrains/java/decompiler/main/extern/IContextSource.java index 3dd82b1b8a..51e52eba9c 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IContextSource.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IContextSource.java @@ -260,6 +260,9 @@ public String path() { } } - + @Override + public String toString() { + return "E[" + basePath + "]"; + } } } diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java index b2f4b2acd0..d3d3921946 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java @@ -1,7 +1,7 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.main.extern; -import org.jetbrains.java.decompiler.util.InterpreterUtil; +import org.jetbrains.java.decompiler.api.DecompilerOption; import java.lang.annotation.*; import java.util.Collections; @@ -12,303 +12,308 @@ public interface IFernflowerPreferences { @Name("Remove Bridge Methods") @Description("Removes any methods that are marked as bridge from the decompiled output.") @ShortName("rbr") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String REMOVE_BRIDGE = "remove-bridge"; @Name("Remove Synthetic Methods And Fields") @Description("Removes any methods and fields that are marked as synthetic from the decompiled output.") @ShortName("rsy") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String REMOVE_SYNTHETIC = "remove-synthetic"; @Name("Decompile Inner Classes") @Description("Process inner classes and add them to the decompiled output.") @ShortName("din") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_INNER = "decompile-inner"; @Name("Decompile Java 4 class references") @Description("Resugar the Java 1-4 class reference format instead of leaving the synthetic code.") @ShortName("dc4") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_CLASS_1_4 = "decompile-java4"; @Name("Decompile Assertions") @Description("Decompile assert statements.") @ShortName("das") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_ASSERTIONS = "decompile-assert"; @Name("Hide Empty super()") @Description("Hide super() calls with no parameters.") @ShortName("hes") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String HIDE_EMPTY_SUPER = "hide-empty-super"; @Name("Hide Default Constructor") @Description("Hide constructors with no parameters and no code.") @ShortName("hdc") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String HIDE_DEFAULT_CONSTRUCTOR = "hide-default-constructor"; @Name("Decompile Generics") @Description("Decompile generics in classes, methods, fields, and variables.") @ShortName("dgs") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_GENERIC_SIGNATURES = "decompile-generics"; @Name("Incorporate returns in try-catch blocks") @Description("Integrate returns better in try-catch blocks instead of storing them in a temporary variable.") @ShortName("ner") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String INCORPORATE_RETURNS = "incorporate-returns"; @Name("Ensure synchronized ranges are complete") @Description("If a synchronized block has a monitorenter without any corresponding monitorexit, try to deduce where one should be to ensure the synchronized is correctly decompiled.") @ShortName("esm") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String ENSURE_SYNCHRONIZED_MONITOR = "ensure-synchronized-monitors"; @Name("Decompile Enums") @Description("Decompile enums.") @ShortName("den") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_ENUM = "decompile-enums"; @Name("Decompile Preview Features") @Description("Decompile features marked as preview or incubating in the latest Java versions.") @ShortName("dpr") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_PREVIEW = "decompile-preview"; @Name("Remove reference getClass()") @Description("Remove synthetic getClass() calls created by code such as 'obj.new Inner()'.") @ShortName("rgn") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String REMOVE_GET_CLASS_NEW = "remove-getclass"; @Name("Keep Literals As Is") @Description("Keep NaN, infinities, and pi values as is without resugaring them.") @ShortName("lit") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String LITERALS_AS_IS = "keep-literals"; @Name("Represent boolean as 0/1") @Description("Represent integers 0 and 1 as booleans.") @ShortName("bto") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String BOOLEAN_TRUE_ONE = "boolean-as-int"; @Name("ASCII String Characters") @Description("Encode non-ASCII characters in string and character literals as Unicode escapes.") @ShortName("asc") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String ASCII_STRING_CHARACTERS = "ascii-strings"; @Name("Synthetic Not Set") @Description("Treat some known structures as synthetic even when not explicitly set.") @ShortName("nns") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SYNTHETIC_NOT_SET = "synthetic-not-set"; @Name("Treat Undefined Param Type As Object") @Description("Treat nameless types as java.lang.Object.") @ShortName("uto") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String UNDEFINED_PARAM_TYPE_OBJECT = "undefined-as-object"; @Name("Use LVT Names") @Description("Use LVT names for local variables and parameters instead of var_.") @ShortName("udv") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String USE_DEBUG_VAR_NAMES = "use-lvt-names"; @Name("Use Method Parameters") @Description("Use method parameter names, as given in the MethodParameters attribute.") @ShortName("ump") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String USE_METHOD_PARAMETERS = "use-method-parameters"; @Name("Remove Empty try-catch blocks") @Description("Remove try-catch blocks with no code.") @ShortName("rer") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String REMOVE_EMPTY_RANGES = "remove-empty-try-catch"; @Name("Decompile Finally") @Description("Decompile finally blocks.") @ShortName("fdi") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String FINALLY_DEINLINE = "decompile-finally"; @Name("Decompile Lambdas as Anonymous Classes") @Description("Decompile lambda expressions as anonymous classes.") @ShortName("lac") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String LAMBDA_TO_ANONYMOUS_CLASS = "lambda-to-anonymous-class"; @Name("Bytecode to Source Mapping") @Description("Map Bytecode to source lines.") @ShortName("bsm") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String BYTECODE_SOURCE_MAPPING = "bytecode-source-mapping"; @Name("Dump Code Lines") @Description("Dump line mappings to output archive zip entry extra data.") @ShortName("dcl") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DUMP_CODE_LINES = "dump-code-lines"; @Name("Ignore Invalid Bytecode") @Description("Ignore bytecode that is malformed.") @ShortName("iib") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String IGNORE_INVALID_BYTECODE = "ignore-invalid-bytecode"; @Name("Verify Anonymous Classes") @Description("Verify that anonymous classes are local.") @ShortName("vac") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String VERIFY_ANONYMOUS_CLASSES = "verify-anonymous-classes"; @Name("Ternary Constant Simplification") @Description("Fold branches of ternary expressions that have boolean true and false constants.") @ShortName("tcs") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String TERNARY_CONSTANT_SIMPLIFICATION = "ternary-constant-simplification"; @Name("Pattern Matching") @Description("Decompile with if and switch pattern matching enabled.") @ShortName("pam") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String PATTERN_MATCHING = "pattern-matching"; @Name("Try-Loop fix") @Description("Fixes rare cases of malformed decompilation when try blocks are found inside of while loops") @ShortName("tlf") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String TRY_LOOP_FIX = "try-loop-fix"; @Name("[Experimental] Ternary In If Conditions") @Description("Tries to collapse if statements that have a ternary in their condition.") @ShortName("tco") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String TERNARY_CONDITIONS = "ternary-in-if"; @Name("Decompile Switch Expressions") @Description("Decompile switch expressions in modern Java class files.") @ShortName("swe") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SWITCH_EXPRESSIONS = "decompile-switch-expressions"; @Name("[Debug] Show hidden statements") @Description("Display hidden code blocks for debugging purposes.") @ShortName("shs") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SHOW_HIDDEN_STATEMENTS = "show-hidden-statements"; @Name("Override Annotation") @Description("Display override annotations for methods known to the decompiler.") @ShortName("ovr") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String OVERRIDE_ANNOTATION = "override-annotation"; @Name("Second-Pass Stack Simplification") @Description("Simplify variables across stack bounds to resugar complex statements.") @ShortName("ssp") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SIMPLIFY_STACK_SECOND_PASS = "simplify-stack"; @Name("[Experimental] Verify Variable Merges") @Description("Tries harder to verify the validity of variable merges. If there are strange variable recompilation issues, this is a good place to start.") @ShortName("vvm") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String VERIFY_VARIABLE_MERGES = "verify-merges"; + @Name("[Experimental] Use old try deduplication") + @Description("Use the old try deduplication algorithm for methods with obfuscated exceptions, which inserts dummy exception handlers instead of duplicating blocks") + @Type(DecompilerOption.Type.BOOLEAN) + String OLD_TRY_DEDUP = "old-try-dedup"; + @Name("Include Entire Classpath") @Description("Give the decompiler information about every jar on the classpath.") @ShortName("iec") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String INCLUDE_ENTIRE_CLASSPATH = "include-classpath"; @Name("Include Java Runtime") @Description("Give the decompiler information about the Java runtime, either 1 or current for the current runtime, or a path to another runtime") @ShortName("jrt") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String INCLUDE_JAVA_RUNTIME = "include-runtime"; @Name("Explicit Generic Arguments") @Description("Put explicit diamond generic arguments on method calls.") @ShortName("ega") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String EXPLICIT_GENERIC_ARGUMENTS = "explicit-generics"; @Name("Inline Simple Lambdas") @Description("Remove braces on simple, one line, lambda expressions.") @ShortName("isl") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String INLINE_SIMPLE_LAMBDAS = "inline-simple-lambdas"; @Name("Logging Level") @Description("Logging level. Must be one of: 'info', 'debug', 'warn', 'error'.") @ShortName("log") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String LOG_LEVEL = "log-level"; @Name("[DEPRECATED] Max time to process method") @Description("Maximum time in seconds to process a method. This is deprecated, do not use.") @ShortName("mpm") - @Type(Type.INTEGER) + @Type(DecompilerOption.Type.INTEGER) String MAX_PROCESSING_METHOD = "max-time-per-method"; @Name("Rename Members") @Description("Rename classes, fields, and methods with a number suffix to help in deobfuscation.") @ShortName("ren") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String RENAME_ENTITIES = "rename-members"; @Name("User Renamer Class") @Description("Path to a class that implements IIdentifierRenamer.") @ShortName("urc") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String USER_RENAMER_CLASS = "user-renamer-class"; @Name("[DEPRECATED] New Line Seperator") @Description("Use \\n instead of \\r\\n for new lines. Deprecated, do not use.") @ShortName("nls") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) @DynamicDefaultValue("Disabled on Windows, enabled on other systems") String NEW_LINE_SEPARATOR = "new-line-separator"; @Name("Indent String") @Description("A string of spaces or tabs that is placed for each indent level.") @ShortName("ind") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String INDENT_STRING = "indent-string"; @Name("Preferred line length") @Description("Max line length before formatting is applied.") @ShortName("pll") - @Type(Type.INTEGER) + @Type(DecompilerOption.Type.INTEGER) String PREFERRED_LINE_LENGTH = "preferred-line-length"; @Name("Banner") @Description("A message to display at the top of the decompiled file.") @ShortName("ban") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String BANNER = "banner"; @Name("Error Message") @Description("Message to display when an error occurs in the decompiler.") @ShortName("erm") - @Type(Type.STRING) + @Type(DecompilerOption.Type.STRING) String ERROR_MESSAGE = "error-message"; @Name("Thread Count") @Description("How many threads to use to decompile.") @DynamicDefaultValue("all available processors") @ShortName("thr") - @Type(Type.INTEGER) + @Type(DecompilerOption.Type.INTEGER) String THREADS = "thread-count"; String DUMP_ORIGINAL_LINES = "__dump_original_lines__"; @@ -320,61 +325,61 @@ public interface IFernflowerPreferences { @Name("Skip Extra Files") @Description("Skip copying non-class files from the input folder or file to the output") @ShortName("sef") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SKIP_EXTRA_FILES = "skip-extra-files"; @Name("Warn about inconsistent inner attributes") @Description("Warn about inconsistent inner class attributes") @ShortName("win") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String WARN_INCONSISTENT_INNER_CLASSES = "warn-inconsistent-inner-attributes"; @Name("Dump Bytecode On Error") @Description("Put the bytecode in the method body when an error occurs.") @ShortName("dbe") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DUMP_BYTECODE_ON_ERROR = "dump-bytecode-on-error"; @Name("Dump Exceptions On Error") @Description("Put the exception message in the method body or source file when an error occurs.") @ShortName("dee") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DUMP_EXCEPTION_ON_ERROR = "dump-exception-on-error"; @Name("Decompiler Comments") @Description("Sometimes, odd behavior of the bytecode or unfixable problems occur. This enables or disables the adding of those to the decompiled output.") @ShortName("dec") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILER_COMMENTS = "decompiler-comments"; @Name("SourceFile comments") @Description("Add debug comments showing the class SourceFile attribute if present.") @ShortName("sfc") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String SOURCE_FILE_COMMENTS = "sourcefile-comments"; @Name("Decompile complex constant-dynamic expressions") @Description("Some constant-dynamic expressions can't be converted to a single Java expression with identical run-time behaviour. This decompiles them to a similar non-lazy expression, marked with a comment.") @ShortName("dcc") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DECOMPILE_COMPLEX_CONDYS = "decompile-complex-constant-dynamic"; @Name("Force JSR inline") @Description("Forces the processing of JSR instructions even if the class files shouldn't contain it (Java 7+)") @ShortName("fji") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String FORCE_JSR_INLINE = "force-jsr-inline"; @Name("Dump Text Tokens") @Description("Dump Text Tokens on each class file") @ShortName("dtt") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String DUMP_TEXT_TOKENS = "dump-text-tokens"; @Name("Remove Imports") @Description("Remove import statements from the decompiled code") @ShortName("rim") - @Type(Type.BOOLEAN) + @Type(DecompilerOption.Type.BOOLEAN) String REMOVE_IMPORTS = "remove-imports"; @Name("Mark Corresponding Synthetics") @@ -382,6 +387,16 @@ public interface IFernflowerPreferences { @ShortName("mcs") String MARK_CORRESPONDING_SYNTHETICS = "mark-corresponding-synthetics"; + @Name("Excluded Classes") + @Description("Exclude classes from decompilation if their fully qualified names match the specified regular expression.") + @Type(DecompilerOption.Type.STRING) + String EXCLUDED_CLASSES = "excluded-classes"; + + @Name("Validate inner classes names") + @Description("Validates that the inner class name is correct (if it is separated using \"$\" for example BaseClass$InnerClass). If not then inner class won't be processed.") + @Type(DecompilerOption.Type.STRING) + String VALIDATE_INNER_CLASSES_NAMES = "validate-inner-classes-names"; + Map DEFAULTS = getDefaults(); static Map getDefaults() { @@ -422,6 +437,7 @@ static Map getDefaults() { defaults.put(SHOW_HIDDEN_STATEMENTS, "0"); // Extra debugging that isn't useful in most cases defaults.put(SIMPLIFY_STACK_SECOND_PASS, "1"); // Generally produces better bytecode, useful to debug if it does something strange defaults.put(VERIFY_VARIABLE_MERGES, "0"); // Produces more correct code in rare cases, but hurts code cleanliness in the majority of cases. Default off until a better fix is created. + defaults.put(OLD_TRY_DEDUP, "0"); defaults.put(DECOMPILE_PREVIEW, "1"); // Preview features are useful to decompile in almost all cases defaults.put(INCLUDE_ENTIRE_CLASSPATH, "0"); @@ -452,6 +468,8 @@ static Map getDefaults() { defaults.put(DUMP_TEXT_TOKENS, "0"); defaults.put(REMOVE_IMPORTS, "0"); defaults.put(MARK_CORRESPONDING_SYNTHETICS, "0"); + defaults.put(EXCLUDED_CLASSES, ""); + defaults.put(VALIDATE_INNER_CLASSES_NAMES, "1"); return Collections.unmodifiableMap(defaults); } @@ -475,7 +493,7 @@ static Map getDefaults() { public @interface Description { String value(); } - + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DynamicDefaultValue { @@ -503,10 +521,6 @@ static Map getDefaults() { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Type { - String value(); - - String BOOLEAN = "bool"; - String INTEGER = "int"; - String STRING = "string"; + DecompilerOption.Type value(); } } diff --git a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessor.java index c7ef4f4033..553f31133f 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessor.java @@ -7,6 +7,7 @@ import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.code.InstructionSequence; import org.jetbrains.java.decompiler.code.cfg.ControlFlowGraph; +import org.jetbrains.java.decompiler.code.cfg.ExceptionRangeCFG; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.main.decompiler.CancelationManager; @@ -137,7 +138,6 @@ public static RootStatement codeToJava(StructClass cl, StructMethod mt, MethodDe DecompilerContext.getCounterContainer().setCounter(CounterContainer.VAR_COUNTER, mt.getLocalVariables()); if (ExceptionDeobfuscator.hasObfuscatedExceptions(graph)) { - DecompilerContext.getLogger().writeMessage("Heavily obfuscated exception ranges found!", IFernflowerLogger.Severity.WARN); DotExporter.toDotFile(graph, mt, "cfgExceptionsPre", true); if (!ExceptionDeobfuscator.handleMultipleEntryExceptionRanges(graph)) { @@ -190,7 +190,14 @@ public static RootStatement codeToJava(StructClass cl, StructMethod mt, MethodDe debugCurrentlyDecompiling.set(root); } - decompileRecord.add("ProcessFinally_Post", root); + // In rare cases, the final round of finally processing can reveal another synchronized statement. Try to parse it now. + if (DomHelper.buildSynchronized(root)) { + decompileRecord.add("BuiltFinallySynchronized", root); + } + + if (finallyProcessed > 0) { + decompileRecord.add("ProcessFinally_Post", root); + } // remove synchronized exception handler // not until now because of comparison between synchronized statements in the finally cycle @@ -304,6 +311,11 @@ public static RootStatement codeToJava(StructClass cl, StructMethod mt, MethodDe continue; } + if (IntersectionCastProcessor.makeIntersectionCasts(root)) { + decompileRecord.add("intersectionCasts", root); + continue; + } + if (DecompilerContext.getOption(IFernflowerPreferences.PATTERN_MATCHING)) { if (cl.getVersion().hasIfPatternMatching()) { if (IfPatternMatchProcessor.matchInstanceof(root)) { diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java index 739e78c61c..375eb1c68d 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java @@ -37,6 +37,7 @@ import org.jetbrains.java.decompiler.struct.gen.generics.GenericType; import org.jetbrains.java.decompiler.util.DotExporter; import org.jetbrains.java.decompiler.util.InterpreterUtil; +import org.jetbrains.java.decompiler.util.Pair; import java.util.*; import java.util.Map.Entry; @@ -332,7 +333,8 @@ private static void computeLocalVarsAndDefinitions(ClassNode node) { if (nd.type != ClassNode.Type.LAMBDA && !nd.classStruct.isSynthetic() && (nd.access & CodeConstants.ACC_STATIC) == 0 && - (nd.access & CodeConstants.ACC_INTERFACE) == 0) { + (nd.access & CodeConstants.ACC_INTERFACE) == 0 && + nd.classStruct.getRecordComponents() == null) { clTypes.add(nd.type); Map> mask = getMaskLocalVars(nd.getWrapper()); @@ -384,7 +386,7 @@ private static void computeLocalVarsAndDefinitions(ClassNode node) { // FIXME: flags of variables are wrong! Correct the entire functionality. // if(method.varproc.getVarFinal(varPair) != VarTypeProcessor.VAR_NON_FINAL) { - pair = new VarFieldPair(mask.get(i).fieldKey, varPair); + pair = new VarFieldPair(mask.get(i).fieldKey, varPair, mask.get(i).assigned); // } } @@ -467,7 +469,7 @@ private static void computeLocalVarsAndDefinitions(ClassNode node) { mergeListSignatures(interPairMask, interMask, true); for (VarFieldPair pair : interPairMask) { - if (pair != null && !pair.fieldKey.isEmpty()) { + if (pair != null && !pair.fieldKey.isEmpty() && pair.assigned) { nestedNode.mapFieldsToVars.put(pair.fieldKey, pair.varPair); } } @@ -742,13 +744,13 @@ private static Map> getMaskLocalVars(ClassWrapper wra int varIndex = 1; for (int i = 0; i < md.params.length; i++) { // no static methods allowed - // Always assume we can use the heuristic if there's only one metho - String keyField = getEnclosingVarField(cl, method, graph, varIndex, i, p == 1 || cl.getMethods().size() == 1); - if (!keyField.isEmpty()) { + // Always assume we can use the heuristic if there's only one method + Pair keyField = getEnclosingVarField(cl, method, graph, varIndex, i, p == 1 || cl.getMethods().size() == 1); + if (keyField != null && !keyField.a.isEmpty()) { found = true; } - fields.add(keyField == null ? null : new VarFieldPair(keyField, new VarVersionPair(-1, 0))); // TODO: null? + fields.add(keyField == null ? null : new VarFieldPair(keyField.a, new VarVersionPair(-1, 0), keyField.b)); // TODO: null? varIndex += md.params[i].stackSize; } @@ -765,8 +767,9 @@ private static Map> getMaskLocalVars(ClassWrapper wra return mapMasks; } - private static String getEnclosingVarField(StructClass cl, MethodWrapper method, DirectGraph graph, int index, int outerIdx, boolean useHeuristic) { + private static Pair getEnclosingVarField(StructClass cl, MethodWrapper method, DirectGraph graph, int index, int outerIdx, boolean useHeuristic) { String field = ""; + boolean assigned = false; // parameter variable final VarVersionPair var = new VarVersionPair(index, 0); @@ -793,6 +796,7 @@ private static String getEnclosingVarField(StructClass cl, MethodWrapper method, (fd.isSynthetic() || noSynthFlag && possiblySyntheticField(fd))) { // local (== not inherited) field field = InterpreterUtil.makeUniqueKey(left.getName(), left.getDescriptor().descriptorString); + assigned = true; break; } } @@ -807,11 +811,12 @@ private static String getEnclosingVarField(StructClass cl, MethodWrapper method, StructMethodParametersAttribute attr = method.methodStruct.getAttribute(StructGeneralAttribute.ATTRIBUTE_METHOD_PARAMETERS); List entries = attr.getEntries(); - if (outerIdx < entries.size() && (entries.get(outerIdx).myAccessFlags & CodeConstants.ACC_MANDATED) == CodeConstants.ACC_MANDATED) { + if (outerIdx < entries.size() && (entries.get(outerIdx).myAccessFlags & (CodeConstants.ACC_MANDATED | CodeConstants.ACC_SYNTHETIC)) != 0) { String name = method.varproc.getVarName(var); VarType type = method.varproc.getVarType(var); field = InterpreterUtil.makeUniqueKey(name, type.toString()); + assigned = false; } } } @@ -827,6 +832,7 @@ private static String getEnclosingVarField(StructClass cl, MethodWrapper method, VarType type = method.varproc.getVarType(var); if (hostName.equals(type.value) && useHeuristic) { field = InterpreterUtil.makeUniqueKey(name, type.toString()); + assigned = false; } else { // Also check the enclosing class if it's anonymous ClassNode nd = DecompilerContext.getClassProcessor().getMapRootClasses().get(cl.qualifiedName); @@ -835,6 +841,7 @@ private static String getEnclosingVarField(StructClass cl, MethodWrapper method, for (String clazz : nd.enclosingClasses) { if (clazz.equals(type.value)) { field = InterpreterUtil.makeUniqueKey(name, type.toString()); + assigned = false; break; } } @@ -843,7 +850,7 @@ private static String getEnclosingVarField(StructClass cl, MethodWrapper method, } } - return field; + return Pair.of(field, assigned); } private static boolean possiblySyntheticField(StructField fd) { @@ -922,12 +929,14 @@ private static boolean isEqual(boolean both, VarFieldPair fObj, VarFieldPair sOb } else { eq = true; - if (fObj.fieldKey.length() == 0) { + if (!fObj.assigned || fObj.fieldKey.length() == 0) { fObj.fieldKey = sObj.fieldKey; + fObj.assigned = sObj.assigned; } - else if (sObj.fieldKey.length() == 0) { + else if (!sObj.assigned || sObj.fieldKey.length() == 0) { if (both) { sObj.fieldKey = fObj.fieldKey; + sObj.assigned = fObj.assigned; } } else { @@ -1147,10 +1156,12 @@ private static boolean containsType(VarType haystack, VarType needle) { private static class VarFieldPair { public String fieldKey; public VarVersionPair varPair; + public boolean assigned; - VarFieldPair(String field, VarVersionPair varPair) { + VarFieldPair(String field, VarVersionPair varPair, boolean assigned) { this.fieldKey = field; this.varPair = varPair; + this.assigned = assigned; } @Override @@ -1159,17 +1170,17 @@ public boolean equals(Object o) { if (!(o instanceof VarFieldPair)) return false; VarFieldPair pair = (VarFieldPair)o; - return fieldKey.equals(pair.fieldKey) && varPair.equals(pair.varPair); + return fieldKey.equals(pair.fieldKey) && varPair.equals(pair.varPair) && assigned == pair.assigned; } @Override public int hashCode() { - return fieldKey.hashCode() + varPair.hashCode(); + return fieldKey.hashCode() + varPair.hashCode() + Boolean.hashCode(assigned); } @Override public String toString() { - return varPair + ": " + fieldKey; + return varPair + (assigned ? " assigned to " : " stored in variable ") + fieldKey; } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java index a2c73e0e80..a1939e8179 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java @@ -4,6 +4,7 @@ import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.modules.decompiler.exps.*; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; +import org.jetbrains.java.decompiler.modules.decompiler.stats.RootStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; import org.jetbrains.java.decompiler.struct.consts.PooledConstant; import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant; @@ -32,7 +33,7 @@ public static void simplifyStringConcat(Statement stat) { if (stat.getExprents() != null) { for (int i = 0; i < stat.getExprents().size(); ++i) { - Exprent ret = simplifyStringConcat(stat.getExprents().get(i)); + Exprent ret = simplifyStringConcat(stat.getTopParent(), stat.getExprents().get(i)); if (ret != null) { stat.getExprents().set(i, ret); } @@ -40,9 +41,9 @@ public static void simplifyStringConcat(Statement stat) { } } - private static Exprent simplifyStringConcat(Exprent exprent) { + private static Exprent simplifyStringConcat(RootStatement root, Exprent exprent) { for (Exprent cexp : exprent.getAllExprents()) { - Exprent ret = simplifyStringConcat(cexp); + Exprent ret = simplifyStringConcat(root, cexp); if (ret != null) { exprent.replaceExprent(cexp, ret); ret.addBytecodeOffsets(cexp.bytecode); @@ -50,7 +51,7 @@ private static Exprent simplifyStringConcat(Exprent exprent) { } if (exprent instanceof InvocationExprent) { - Exprent ret = ConcatenationHelper.contractStringConcat(exprent); + Exprent ret = ConcatenationHelper.contractStringConcat(root, exprent); if (!exprent.equals(ret)) { return ret; } @@ -59,7 +60,7 @@ private static Exprent simplifyStringConcat(Exprent exprent) { return null; } - public static Exprent contractStringConcat(Exprent expr) { + public static Exprent contractStringConcat(RootStatement root, Exprent expr) { Exprent exprTmp = null; VarType cltype = null; @@ -78,7 +79,7 @@ else if (bufferClass.equals(iex.getClassname())) { exprTmp = iex.getInstance(); } } else if ("makeConcatWithConstants".equals(iex.getName()) || "makeConcat".equals(iex.getName())) { // java 9 style - List parameters = extractParameters(iex.getBootstrapArguments(), iex); + List parameters = extractParameters(root, iex.getBootstrapArguments(), iex); // Check if we need to add an empty string to the param list to convert from objects or primitives to strings. boolean addEmptyString = true; @@ -198,7 +199,7 @@ private static Exprent createConcatExprent(List lstOperands, BitSet byt private static final String TAG_ARG_S = "\u0001"; private static final char TAG_CONST = '\u0002'; - private static List extractParameters(List bootstrapArguments, InvocationExprent expr) { + private static List extractParameters(RootStatement root, List bootstrapArguments, InvocationExprent expr) { List parameters = expr.getLstParameters(); // Remove unnecessary String.valueOf() calls to resolve Vineflower#151 @@ -235,6 +236,10 @@ private static List extractParameters(List bootstrapArg // skip for now } if (c == TAG_ARG) { + if (parameterId >= parameters.size()) { + root.addComment("$VF: Could not fully resugar string concatentation!"); + continue; + } res.add(parameters.get(parameterId++)); } } else { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java index a3e90f7ea5..194443a832 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java @@ -212,11 +212,7 @@ public void processBlock(BasicBlockStatement stat, PrimitiveExprsList data, Stru BitSet bytecode_offsets = null; if (bytecode_offset >= 0) { bytecode_offsets = new BitSet(); - bytecode_offsets.set(bytecode_offset); - int end_offset = block.getOldOffset(i+1); - if (end_offset > bytecode_offset) { - bytecode_offsets.set(bytecode_offset, end_offset); - } + bytecode_offsets.set(bytecode_offset, bytecode_offset + instr.length); } switch (instr.opcode) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java index 0e41f4efd5..4e51a7d840 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java @@ -18,7 +18,6 @@ import org.jetbrains.java.decompiler.modules.decompiler.flow.DirectGraph; import org.jetbrains.java.decompiler.modules.decompiler.flow.DirectNode; import org.jetbrains.java.decompiler.modules.decompiler.flow.FlattenStatementsHelper; -import org.jetbrains.java.decompiler.modules.decompiler.sforms.SFormsConstructor; import org.jetbrains.java.decompiler.modules.decompiler.sforms.SSAConstructorSparseEx; import org.jetbrains.java.decompiler.modules.decompiler.sforms.SSAUConstructorSparseEx; import org.jetbrains.java.decompiler.modules.decompiler.sforms.SimpleSSAReassign; @@ -155,6 +154,11 @@ private Record getFinallyInformation(StructClass cl, StructMethod mt, RootStatem BasicBlockStatement firstBlockStatement = fstat.getHandler().getBasichead(); BasicBlock firstBasicBlock = firstBlockStatement.getBlock(); + + if (firstBasicBlock.getSeq().isEmpty()) { + return null; + } + Instruction instrFirst = firstBasicBlock.getInstruction(0); int firstcode = 0; @@ -203,7 +207,18 @@ private Record getFinallyInformation(StructClass cl, StructMethod mt, RootStatem isTrueExit = false; - for (int i = 0; i < node.exprents.size(); i++) { + // Try to find the "true path" of the finally block by searching for a relevant 'athrow '. + // We should search from the initial expression of each block, except in the case where the block we're searching + // contains the relevant var itself, in which case we should search from the 2nd or 3rd expression, depending on + // the firstcode. This is because we might accidentally stumble into the same expression we were searching from, + // leading to a false failure of finally processing. + int startIdx = 0; + if (firstBlockStatement == node.block) { + // firstcode (only 0 or 2 here) determines which instruction to start from. + startIdx = firstcode == 2 ? 2 : 1; + } + + for (int i = startIdx; i < node.exprents.size(); i++) { Exprent exprent = node.exprents.get(i); if (firstcode == 0) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java index b16dd9b283..6de55b74b3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java @@ -581,12 +581,6 @@ private static boolean reorderIf(IfStatement ifstat) { return false; } - // Cannot reorder pattern matches, causes semantic issues! - // TODO: proper pattern match reorder analysis - if (ifstat.isPatternMatched()) { - return false; - } - boolean ifdirect, elsedirect; boolean noifstat = false, noelsestat; boolean ifdirectpath = false, elsedirectpath = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfPatternMatchProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfPatternMatchProcessor.java index 8daad1a16b..c5263406ab 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfPatternMatchProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfPatternMatchProcessor.java @@ -1,16 +1,12 @@ package org.jetbrains.java.decompiler.modules.decompiler; -import org.jetbrains.java.decompiler.modules.decompiler.exps.AssignmentExprent; -import org.jetbrains.java.decompiler.modules.decompiler.exps.ConstExprent; -import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; -import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.modules.decompiler.exps.*; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; -import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; -import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement; -import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement; -import org.jetbrains.java.decompiler.modules.decompiler.stats.RootStatement; -import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.*; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair; +import org.jetbrains.java.decompiler.struct.StructClass; +import org.jetbrains.java.decompiler.struct.StructRecordComponent; import org.jetbrains.java.decompiler.struct.gen.VarType; import java.util.*; @@ -22,8 +18,12 @@ public static boolean matchInstanceof(RootStatement root) { if (res) { ValidationHelper.validateStatement(root); + SequenceHelper.condenseSequences(root); + // IfHelper already called SequenceHelper.condenseSequences if it returned true - if (!IfHelper.mergeAllIfs(root)) { + if (IfHelper.mergeAllIfs(root)) { + improvePatternTypes(root); + } else { SequenceHelper.condenseSequences(root); } } @@ -127,12 +127,43 @@ private static boolean checkBranch(Exprent exprent, IfStatement statement, State Exprent left = first.getAllExprents().get(0); Exprent right = first.getAllExprents().get(1); - // Right side needs to be a cast function - if (!(right instanceof FunctionExprent)) { - return false; + boolean result = findPatternMatchingInstanceof(left, right, source, target, branch, iof, head); + + if (head.getExprents() != null && !head.getExprents().isEmpty() && head.getExprents().get(0) instanceof AssignmentExprent assignment) { + // If it's an assignement, get both sides + left = assignment.getAllExprents().get(0); + right = assignment.getAllExprents().get(1); + + // Right side needs to be a cast function + // If it's not, we might be a record pattern match + if (!(right instanceof FunctionExprent)) { + result |= identifyIfRecordPatternMatch(statement, branch, iof, assignment); + } } - if (((FunctionExprent) right).getFuncType() != FunctionType.CAST) { + if (result) { + statement.setPatternMatched(true); + + BasicBlockStatement before = statement.getBasichead(); + if (before.getExprents() != null && before.getExprents().size() > 0) { + Exprent last = before.getExprents().get(before.getExprents().size() - 1); + if (last instanceof AssignmentExprent assign && source instanceof VarExprent checked) { + Exprent stored = assign.getLeft(); + Exprent method = assign.getRight(); + if ((!(method instanceof FunctionExprent) || ((FunctionExprent) method).getFuncType() != FunctionType.CAST) + && checked.equals(stored) && !checked.isVarReferenced(root, (VarExprent) stored)) { + iof.getLstOperands().set(0, assign.getRight()); + before.getExprents().remove(before.getExprents().size() - 1); + } + } + } + } + + return result; + } + + private static boolean findPatternMatchingInstanceof(Exprent left, Exprent right, Exprent source, Exprent target, Statement branch, FunctionExprent iof, Statement head) { + if (!(right instanceof FunctionExprent function) || function.getFuncType() != FunctionType.CAST) { return false; } @@ -172,24 +203,6 @@ private static boolean checkBranch(Exprent exprent, IfStatement statement, State if (storeType.isGeneric()) { iof.getLstOperands().set(1, new ConstExprent(storeType, null, iof.getLstOperands().get(1).bytecode)); } - - statement.setPatternMatched(true); - - BasicBlockStatement before = statement.getBasichead(); - if (before.getExprents() != null && before.getExprents().size() > 0) { - Exprent last = before.getExprents().get(before.getExprents().size() - 1); - if (last instanceof AssignmentExprent && source instanceof VarExprent) { - Exprent stored = last.getAllExprents().get(0); - Exprent method = last.getAllExprents().get(1); - VarExprent checked = (VarExprent) source; - if ((!(method instanceof FunctionExprent) || ((FunctionExprent) method).getFuncType() != FunctionType.CAST) - && checked.equals(stored) && !checked.isVarReferenced(root, (VarExprent) stored)) { - iof.getLstOperands().set(0, last.getAllExprents().get(1)); - before.getExprents().remove(before.getExprents().size() - 1); - } - } - } - return true; } @@ -235,6 +248,266 @@ private static void findVarsInPredecessors(List vvs, Statement r } } + private static boolean identifyIfRecordPatternMatch(IfStatement stat, Statement branch, FunctionExprent instOf, AssignmentExprent head) { + if (!stat.getTopParent().mt.getBytecodeVersion().hasRecordPatternMatching()) { + return false; + } + + Exprent headRight = head.getRight(); + + // Check for: + // + // if (v instanceof MyType) { + // var10000 = v; + // ... + // or: + // + // if (v instanceof MyType var10000) { + // ... + + if (!(instOf.getLstOperands().size() > 2 ? instOf.getLstOperands().get(2) : instOf.getLstOperands().get(0)).equals(headRight)) { + return false; + } + + VarType type = instOf.getLstOperands().get(1).getExprType(); + + PatternExprent exprent = identifyRecordPatternMatch(stat, branch, headRight, type, false); + if (exprent == null) { + return false; + } + + if (instOf.getLstOperands().size() > 2) { + instOf.getLstOperands().set(2, exprent); + } else { + instOf.getLstOperands().add(2, exprent); + } + + stat.setPatternMatched(true); + return true; + } + + public static PatternExprent identifyRecordPatternMatch(Statement parent, Statement branch, Exprent storeVariable, VarType type, boolean simulate) { + Statement original = branch; + + StructClass cl = DecompilerContext.getStructContext().getClass(type.value); + + if (cl == null || cl.getRecordComponents() == null || cl.getRecordComponents().isEmpty()) { + return null; + } + + // Ending exprents we may want to remove + Map remove = new HashMap<>(); + // Statements that ought to be destroyed as a result of creating the pattern + List toDestroy = new ArrayList<>(); + + PatternData pattern = getChildPattern(cl, storeVariable, type, branch, 1, toDestroy, remove); + if (pattern == null) { + return null; + } + branch = pattern.stat; + + if (simulate) { + return pattern.exp; + } + + if (original != branch) { + parent.replaceStatement(original, branch); + } + + for (Statement st : toDestroy) { + st.replaceWithEmpty(); + } + + for (Map.Entry e : remove.entrySet()) { + e.getKey().getExprents().remove(e.getValue()); + } + + return pattern.exp; + } + + private static PatternData getChildPattern(StructClass cl, Exprent storeVariable, VarType type, Statement branch, int stIdx, List toDestroy, Map remove) { + // Iteratively go through the sequence to see if it extracts from the record + + // The general strategy is to identify an "extracting try" [1] for each record component. + // If we identify it, continue matching. Between each try we might see pseudo stack ops [2] + // that we'll want to clean up as well. If all the components were matched, then we are able + // to create the pattern with the variables. + // + // [1]: + // try { + // exVar = .(); + // } catch (Throwable t) { + // throw new MatchException(...); + // } + // + // [2]: + // realVar = exVar; + // = ; + + if (cl == null || cl.getRecordComponents() == null) { + return null; // No idea what class, or not a record! + } + + record PatternStore(StructRecordComponent component, StructClass cl, VarType type, VarExprent store) { + } + List patternStores = new ArrayList<>(); + List comp = cl.getRecordComponents(); + + // Map which variable refers to which part of the record + Map vars = new LinkedHashMap<>(); + for (StructRecordComponent c : comp) { + if (branch.getStats().size() <= stIdx) { + return null; + } + + Statement next = branch.getStats().get(stIdx); + if (next instanceof CatchStatement catchSt && catchSt.getVars().size() == 1 && catchSt.getVars().get(0).getVarType().value.equals("java/lang/Throwable")) { + // Check catch for "throw new MatchException" + VarExprent foundVar = null; + if (catchSt.getStats().size() == 2 && isStatementMatchThrow(catchSt.getStats().get(1))) { + // Now make sure the inside of the try is ok + Statement inner = catchSt.getStats().get(0); + if (inner instanceof BasicBlockStatement) { + // var = var10000.() + if (inner.getExprents().size() == 1 && inner.getExprents().get(0) instanceof AssignmentExprent assign) { + // Make sure the invocation matches the record component + if (assign.getLeft() instanceof VarExprent var && assign.getRight() instanceof InvocationExprent invok && invok.getClassname().equals(type.value)) { + if (invok.getName().equals(c.getName())) { + // Found one! + foundVar = var; + } + } + } + } + } + + if (foundVar == null) { + return null; + } + + toDestroy.add(next); + + // Check the next statement for any pseudo stack ops + stIdx++; + if (branch.getStats().size() > stIdx) { + next = branch.getStats().get(stIdx); + + boolean ok = false; + if (next instanceof BasicBlockStatement bb && next.getExprents().size() > 0) { + // look for "realVar = exVar;" to remove it + if (next.getExprents().get(0) instanceof AssignmentExprent assign && assign.getLeft() instanceof VarExprent var) { + if (assign.getRight().equals(foundVar)) { + vars.put(c, var); + + ok = true; + + // Check for " = ;" + // If that's the only other thing in the statement, then we can destroy it! + boolean destroyed = false; + if (next.getExprents().size() == 2) { + if (next.getExprents().get(1) instanceof AssignmentExprent nAssign && nAssign.getRight().equals(storeVariable)) { + toDestroy.add(next); + + destroyed = true; + } + } + + // If we haven't destroyed it, we should remove the "realVar = exVar;" anyway. Mark it as such. + if (!destroyed) { + remove.put(bb, assign); + } + } + } + } else if (next instanceof IfStatement ifSt && ifSt.iftype == IfStatement.IFTYPE_IF && ifSt.getHeadexprent().getCondition() instanceof FunctionExprent func) { + // Is the next statement an if with an instanceof inside? It might be a type-improving if. Search inside it too. + FunctionExprent function = null; + boolean found = false; + boolean inverted = false; + if (func.getFuncType() == FunctionType.INSTANCEOF) { + found = true; + function = func; + } else if (func.getFuncType() == FunctionType.BOOL_NOT && func.getLstOperands().get(0) instanceof FunctionExprent inner && inner.getFuncType() == FunctionType.INSTANCEOF) { + found = true; + inverted = true; + function = inner; + } + + if (found) { + // " = ;" idiom + // Ensure this is the right idiom be fore we mark it for destruction. + if (branch.getBasichead().getExprents().size() == 1) { + if (branch.getBasichead().getExprents().get(0) instanceof AssignmentExprent assign + && assign.getLeft() instanceof VarExprent && assign.getRight() instanceof VarExprent) { + toDestroy.add(branch.getBasichead()); + } + } + + // Find any nested record patterns + Exprent store = function.getLstOperands().size() > 2 ? function.getLstOperands().get(2) : function.getLstOperands().get(0); + if (store instanceof VarExprent variable) { + patternStores.add(new PatternStore(c, DecompilerContext.getStructContext().getClass(variable.getExprType().value), variable.getExprType(), variable)); + vars.put(c, variable); + ok = true; + } + + if (inverted) { + stIdx++; + toDestroy.add(ifSt); + } else { + branch = ifSt.getIfstat(); + stIdx = 0; + } + } + } + + // If we found a "realVar = exVar;" then we can skip over this statement and move on. + // Otherwise, "exVar" is probably the real var. Mark it as such. + if (!ok) { + vars.put(c, foundVar); + } + + stIdx++; + } + } else { + return null; + } + } + + // Check for any nested record patterns + for (PatternStore patternStore : patternStores) { + List tmpToDestroy = new ArrayList<>(); + Map tmpRemove = new HashMap<>(); + PatternData patternData = getChildPattern(patternStore.cl, patternStore.store, patternStore.type, branch, stIdx, tmpToDestroy, tmpRemove); + if (patternData != null) { + vars.put(patternStore.component, patternData.exp); + branch = patternData.stat; + stIdx = patternData.index; + toDestroy.addAll(tmpToDestroy); + remove.putAll(tmpRemove); + } + } + + PatternExprent pattern = new PatternExprent(PatternExprent.recordData(cl), type, new ArrayList<>(vars.values())); + return new PatternData(pattern, branch, stIdx); + } + + private record PatternData(PatternExprent exp, Statement stat, int index) {} + + public static boolean isStatementMatchThrow(Statement st) { + if (st instanceof BasicBlockStatement && st.getExprents().size() == 1) { + // throw ... + if (st.getExprents().get(0) instanceof ExitExprent exit && exit.getExitType() == ExitExprent.Type.THROW) { + // throw new ... + if (exit.getValue() instanceof NewExprent newEx) { + // throw new MatchException + return newEx.getNewType().value.equals("java/lang/MatchException"); + } + } + } + + return false; + } + /** * Gets the last guaranteed executed exprent in an expression. * @param ifTrue if true, gets the last executed exprent when the condition is true. @@ -320,4 +593,102 @@ public static Exprent getLastExprentWhen(Exprent base, boolean ifTrue, boolean o // otherwise, return ourselves return base; } + + private static boolean improvePatternTypes(Statement stat) { + boolean res = false; + for (Statement st : stat.getStats()) { + res |= improvePatternTypes(st); + } + + if (stat instanceof IfStatement ifSt) { + Exprent cond = ifSt.getHeadexprent().getCondition(); + + if (improvePatternType(ifSt.getHeadexprent(), cond, ifSt.getIfstat())) { + res = true; + } + } + + return res; + } + + private static boolean improvePatternType(Exprent parent, Exprent ex, Statement st) { + boolean res = false; + for (Exprent e : ex.getAllExprents(false, true)) { + // don't recurse on self + if (e != ex) { + res |= improvePatternType(ex, e, st); + } + + if (e instanceof FunctionExprent fn && fn.getFuncType() == FunctionType.BOOLEAN_AND) { + Exprent base = fn.getLstOperands().get(0); + + // Check for record pattern instanceof + if (base instanceof FunctionExprent baseFn && baseFn.getFuncType() == FunctionType.INSTANCEOF + && baseFn.getLstOperands().size() > 2 && baseFn.getLstOperands().get(2) instanceof PatternExprent pattern + && pattern.getData() instanceof PatternExprent.PatternData.RecordPatternData) { + // Found one? now find type-enhancing instanceofs in the other arm + + // Map a list of vars 1:1 with the exprents in the pattern, with any nested patterns represented with null + List vars = new ArrayList<>(); + + for (Exprent patternEx : pattern.getExprents()) { + if (patternEx instanceof VarExprent var) { + vars.add(var); + } else { + vars.add(null); + } + } + + for (int j = 0; j < vars.size(); j++) { + VarExprent var = vars.get(j); + if (var == null) { + continue; + } + + // Now go through the following ordeal to improve pattern types. + // Look for cases that look like 'Rec(Object synth) && synth instanceof Type t' where 'synth' is a synthetic + // variable that is only used in the pattern. + + // Is the 'synth' variable used outside the pattern? All hope is lost. + if (var.isVarReferenced(st)) { + continue; + } + + // Go through all of the exprents one by one to see if we can find redundant instanceofs + // We need to start at the parent, as in the case where there is only one instanceof, such as + // 'o instanceof Rec(Object x) && x instanceof String s', we need to replace the whole expression with the + // left hand side. + out: + for (Exprent exp : parent.getAllExprents(true, true)) { + for (Exprent inst : exp.getAllExprents()) { + if (inst instanceof FunctionExprent instFun && instFun.getFuncType() == FunctionType.BOOLEAN_AND) { + // Search each arm of the boolean and + for (int i = 0; i < 2; i++) { + Exprent inner = instFun.getLstOperands().get(i); + if (inner instanceof FunctionExprent innerFun && innerFun.getFuncType() == FunctionType.INSTANCEOF && innerFun.getLstOperands().size() > 2) { + if (innerFun.getLstOperands().get(0).equals(var)) { + + // Replace the var + pattern.getExprents().set(j, innerFun.getLstOperands().get(2)); + pattern.getBoundTypes().set(j, innerFun.getLstOperands().get(1).getExprType()); + + // replace 'A && B' where A is the redundant instanceof with simply 'B' + exp.replaceExprent(inst, instFun.getLstOperands().get(i ^ 1)); + + break out; + } + } + } + } + } + } + + // Iterate again, to try to replace all components + } + } + } + } + + return res; + } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IntersectionCastProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IntersectionCastProcessor.java new file mode 100644 index 0000000000..7ca02a01a3 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IntersectionCastProcessor.java @@ -0,0 +1,258 @@ +package org.jetbrains.java.decompiler.modules.decompiler; + +import org.jetbrains.java.decompiler.code.CodeConstants; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.modules.decompiler.exps.*; +import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; +import org.jetbrains.java.decompiler.modules.decompiler.stats.RootStatement; +import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; +import org.jetbrains.java.decompiler.struct.StructClass; +import org.jetbrains.java.decompiler.struct.StructMethod; +import org.jetbrains.java.decompiler.struct.gen.CodeType; +import org.jetbrains.java.decompiler.struct.gen.TypeFamily; +import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.struct.gen.generics.GenericMethodDescriptor; +import org.jetbrains.java.decompiler.util.Pair; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class IntersectionCastProcessor { + + public static boolean makeIntersectionCasts(RootStatement root) { + return makeIntersectionCastsRec(root, root); + } + + private static boolean makeIntersectionCastsRec(Statement stat, RootStatement root) { + boolean result = false; + if (stat.getExprents() != null) { + for (Exprent e : stat.getExprents()) { + result |= makeIntersectionCasts(e, root); + } + } else { + for (Object o : stat.getSequentialObjects()) { + if (o instanceof Statement s) { + result |= makeIntersectionCastsRec(s, root); + } else if (o instanceof Exprent e) { + result |= makeIntersectionCasts(e, root); + } + } + } + return result; + } + + private static boolean makeIntersectionCasts(Exprent exp, RootStatement root) { + if (exp instanceof InvocationExprent inv) { + if (handleInvocation(inv, root)) { + return true; + } + } else if (exp instanceof AssignmentExprent assignment) { + if (handleAssignment(assignment, root)) { + return true; + } + } + boolean result = false; + for (Exprent sub : exp.getAllExprents()) { + result |= makeIntersectionCasts(sub, root); + } + return result; + } + + private static boolean handleInvocation(InvocationExprent exp, RootStatement root) { + List lstParameters = exp.getLstParameters(); + boolean result = false; + for (int i = 0; i < lstParameters.size(); i++) { + Exprent parameter = lstParameters.get(i); + if (parameter instanceof FunctionExprent cast && isValidCast(cast)) { + Pair, Exprent> casts = getCasts(cast); + List types = casts.a; + Exprent inner = casts.b; + // Checks for any bounds not supported by the current list of casts + List bounds = getBounds(exp, i).stream() + .filter(bound -> !types + .stream() + .anyMatch(constant -> DecompilerContext.getStructContext().instanceOf(constant.getExprType().value, bound.value))) + .toList(); + + // Checks if the original type supports the remaining bounds + if (!bounds.isEmpty() && bounds.stream().allMatch(bound -> DecompilerContext.getStructContext().instanceOf(inner.getExprType().value, bound.value))) { + types.add(new ConstExprent(inner.getExprType(), null, null)); + } + result |= replaceCasts(cast, types, inner); + } + } + return result; + } + + private static boolean handleAssignment(AssignmentExprent exp, RootStatement root) { + if (exp.getLeft() instanceof VarExprent varExp) { + Exprent assigned = exp.getRight(); + if (assigned instanceof FunctionExprent cast && isValidCast(cast)) { + Pair, Exprent> casts = getCasts(cast); + List types = casts.a; + Exprent inner = casts.b; + List references = findReferences(varExp, root); + + // Convert the variable references into a set of bounds + Set bounds = new HashSet<>(); + for (VariablePosition position : references) { + bounds.addAll(switch (position.position) { + case METHOD_PARAMETER -> getBounds((InvocationExprent) position.exp, position.index); + case CASTED -> { + FunctionExprent func = (FunctionExprent) position.exp; + if (func.getLstOperands().size() == 2) { + yield List.of(func.getLstOperands().get(1).getExprType()); + } else { + yield List.of(); + } + } + }); + } + + // Checks for any bounds not supported by the current list of casts + bounds = bounds.stream() + .filter(bound -> !types + .stream() + .anyMatch(constant -> DecompilerContext.getStructContext().instanceOf(constant.getExprType().value, bound.value))) + .collect(Collectors.toSet()); + + // Checks if the original type supports the remaining bounds + if (!bounds.isEmpty() && bounds.stream().anyMatch(bound -> DecompilerContext.getStructContext().instanceOf(inner.getExprType().value, bound.value))) { + types.add(new ConstExprent(inner.getExprType(), null, null)); + } + if (replaceCasts(cast, types, inner)) { + // If the casts were replaced make sure that the variable uses "var" instead of + // a type + varExp.setIntersectionType(true); + return true; + } + } + } + return false; + } + + private static List getBounds(InvocationExprent exp, int parameter) { + // Gets the bounds of a type parameter of a parameter of a method + StructMethod method = exp.getDesc(); + GenericMethodDescriptor gmd = method != null ? method.getSignature() : null; + int start = gmd != null && DecompilerContext.getStructContext().getClass(method.getClassQualifiedName()).hasModifier(CodeConstants.ACC_ENUM) && method.getName().equals(CodeConstants.INIT_NAME) ? 2 : 0; + if (gmd != null) { + int index = parameter - start; + VarType type = gmd.parameterTypes.get(index); + if (type.type == CodeType.GENVAR) { + int typeParameterIndex = gmd.typeParameters.indexOf(type.value); + if (typeParameterIndex != -1) { + return gmd.typeParameterBounds.get(typeParameterIndex); + } + } + } + return List.of(); + } + + /** + * Searches for where a variable is referenced and returns the context + */ + private static List findReferences(VarExprent varExp, RootStatement root) { + List list = new ArrayList<>(); + findReferencesRec(varExp, root, root, list); + return list; + } + + private static void findReferencesRec(VarExprent varExp, Statement stat, RootStatement root, List list) { + if (stat.getExprents() != null) { + for (Exprent e : stat.getExprents()) { + findReferences(varExp, e, root, list); + } + } else { + for (Object o : stat.getSequentialObjects()) { + if (o instanceof Statement s) { + findReferencesRec(varExp, s, root, list); + } else if (o instanceof Exprent e) { + findReferences(varExp, e, root, list); + } + } + } + } + + private static void findReferences(VarExprent varExp, Exprent exp, RootStatement root, List list) { + if (exp instanceof InvocationExprent inv) { + findReferences(varExp, inv, list); + } else if (exp instanceof FunctionExprent func && func.getFuncType() == FunctionType.CAST) { + if (func.getLstOperands().get(0) instanceof VarExprent otherVar && varExp.getVarVersionPair().equals(otherVar.getVarVersionPair())) { + list.add(new VariablePosition(VariablePositionEnum.CASTED, exp, -1)); + } + } + for (Exprent sub : exp.getAllExprents()) { + findReferences(varExp, sub, root, list); + } + } + + private static void findReferences(VarExprent varExp, InvocationExprent inv, List list) { + List lstParameters = inv.getLstParameters(); + for (int i = 0; i < lstParameters.size(); i++) { + Exprent parameter = lstParameters.get(i); + if (parameter instanceof VarExprent otherVar && varExp.getVarVersionPair().equals(otherVar.getVarVersionPair())) { + list.add(new VariablePosition(VariablePositionEnum.METHOD_PARAMETER, inv, i)); + } + } + } + + private static Pair, Exprent> getCasts(Exprent exp) { + // Gets the list of casts done and gets the original exprent + List types = new ArrayList<>(); + Exprent inner = exp; + while (inner instanceof FunctionExprent cast && isValidCast(cast)) { + types.add(cast.getLstOperands().get(1)); + inner = cast.getLstOperands().get(0); + } + return Pair.of(types, inner); + } + + private static boolean isValidCast(FunctionExprent cast) { + if (cast.getFuncType() == FunctionType.CAST && cast.getLstOperands().size() == 2) { + VarType type = cast.getLstOperands().get(1).getExprType(); + // Intersection casts cannot include arrays + return type.typeFamily == TypeFamily.OBJECT && type.arrayDim == 0; + } + return false; + } + + private static boolean replaceCasts(FunctionExprent cast, List types, Exprent inner) { + if (types.size() > 1) { + // Reorders the list of types to make sure that the class is always first + Exprent nonInterface = null; + for (Exprent type : types) { + StructClass clazz = DecompilerContext.getStructContext().getClass(type.getExprType().value); + if (clazz != null && !clazz.hasModifier(CodeConstants.ACC_INTERFACE)) { + if (nonInterface == null) { + nonInterface = type; + } else { + return false; + } + } + } + if (nonInterface != null) { + types.remove(types.indexOf(nonInterface)); + types.add(0, nonInterface); + } + // Replaces the operands of the cast with the casted exprent and the list of needed casts + cast.getLstOperands().clear(); + cast.getLstOperands().add(inner); + cast.getLstOperands().addAll(types); + return true; + } + return false; + } + + private static record VariablePosition(VariablePositionEnum position, Exprent exp, int index) { + + } + + private static enum VariablePositionEnum { + METHOD_PARAMETER, + CASTED; + } +} diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java index 142cee1ea6..bd3363c16a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java @@ -12,6 +12,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair; import org.jetbrains.java.decompiler.struct.gen.CodeType; +import org.jetbrains.java.decompiler.struct.gen.TypeFamily; import org.jetbrains.java.decompiler.struct.gen.VarType; import java.util.*; @@ -143,7 +144,7 @@ public static boolean identifySecondaryFunctions(Statement stat, VarProcessor va break; } } else if (obj instanceof Exprent) { - Exprent retexpr = identifySecondaryFunctions((Exprent) obj, true, varProc, options); + Exprent retexpr = identifySecondaryFunctions(stat, (Exprent) obj, true, varProc, options); if (retexpr != null) { if (stat.getExprents() == null) { // only head expressions can be replaced! @@ -162,7 +163,7 @@ public static boolean identifySecondaryFunctions(Statement stat, VarProcessor va return ret; } - private static Exprent identifySecondaryFunctions(Exprent exprent, boolean statement_level, VarProcessor varProc, IdentifySecondaryOptions options) { + private static Exprent identifySecondaryFunctions(Statement stat, Exprent exprent, boolean statement_level, VarProcessor varProc, IdentifySecondaryOptions options) { if (exprent instanceof FunctionExprent) { FunctionExprent fexpr = (FunctionExprent) exprent; @@ -253,7 +254,7 @@ private static Exprent identifySecondaryFunctions(Exprent exprent, boolean state replaced = false; for (Exprent expr : exprent.getAllExprents()) { - Exprent retexpr = identifySecondaryFunctions(expr, false, varProc, options); + Exprent retexpr = identifySecondaryFunctions(stat, expr, false, varProc, options); if (retexpr != null) { exprent.replaceExprent(expr, retexpr); retexpr.addBytecodeOffsets(expr.bytecode); @@ -402,6 +403,60 @@ private static Exprent identifySecondaryFunctions(Exprent exprent, boolean state return new FunctionExprent(FunctionType.TERNARY, Arrays.asList( head, new ConstExprent(VarType.VARTYPE_INT, 0, null), iff), fexpr.bytecode); + case I2B: + case I2C: + case I2S: + if (lstOperands.get(0) instanceof FunctionExprent) { + FunctionExprent innerFunction = (FunctionExprent) lstOperands.get(0); + VarType castType = innerFunction.getFuncType().castType; + if (castType == VarType.VARTYPE_INT) { + // longs, floats and doubles are converted to ints before being converted to bytes, shorts or chars + innerFunction.setNeedsCast(false); + return ret; + } + } + // fallthrough + case I2L: + case I2F: + case I2D: + case L2F: + case L2D: + case F2D: + VarType exprType = lstOperands.get(0).getExprType(); + VarType castType = fexpr.getSimpleCastType(); + + // Simplify widening cast + if (castType.typeFamily == TypeFamily.INTEGER) { + if (castType.isStrictSuperset(exprType)) { + fexpr.setNeedsCast(false); + return ret; + } + } else if (castType.typeFamily.isGreater(exprType.typeFamily)) { + fexpr.setNeedsCast(false); + return ret; + } + break; + case ADD: + case SUB: + case MUL: + case DIV: + Exprent left = lstOperands.get(0); + boolean leftImplicitCast = left instanceof FunctionExprent && ((FunctionExprent) left).getSimpleCastType() != null && !((FunctionExprent) left).doesCast(); + Exprent right = lstOperands.get(1); + boolean rightImplicitCast = right instanceof FunctionExprent && ((FunctionExprent) right).getSimpleCastType() != null && !((FunctionExprent) right).doesCast(); + + if (leftImplicitCast && rightImplicitCast && right.getExprType() == left.getExprType()) { + // Only a single cast is needed explicitly + ((FunctionExprent) left).setNeedsCast(true); + } + break; + case SHL: + case SHR: + case USHR: + Exprent op = lstOperands.get(0); + if (op instanceof FunctionExprent && ((FunctionExprent) op).getSimpleCastType() != null && !((FunctionExprent) op).doesCast()) { + ((FunctionExprent) op).setNeedsCast(true); + } } break; case ASSIGNMENT: // check for conditional assignment @@ -464,8 +519,17 @@ private static Exprent identifySecondaryFunctions(Exprent exprent, boolean state } break; case INVOCATION: + InvocationExprent invocationExpr = (InvocationExprent) exprent; + if (invocationExpr.isBoxingCall()) { + Exprent param = invocationExpr.getLstParameters().get(0); + // Keep casts of boxed exprents + if (param instanceof FunctionExprent && ((FunctionExprent) param).getSimpleCastType() != null && !((FunctionExprent) param).doesCast()) { + ((FunctionExprent) param).setNeedsCast(true); + } + } + if (!statement_level) { // simplify if exprent is a real expression. The opposite case is pretty absurd, can still happen however (and happened at least once). - Exprent retexpr = ConcatenationHelper.contractStringConcat(exprent); + Exprent retexpr = ConcatenationHelper.contractStringConcat(stat.getTopParent(), exprent); if (!exprent.equals(retexpr)) { return retexpr; } @@ -508,6 +572,16 @@ private static boolean isSuperSimple(Exprent exprent) { return exprent.type == Exprent.Type.VAR || exprent.type == Exprent.Type.CONST; } + private static boolean hasPattern(Exprent exprent) { + for (Exprent ex : exprent.getAllExprents(false, true)) { + if (ex instanceof PatternExprent || ex instanceof FunctionExprent func && func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().size() > 2) { + return true; + } + } + + return false; + } + public static Exprent propagateBoolNot(Exprent exprent) { if (exprent instanceof FunctionExprent) { @@ -517,10 +591,13 @@ public static Exprent propagateBoolNot(Exprent exprent) { Exprent param = fexpr.getLstOperands().get(0); - if (param instanceof FunctionExprent) { - FunctionExprent fparam = (FunctionExprent) param; + if (param instanceof FunctionExprent fparam) { FunctionType ftype = fparam.getFuncType(); + // Can't change any patterns, except for nested '!' which we can peek through + if (hasPattern(fparam) && ftype != FunctionType.BOOL_NOT) { + return null; + } boolean canSimplify = false; switch (ftype) { case BOOL_NOT: diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java index 9f7d82769c..b4ef361371 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java @@ -263,7 +263,9 @@ private static void removeEmptyStatements(SequenceStatement sequence) { } } - sequence.setFirst(sequence.getStats().get(0)); + if (!sequence.getStats().isEmpty()) { + sequence.setFirst(sequence.getStats().get(0)); + } } private static void mergeFlatStatements(SequenceStatement sequence) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchExpressionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchExpressionHelper.java index d035a3f4d0..70c16887f8 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchExpressionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchExpressionHelper.java @@ -309,10 +309,9 @@ private static Map> mapAssignments(List exprents = breakJump.getExprents(); if (exprents != null && !exprents.isEmpty()) { - if (exprents.size() == 1 && exprents.get(0) instanceof ExitExprent) { - ExitExprent exit = ((ExitExprent) exprents.get(0)); + if (exprents.size() > 0 && exprents.get(exprents.size() - 1) instanceof ExitExprent exit) { - // Special case throws + // Last exprent throws instead of storing a value if (exit.getExitType() == ExitExprent.Type.THROW) { map.put(breakJump, null); continue; @@ -325,13 +324,16 @@ private static Map> mapAssignments(List= 0; i--) { Exprent exprent = exprents.get(i); - if (exprent instanceof AssignmentExprent) { - AssignmentExprent assign = (AssignmentExprent) exprent; + if (exprent instanceof AssignmentExprent assign) { - if (assign.getLeft() instanceof VarExprent) { - VarExprent var = ((VarExprent) assign.getLeft()); + if (assign.getLeft() instanceof VarExprent var) { list.add(var.getVarVersionPair()); + + // Found a stack variable at the end? This is probably our candidate, return it. + if (var.getIndex() >= VarExprent.STACK_BASE) { + break; + } continue; } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java index 393aa16942..8ecb72b84f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java @@ -10,12 +10,12 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.*; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; import org.jetbrains.java.decompiler.modules.decompiler.stats.*; +import org.jetbrains.java.decompiler.struct.StructClass; import org.jetbrains.java.decompiler.struct.StructField; import org.jetbrains.java.decompiler.struct.StructMethod; import org.jetbrains.java.decompiler.struct.gen.FieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.TypeFamily; import org.jetbrains.java.decompiler.struct.gen.VarType; -import org.jetbrains.java.decompiler.util.DotExporter; import org.jetbrains.java.decompiler.util.Pair; import java.util.*; @@ -38,7 +38,7 @@ public static boolean simplifySwitches(Statement stat, StructMethod mt, RootStat } private static boolean simplify(SwitchStatement switchStatement, StructMethod mt, RootStatement root) { - if (simplifyNewEnumSwitch(switchStatement)) { + if (simplifySwitchOnEnumJ21(switchStatement, root)) { return true; } @@ -285,7 +285,7 @@ private static boolean simplify(SwitchStatement switchStatement, StructMethod mt return false; } - private static boolean simplifyNewEnumSwitch(SwitchStatement switchSt) { + private static boolean simplifySwitchOnEnumJ21(SwitchStatement switchSt, RootStatement root) { SwitchHeadExprent head = (SwitchHeadExprent) switchSt.getHeadexprent(); Exprent inner = head.getValue(); @@ -313,14 +313,18 @@ private static boolean simplifyNewEnumSwitch(SwitchStatement switchSt) { if (inner instanceof InvocationExprent && ((InvocationExprent) inner).getName().equals("ordinal")) { InvocationExprent invInner = (InvocationExprent) inner; - ClassesProcessor.ClassNode classNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(invInner.getClassname()); + StructClass classStruct = DecompilerContext.getStructContext().getClass(invInner.getClassname()); + if (classStruct == null) { + root.addComment("$VF: Unable to simplify switch-on-enum, as the enum class was not able to be found.", true); + return false; + } // Check for enum - if ((classNode.classStruct.getAccessFlags() & CodeConstants.ACC_ENUM) == CodeConstants.ACC_ENUM) { + if ((classStruct.getAccessFlags() & CodeConstants.ACC_ENUM) == CodeConstants.ACC_ENUM) { List enumNames = new ArrayList<>(); // Capture fields - for (StructField fd : classNode.classStruct.getFields()) { + for (StructField fd : classStruct.getFields()) { if ((fd.getAccessFlags() & CodeConstants.ACC_ENUM) == CodeConstants.ACC_ENUM) { enumNames.add(fd.getName()); } @@ -350,21 +354,9 @@ private static boolean simplifyNewEnumSwitch(SwitchStatement switchSt) { if (list.size() == 1 && list.get(0) == null) { // default by itself Statement st = switchSt.getCaseStatements().get(i); - // Check for a block with something inside - if (st.type == Statement.StatementType.BASIC_BLOCK && st.getExprents().size() == 1) { - Exprent check = st.getExprents().get(0); - // throw ... - if (check instanceof ExitExprent && ((ExitExprent) check).getExitType() == ExitExprent.Type.THROW) { - Exprent i1 = ((ExitExprent) check).getValue(); - // throw new ... - if (i1 instanceof NewExprent) { - // throw new MatchException - if (((NewExprent) i1).getNewType().toString().equals("Ljava/lang/MatchException;")) { - - st.replaceWithEmpty(); - } - } - } + if (IfPatternMatchProcessor.isStatementMatchThrow(st)) { + // Replace it with an empty block + st.replaceWithEmpty(); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternMatchProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternMatchProcessor.java index 35acab384a..0692ff61d7 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternMatchProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternMatchProcessor.java @@ -5,6 +5,7 @@ import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.modules.decompiler.exps.*; +import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; import org.jetbrains.java.decompiler.modules.decompiler.stats.*; import org.jetbrains.java.decompiler.struct.consts.PooledConstant; import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant; @@ -15,6 +16,7 @@ import org.jetbrains.java.decompiler.util.Pair; import java.util.*; +import java.util.stream.Stream; public final class SwitchPatternMatchProcessor { public static boolean processPatternMatching(Statement root) { @@ -66,6 +68,7 @@ private static boolean processStatement(SwitchStatement stat, Statement root) { Exprent realSelector = origParams.get(0); boolean guarded = true; boolean isEnumSwitch = value.getName().equals("enumSwitch"); + boolean nullCase = false; List> references = new ArrayList<>(); if (origParams.get(1) instanceof VarExprent) { VarExprent var = (VarExprent) origParams.get(1); @@ -134,6 +137,7 @@ private static boolean processStatement(SwitchStatement stat, Statement root) { // -1 always means null if (caseValue == -1) { + nullCase = true; allCases.remove(caseExpr); ConstExprent nullConst = new ConstExprent(VarType.VARTYPE_NULL, null, null); // null can be shared with a pattern or default; put it at the end, but before default, to make sure it doesn't get @@ -155,34 +159,74 @@ private static boolean processStatement(SwitchStatement stat, Statement root) { oldStat.replaceWith(caseStat); } } - // make instanceof from assignment - BasicBlockStatement caseStatBlock = caseStat.getBasichead(); - if (caseStatBlock.getExprents().size() >= 1) { - Exprent expr = caseStatBlock.getExprents().get(0); - if (expr instanceof AssignmentExprent) { - AssignmentExprent assign = (AssignmentExprent) expr; - if (assign.getLeft() instanceof VarExprent) { - VarExprent var = (VarExprent) assign.getLeft(); + PatternExprent pattern; + if (stat.getCaseGuards().size() > i && stat.getCaseGuards().get(i) instanceof PatternExprent) { + pattern = (PatternExprent) stat.getCaseGuards().set(i, null); + } else { + pattern = identifySwitchRecordPatternMatch(stat, stat.getCaseStatements().get(i), false); + } - if (assign.getRight() instanceof FunctionExprent && ((FunctionExprent) assign.getRight()).getFuncType() == FunctionExprent.FunctionType.CAST) { - FunctionExprent cast = (FunctionExprent) assign.getRight(); + if (pattern != null) { + List operands = new ArrayList<>(); + operands.add(realSelector); + operands.add(new ConstExprent(pattern.getExprType(), null, null)); + operands.add(pattern); - List operands = new ArrayList<>(); - operands.add(cast.getLstOperands().get(0)); // checking var - operands.add(cast.getLstOperands().get(1)); // type - operands.add(var); // pattern match var + FunctionExprent function = new FunctionExprent(FunctionType.INSTANCEOF, operands, null); + allCases.set(0, function); + } else { + + // make instanceof from assignment + BasicBlockStatement caseStatBlock = caseStat.getBasichead(); + if (caseStatBlock.getExprents().size() >= 1) { + Exprent expr = caseStatBlock.getExprents().get(0); + if (expr instanceof AssignmentExprent) { + AssignmentExprent assign = (AssignmentExprent) expr; + + if (assign.getLeft() instanceof VarExprent) { + VarExprent var = (VarExprent) assign.getLeft(); - FunctionExprent func = new FunctionExprent(FunctionExprent.FunctionType.INSTANCEOF, operands, null); + if (assign.getRight() instanceof FunctionExprent && ((FunctionExprent) assign.getRight()).getFuncType() == FunctionExprent.FunctionType.CAST) { + FunctionExprent cast = (FunctionExprent) assign.getRight(); - caseStatBlock.getExprents().remove(0); + List operands = new ArrayList<>(); + operands.add(cast.getLstOperands().get(0)); // checking var + operands.add(cast.getLstOperands().get(1)); // type + operands.add(var); // pattern match var + + FunctionExprent func = new FunctionExprent(FunctionExprent.FunctionType.INSTANCEOF, operands, null); + + caseStatBlock.getExprents().remove(0); + + // TODO: ssau representation + // any shared nulls will be at the end, and patterns & defaults can't be shared, + // so its safe to overwrite whatever's here + allCases.set(0, func); + } + } + } + } + } + } - // TODO: ssau representation - // any shared nulls will be at the end, and patterns & defaults can't be shared, so its safe to overwrite whatever's here - allCases.set(0, func); + for (int i = 0; i < stat.getCaseValues().size(); i++) { + if (stat.getCaseValues().get(i).contains(null)) { + // Default case statements are required to be last + stat.getCaseValues().add(stat.getCaseValues().remove(i)); + stat.getCaseStatements().add(stat.getCaseStatements().remove(i)); + stat.getCaseEdges().add(stat.getCaseEdges().remove(i)); + if (i < stat.getCaseGuards().size()) { + if (stat.getCaseGuards().get(i) != null) { + while (stat.getCaseGuards().size() < stat.getCaseStatements().size()) { + stat.getCaseGuards().add(null); } + stat.getCaseGuards().add(stat.getCaseGuards().remove(i)); + } else { + stat.getCaseGuards().remove(i); } } + break; } } @@ -242,6 +286,62 @@ private static boolean processStatement(SwitchStatement stat, Statement root) { } } + // Try to inline: + // var stackVar = ... + // Objects.requireNonNull(stackVar) + // var var1 = stackVar + // switch (var1) { + // + // to: + // switch (...) { + + Exprent oldSelector = realSelector; + // inline head + List basicHead = stat.getBasichead().getExprents(); + if (realSelector instanceof VarExprent var && basicHead != null && basicHead.size() >= 1) { + if (basicHead.get(basicHead.size() - 1) instanceof AssignmentExprent assignment && assignment.getLeft() instanceof VarExprent assigned) { + if (var.equals(assigned) && !var.isVarReferenced(root, + Stream.concat( + Stream.of(assigned), + stat.getCaseValues().stream() + .flatMap(List::stream) + .filter(exp -> exp instanceof FunctionExprent func && func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().get(0) instanceof VarExprent checked && checked.equals(var)) + .map(exp -> (VarExprent) ((FunctionExprent) exp).getLstOperands().get(0))) + .toArray(VarExprent[]::new))) { + realSelector = assignment.getRight(); + basicHead.remove(basicHead.size() - 1); + } + } + } + + // Check for non null + if (basicHead != null && basicHead.size() >= 1 && realSelector instanceof VarExprent var && !nullCase) { + Exprent last = basicHead.get(basicHead.size() - 1); + if (last instanceof InvocationExprent inv && inv.isStatic() && inv.getClassname().equals("java/util/Objects") && inv.getName().equals("requireNonNull") && inv.getStringDescriptor().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && var.equals(inv.getLstParameters().get(0))) { + basicHead.remove(basicHead.size() - 1); + // Check for other assignment + if (basicHead.size() >= 1 && var.isStack() && !nullCase) { + last = basicHead.get(basicHead.size() - 1); + if (last instanceof AssignmentExprent assignment && assignment.getLeft() instanceof VarExprent assigned && var.equals(assigned)) { + if (!var.isVarReferenced(root, assigned)) { + realSelector = assignment.getRight(); + basicHead.remove(basicHead.size() - 1); + } + } + } + } + } + + if (oldSelector != realSelector) { + Exprent finalSelector = realSelector; + // Replace the original selector with the new selector in instanceof check in case values + stat.getCaseValues().stream() + .flatMap(List::stream) + .filter(Objects::nonNull) + .filter(exp -> exp instanceof FunctionExprent func && func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().get(0).equals(oldSelector)) + .forEach(exp -> ((FunctionExprent) exp).getLstOperands().set(0, finalSelector)); + } + head.setValue(realSelector); // SwitchBootstraps.typeSwitch(o, var1) -> o if (guarded && stat.getParent() instanceof DoStatement) { @@ -265,6 +365,23 @@ private static boolean eliminateGuardRef(SwitchStatement stat, Map // alternatively, it can be inverted as `if (guardCond) { /* regular case code... */ break; } idx = __thisIdx + 1;` if (reference.b instanceof AssignmentExprent) { Statement assignStat = reference.a; + + // If a record pattern contains an `instanceof` check then a guard is used so + // attempt to eliminate it + for (int i = 0; i < stat.getCaseStatements().size(); i++) { + if (stat.getCaseStatements().get(i).containsStatement(assignStat)) { + Statement patternStat = stat.getCaseStatements().get(i); + PatternExprent pattern = identifySwitchRecordPatternMatch(stat, patternStat, simulate); + if (pattern != null) { + if (!simulate) { + guards.put(stat.getCaseValues().get(i), pattern); + } + return true; + } + break; + } + } + // Note: This can probably be checked earlier if (assignStat.getAllPredecessorEdges().size() > 1) { return false; @@ -383,6 +500,28 @@ private static boolean eliminateGuardRef(SwitchStatement stat, Map return false; } + private static PatternExprent identifySwitchRecordPatternMatch(SwitchStatement stat, Statement statement, boolean simulate) { + BasicBlockStatement head = statement.getBasichead(); + if (head.getExprents() == null || head.getExprents().isEmpty()) { + return null; + } + + Exprent first = head.getExprents().get(0); + + if (!(first instanceof AssignmentExprent assignment)) { + return null; + } + + if (!(assignment.getLeft() instanceof VarExprent assigned)) { + return null; + } + PatternExprent pattern = IfPatternMatchProcessor.identifyRecordPatternMatch(stat, statement, assigned, assigned.getExprType(), simulate); + if (pattern != null && !simulate) { + head.getExprents().remove(0); + } + return pattern; + } + private static boolean isSwitchPatternMatch(SwitchHeadExprent head) { Exprent value = head.getValue(); @@ -398,6 +537,6 @@ private static boolean isSwitchPatternMatch(SwitchHeadExprent head) { } public static boolean hasPatternMatch(RootStatement root) { - return root.mt.getBytecodeVersion().hasSwitchPatternMatch() && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_PREVIEW); + return root.mt.getBytecodeVersion().hasSwitchPatternMatch() && DecompilerContext.getOption(IFernflowerPreferences.PATTERN_MATCHING); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/TryWithResourcesProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/TryWithResourcesProcessor.java index 84cbd2fa9c..2dd9daa0d0 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/TryWithResourcesProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/TryWithResourcesProcessor.java @@ -7,8 +7,11 @@ import org.jetbrains.java.decompiler.struct.gen.VarType; import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -348,14 +351,22 @@ public static void findEdgesLeaving(Statement curr, Statement check, Set edges, boolean allowExit) { + findEdgesLeaving(curr, check, edges, allowExit, new HashMap<>()); + } + + private static void findEdgesLeaving(Statement curr, Statement check, Set edges, boolean allowExit, Map> found) { for (StatEdge edge : curr.getAllSuccessorEdges()) { if (!check.containsStatement(edge.getDestination()) && (allowExit || !(edge.getDestination() instanceof DummyExitStatement))) { - edges.add(edge); + // Check if the edge is either explicit or isn't implicit to an already found edge + if (edge.explicit || found.entrySet().stream().allMatch(e -> !e.getKey().containsStatement(curr) || !e.getValue().contains(edge.getDestination()))) { + edges.add(edge); + found.computeIfAbsent(curr, stat -> new HashSet<>()).add(edge.getDestination()); + } } } for (Statement stat : curr.getStats()) { - findEdgesLeaving(stat, check, edges, allowExit); + findEdgesLeaving(stat, check, edges, allowExit, found); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ValidationHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ValidationHelper.java index 7b61bac2b6..8e19b1df86 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ValidationHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ValidationHelper.java @@ -357,6 +357,26 @@ public static void validateDGraph(DirectGraph graph, RootStatement root) { } } } + + // ensure all exprents are unique + Map, DirectNode> allExprents = new HashMap<>(); + + for (DirectNode node : graph.nodes) { + for (Exprent exprent : node.exprents) { + for (Exprent subExprent : exprent.getAllExprents(true, true)) { + ID key = new ID<>(subExprent); + if (allExprents.containsKey(key) && !(subExprent instanceof VarExprent)) { + throw new IllegalStateException( + "Duplicated exprent: " + subExprent + " (Sub exprent of: " + exprent + ") in dgraph. " + + "Appears in both node " + node.id + " and node " + allExprents.get(key).id + "!" + ); + } else { + allExprents.put(key, node); + } + } + } + } + } catch (Throwable e) { DotExporter.errorToDotFile(graph, root.mt, "erroring_dgraph"); throw e; @@ -507,4 +527,28 @@ public static void validateVarVersionsGraph( throw new IllegalStateException("Highly cyclic varversions graph!"); } } + + + static private class ID { + private final T obj; + + + private ID(T obj) { + this.obj = obj; + } + + @Override + public int hashCode() { + return System.identityHashCode(this.obj); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ID id = (ID) o; + return obj == id.obj; + } + } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DomHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DomHelper.java index 2992dca7a9..721ab540cf 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DomHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DomHelper.java @@ -240,10 +240,10 @@ public static boolean removeSynchronizedHandler(Statement stat) { } - private static void buildSynchronized(Statement stat) { - + public static boolean buildSynchronized(Statement stat) { + boolean res = false; for (Statement st : stat.getStats()) { - buildSynchronized(st); + res |= buildSynchronized(st); } if (stat instanceof SequenceStatement) { @@ -265,16 +265,25 @@ private static void buildSynchronized(Statement stat) { next = next.getFirst(); } - if (next instanceof CatchAllStatement) { - - CatchAllStatement ca = (CatchAllStatement) next; + if (next instanceof CatchAllStatement ca) { + // See if the head of the synchronized is suitable. + // In most cases, the synchronized block will contain a monitorexit in the exit block of the catchall. + // If the synchronized statement ends in a throw expression, check for that too. boolean headOk = ca.getFirst().containsMonitorExitOrAthrow(); + // In case the statement has no exit points, it will not have a monitorexit on the exit block because + // there is no exit block. Consider it ok too. if (!headOk) { headOk = hasNoExits(ca.getFirst()); } + // In the final case, we may have incorporated all the monitorexits into a finally block, which should be + // semantically identical. Handle that too. + if (!headOk) { + headOk = ca.isFinally(); + } + // If the body of the monitor ends in a throw, it won't have a monitor exit as the catch handler will call it. // We will also not have a monitorexit in an infinite loop as there is no way to leave the statement. // However, the handler *must* have a monitorexit! @@ -284,6 +293,15 @@ private static void buildSynchronized(Statement stat) { ca.getFirst().markMonitorexitDead(); ca.getHandler().markMonitorexitDead(); + // Sometimes trailing monitorexits occur in our or our parent's successor edges too, remove them too. + for (StatEdge edge : ca.getSuccessorEdgeView(StatEdge.TYPE_REGULAR)) { + edge.getDestination().markMonitorexitDead(); + } + + for (StatEdge edge : ca.getParent().getSuccessorEdgeView(StatEdge.TYPE_REGULAR)) { + edge.getDestination().markMonitorexitDead(); + } + // remove the head block from sequence current.removeSuccessor(current.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL).get(0)); @@ -308,6 +326,7 @@ private static void buildSynchronized(Statement stat) { ca.getParent().replaceStatement(ca, sync); found = true; + res = true; break; } } @@ -319,6 +338,8 @@ private static void buildSynchronized(Statement stat) { } } } + + return res; } // Checks if a statement has no exits (disregarding exceptions) that lead outside the statement. diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java index e0f2494e5d..8a4cb21825 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java @@ -7,9 +7,12 @@ import org.jetbrains.java.decompiler.code.cfg.ExceptionRangeCFG; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; +import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; +import org.jetbrains.java.decompiler.modules.decompiler.ValidationHelper; import org.jetbrains.java.decompiler.modules.decompiler.decompose.GenericDominatorEngine; import org.jetbrains.java.decompiler.modules.decompiler.decompose.IGraph; import org.jetbrains.java.decompiler.modules.decompiler.decompose.IGraphNode; +import org.jetbrains.java.decompiler.struct.StructClass; import org.jetbrains.java.decompiler.util.InterpreterUtil; import java.util.*; @@ -395,59 +398,112 @@ private static boolean splitExceptionRange(ExceptionRangeCFG range, } public static void insertDummyExceptionHandlerBlocks(ControlFlowGraph graph, BytecodeVersion bytecode_version) { - Map> mapRanges = new HashMap<>(); + Map> mapRanges = new HashMap<>(); for (ExceptionRangeCFG range : graph.getExceptions()) { - mapRanges.computeIfAbsent(range.getHandler(), k -> new HashSet<>()).add(range); + mapRanges.computeIfAbsent(range.getHandler(), k -> new ArrayList<>()).add(range); } - for (Entry> ent : mapRanges.entrySet()) { + for (Entry> ent : mapRanges.entrySet()) { BasicBlock handler = ent.getKey(); - Set ranges = ent.getValue(); + List ranges = ent.getValue(); if (ranges.size() == 1) { continue; } - for (ExceptionRangeCFG range : ranges) { + if (!DecompilerContext.getOption(IFernflowerPreferences.OLD_TRY_DEDUP)) { + for (int i = 1; i < ranges.size(); i++) { + ExceptionRangeCFG range = ranges.get(i); - // add some dummy instructions to prevent optimizing away the empty block - SimpleInstructionSequence seq = new SimpleInstructionSequence(); - seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecode_version, new int[]{0}, 1), -1); - seq.addInstruction(Instruction.create(CodeConstants.opc_pop, false, CodeConstants.GROUP_GENERAL, bytecode_version, null, 1), -1); + // Duplicate block now + BasicBlock newBlock = new BasicBlock(++graph.last_id); + newBlock.setSeq(handler.getSeq().clone()); - BasicBlock dummyBlock = new BasicBlock(++graph.last_id); - dummyBlock.setSeq(seq); + graph.getBlocks().addWithKey(newBlock, newBlock.id); - graph.getBlocks().addWithKey(dummyBlock, dummyBlock.id); + // only exception predecessors from this range considered + List lstPredExceptions = new ArrayList<>(handler.getPredExceptions()); + lstPredExceptions.retainAll(range.getProtectedRange()); - // only exception predecessors from this range considered - List lstPredExceptions = new ArrayList<>(handler.getPredExceptions()); - lstPredExceptions.retainAll(range.getProtectedRange()); + // replace predecessors + for (BasicBlock pred : lstPredExceptions) { + pred.replaceSuccessor(handler, newBlock); + } + range.setHandler(newBlock); + + // Add successors + + for (BasicBlock succ : handler.getSuccs()) { + newBlock.addSuccessor(succ); + } - // replace predecessors - for (BasicBlock pred : lstPredExceptions) { - pred.replaceSuccessor(handler, dummyBlock); + for (BasicBlock succ : handler.getSuccExceptions()) { + newBlock.addSuccessorException(succ); + } } - // replace handler - range.setHandler(dummyBlock); - // add common exception edges - Set commonHandlers = new HashSet<>(handler.getSuccExceptions()); - for (BasicBlock pred : lstPredExceptions) { - commonHandlers.retainAll(pred.getSuccExceptions()); + if (!isMatchException(handler)) { + graph.addComment("$VF: Duplicated exception handlers to handle obfuscated exceptions"); } - // TODO: more sanity checks? - for (BasicBlock commonHandler : commonHandlers) { - ExceptionRangeCFG commonRange = graph.getExceptionRange(commonHandler, handler); - dummyBlock.addSuccessorException(commonHandler); - commonRange.getProtectedRange().add(dummyBlock); + } else { + for (ExceptionRangeCFG range : ranges) { + + // add some dummy instructions to prevent optimizing away the empty block + SimpleInstructionSequence seq = new SimpleInstructionSequence(); + seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecode_version, new int[]{0}, 1), -1); + seq.addInstruction(Instruction.create(CodeConstants.opc_pop, false, CodeConstants.GROUP_GENERAL, bytecode_version, null, 1), -1); + + BasicBlock dummyBlock = new BasicBlock(++graph.last_id); + dummyBlock.setSeq(seq); + + graph.getBlocks().addWithKey(dummyBlock, dummyBlock.id); + + // only exception predecessors from this range considered + List lstPredExceptions = new ArrayList<>(handler.getPredExceptions()); + lstPredExceptions.retainAll(range.getProtectedRange()); + + // replace predecessors + for (BasicBlock pred : lstPredExceptions) { + pred.replaceSuccessor(handler, dummyBlock); + } + + // replace handler + range.setHandler(dummyBlock); + // add common exception edges + Set commonHandlers = new HashSet<>(handler.getSuccExceptions()); + for (BasicBlock pred : lstPredExceptions) { + commonHandlers.retainAll(pred.getSuccExceptions()); + } + // TODO: more sanity checks? + for (BasicBlock commonHandler : commonHandlers) { + ExceptionRangeCFG commonRange = graph.getExceptionRange(commonHandler, handler); + + dummyBlock.addSuccessorException(commonHandler); + commonRange.getProtectedRange().add(dummyBlock); + } + + dummyBlock.addSuccessor(handler); + + graph.addComment("$VF: Inserted dummy exception handlers to handle obfuscated exceptions"); } + } + } + } + + private static boolean isMatchException(BasicBlock block) { + StructClass cl = DecompilerContext.getContextProperty(DecompilerContext.CURRENT_CLASS); - dummyBlock.addSuccessor(handler); + // Check if block has any "new MatchException;" + for (Instruction instr : block.getSeq()) { + if (instr.opcode == CodeConstants.opc_new) { + if ("java/lang/MatchException".equals(cl.getPool().getPrimitiveConstant(instr.operand(0)).getString())) { + return true; - graph.addComment("$VF: Inserted dummy exception handlers to handle obfuscated exceptions"); + } } } + + return false; } -} \ No newline at end of file +} diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java index 220a8e9acc..185f373775 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java @@ -42,6 +42,7 @@ public enum Type { INVOCATION, MONITOR, NEW, + PATTERN, SWITCH, SWITCH_HEAD, VAR, diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java index d1a97ba1ff..390e0650e4 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java @@ -19,6 +19,7 @@ import org.jetbrains.java.decompiler.struct.gen.CodeType; import org.jetbrains.java.decompiler.struct.gen.FieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.struct.gen.generics.GenericFieldDescriptor; import org.jetbrains.java.decompiler.struct.gen.generics.GenericType; import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchNode; @@ -78,31 +79,36 @@ public VarType getInferredExprType(VarType upperBound) { cl = cl.superClass == null ? null : DecompilerContext.getStructContext().getClass((String)cl.superClass.value); } - if (ft != null && ft.getSignature() != null) { - VarType ret = ft.getSignature().type.remap(types.getOrDefault(cl.qualifiedName, Collections.emptyMap())); + if (ft != null) { + GenericFieldDescriptor signature = ft.getSignature(); + if (signature != null) { + signature.verifyType(cl.getSignature(), descriptor.type); - if (instance != null && cl.getSignature() != null) { - VarType instType = instance.getInferredExprType(null); + VarType ret = signature.type.remap(types.getOrDefault(cl.qualifiedName, Collections.emptyMap())); - if (instType.isGeneric() && instType.type != CodeType.GENVAR) { - GenericType ginstance = (GenericType)instType; + if (instance != null && cl.getSignature() != null) { + VarType instType = instance.getInferredExprType(null); - cl = DecompilerContext.getStructContext().getClass(instType.value); - if (cl != null && cl.getSignature() != null) { - Map tempMap = new HashMap<>(); - cl.getSignature().genericType.mapGenVarsTo(ginstance, tempMap); - VarType _new = ret.remap(tempMap); + if (instType.isGeneric() && instType.type != CodeType.GENVAR) { + GenericType ginstance = (GenericType) instType; - if (_new != null) { - ret = _new; - } else { - ret = getExprType(); + cl = DecompilerContext.getStructContext().getClass(instType.value); + if (cl != null && cl.getSignature() != null) { + Map tempMap = new HashMap<>(); + cl.getSignature().genericType.mapGenVarsTo(ginstance, tempMap); + VarType _new = ret.remap(tempMap); + + if (_new != null) { + ret = _new; + } else { + ret = getExprType(); + } } } } - } - return ret; + return ret; + } } return getExprType(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java index 43135b8997..91d364ed8b 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java @@ -3,7 +3,6 @@ */ package org.jetbrains.java.decompiler.modules.decompiler.exps; -import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.plugins.PluginImplementationException; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; @@ -241,7 +240,7 @@ public VarType getInferredExprType(VarType upperBound) { if (funcType == FunctionType.CAST) { this.needsCast = true; VarType right = lstOperands.get(0).getInferredExprType(upperBound); - VarType cast = lstOperands.get(1).getExprType(); + List cast = lstOperands.subList(1, lstOperands.size()).stream().map(Exprent::getExprType).toList(); if (upperBound != null && (upperBound.isGeneric() || right.isGeneric())) { Map> names = this.getNamedGenerics(); @@ -259,12 +258,8 @@ public VarType getInferredExprType(VarType upperBound) { } if (types != null) { - boolean anyMatch = false; //TODO: allMatch instead of anyMatch? - for (VarType type : types) { - anyMatch |= DecompilerContext.getStructContext().instanceOf(type.value, cast.value); - } - - if (anyMatch) { + List finalTypes = types; + if (cast.stream().allMatch(castType -> finalTypes.stream().anyMatch(type -> DecompilerContext.getStructContext().instanceOf(type.value, castType.value)))) { this.needsCast = false; } } else { @@ -279,7 +274,8 @@ public VarType getInferredExprType(VarType upperBound) { return right; } } else { //TODO: Capture generics to make cast better? - this.needsCast = right.type == CodeType.NULL || !DecompilerContext.getStructContext().instanceOf(right.value, cast.value) || right.arrayDim != cast.arrayDim; + final VarType finalRight = right; + this.needsCast = right.type == CodeType.NULL || cast.stream().anyMatch(castType -> !DecompilerContext.getStructContext().instanceOf(finalRight.value, castType.value)) || cast.stream().anyMatch(castType -> finalRight.arrayDim != castType.arrayDim); } return getExprType(); @@ -438,9 +434,9 @@ else if (type2.type == CodeType.BOOLEAN) { break; } case INSTANCEOF: - if (lstOperands.size() > 2) { // pattern matching instanceof + if (lstOperands.size() > 2 && lstOperands.get(2) instanceof VarExprent var) { // pattern matching instanceof // The type of the defined var must be the type being tested - result.addMinTypeExprent(lstOperands.get(2), lstOperands.get(1).getExprType()); + result.addMinTypeExprent(var, lstOperands.get(1).getExprType()); } break; case STR_CONCAT: @@ -607,7 +603,13 @@ else if (left instanceof ConstExprent) { if (!needsCast) { return buf.append(lstOperands.get(0).toJava(indent)); } - return buf.append(lstOperands.get(1).toJava(indent)).encloseWithParens().append(wrapOperandString(lstOperands.get(0), true, indent)); + for (int i = 1; i < lstOperands.size(); i++) { + if (i > 1) { + buf.append(" & "); + } + buf.append(lstOperands.get(i).toJava(indent)); + } + return buf.encloseWithParens().append(wrapOperandString(lstOperands.get(0), true, indent)); case ARRAY_LENGTH: Exprent arr = lstOperands.get(0); @@ -628,14 +630,22 @@ else if (left instanceof ConstExprent) { buf.popNewlineGroup(); return buf; case INSTANCEOF: - buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" instanceof ").append(wrapOperandString(lstOperands.get(1), true, indent)); + buf.append(wrapOperandString(lstOperands.get(0), true, indent)).append(" instanceof "); if (this.lstOperands.size() > 2) { // Pattern instanceof creation- only happens when we have more than 2 exprents - buf.append(" "); - ((VarExprent)this.lstOperands.get(2)).setDefinition(false); + + Pattern pattern = (Pattern) this.lstOperands.get(2); + for (VarExprent var : pattern.getPatternVars()) { + var.setWritingPattern(); + } + buf.append(wrapOperandString(this.lstOperands.get(2), true, indent)); + } else { + buf.append(wrapOperandString(lstOperands.get(1), true, indent)); } + + return buf; case LCMP: case FCMPL: @@ -663,9 +673,12 @@ else if (left instanceof ConstExprent) { inv.forceUnboxing(true); } } - return buf.append(wrapOperandString(lstOperands.get(0), true, indent)) - .prepend("(" + ExprProcessor.getTypeName(funcType.castType) + ")") - .addTypeNameToken(funcType.castType, 1); + + if (!needsCast) { + return buf.append(lstOperands.get(0).toJava(indent)); + } + + return buf.append(ExprProcessor.getTypeName(funcType.castType)).encloseWithParens().append(wrapOperandString(lstOperands.get(0), true, indent)); } // return ""; @@ -695,7 +708,7 @@ public void unwrapBox() { @Override public int getPrecedence() { - if (funcType == FunctionType.CAST && !doesCast()) { + if ((funcType == FunctionType.CAST || funcType.castType != null) && !doesCast()) { return lstOperands.get(0).getPrecedence(); } @@ -904,9 +917,11 @@ public void processSforms(SFormsConstructor sFormsConstructor, VarMapHolder varM // but it comes down to the same ideas. varMaps.makeFullyMutable(); - VarExprent var = (VarExprent) this.getLstOperands().get(2); + Pattern pattern = (Pattern) this.getLstOperands().get(2); - sFormsConstructor.updateVarExprent(var, stat, varMaps.getIfTrue(), calcLiveVars); + for (VarExprent var : pattern.getPatternVars()) { + sFormsConstructor.updateVarExprent(var, stat, varMaps.getIfTrue(), calcLiveVars); + } } return; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java index edea96b18b..3e7ca0447a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java @@ -467,7 +467,7 @@ else if (!bounds.containsKey(from)) { } if (found != null) { Map genvars = new HashMap<>(); - if (base.getSignature() != null) { + if (base.getSignature() != null && found.getSignature() != null) { base.getSignature().genericType.mapGenVarsTo((GenericType) paramType, genvars); excluded.addAll(found.getSignature().parameterTypes.stream() .filter(VarType::isGeneric) @@ -600,7 +600,7 @@ else if (paramType.type == CodeType.GENVAR && !paramType.equals(argtype) && argt } newRet = newRet.remap(genericsMap); - if (newRet == null) { + if (newRet == null && bounds.get(ret) != null && bounds.get(ret).size() > 0) { newRet = bounds.get(ret).get(0).remap(genericsMap); } @@ -616,8 +616,8 @@ else if (paramType.type == CodeType.GENVAR && !paramType.equals(argtype) && argt } } - boolean suppress = (!missing || !isInvocationInstance) && - (upperBound == null || !newRet.isGeneric() || DecompilerContext.getStructContext().instanceOf(newRet.value, upperBound.value)); + boolean suppress = (!missing || !isInvocationInstance) && newRet != null && + (upperBound == null || !newRet.isGeneric() || DecompilerContext.getStructContext().instanceOf(newRet.value, upperBound.value)); if (this.forceGenericQualfication) { suppress = false; @@ -631,7 +631,7 @@ else if (isGenNew) { } } - if (newRet != ret && !(newRet.isGeneric() && ((GenericType)newRet).hasUnknownGenericType(named.keySet()))) { + if (newRet != ret && newRet != null && !(newRet.isGeneric() && ((GenericType)newRet).hasUnknownGenericType(named.keySet()))) { return newRet; } } @@ -949,8 +949,6 @@ private static void appendBootstrapArgument(TextBuffer buf, PooledConstant arg) } public TextBuffer appendParamList(int indent) { - TextBuffer buf = new TextBuffer(); - buf.pushNewlineGroup(indent, 1); List mask = null; boolean isEnum = false; if (functype == Type.INIT) { @@ -1105,9 +1103,14 @@ else if (inv.isUnboxingCall() && !inv.shouldForceUnboxing()) { } + TextBuffer buf = new TextBuffer(); + boolean firstParameter = true; - buf.appendPossibleNewline(); - buf.pushNewlineGroup(indent, 0); + if (!lstParameters.isEmpty()) { + buf.pushNewlineGroup(indent, 1); + buf.appendPossibleNewline(); + buf.pushNewlineGroup(indent, 0); + } for (int i = start; i < lstParameters.size(); i++) { if (mask == null || mask.get(i) == null) { @@ -1161,9 +1164,11 @@ else if (desc != null && desc.getSignature() != null && genericArgs.size() != 0) } } - buf.popNewlineGroup(); - buf.appendPossibleNewline("", true); - buf.popNewlineGroup(); + if (!lstParameters.isEmpty()) { + buf.popNewlineGroup(); + buf.appendPossibleNewline("", true); + buf.popNewlineGroup(); + } return buf; } @@ -1333,7 +1338,9 @@ private List getMatchedDescriptors() { private boolean matches(VarType[] left, VarType[] right) { if (left.length == right.length) { for (int i = 0; i < left.length; i++) { - if (left[i].typeFamily != right[i].typeFamily) { + TypeFamily leftFamily = left[i].typeFamily; + TypeFamily rightFamily = right[i].typeFamily; + if (leftFamily != rightFamily && !(leftFamily.isNumeric() && rightFamily.isNumeric())) { return false; } @@ -1401,6 +1408,10 @@ private BitSet getAmbiguousParameters(List matches) { boolean exact = true; for (int i = 0; i < md.params.length; i++) { Exprent exp = lstParameters.get(i); + if (exp instanceof FunctionExprent && ((FunctionExprent) exp).getSimpleCastType() != null) { + ((FunctionExprent) exp).setNeedsCast(true); + } + // Check if the current parameters and method descriptor are of the same type, or if the descriptor's type is a superset of the parameter's type. // This check ensures that parameters that can be safely passed don't have an unneeded cast on them, such as System.out.println((int)5);. // TODO: The root cause of the above issue seems to be threading related- When debugging line by line it doesn't cast, but when running normally it does. More digging needs to be done to figure out why this happens. @@ -1798,6 +1809,10 @@ public Map getGenericsMap() { } public StructMethod getDesc() { + if (desc == null) { + StructClass cl = DecompilerContext.getStructContext().getClass(classname); + desc = cl != null ? cl.getMethodRecursive(name, stringDescriptor) : null; + } return desc; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java index f729806bea..468c72592c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java @@ -9,6 +9,7 @@ import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.main.rels.ClassWrapper; import org.jetbrains.java.decompiler.main.rels.MethodWrapper; +import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.sforms.SFormsConstructor; @@ -179,14 +180,15 @@ else if (method.getSignature() != null) { // generated lambda methods have no generic info, so only map to generic var parameters List types = method.getSignature() != null ? method.getSignature().parameterTypes : Arrays.asList(desc.params); for (int i = 0; i < types.size(); ++i) { - if (refMethod.getSignature().parameterTypes.get(i).type == CodeType.GENVAR) { - if (!genericsMap.containsKey(refMethod.getSignature().parameterTypes.get(i))) { + List parameterTypes = refMethod.getSignature().parameterTypes; + if (i < parameterTypes.size() && parameterTypes.get(i).type == CodeType.GENVAR) { + if (!genericsMap.containsKey(parameterTypes.get(i))) { VarType realType = types.get(i); StructClass typeCls = DecompilerContext.getStructContext().getClass(realType.value); if (typeCls != null && typeCls.getSignature() != null && !realType.equals(typeCls.getSignature().genericType)) { realType = typeCls.getSignature().genericType.resizeArrayDim(realType.arrayDim); } - genericsMap.put(refMethod.getSignature().parameterTypes.get(i), realType); + genericsMap.put(parameterTypes.get(i), realType); } } } @@ -307,7 +309,7 @@ public Exprent copy() { NewExprent ret = new NewExprent(newType, lst, bytecode); ret.setConstructor(constructor == null ? null : (InvocationExprent)constructor.copy()); - ret.setLstArrayElements(lstArrayElements); + ret.setLstArrayElements(DecHelper.copyExprentList(lstArrayElements)); ret.setDirectArrayInit(directArrayInit); ret.setAnonymous(anonymous); ret.setEnumConst(enumConst); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Pattern.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Pattern.java new file mode 100644 index 0000000000..ed00f0fc63 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Pattern.java @@ -0,0 +1,9 @@ +package org.jetbrains.java.decompiler.modules.decompiler.exps; + +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public interface Pattern { + @NotNull List getPatternVars(); +} diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/PatternExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/PatternExprent.java new file mode 100644 index 0000000000..d4a4f72a58 --- /dev/null +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/PatternExprent.java @@ -0,0 +1,140 @@ +package org.jetbrains.java.decompiler.modules.decompiler.exps; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; +import org.jetbrains.java.decompiler.modules.decompiler.ValidationHelper; +import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult; +import org.jetbrains.java.decompiler.struct.StructClass; +import org.jetbrains.java.decompiler.struct.StructRecordComponent; +import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.util.TextBuffer; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; + +public class PatternExprent extends Exprent implements Pattern { + private final PatternData data; + private final VarType varType; + private final List exprents; + private final List<@Nullable VarType> boundTypes; + + public PatternExprent(PatternData data, VarType type, List exprents) { + super(Type.PATTERN); + this.data = data; + this.varType = type; + this.exprents = exprents; + this.boundTypes = new ArrayList<>(); + + for (Exprent exprent : exprents) { + if (!(exprent instanceof Pattern)) { + ValidationHelper.assertTrue(false, "Illegal input for PatternExprent"); + } + boundTypes.add(null); + } + } + + @Override + protected List getAllExprents(List list) { + list.addAll(exprents); + return list; + } + + @Override + public VarType getExprType() { + return varType; + } + + @Override + public Exprent copy() { + return new PatternExprent(data, varType, DecHelper.copyExprentList(exprents)); + } + + @Override + public TextBuffer toJava(int indent) { + TextBuffer buf = new TextBuffer(); + buf.appendCastTypeName(varType); + buf.append("("); + + for (int i = 0; i < exprents.size(); i++) { + buf.append(exprents.get(i).toJava()); + + if (i < exprents.size() - 1) { + buf.append(", "); + } + } + + buf.append(")"); + + return buf; + } + + @Override + public CheckTypesResult checkExprTypeBounds() { + if (this.data instanceof PatternData.RecordPatternData record) { + CheckTypesResult res = new CheckTypesResult(); + + ValidationHelper.assertTrue(record.cl.getRecordComponents() != null, "Must not be null!"); + ValidationHelper.assertTrue(record.cl.getRecordComponents().size() == exprents.size(), "Record component size and expr list size must be equal!"); + + // The type lower bound must be at least the type of the record. However, we might have found a stronger lower bound, use that instead in that case. + for (int i = 0; i < exprents.size(); i++) { + VarType type = boundTypes.get(i); + if (type != null) { + res.addMinTypeExprent(exprents.get(i), type); + } else { + res.addMinTypeExprent(exprents.get(i), new VarType(record.cl.getRecordComponents().get(i).getDescriptor())); + } + } + + return res; + } + + return super.checkExprTypeBounds(); + } + + @Override + public void getBytecodeRange(BitSet values) { + measureBytecode(values, exprents); + measureBytecode(values); + } + + @Override + @NotNull + public List getPatternVars() { + List vars = new ArrayList<>(); + + for (Exprent e : exprents) { + if (e instanceof Pattern p) { + vars.addAll(p.getPatternVars()); + } else { + ValidationHelper.assertTrue(false, "Illegal input in PatternExprent"); + } + } + + return vars; + } + + public PatternData getData() { + return data; + } + + public List getExprents() { + return exprents; + } + + public List<@Nullable VarType> getBoundTypes() { + return boundTypes; + } + + public static PatternData recordData(StructClass cl) { + return new PatternData.RecordPatternData(cl); + } + + public sealed interface PatternData { + record RecordPatternData(StructClass cl) implements PatternData { + + } + } +} diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java index aca49427da..6e24aedeb0 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java @@ -94,12 +94,13 @@ public TextBuffer toJava(int indent) { buf.appendField(field.getName(), false, field.getClassname(), field.getName(), field.getDescriptor()); } else if (value instanceof FunctionExprent && ((FunctionExprent) value).getFuncType() == FunctionExprent.FunctionType.INSTANCEOF) { // Pattern matching variables - List operands = ((FunctionExprent) value).getLstOperands(); - buf.append(operands.get(1).toJava(indent)); - buf.append(" "); - // We're pasting the var type, don't do it again - ((VarExprent)operands.get(2)).setDefinition(false); - buf.append(operands.get(2).toJava(indent)); + + Pattern pattern = (Pattern) value.getAllExprents().get(2); + for (VarExprent var : pattern.getPatternVars()) { + var.setWritingPattern(); + } + + buf.append(value.getAllExprents().get(2).toJava(indent)); } else { buf.append(value.toJava(indent)); } @@ -148,17 +149,17 @@ public TextBuffer toJava(int indent) { ((ConstExprent)content).setConstType(this.type); } - buf.append(content.toJava(indent).append(";")); + buf.append(content.toJava(indent + 1).append(";")); } else if (exprent instanceof ExitExprent) { ExitExprent exit = (ExitExprent) exprent; if (exit.getExitType() == ExitExprent.Type.THROW) { - buf.append(exit.toJava(indent).append(";")); + buf.append(exit.toJava(indent + 1).append(";")); } else { throw new IllegalStateException("Can't have return in switch expression"); } } else { // Catchall - buf.append(exprent.toJava(indent).append(";")); + buf.append(exprent.toJava(indent + 1).append(";")); } } else { buf.append("{"); @@ -215,7 +216,8 @@ private static boolean isSyntheticThrowEdge(StatEdge edge){ Exprent targetExpr = targetExprs.get(0); return targetExpr instanceof ExitExprent && ((ExitExprent) targetExpr).getExitType() == ExitExprent.Type.THROW - && ((ExitExprent) targetExpr).getValue().getExprType().value.equals("java/lang/IncompatibleClassChangeError"); + && (((ExitExprent) targetExpr).getValue().getExprType().value.equals("java/lang/IncompatibleClassChangeError") + || ((ExitExprent) targetExpr).getValue().getExprType().value.equals("java/lang/MatchException")); } return false; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index 8d71deaa04..6c6ebcb45a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -1,6 +1,7 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.exps; +import org.jetbrains.annotations.NotNull; import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.main.ClassWriter; @@ -39,7 +40,7 @@ import java.util.List; import java.util.stream.Collectors; -public class VarExprent extends Exprent { +public class VarExprent extends Exprent implements Pattern { public static final int STACK_BASE = 10000; public static final String VAR_NAMELESS_ENCLOSURE = ""; private static final boolean FORCE_VARVER_NAME = false; // Debug only! @@ -56,7 +57,9 @@ public class VarExprent extends Exprent { // Applies only to real vars, not stack vars private Instruction backing = null; private boolean isEffectivelyFinal = false; + private boolean writingPattern = false; private VarType boundType; + private boolean isIntersectionType = false; public VarExprent(int index, VarType varType, VarProcessor processor) { this(index, varType, processor, null); @@ -126,12 +129,12 @@ public TextBuffer toJava(int indent) { VarVersionPair varVersion = getVarVersionPair(); if (definition) { - if (processor != null && processor.getVarFinal(varVersion) == FinalType.EXPLICIT_FINAL) { + if (!writingPattern && processor != null && processor.getVarFinal(varVersion) == FinalType.EXPLICIT_FINAL) { buffer.append("final "); } VarType definitionType = getDefinitionVarType(); String name = ExprProcessor.getCastTypeName(definitionType); - if (name.equals(ExprProcessor.UNREPRESENTABLE_TYPE_STRING)) { + if (name.equals(ExprProcessor.UNREPRESENTABLE_TYPE_STRING) || isIntersectionType) { buffer.append("var"); } else { buffer.appendCastTypeName(definitionType); @@ -227,6 +230,7 @@ public VarType getDefinitionVarType() { if (lvt.getSignature() != null) { GenericFieldDescriptor descriptor = GenericMain.parseFieldSignature(lvt.getSignature()); if (descriptor != null) { + descriptor.verifyLoosely(lvt.getVarType()); return descriptor.type; } } @@ -242,28 +246,39 @@ public VarType getDefinitionVarType() { } int visibleOffset = bytecode == null ? -1 : bytecode.length(); if (originalIndex != null) { - // first try from signature + // Try loading the type from LVT attributes: + // First try the signature if it's available and matches a known descriptor. + // If signature not available, then try the descriptor. + // If neither are present, fall back to the context-inferred type. + + VarType type = null; + StructLocalVariableTableAttribute lvt = method.methodStruct.getLocalVariableAttr(); + if (lvt != null) { + String descriptor = lvt.getDescriptor(originalIndex, visibleOffset); + if (descriptor != null) { + type = new VarType(descriptor); + } + } + if (DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) { - StructLocalVariableTypeTableAttribute attr = + StructLocalVariableTypeTableAttribute lvtSignatures = method.methodStruct.getAttribute(StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TYPE_TABLE); - if (attr != null) { - String signature = attr.getSignature(originalIndex, visibleOffset); + if (lvtSignatures != null) { + String signature = lvtSignatures.getSignature(originalIndex, visibleOffset); if (signature != null) { GenericFieldDescriptor descriptor = GenericMain.parseFieldSignature(signature); if (descriptor != null) { + if (type != null) { + descriptor.verifyLoosely(type); + } return descriptor.type; } } } } - // then try from descriptor - StructLocalVariableTableAttribute attr = method.methodStruct.getLocalVariableAttr(); - if (attr != null) { - String descriptor = attr.getDescriptor(originalIndex, visibleOffset); - if (descriptor != null) { - return new VarType(descriptor); - } + if (type != null) { + return type; } } } @@ -402,6 +417,10 @@ public boolean isEffectivelyFinal() { return this.isEffectivelyFinal; } + public void setWritingPattern() { + writingPattern = true; + } + public String getName() { VarVersionPair pair = getVarVersionPair(); if (!FORCE_VARVER_NAME) { @@ -514,6 +533,14 @@ public String toString() { return "VarExprent[" + index + ',' + version + (definition ? " Def" : "") + "]: {" + super.toString() + "}"; } + public void setIntersectionType(boolean intersection) { + this.isIntersectionType = intersection; + } + + public boolean isIntersectionType() { + return this.isIntersectionType; + } + // ***************************************************************************** // IMatchable implementation // ***************************************************************************** @@ -536,4 +563,9 @@ public boolean match(MatchNode matchNode, MatchEngine engine) { return true; } + + @Override + public @NotNull List getPatternVars() { + return List.of(this); + } } \ No newline at end of file diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java index 393af9fa14..0feb169564 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java @@ -11,6 +11,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent; +import org.jetbrains.java.decompiler.modules.decompiler.exps.Pattern; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.util.StartEndPair; import org.jetbrains.java.decompiler.util.TextBuffer; @@ -119,9 +120,9 @@ public List getImplicitlyDefinedVars() { inner.add(exp); for (Exprent exprent : inner) { - if (exprent instanceof FunctionExprent && ((FunctionExprent) exprent).getFuncType() == FunctionExprent.FunctionType.INSTANCEOF) { - if (((FunctionExprent) exprent).getLstOperands().size() > 2) { - vars.add((VarExprent) ((FunctionExprent) exprent).getLstOperands().get(2)); + if (exprent instanceof FunctionExprent func && func.getFuncType() == FunctionExprent.FunctionType.INSTANCEOF) { + if (func.getLstOperands().size() > 2) { + vars.addAll(((Pattern) func.getLstOperands().get(2)).getPatternVars()); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index daab8f1e9e..d60bec7d47 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Set; -public final class CatchAllStatement extends Statement { +public class CatchAllStatement extends Statement { private Statement handler; @@ -31,11 +31,11 @@ public final class CatchAllStatement extends Statement { // constructors // ***************************************************************************** - private CatchAllStatement() { + protected CatchAllStatement() { super(StatementType.CATCH_ALL); } - private CatchAllStatement(Statement head, Statement handler) { + protected CatchAllStatement(Statement head, Statement handler) { this(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java index de600fb444..93d48bed19 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; -public final class CatchStatement extends Statement { +public class CatchStatement extends Statement { private final List> exctstrings = new ArrayList<>(); private final List vars = new ArrayList<>(); private final List resources = new ArrayList<>(); @@ -30,11 +30,11 @@ public final class CatchStatement extends Statement { // constructors // ***************************************************************************** - private CatchStatement() { + protected CatchStatement() { super(StatementType.TRY_CATCH); } - private CatchStatement(Statement head, Statement next, Set setHandlers) { + protected CatchStatement(Statement head, Statement next, Set setHandlers) { this(); first = head; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java index 8f2edd65cb..726da8c621 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java @@ -6,6 +6,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; +import org.jetbrains.java.decompiler.modules.decompiler.exps.Pattern; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.util.TextBuffer; @@ -14,7 +15,7 @@ import java.util.List; // Loop statement -public final class DoStatement extends Statement { +public class DoStatement extends Statement { public enum Type { INFINITE, DO_WHILE, WHILE, FOR, FOR_EACH } @@ -29,7 +30,7 @@ public enum Type { // constructors // ***************************************************************************** - private DoStatement() { + protected DoStatement() { super(StatementType.DO); looptype = Type.INFINITE; @@ -38,7 +39,7 @@ private DoStatement() { incExprent.add(null); } - private DoStatement(Statement head) { + protected DoStatement(Statement head) { this(); @@ -208,12 +209,11 @@ public List getImplicitlyDefinedVars() { List conditionList = getConditionExprent().getAllExprents(true, true); for (Exprent condition : conditionList) { - if (condition instanceof FunctionExprent) { - FunctionExprent func = ((FunctionExprent)condition); + if (condition instanceof FunctionExprent func) { // Pattern match variable is implicitly defined if (func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().size() > 2) { - vars.add((VarExprent) func.getLstOperands().get(2)); + vars.addAll(((Pattern) func.getLstOperands().get(2)).getPatternVars()); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java index 9f2314196a..c866c057eb 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -5,11 +5,8 @@ import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.ValidationHelper; -import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; -import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent; +import org.jetbrains.java.decompiler.modules.decompiler.exps.*; import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent.FunctionType; -import org.jetbrains.java.decompiler.modules.decompiler.exps.IfExprent; -import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.struct.match.IMatchable; import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchNode; @@ -21,7 +18,7 @@ import java.util.List; -public final class IfStatement extends Statement { +public class IfStatement extends Statement { public static final int IFTYPE_IF = 0; public static final int IFTYPE_IFELSE = 1; @@ -49,13 +46,13 @@ public final class IfStatement extends Statement { // constructors // ***************************************************************************** - private IfStatement() { + protected IfStatement() { super(StatementType.IF); headexprent.add(null); } - private IfStatement(Statement head, int regedges, Statement postst) { + protected IfStatement(Statement head, int regedges, Statement postst) { this(); @@ -440,12 +437,10 @@ public List getImplicitlyDefinedVars() { conditionList.add(getHeadexprent().getCondition()); for (Exprent condition : conditionList) { - if (condition instanceof FunctionExprent) { - FunctionExprent func = ((FunctionExprent)condition); - + if (condition instanceof FunctionExprent func) { // Pattern match variable is implicitly defined if (func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().size() > 2) { - vars.add((VarExprent) func.getLstOperands().get(2)); + vars.addAll(((Pattern) func.getLstOperands().get(2)).getPatternVars()); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java index 4fd2d23819..7bbb4ae064 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java @@ -10,14 +10,14 @@ import java.util.List; -public final class SequenceStatement extends Statement { +public class SequenceStatement extends Statement { // ***************************************************************************** // constructors // ***************************************************************************** - private SequenceStatement() { + protected SequenceStatement() { super(StatementType.SEQUENCE); } @@ -38,7 +38,7 @@ public SequenceStatement(List lst) { first = stats.get(0); } - private SequenceStatement(Statement head, Statement tail) { + protected SequenceStatement(Statement head, Statement tail) { this(Arrays.asList(head, tail)); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java index 14f6a0997a..2d358f0070 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java @@ -968,6 +968,10 @@ public void setPhantom(boolean phantom) { this.phantom = phantom; } + public String toDebug() { + return toJava().convertToStringAndAllowDataDiscard(); + } + // helper methods public String toString() { return "{" + type.prettyId + "}:" + id; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java index 1fe72d8fcd..5529b21e4b 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java @@ -19,7 +19,7 @@ import java.util.*; import java.util.stream.Collectors; -public final class SwitchStatement extends Statement { +public class SwitchStatement extends Statement { // ***************************************************************************** // private fields @@ -43,13 +43,13 @@ public final class SwitchStatement extends Statement { // constructors // ***************************************************************************** - private SwitchStatement() { + protected SwitchStatement() { super(StatementType.SWITCH); headexprent.add(null); } - private SwitchStatement(Statement head, Statement poststat) { + protected SwitchStatement(Statement head, Statement poststat) { this(); @@ -160,12 +160,13 @@ public TextBuffer toJava(int indent) { buf.appendField(field.getName(), false, field.getClassname(), field.getName(), field.getDescriptor()); } else if (value instanceof FunctionExprent && ((FunctionExprent) value).getFuncType() == FunctionType.INSTANCEOF) { // Pattern matching variables - List operands = ((FunctionExprent) value).getLstOperands(); - buf.append(operands.get(1).toJava(indent)); - buf.append(" "); - // We're pasting the var type, don't do it again - ((VarExprent)operands.get(2)).setDefinition(false); - buf.append(operands.get(2).toJava(indent)); + + Pattern pattern = (Pattern) value.getAllExprents().get(2); + for (VarExprent var : pattern.getPatternVars()) { + var.setWritingPattern(); + } + + buf.append(value.getAllExprents().get(2).toJava(indent)); } else { buf.append(value.toJava(indent)); } @@ -266,12 +267,11 @@ public List getImplicitlyDefinedVars() { continue; } - if (caseContent instanceof FunctionExprent) { - FunctionExprent func = ((FunctionExprent) caseContent); + if (caseContent instanceof FunctionExprent func) { // Pattern match variable is implicitly defined if (func.getFuncType() == FunctionType.INSTANCEOF && func.getLstOperands().size() > 2) { - vars.add((VarExprent) func.getLstOperands().get(2)); + vars.addAll(((Pattern) func.getLstOperands().get(2)).getPatternVars()); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java index 0e7fef4f8a..056de8e7e3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java @@ -13,7 +13,7 @@ import java.util.List; -public final class SynchronizedStatement extends Statement { +public class SynchronizedStatement extends Statement { private Statement body; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java index e751bf0af5..43bdb90ce6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java @@ -1,6 +1,7 @@ // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.vars; +import org.jetbrains.annotations.NotNull; import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode; import org.jetbrains.java.decompiler.main.DecompilerContext; @@ -25,6 +26,7 @@ import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.struct.gen.generics.GenericType; import org.jetbrains.java.decompiler.util.ArrayHelper; +import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.Pair; import org.jetbrains.java.decompiler.util.StatementIterator; @@ -1028,18 +1030,11 @@ private void propogateLVTs(Statement stat) { Map renames = this.mt.getVariableNamer().rename(typeNames); + Set methods = new HashSet<>(); + // Stuff the parent context into enclosed child methods StatementIterator.iterate(root, (exprent) -> { - List methods = new ArrayList<>(); - if (exprent instanceof VarExprent) { - VarExprent var = (VarExprent)exprent; - if (var.isClassDef()) { - ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(var.getVarType().value); - if (child != null) - methods.addAll(child.classStruct.getMethods()); - } - } - else if (exprent instanceof NewExprent) { + if (exprent instanceof NewExprent) { NewExprent _new = (NewExprent)exprent; if (_new.isAnonymous()) { //TODO: Check for Lambda here? ClassNode child = DecompilerContext.getClassProcessor().getMapRootClasses().get(_new.getNewType().value); @@ -1056,13 +1051,21 @@ else if (exprent instanceof NewExprent) { } } } - - for (StructMethod meth : methods) { - meth.getVariableNamer().addParentContext(VarDefinitionHelper.this.mt.getVariableNamer()); - } return 0; }); + // Local classes aren't added into the method body yet + String thisKey = InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()); + for (ClassNode nested : DecompilerContext.getClassProcessor().getMapRootClasses().get(mt.getClassQualifiedName()).nested) { + if (nested.type == ClassNode.Type.LOCAL && thisKey.equals(nested.enclosingMethod)) { + methods.addAll(nested.classStruct.getMethods()); + } + } + + for (StructMethod meth : methods) { + meth.getVariableNamer().addParentContext(VarDefinitionHelper.this.mt.getVariableNamer()); + } + Map lvts = new HashMap<>(); for (Entry e : types.entrySet()) { @@ -1599,10 +1602,11 @@ private void iterateClashingExprent(Statement stat, StructMethod mt, Map= startIdx) { + VarVersionPair vvp = new VarVersionPair(start, 0); + + // Try to perform a rename + String name = mw.varproc.getVarName(vvp); + String original = name; + name = rename(nameMap, name); + + // Did we rename? If so, we should add it to the name map and set as clashing + if (original != null && !original.equals(name)) { + mw.varproc.setClashingName(vvp, name); + nameMap.put(new VarInMethod(vvp, mt2), name); + } + } + + start += md.params[i].stackSize; + } + + // Iterate clashing names with the lambda's body, with the context of the outer method + vardef.iterateClashingNames(mw.root, mt2, varDefinitions, liveVarDefs, nameMap); + + for (Entry e : vardef.getClashingNames().entrySet()) { + mw.varproc.setClashingName(e.getKey(), e.getValue()); + } + + // Pop all the variables we've seen, now that the lambda processing is done + for (Entry e : new HashSet<>(nameMap.entrySet())) { + if (e.getKey().mt == mt2) { + nameMap.remove(e.getKey()); + } + } + } + } + } } } @@ -1701,7 +1759,7 @@ private void iterateClashingExprent(Statement stat, StructMethod mt, Map nameMap, String name) { + private static @NotNull String rename(Map nameMap, String name) { while (nameMap.containsValue(name)) { name += "x"; } diff --git a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java index 5ddb6029ee..afb05f815c 100644 --- a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java +++ b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java @@ -13,15 +13,14 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; +import java.util.*; import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.stream.Collectors; public class ContextUnit { + private static AtomicInteger THREAD_ID = new AtomicInteger(0); private final IContextSource source; private final boolean own; private final boolean root; @@ -140,29 +139,38 @@ public void save(final Function loader) throws IOException } //Whooo threads! - final List> futures = new LinkedList<>(); - final int threads = Integer.parseInt((String) DecompilerContext.getProperty(IFernflowerPreferences.THREADS)); - final ExecutorService workerExec = Executors.newFixedThreadPool(threads > 0 ? threads : Runtime.getRuntime().availableProcessors()); + List> futures = new ArrayList<>(); + int threads = Integer.parseInt((String) DecompilerContext.getProperty(IFernflowerPreferences.THREADS)); + if (threads <= 0) { + threads = Runtime.getRuntime().availableProcessors(); + } + ForkJoinPool pool = new ForkJoinPool(threads, namingScheme(), null, true); final DecompilerContext rootContext = DecompilerContext.getCurrentContext(); final List toDump = new ArrayList<>(classEntries.size()); + Set seen = new LinkedHashSet<>(); // collect classes for (int i = 0; i < classEntries.size(); i++) { StructClass cl = loader.apply(classEntries.get(i)); String entryName = decompiledData.getClassEntryName(cl, classEntries.get(i)); if (entryName != null) { - toDump.add(new ClassContext(cl, entryName)); + if (seen.add(cl.qualifiedName)) { + toDump.add(new ClassContext(cl, entryName)); + } else { + DecompilerContext.getLogger().writeMessage("Skipping writing already existing class: " + cl.qualifiedName, IFernflowerLogger.Severity.ERROR); + } } } // pre-process for (final ClassContext classCtx : toDump) { - futures.add(workerExec.submit(() -> { + futures.add(pool.submit(() -> { setContext(rootContext); classCtx.ctx = DecompilerContext.getCurrentContext(); try { decompiledData.processClass(classCtx.cl); } catch (final Throwable thr) { + DecompilerContext.getLogger().writeMessage("Class " + classCtx.cl.qualifiedName + " couldn't be fully decompiled.", thr); classCtx.onError(thr); } finally { DecompilerContext.setCurrentContext(null); @@ -182,7 +190,7 @@ public void save(final Function loader) throws IOException continue; } - futures.add(workerExec.submit(() -> { + futures.add(pool.submit(() -> { DecompilerContext.setCurrentContext(classCtx.ctx); classCtx.classContent = decompiledData.getClassContent(classCtx.cl); if (DecompilerContext.getOption(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING)) { @@ -193,7 +201,8 @@ public void save(final Function loader) throws IOException waitForAll(futures); futures.clear(); - workerExec.shutdown(); + pool.shutdown(); + THREAD_ID.set(0); // write to file for (final ClassContext cls : toDump) { @@ -205,6 +214,15 @@ public void save(final Function loader) throws IOException sink.close(); } + private static ForkJoinPool.ForkJoinWorkerThreadFactory namingScheme() { + return pool -> { + ForkJoinWorkerThread thread = new ForkJoinWorkerThread(pool) {}; + thread.setName("Vineflower-DecompilerThread-" + THREAD_ID.getAndIncrement()); + + return thread; + }; + } + public void setContext(DecompilerContext rootContext) { DecompilerContext current = DecompilerContext.getCurrentContext(); if (current == null) { @@ -221,7 +239,9 @@ public void setContext(DecompilerContext rootContext) { } private static void waitForAll(final List> futures) { - for (Future future : futures) { + for (int i = futures.size() - 1; i >= 0; i--) { + Future future = futures.get(i); + try { future.get(); } catch (ExecutionException e) { diff --git a/src/org/jetbrains/java/decompiler/struct/SingleFileContextSource.java b/src/org/jetbrains/java/decompiler/struct/SingleFileContextSource.java index 2b8ce0ce28..9fe4405813 100644 --- a/src/org/jetbrains/java/decompiler/struct/SingleFileContextSource.java +++ b/src/org/jetbrains/java/decompiler/struct/SingleFileContextSource.java @@ -84,7 +84,8 @@ public void acceptDirectory(String directory) { @Override public void acceptClass(String qualifiedName, String fileName, String content, int[] mapping) { - saver.saveClassFile("", qualifiedName, file.getName().substring(0, file.getName().length() - CLASS_SUFFIX.length()) + ".java", content, mapping); + String entryName = fileName.substring(fileName.lastIndexOf('/') + 1); + saver.saveClassFile("", qualifiedName, entryName, content, mapping); } }; } diff --git a/src/org/jetbrains/java/decompiler/struct/StructClass.java b/src/org/jetbrains/java/decompiler/struct/StructClass.java index 40324a5a07..55b0c5cef0 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructClass.java +++ b/src/org/jetbrains/java/decompiler/struct/StructClass.java @@ -1,6 +1,8 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.struct; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.java.decompiler.code.BytecodeVersion; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; @@ -206,7 +208,7 @@ public ConstantPool getPool() { /** * @return list of record components; null if this class is not a record */ - public List getRecordComponents() { + public @Nullable List getRecordComponents() { StructRecordAttribute recordAttr = getAttribute(StructGeneralAttribute.ATTRIBUTE_RECORD); if (recordAttr == null) { // If our class extends j.l.Record but also has no components, it's probably malformed. diff --git a/src/org/jetbrains/java/decompiler/struct/StructContext.java b/src/org/jetbrains/java/decompiler/struct/StructContext.java index 72030d8b53..4fc92abcbe 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructContext.java +++ b/src/org/jetbrains/java/decompiler/struct/StructContext.java @@ -1,6 +1,7 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.struct; +import org.jetbrains.annotations.Nullable; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider; import org.jetbrains.java.decompiler.main.extern.IContextSource; @@ -69,7 +70,7 @@ public StructContext(IResultSaver saver, IDecompiledData decompiledData) { this.decompiledData = decompiledData; } - public StructClass getClass(String name) { + public @Nullable StructClass getClass(String name) { if (name == null) { return null; } diff --git a/src/org/jetbrains/java/decompiler/struct/consts/PrimitiveConstant.java b/src/org/jetbrains/java/decompiler/struct/consts/PrimitiveConstant.java index 408622a592..bff813b93a 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/PrimitiveConstant.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/PrimitiveConstant.java @@ -47,4 +47,4 @@ public boolean equals(Object o) { this.isArray == cn.isArray && this.value.equals(cn.value); } -} \ No newline at end of file +} diff --git a/src/org/jetbrains/java/decompiler/struct/gen/TypeFamily.java b/src/org/jetbrains/java/decompiler/struct/gen/TypeFamily.java index 2006596f51..e7929c32cc 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/TypeFamily.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/TypeFamily.java @@ -5,12 +5,26 @@ public enum TypeFamily { UNKNOWN, BOOLEAN, - INTEGER, - FLOAT, - LONG, - DOUBLE, + INTEGER(true), + FLOAT(true), + LONG(true), + DOUBLE(true), OBJECT; + private final boolean numeric; + + TypeFamily() { + this(false); + } + + TypeFamily(boolean numeric) { + this.numeric = numeric; + } + + public boolean isNumeric() { + return numeric; + } + // TODO: document what these mean, and try to remove! Doesn't make sense to have these public boolean isGreater(@NotNull TypeFamily other) { diff --git a/src/org/jetbrains/java/decompiler/struct/gen/VarType.java b/src/org/jetbrains/java/decompiler/struct/gen/VarType.java index 40e9f6a39c..d1eb7f225f 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/VarType.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/VarType.java @@ -423,7 +423,7 @@ public boolean isGeneric() { return false; } - public VarType remap(Map map) { + public @Nullable VarType remap(Map map) { VarType key = arrayDim == 0 ? this : this.resizeArrayDim(0); if (map.containsKey(key)) { VarType ret = map.get(key); diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java index ae2a3dd908..06f24f94d5 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java @@ -2,8 +2,12 @@ package org.jetbrains.java.decompiler.struct.gen.generics; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; import org.jetbrains.java.decompiler.struct.gen.VarType; public class GenericClassDescriptor { @@ -17,4 +21,40 @@ public class GenericClassDescriptor { public final List fparameters = new ArrayList<>(); public final List> fbounds = new ArrayList<>(); + + private GenericsChecker checker; + + public GenericsChecker getChecker() { + if (checker == null) { + checker = new GenericsChecker(fparameters, fbounds); + } + + return checker; + } + + public void verifyTypes(VarType actualSuperclass, List actualSuperInterfaces) { + GenericsChecker checker = getChecker(); + + if (superclass != null) { + if (!checker.isProperlyBounded(actualSuperclass, superclass)) { + DecompilerContext.getLogger().writeMessage("Mismatched superclass signature, expected: " + actualSuperclass + ", actual: " + superclass.value, IFernflowerLogger.Severity.WARN); + superclass = actualSuperclass; + } + } + + for (int i = 0; i < superinterfaces.size(); i++) { + VarType actualSuperInterface = i < actualSuperInterfaces.size() ? actualSuperInterfaces.get(i) : null; + VarType superInterface = superinterfaces.get(i); + + if (actualSuperInterface == null) { + DecompilerContext.getLogger().writeMessage("Actual superinterface count is less than expected", IFernflowerLogger.Severity.WARN); + break; + } + + if (!checker.isProperlyBounded(actualSuperInterface, superInterface)) { + DecompilerContext.getLogger().writeMessage("Mismatched superinterface signature, expected: " + actualSuperInterface + ", actual: " + superInterface.value, IFernflowerLogger.Severity.WARN); + superinterfaces.set(i, actualSuperInterface); + } + } + } } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericFieldDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericFieldDescriptor.java index 2b0fdf1dad..d53a23e6d5 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericFieldDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericFieldDescriptor.java @@ -1,12 +1,45 @@ // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.struct.gen.generics; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; +import org.jetbrains.java.decompiler.struct.gen.CodeType; import org.jetbrains.java.decompiler.struct.gen.VarType; public class GenericFieldDescriptor { - public final VarType type; + public VarType type; public GenericFieldDescriptor(VarType type) { this.type = type; } + + public void verifyType(GenericClassDescriptor containingClassGenerics, VarType realType) { + if (containingClassGenerics == null) { + DecompilerContext.getLogger().writeMessage("Class generics were not found, verifying type loosely", IFernflowerLogger.Severity.INFO); + verifyLoosely(realType); + return; + } + + GenericsChecker checker = containingClassGenerics.getChecker(); + + if (!checker.isProperlyBounded(type, realType)) { + DecompilerContext.getLogger().writeMessage("Mismatched field signature, expected: " + realType.value + ", actual: " + type.value, IFernflowerLogger.Severity.WARN); + type = realType; + } + } + + //FIXME this is necessary because some places don't have other signature information, + // which prevents the ability to check class- or method-provided generic types + public void verifyLoosely(VarType actualType) { + if (actualType.isSuperset(type)) { + return; + } + + if (type.type == CodeType.GENVAR) { + return; // Impossible to verify + } + + DecompilerContext.getLogger().writeMessage("Mismatched field signature, expected: " + type.value + ", actual: " + actualType.value, IFernflowerLogger.Severity.WARN); + type = actualType; + } } \ No newline at end of file diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java index a93d250e24..2382252889 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java @@ -4,13 +4,15 @@ import java.util.Collections; import java.util.List; +import org.jetbrains.java.decompiler.main.DecompilerContext; +import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; import org.jetbrains.java.decompiler.struct.gen.VarType; public class GenericMethodDescriptor { public final List typeParameters; public final List> typeParameterBounds; public final List parameterTypes; - public final VarType returnType; + public VarType returnType; public final List exceptionTypes; public GenericMethodDescriptor(List typeParameters, @@ -28,4 +30,31 @@ public GenericMethodDescriptor(List typeParameters, private static List substitute(List list) { return list.isEmpty() ? Collections.emptyList() : list; } + + public void verifyTypes(GenericsChecker checker, List realParamTypes, VarType realReturnType, List realExceptionTypes) { + checker = checker == null ? new GenericsChecker(typeParameters, typeParameterBounds) : checker.copy(typeParameters, typeParameterBounds); + + for (int i = 0; i < parameterTypes.size(); i++) { + VarType parameterType = parameterTypes.get(i); + VarType realType = realParamTypes.get(i); + + if (!checker.isProperlyBounded(parameterType, realType)) { + DecompilerContext.getLogger().writeMessage("Mismatched method parameter signature, expected: " + realType.value + ", actual: " + parameterType.value, IFernflowerLogger.Severity.WARN); + parameterTypes.set(i, realType); + } + } + + if (!checker.isProperlyBounded(returnType, realReturnType)) { + DecompilerContext.getLogger().writeMessage("Mismatched method return signature, expected: " + realReturnType.value + ", actual: " + returnType.value, IFernflowerLogger.Severity.WARN); + returnType = realReturnType; + } + + for (int i = 0; i < exceptionTypes.size(); i++) { + VarType exceptionType = exceptionTypes.get(i); + VarType realType = realExceptionTypes.get(i); + if (!checker.isProperlyBounded(exceptionType, realType)) { + DecompilerContext.getLogger().writeMessage("Mismatched method exception signature, expected: " + realType.value + ", actual: " + exceptionType.value, IFernflowerLogger.Severity.WARN); + } + } + } } \ No newline at end of file diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericsChecker.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericsChecker.java new file mode 100644 index 0000000000..d6df6ac31e --- /dev/null +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericsChecker.java @@ -0,0 +1,70 @@ +package org.jetbrains.java.decompiler.struct.gen.generics; + +import org.jetbrains.java.decompiler.struct.gen.CodeType; +import org.jetbrains.java.decompiler.struct.gen.VarType; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GenericsChecker { + private final Map> boundsMap; + + public GenericsChecker() { + boundsMap = Map.of(); + } + + public GenericsChecker(List typeVariables, List> bounds) { + boundsMap = new HashMap<>(typeVariables.size(), 1); + for (int i = 0; i < typeVariables.size(); i++) { + boundsMap.put(typeVariables.get(i), bounds.get(i)); + } + } + + private GenericsChecker(Map> boundsMap) { + this.boundsMap = boundsMap; + } + + public GenericsChecker copy(List typeVariables, List> bounds) { + HashMap> newBounds = new HashMap<>(boundsMap); + for (int i = 0; i < typeVariables.size(); i++) { + newBounds.put(typeVariables.get(i), bounds.get(i)); + } + + return new GenericsChecker(newBounds); + } + + public GenericsChecker copy(GenericsChecker parent) { + HashMap> newBoundsMap = new HashMap<>(this.boundsMap); + for (Map.Entry> entry : parent.boundsMap.entrySet()) { + if (!newBoundsMap.containsKey(entry.getKey())) { + newBoundsMap.put(entry.getKey(), new ArrayList<>(entry.getValue())); + } + } + + return new GenericsChecker(newBoundsMap); + } + + public boolean isProperlyBounded(VarType type, VarType bound) { + if (type.isSuperset(bound)) { + return true; + } + + // Get base type if array + bound = bound.resizeArrayDim(0); + + if (type.type == CodeType.GENVAR && type instanceof GenericType genericType) { + List typeBounds = boundsMap.get(genericType.value); + if (typeBounds != null) { + for (VarType typeBound : typeBounds) { + if (isProperlyBounded(typeBound, bound)) { + return true; + } + } + } + } + + return false; + } +} diff --git a/src/org/jetbrains/java/decompiler/util/TextBuffer.java b/src/org/jetbrains/java/decompiler/util/TextBuffer.java index 7fe20cd28a..7861d753a4 100644 --- a/src/org/jetbrains/java/decompiler/util/TextBuffer.java +++ b/src/org/jetbrains/java/decompiler/util/TextBuffer.java @@ -433,10 +433,13 @@ private void reformatGroup(NewlineGroup group, List offsetMapping, int // add extra indent after newlines if (pos + offset + myLineSeparator.length() < myStringBuilder.length() && myStringBuilder.substring(pos + offset, pos + offset + myLineSeparator.length()).equals(myLineSeparator)) { - for (int i = 0; i < extraIndent; i++) { - myStringBuilder.insert(pos + offset + myLineSeparator.length(), myIndent); + // not for blank lines + if (!(pos + offset + myLineSeparator.length() * 2 < myStringBuilder.length()) || !myStringBuilder.substring(pos + offset + myLineSeparator.length(), pos + offset + myLineSeparator.length() * 2).equals(myLineSeparator)) { + for (int i = 0; i < extraIndent; i++) { + myStringBuilder.insert(pos + offset + myLineSeparator.length(), myIndent); + } + offset += myIndent.length() * extraIndent; } - offset += myIndent.length() * extraIndent; } // do multiple passes in an inner loop, as there could be arbitrarily many with the same offset diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index a81d6cec22..3123b040fa 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -173,11 +173,10 @@ private void registerDefault() { register(JAVA_8, "TestConstants"); register(JAVA_8, "TestEnum"); register(JAVA_8, "TestDebugSymbols"); - registerRaw(CUSTOM, "InvalidMethodSignature"); + registerRaw(CUSTOM, "InvalidMethodSignature").setExpectedFileName("i.java"); register(JAVA_8, "TestAnonymousClassConstructor"); register(JAVA_8, "TestInnerClassConstructor"); register(CUSTOM, "v11/TestInnerClassConstructor"); - // [minor] todo: the linenumbers are incorrect on the finally block register(JAVA_8, "TestTryCatchFinally"); register(JAVA_8, "TestTryFinally"); register(JAVA_8, "TestAmbiguousCall"); @@ -253,7 +252,6 @@ private void registerDefault() { register(JAVA_16, "TestRecordAnno"); register(JAVA_16, "TestRecordBig"); register(JAVA_16, "TestRecordGenericSuperclass"); - // TODO: The (double) in front of the (int) should be removed register(JAVA_8, "TestMultiCast"); // TODO: some tests don't have proper if else chains register(JAVA_8, "TestComplexIfElseChain"); @@ -325,6 +323,7 @@ private void registerDefault() { register(JAVA_8, "TestLongMethodDeclaration"); register(JAVA_8, "TestLongMethodInvocation"); register(JAVA_8, "TestBinaryOperationWrapping"); + register(JAVA_8, "TestBlankLinesSpaces"); register(JAVA_8, "TestLoopBreak"); register(JAVA_8, "TestLoopBreak2"); register(JAVA_8, "TestSimpleWhile"); @@ -384,11 +383,13 @@ private void registerDefault() { register(JAVA_16, "TestInlineSwitchExpression4"); register(JAVA_16, "TestInlineSwitchExpression5"); register(JAVA_16, "TestInlineSwitchExpression6"); + register(JAVA_16, "TestInlineSwitchExpression7"); register(JAVA_16, "TestReturnSwitchExpression1"); register(JAVA_16, "TestReturnSwitchExpression2"); register(JAVA_16, "TestReturnSwitchExpression3"); register(JAVA_16, "TestReturnSwitchExpression4"); + register(JAVA_16, "TestReturnSwitchExpression5"); register(JAVA_16, "TestSwitchExprString1"); register(JAVA_16, "TestConstructorSwitchExpression1"); @@ -413,6 +414,7 @@ private void registerDefault() { register(JAVA_16_PREVIEW, "PermittedSubClassE", "TestSealedInterfaces"); register(JAVA_8_NODEBUG, "TestDuplicateLocals"); + register(CUSTOM, "TestConflictingLvtNamer"); // Generated by compiling, stripping LVT, and then remapping with tiny-remapper register(JAVA_8, "TestMethodHandles"); register(JAVA_9, "TestVarHandles"); @@ -466,13 +468,6 @@ private void registerDefault() { register(JAVA_17_PREVIEW, "TestSwitchPatternMatchingFuzz1"); - // TODO: non-resugared record patterns reference hidden proxy methods - register(JAVA_19_PREVIEW, "TestRecordPattern1"); - register(JAVA_19_PREVIEW, "TestRecordPattern2"); - register(JAVA_19_PREVIEW, "TestRecordPattern3"); - // TODO: incorrect use of reassigned variable `var21` in `test2` - register(JAVA_19_PREVIEW, "TestRecordPattern4"); - register(JASM, "TestCondy"); register(JASM, "TestBackwardsExceptionHandler"); register(JASM, "TestLeakyMethod"); @@ -522,8 +517,8 @@ private void registerDefault() { register(JAVA_8, "TestOverrideIndirect"); // INN resugaring is now in a separate plugin, so this produces intentionally "bad" output registerRaw(CUSTOM, "TestIdeaNotNull"); - // TODO: Synchronized blocks don't work properly registerRaw(CUSTOM, "TestHotjava"); + registerRaw(CUSTOM, "TestJava1Synchronized"); register(JAVA_8, "TestLabeledBreaks"); // TODO: test9&10- for loop not created, loop extractor needs another pass register(JAVA_8, "TestSwitchLoop"); @@ -607,6 +602,7 @@ private void registerDefault() { register(JAVA_8, "TestNestedArrayPP"); // TODO: variable stores completely ignored due to variable merging // now is fixed by verify variable merges + // seems also is a bug in stack vars processing, disable main loop stackvars to replicate register(JAVA_8_NODEBUG, "TestCompoundAssignmentReplace"); register(JAVA_8, "TestSharedVarIndex"); @@ -619,7 +615,7 @@ private void registerDefault() { // TODO: order of additions is wrong. Addition over floats isn't associative. // Derived from IDEA-291735 register(JAVA_8, "TestFloatOrderOfOperations"); - // TODO: many unnecessary casts, and not simplifying to `+=` + // TODO: not simplifying to `+=` register(JAVA_8, "TestMixedCompoundAssignment"); register(JAVA_8, "TestForeachVardef"); register(JAVA_8, "TestGenericStaticCall"); @@ -633,7 +629,6 @@ private void registerDefault() { register(JAVA_8, "TestTryCatchNested"); register(JAVA_8, "TestSwitchTernary"); register(JAVA_8, "TestBooleanExpressions"); - // TODO: cast not created, incorrect register(JAVA_8, "TestObjectBitwise"); register(JAVA_17, "TestSealedFinal", "SealedInterface"); register(JAVA_17, "TestSealedRecord", "SealedInterface"); @@ -676,6 +671,7 @@ private void registerDefault() { // TODO: switch (s) decompiled as switch (s.hashCode()) register(JAVA_17, "TestSingleCaseStrSwitch"); register(JAVA_16, "TestIfPatternMatchMethod"); + register(JAVA_16, "TestPatternMatchingInvoke"); // TODO: Param type information is lost for lambdas where a more specific type is not required by the context register(JAVA_8, "TestLambdaParamTypes"); register(JAVA_8, "TestGenericComparison"); @@ -686,16 +682,36 @@ private void registerDefault() { register(JAVA_8, "TestWhileForeach"); register(JAVA_21, "TestRecordPatterns1"); register(JAVA_21, "TestRecordPatterns2"); + register(JAVA_21, "TestRecordPatterns3"); + register(JAVA_21, "TestRecordPatterns4"); + register(JAVA_21, "TestRecordPatterns5"); + register(JAVA_21, "TestRecordPatterns6"); + register(JAVA_21, "TestRecordPatterns7"); register(JAVA_21_PREVIEW, "TestStrProcessor"); register(JAVA_21_PREVIEW, "TestRawProcessor"); register(JAVA_21_PREVIEW, "TestFmtProcessor"); register(JAVA_21_PREVIEW, "TestCustomProcessor"); register(JAVA_16, "TestMissingLambdaBody"); register(JAVA_21_PREVIEW, "TestUnnamedVar1"); + register(JAVA_8, "TestNumberCasts"); + // TODO: Disambiguate only the required parameters + register(JAVA_8, "TestNumberDisambiguation"); register(JAVA_8, "TestDanglingBoxingCall"); - register(JAVA_21, "TestSwitchOnEnumJ21"); + register(JAVA_21, "TestSwitchOnEnumJ21", "ext/TestEnum2"); + // Test switch-on-enum decompilation when enum does not exist in the classpath + registerRaw(CUSTOM, "TestSwitchOnEnumWithoutEnumJ21"); + register(JAVA_21, "TestSwitchSimpleMultiLine"); register(JAVA_21, "TestInnerClassesJ21"); + register(JAVA_21, "TestInnerClasses2J21"); + register(JAVA_21, "TestInnerClasses3J21"); + register(JAVA_21, "TestInnerClasses4J21"); register(JAVA_8, "TestInnerClassesJ8"); + register(JAVA_8, "TestSwitchInTry"); + register(JAVA_21, "TestSwitchPatternMatchingJ21"); + register(JAVA_21, "TestCastIntersectionJ21"); + register(JAVA_16, "TestRecordLocal"); + register(JAVA_8, "TestAnonymousClassToLambda"); + registerRaw(CUSTOM, "TestCorruptedSignatures").setExpectedFileName("Signatures.java"); } private void registerEntireClassPath() { @@ -788,6 +804,7 @@ private void registerJavaRuntime() { register(JAVA_8, "TestInstanceGeneric"); // TODO: wrong cast in lambda for array register(JAVA_8, "TestArrayGenerics"); + register(JAVA_8, "TestEmptyLambda"); } private void registerLiterals() { diff --git a/testData/classes/custom/TestCorruptedSignatures.class b/testData/classes/custom/TestCorruptedSignatures.class new file mode 100644 index 0000000000..49993f8b54 Binary files /dev/null and b/testData/classes/custom/TestCorruptedSignatures.class differ diff --git a/testData/classes/custom/TestJava1Synchronized.class b/testData/classes/custom/TestJava1Synchronized.class new file mode 100644 index 0000000000..ed780b5843 Binary files /dev/null and b/testData/classes/custom/TestJava1Synchronized.class differ diff --git a/testData/classes/custom/TestSwitchOnEnumWithoutEnumJ21.class b/testData/classes/custom/TestSwitchOnEnumWithoutEnumJ21.class new file mode 100644 index 0000000000..85fe0906c1 Binary files /dev/null and b/testData/classes/custom/TestSwitchOnEnumWithoutEnumJ21.class differ diff --git a/testData/classes/custom/pkg/TestConflictingLvtNamer$1.class b/testData/classes/custom/pkg/TestConflictingLvtNamer$1.class new file mode 100644 index 0000000000..f82d324462 Binary files /dev/null and b/testData/classes/custom/pkg/TestConflictingLvtNamer$1.class differ diff --git a/testData/classes/custom/pkg/TestConflictingLvtNamer$Position.class b/testData/classes/custom/pkg/TestConflictingLvtNamer$Position.class new file mode 100644 index 0000000000..d75e93b086 Binary files /dev/null and b/testData/classes/custom/pkg/TestConflictingLvtNamer$Position.class differ diff --git a/testData/classes/custom/pkg/TestConflictingLvtNamer.class b/testData/classes/custom/pkg/TestConflictingLvtNamer.class new file mode 100644 index 0000000000..b350e90b6e Binary files /dev/null and b/testData/classes/custom/pkg/TestConflictingLvtNamer.class differ diff --git a/testData/classes/custom/source/TestJava1Synchronized.java b/testData/classes/custom/source/TestJava1Synchronized.java new file mode 100644 index 0000000000..5a5e57319b --- /dev/null +++ b/testData/classes/custom/source/TestJava1Synchronized.java @@ -0,0 +1,43 @@ +public class TestJava1Synchronized { + public void test1(int in) { + synchronized (this) { + if (in == 0) { + System.out.println("0"); + return; + } + + System.out.println("1"); + } + + System.out.println("2"); + } + + public void test2(int in) { + synchronized (this) { + for (int i = 0; i < in; i++) { + System.out.println("hello"); + } + } + } + + public void test3() { + try { + synchronized (this) { + System.out.println("hello"); + } + } finally { + System.out.println("finally"); + } + } + + public void test4() { + try { + System.out.println("try"); + } finally { + synchronized (this) { + System.out.println("hello"); + } + } + } + +} \ No newline at end of file diff --git a/testData/results/Java14Test.dec b/testData/results/Java14Test.dec index 99166b33a2..50d88dbf95 100644 --- a/testData/results/Java14Test.dec +++ b/testData/results/Java14Test.dec @@ -24,6 +24,8 @@ class 'cfrtest/Java14Test' { method ' ()V' { 4 6 8 6 + 9 6 + a 6 1a 6 1b 6 1c 6 @@ -39,6 +41,8 @@ class 'cfrtest/Java14Test' { method 'instance ()Lcfrtest/Java14Test;' { 3 14 + 4 14 + 5 14 15 14 16 14 17 14 @@ -47,6 +51,8 @@ class 'cfrtest/Java14Test' { method 'getAClass ()Ljava/lang/Class;' { 3 18 + 4 18 + 5 18 15 18 } } diff --git a/testData/results/JsHurt.dec b/testData/results/JsHurt.dec index 22ddc4d92f..817cb39df0 100644 --- a/testData/results/JsHurt.dec +++ b/testData/results/JsHurt.dec @@ -18,6 +18,11 @@ class 'JsHurt' { 0 2 1 2 5 10 + 6 10 + 7 10 + 8 10 + 9 10 + a 10 c 5 d 5 e 5 @@ -29,6 +34,8 @@ class 'JsHurt' { 14 6 15 6 16 6 + 17 6 + 18 6 1c 7 } } diff --git a/testData/results/TestCorruptedSignatures.dec b/testData/results/TestCorruptedSignatures.dec new file mode 100644 index 0000000000..30e14cb5ec --- /dev/null +++ b/testData/results/TestCorruptedSignatures.dec @@ -0,0 +1,18 @@ +import java.util.ArrayList; +import java.util.List; + +abstract class Signatures implements List { + List field = new ArrayList(); + + void method(List o) { + }// 9 +} + +class 'Signatures' { + method 'method (Ljava/util/List;)V' { + 0 7 + } +} + +Lines mapping: +9 <-> 8 diff --git a/testData/results/TestEclipseSwitchEnum.dec b/testData/results/TestEclipseSwitchEnum.dec index 224b509cad..48a153af43 100644 --- a/testData/results/TestEclipseSwitchEnum.dec +++ b/testData/results/TestEclipseSwitchEnum.dec @@ -24,6 +24,33 @@ class 'pkg/TestEclipseSwitchEnum' { 3 8 7 8 8 8 + 9 8 + a 8 + b 8 + c 8 + d 8 + e 8 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 24 10 25 10 26 10 @@ -48,6 +75,8 @@ class 'pkg/TestEclipseSwitchEnum' { 3d 16 3e 16 3f 16 + 40 16 + 41 16 42 18 } } diff --git a/testData/results/TestEclipseSwitchString.dec b/testData/results/TestEclipseSwitchString.dec index b16693585d..6bd76e054b 100644 --- a/testData/results/TestEclipseSwitchString.dec +++ b/testData/results/TestEclipseSwitchString.dec @@ -132,6 +132,31 @@ class 'pkg/TestEclipseSwitchString' { 4 4 5 4 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 20 6 21 6 22 6 @@ -139,6 +164,8 @@ class 'pkg/TestEclipseSwitchString' { 24 6 25 6 26 6 + 27 6 + 28 6 2c 11 2d 11 2e 11 @@ -146,6 +173,8 @@ class 'pkg/TestEclipseSwitchString' { 30 11 31 11 32 11 + 33 11 + 34 11 35 16 36 16 37 16 @@ -155,8 +184,6 @@ class 'pkg/TestEclipseSwitchString' { 3b 16 3c 16 3d 17 - 3e 17 - 3f 17 40 7 41 7 42 12 @@ -170,6 +197,39 @@ class 'pkg/TestEclipseSwitchString' { 4 22 5 22 6 22 + 7 22 + 8 22 + 9 22 + a 22 + b 22 + c 22 + d 22 + e 22 + f 22 + 10 22 + 11 22 + 12 22 + 13 22 + 14 22 + 15 22 + 16 22 + 17 22 + 18 22 + 19 22 + 1a 22 + 1b 22 + 1c 22 + 1d 22 + 1e 22 + 1f 22 + 20 22 + 21 22 + 22 22 + 23 22 + 24 22 + 25 22 + 26 22 + 27 22 28 24 29 24 2a 24 @@ -177,6 +237,8 @@ class 'pkg/TestEclipseSwitchString' { 2c 24 2d 24 2e 24 + 2f 24 + 30 24 34 29 35 29 36 29 @@ -184,6 +246,8 @@ class 'pkg/TestEclipseSwitchString' { 38 29 39 29 3a 29 + 3b 29 + 3c 29 40 34 41 34 42 34 @@ -191,6 +255,8 @@ class 'pkg/TestEclipseSwitchString' { 44 34 45 34 46 34 + 47 34 + 48 34 49 45 4a 45 4b 45 @@ -200,8 +266,6 @@ class 'pkg/TestEclipseSwitchString' { 4f 45 50 45 51 46 - 52 46 - 53 46 54 25 55 25 56 42 @@ -215,6 +279,39 @@ class 'pkg/TestEclipseSwitchString' { 4 51 5 51 6 51 + 7 51 + 8 51 + 9 51 + a 51 + b 51 + c 51 + d 51 + e 51 + f 51 + 10 51 + 11 51 + 12 51 + 13 51 + 14 51 + 15 51 + 16 51 + 17 51 + 18 51 + 19 51 + 1a 51 + 1b 51 + 1c 51 + 1d 51 + 1e 51 + 1f 51 + 20 51 + 21 51 + 22 51 + 23 51 + 24 51 + 25 51 + 26 51 + 27 51 28 53 29 53 2a 53 @@ -222,6 +319,8 @@ class 'pkg/TestEclipseSwitchString' { 2c 53 2d 53 2e 53 + 2f 53 + 30 53 34 60 35 60 36 60 @@ -229,6 +328,8 @@ class 'pkg/TestEclipseSwitchString' { 38 60 39 60 3a 60 + 3b 60 + 3c 60 40 65 41 65 42 65 @@ -236,6 +337,8 @@ class 'pkg/TestEclipseSwitchString' { 44 65 45 65 46 65 + 47 65 + 48 65 49 76 4a 76 4b 76 @@ -245,16 +348,14 @@ class 'pkg/TestEclipseSwitchString' { 4f 76 50 76 51 77 - 52 77 - 53 77 54 57 55 57 56 57 57 57 58 57 59 57 - 5a 77 - 5b 77 + 5a 57 + 5b 57 5c 73 5d 73 5e 77 @@ -266,6 +367,23 @@ class 'pkg/TestEclipseSwitchString' { 4 81 5 81 6 81 + 7 81 + 8 81 + 9 81 + a 81 + b 81 + c 81 + d 81 + e 81 + f 81 + 10 81 + 11 81 + 12 81 + 13 81 + 14 81 + 15 81 + 16 81 + 17 81 18 83 19 83 1a 83 @@ -273,6 +391,8 @@ class 'pkg/TestEclipseSwitchString' { 1c 83 1d 83 1e 83 + 1f 83 + 20 83 21 85 22 85 23 85 @@ -280,6 +400,8 @@ class 'pkg/TestEclipseSwitchString' { 25 85 26 85 27 85 + 28 85 + 29 85 2a 89 2b 89 2c 89 @@ -289,8 +411,6 @@ class 'pkg/TestEclipseSwitchString' { 30 89 31 89 32 90 - 33 90 - 34 90 35 84 36 84 37 86 @@ -304,6 +424,23 @@ class 'pkg/TestEclipseSwitchString' { 4 95 5 95 6 95 + 7 95 + 8 95 + 9 95 + a 95 + b 95 + c 95 + d 95 + e 95 + f 95 + 10 95 + 11 95 + 12 95 + 13 95 + 14 95 + 15 95 + 16 95 + 17 95 18 97 19 97 1a 97 @@ -311,6 +448,8 @@ class 'pkg/TestEclipseSwitchString' { 1c 97 1d 97 1e 97 + 1f 97 + 20 97 21 97 22 97 23 97 @@ -318,6 +457,8 @@ class 'pkg/TestEclipseSwitchString' { 25 97 26 97 27 97 + 28 97 + 29 97 2a 102 2b 102 2c 102 @@ -327,8 +468,6 @@ class 'pkg/TestEclipseSwitchString' { 30 102 31 102 32 103 - 33 103 - 34 103 35 98 36 98 37 103 @@ -340,6 +479,23 @@ class 'pkg/TestEclipseSwitchString' { 4 107 5 107 6 107 + 7 107 + 8 107 + 9 107 + a 107 + b 107 + c 107 + d 107 + e 107 + f 107 + 10 107 + 11 107 + 12 107 + 13 107 + 14 107 + 15 107 + 16 107 + 17 107 18 110 19 110 1a 110 @@ -347,6 +503,8 @@ class 'pkg/TestEclipseSwitchString' { 1c 110 1d 110 1e 110 + 1f 110 + 20 110 21 111 22 111 23 111 @@ -354,6 +512,8 @@ class 'pkg/TestEclipseSwitchString' { 25 111 26 111 27 111 + 28 111 + 29 111 2a 122 2b 122 2c 122 @@ -363,16 +523,14 @@ class 'pkg/TestEclipseSwitchString' { 30 122 31 122 32 123 - 33 123 - 34 123 35 115 36 115 37 115 38 115 39 115 3a 115 - 3b 123 - 3c 123 + 3b 115 + 3c 115 3d 118 3e 118 3f 123 diff --git a/testData/results/TestHotjava.dec b/testData/results/TestHotjava.dec index 46da14e491..1b7bdef6c9 100644 --- a/testData/results/TestHotjava.dec +++ b/testData/results/TestHotjava.dec @@ -11,53 +11,26 @@ public class TestHotjava { } } - // $VF: Could not inline inconsistent finally blocks - // $VF: Could not create synchronized statement, marking monitor enters and exits public void testMonitor1() { - synchronized (this){} // $VF: monitorenter // 15 - - try { + synchronized (this) {// 15 System.out.println("Synchronized");// 16 - } catch (Throwable var3) { - // $VF: monitorexit - throw var3; } - - // $VF: monitorexit } - // $VF: Could not inline inconsistent finally blocks - // $VF: Could not create synchronized statement, marking monitor enters and exits public void testMonitor2(Object var1) { - synchronized (var1){} // $VF: monitorenter // 21 - - try { + synchronized (var1) {// 21 System.out.println("Synchronized");// 22 - } catch (Throwable var4) { - // $VF: monitorexit - throw var4; } - - // $VF: monitorexit } - // $VF: Could not inline inconsistent finally blocks - // $VF: Could not create synchronized statement, marking monitor enters and exits public void testMonitor3() { - synchronized (this){} // $VF: monitorenter // 27 - - try { + synchronized (this) {// 27 try { System.out.println("Try");// 28 29 } finally { System.out.println("Jsr");// 31 } - } catch (Throwable var10) { - // $VF: monitorexit - throw var10; } - - // $VF: monitorexit } } @@ -81,11 +54,11 @@ class 'TestHotjava' { 3 7 4 7 5 7 + 6 7 + 7 7 d 9 e 9 f 9 - 10 9 - 11 9 12 9 13 9 14 9 @@ -94,61 +67,56 @@ class 'TestHotjava' { } method 'testMonitor1 ()V' { - 0 16 - 2 16 - 3 16 - 4 19 - 5 19 - 6 19 - 7 19 - 8 19 - 9 19 - d 25 - e 26 - 10 21 - 11 22 + 0 14 + 2 14 + 3 14 + 4 15 + 5 15 + 6 15 + 7 15 + 8 15 + 9 15 + a 15 + b 15 + e 17 } method 'testMonitor2 (Ljava/lang/Object;)V' { - 0 31 - 2 31 - 3 31 - 4 34 - 5 34 - 6 34 - 7 34 - 8 34 - 9 34 - d 40 - e 41 - 10 36 - 11 37 + 0 20 + 2 20 + 3 20 + 4 21 + 5 21 + 6 21 + 7 21 + 8 21 + 9 21 + a 21 + b 21 + e 23 } method 'testMonitor3 ()V' { - 0 46 - 2 46 - 3 46 - 4 50 - 5 50 - 6 50 - 7 50 - 8 50 - 9 50 - 13 52 - 14 52 - 15 52 - 16 52 - 17 52 - 18 52 - 19 52 - 1a 52 - 1b 52 - 1c 52 - 25 59 - 26 60 - 28 55 - 29 56 + 0 26 + 2 26 + 3 26 + 4 28 + 5 28 + 6 28 + 7 28 + 8 28 + 9 28 + a 28 + b 28 + 13 30 + 14 30 + 15 30 + 18 30 + 19 30 + 1a 30 + 1b 30 + 1c 30 + 26 33 } } @@ -158,11 +126,11 @@ Lines mapping: 7 <-> 8 8 <-> 8 10 <-> 10 -15 <-> 17 -16 <-> 20 -21 <-> 32 -22 <-> 35 -27 <-> 47 -28 <-> 51 -29 <-> 51 -31 <-> 53 +15 <-> 15 +16 <-> 16 +21 <-> 21 +22 <-> 22 +27 <-> 27 +28 <-> 29 +29 <-> 29 +31 <-> 31 \ No newline at end of file diff --git a/testData/results/TestIdeaNotNull.dec b/testData/results/TestIdeaNotNull.dec index 10a8919507..1a44a52ed7 100644 --- a/testData/results/TestIdeaNotNull.dec +++ b/testData/results/TestIdeaNotNull.dec @@ -120,16 +120,24 @@ class 'pkg/TestIdeaNotNull' { f 9 10 10 11 10 + 12 10 + 13 10 14 11 16 11 + 17 11 + 18 11 19 12 1a 12 + 1b 12 + 1c 12 1d 15 1e 17 1f 17 20 17 21 17 22 17 + 23 17 + 24 17 2c 18 30 18 34 18 @@ -141,16 +149,24 @@ class 'pkg/TestIdeaNotNull' { 3a 17 3e 21 40 21 + 41 21 + 42 21 43 22 44 22 + 45 22 + 46 22 47 25 } method 'test1 (Ljava/lang/String;)V' { 0 30 1 30 + 2 30 + 3 30 4 31 5 31 + 6 31 + 7 31 8 34 9 34 a 34 @@ -164,12 +180,20 @@ class 'pkg/TestIdeaNotNull' { method 'test2 (Ljava/lang/String;Ljava/lang/Integer;)V' { 0 38 1 38 + 2 38 + 3 38 4 39 5 39 + 6 39 + 7 39 8 42 9 42 + a 42 + b 42 c 43 d 43 + e 43 + f 43 10 46 11 46 12 46 @@ -190,18 +214,30 @@ class 'pkg/TestIdeaNotNull' { method 'test3 (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Float;)V' { 0 51 1 51 + 2 51 + 3 51 4 52 5 52 + 6 52 + 7 52 8 55 9 55 + a 55 + b 55 c 56 d 56 e 56 + f 56 + 10 56 11 59 12 59 + 13 59 + 14 59 15 60 16 60 17 60 + 18 60 + 19 60 1a 63 1b 63 1c 63 @@ -221,11 +257,15 @@ class 'pkg/TestIdeaNotNull' { 2a 65 2b 65 2c 65 + 2d 65 + 2e 65 2f 66 30 66 31 66 32 66 33 66 + 34 66 + 35 66 36 68 } @@ -244,6 +284,8 @@ class 'pkg/TestIdeaNotNull' { 12 75 13 75 14 75 + 15 75 + 16 75 1e 76 22 76 26 76 @@ -260,9 +302,13 @@ class 'pkg/TestIdeaNotNull' { method 'test5 (Ljava/lang/Integer;)Ljava/lang/String;' { 0 84 1 84 + 2 84 + 3 84 4 85 5 85 6 85 + 7 85 + 8 85 9 88 a 88 b 88 @@ -271,11 +317,17 @@ class 'pkg/TestIdeaNotNull' { e 89 f 89 10 89 + 11 89 + 12 89 13 90 15 90 + 16 90 + 17 90 18 91 19 91 1a 91 + 1b 91 + 1c 91 1d 94 1e 96 1f 96 @@ -285,6 +337,8 @@ class 'pkg/TestIdeaNotNull' { 23 96 24 96 25 96 + 26 96 + 27 96 2f 97 33 97 37 97 @@ -296,9 +350,13 @@ class 'pkg/TestIdeaNotNull' { 3d 96 41 100 43 100 + 44 100 + 45 100 46 101 47 101 48 101 + 49 101 + 4a 101 4b 104 } } diff --git a/testData/results/TestJava1Synchronized.dec b/testData/results/TestJava1Synchronized.dec new file mode 100644 index 0000000000..03f73b1c1d --- /dev/null +++ b/testData/results/TestJava1Synchronized.dec @@ -0,0 +1,173 @@ +public class TestJava1Synchronized { + public void test1(int var1) { + synchronized (this) {// 3 + if (var1 == 0) {// 4 + System.out.println("0");// 5 + return; + } + + System.out.println("1");// 9 + } + + System.out.println("2");// 12 + } + + public void test2(int var1) { + synchronized (this) {// 16 + for (int var4 = 0; var4 < var1; var4++) {// 17 + System.out.println("hello");// 18 + } + } + } + + public void test3() { + try { + synchronized (this) {// 24 25 + System.out.println("hello");// 26 + } + } finally { + System.out.println("finally");// 29 + } + } + + public void test4() { + try { + System.out.println("try");// 34 35 + } finally { + synchronized (this) {// 37 + System.out.println("hello");// 38 + } + } + } +} + +class 'TestJava1Synchronized' { + method 'test1 (I)V' { + 0 2 + 2 2 + 3 2 + 4 3 + 5 3 + 6 3 + 7 3 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1e 11 + 1f 11 + 20 11 + 26 5 + 29 11 + 2a 11 + 2c 11 + 2d 11 + 2e 11 + } + + method 'test2 (I)V' { + 0 15 + 2 15 + 3 15 + 4 16 + 5 16 + 6 16 + a 17 + b 17 + c 17 + d 17 + e 17 + f 17 + 10 17 + 11 17 + 12 16 + 13 16 + 14 16 + 15 16 + 16 16 + 17 16 + 18 16 + 19 16 + 1a 16 + 1d 20 + } + + method 'test3 ()V' { + 0 24 + 2 24 + 3 24 + 4 25 + 5 25 + 6 25 + 7 25 + 8 25 + 9 25 + a 25 + b 25 + 19 28 + 1a 28 + 1b 28 + 1e 28 + 1f 28 + 20 28 + 21 28 + 24 30 + } + + method 'test4 ()V' { + 0 34 + 1 34 + 2 34 + 3 34 + 4 34 + 5 34 + 6 34 + 7 34 + d 36 + 13 36 + 14 36 + 17 37 + 18 37 + 19 37 + 1a 37 + 1b 37 + 1c 37 + 1d 37 + 1e 37 + 20 38 + 21 40 + } +} + +Lines mapping: +3 <-> 3 +4 <-> 4 +5 <-> 5 +9 <-> 9 +12 <-> 12 +16 <-> 16 +17 <-> 17 +18 <-> 18 +24 <-> 25 +25 <-> 25 +26 <-> 26 +29 <-> 29 +34 <-> 35 +35 <-> 35 +37 <-> 37 +38 <-> 38 +Not mapped: +2 +6 diff --git a/testData/results/TestJsr.dec b/testData/results/TestJsr.dec index 048ee69efd..671f9fd4f3 100644 --- a/testData/results/TestJsr.dec +++ b/testData/results/TestJsr.dec @@ -16,11 +16,11 @@ class 'TestJsr' { 3 3 4 3 5 3 + 6 3 + 7 3 d 5 e 5 f 5 - 10 5 - 11 5 12 5 13 5 14 5 diff --git a/testData/results/TestJsr2.dec b/testData/results/TestJsr2.dec index 4d37db61eb..bf8c8e4677 100644 --- a/testData/results/TestJsr2.dec +++ b/testData/results/TestJsr2.dec @@ -50,6 +50,8 @@ class 'TestJsr2' { 3 3 4 3 5 3 + 6 3 + 7 3 c 8 d 8 e 8 @@ -68,6 +70,8 @@ class 'TestJsr2' { 3 14 4 14 5 14 + 6 14 + 7 14 c 19 d 19 e 19 diff --git a/testData/results/TestSwitchOnEnumWithoutEnumJ21.dec b/testData/results/TestSwitchOnEnumWithoutEnumJ21.dec new file mode 100644 index 0000000000..4800e306db --- /dev/null +++ b/testData/results/TestSwitchOnEnumWithoutEnumJ21.dec @@ -0,0 +1,63 @@ +import TestSwitchOnEnumWithoutEnumJ21.TestEnum; + +public class TestSwitchOnEnumWithoutEnumJ21 { + // $VF: Unable to simplify switch-on-enum, as the enum class was not able to be found. + public int test1(TestEnum a) { + return switch (a.ordinal()) {// 3 + case 0 -> 1;// 4 + case 1 -> 2;// 5 + case 2 -> 3;// 6 + default -> throw new MatchException(null, null); + }; + } +} + +class 'TestSwitchOnEnumWithoutEnumJ21' { + method 'test1 (LTestSwitchOnEnumWithoutEnumJ21$TestEnum;)I' { + 0 5 + 1 5 + 2 5 + 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 + 1c 5 + 1d 5 + 1e 5 + 1f 5 + 24 9 + 25 9 + 29 9 + 2a 6 + 2e 7 + 32 8 + 33 5 + } +} + +Lines mapping: +3 <-> 6 +4 <-> 7 +5 <-> 8 +6 <-> 9 \ No newline at end of file diff --git a/testData/results/pkg/TestAccidentalSwitchExpression.dec b/testData/results/pkg/TestAccidentalSwitchExpression.dec index 690e0f167a..ea3fb465b8 100644 --- a/testData/results/pkg/TestAccidentalSwitchExpression.dec +++ b/testData/results/pkg/TestAccidentalSwitchExpression.dec @@ -26,16 +26,44 @@ class 'pkg/TestAccidentalSwitchExpression' { 1 4 2 4 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 8 1d 8 1e 10 1f 10 + 20 10 + 21 10 25 13 26 13 27 13 28 13 29 16 2a 16 + 2b 16 + 2c 16 2d 19 2e 17 2f 17 diff --git a/testData/results/pkg/TestAmbiguousArraylen.dec b/testData/results/pkg/TestAmbiguousArraylen.dec index a0baf63d68..69ff56792d 100644 --- a/testData/results/pkg/TestAmbiguousArraylen.dec +++ b/testData/results/pkg/TestAmbiguousArraylen.dec @@ -26,6 +26,8 @@ class 'pkg/TestAmbiguousArraylen' { 5 7 6 7 7 7 + 8 7 + 9 7 a 8 b 8 c 8 @@ -55,6 +57,8 @@ class 'pkg/TestAmbiguousArraylen' { 28 13 29 13 2a 13 + 2b 13 + 2c 13 2d 13 2e 13 2f 13 @@ -75,6 +79,8 @@ class 'pkg/TestAmbiguousArraylen' { 41 13 42 13 43 13 + 44 13 + 45 13 46 13 47 14 48 14 diff --git a/testData/results/pkg/TestAmbiguousCall.dec b/testData/results/pkg/TestAmbiguousCall.dec index 233d8c90b9..cf4eacf739 100644 --- a/testData/results/pkg/TestAmbiguousCall.dec +++ b/testData/results/pkg/TestAmbiguousCall.dec @@ -116,6 +116,8 @@ class 'pkg/TestAmbiguousCall' { 2 31 3 31 4 31 + 5 31 + 6 31 7 32 8 32 9 32 @@ -133,6 +135,8 @@ class 'pkg/TestAmbiguousCall' { 18 34 19 34 1a 34 + 1b 34 + 1c 34 1d 36 } @@ -142,6 +146,8 @@ class 'pkg/TestAmbiguousCall' { 2 39 3 39 4 39 + 5 39 + 6 39 7 40 8 40 9 40 @@ -159,6 +165,8 @@ class 'pkg/TestAmbiguousCall' { 18 42 19 42 1a 42 + 1b 42 + 1c 42 1d 44 } diff --git a/testData/results/pkg/TestAnonymousClass.dec b/testData/results/pkg/TestAnonymousClass.dec index e601852ee4..df70e506e0 100644 --- a/testData/results/pkg/TestAnonymousClass.dec +++ b/testData/results/pkg/TestAnonymousClass.dec @@ -213,6 +213,8 @@ class 'pkg/TestAnonymousClass' { method 'foo (I)V' { 0 54 1 54 + 2 54 + 3 54 c 55 d 62 e 62 @@ -227,6 +229,8 @@ class 'pkg/TestAnonymousClass' { 1a 65 1b 65 1c 65 + 1d 65 + 1e 65 1f 67 } @@ -416,4 +420,4 @@ Lines mapping: 169 <-> 114 Not mapped: 21 -115 \ No newline at end of file +115 diff --git a/testData/results/pkg/TestAnonymousClassConstructor.dec b/testData/results/pkg/TestAnonymousClassConstructor.dec index dc88098732..6887f54e87 100644 --- a/testData/results/pkg/TestAnonymousClassConstructor.dec +++ b/testData/results/pkg/TestAnonymousClassConstructor.dec @@ -2,63 +2,51 @@ package pkg; class TestAnonymousClassConstructor { void innerPrivateString() { - new TestAnonymousClassConstructor.InnerPrivateString("text") {// 5 - }; + new TestAnonymousClassConstructor.InnerPrivateString("text") {};// 5 }// 6 void innerPrivate() { - new TestAnonymousClassConstructor.InnerPrivate(3L, 4) {// 9 - }; + new TestAnonymousClassConstructor.InnerPrivate(3L, 4) {};// 9 }// 10 void innerStaticPrivateString() { - new TestAnonymousClassConstructor.InnerStaticPrivateString("text") {// 13 - }; + new TestAnonymousClassConstructor.InnerStaticPrivateString("text") {};// 13 }// 14 void innerStaticPrivate() { - new TestAnonymousClassConstructor.InnerStaticPrivate(3L, 4) {// 17 - }; + new TestAnonymousClassConstructor.InnerStaticPrivate(3L, 4) {};// 17 }// 18 static void innerStaticPrivateStringStatic() { - new TestAnonymousClassConstructor.InnerStaticPrivateString("text") {// 21 - }; + new TestAnonymousClassConstructor.InnerStaticPrivateString("text") {};// 21 }// 22 static void innerStaticPrivateStatic() { - new TestAnonymousClassConstructor.InnerStaticPrivate(3L, 4) {// 25 - }; + new TestAnonymousClassConstructor.InnerStaticPrivate(3L, 4) {};// 25 }// 26 void innerPublicString() { - new TestAnonymousClassConstructor.InnerPublicString("text") {// 29 - }; + new TestAnonymousClassConstructor.InnerPublicString("text") {};// 29 }// 30 void innerPublic() { - new TestAnonymousClassConstructor.InnerPublic(3L, 4) {// 33 - }; + new TestAnonymousClassConstructor.InnerPublic(3L, 4) {};// 33 }// 34 void innerStaticPublicString() { - new TestAnonymousClassConstructor.InnerStaticPublicString("text") {// 37 - }; + new TestAnonymousClassConstructor.InnerStaticPublicString("text") {};// 37 }// 38 void innerStaticPublic() { - new TestAnonymousClassConstructor.InnerStaticPublic(3L, 4) {// 41 - }; + new TestAnonymousClassConstructor.InnerStaticPublic(3L, 4) {};// 41 }// 42 static void innerStaticPublicStringStatic() { - new TestAnonymousClassConstructor.InnerStaticPublicString("text") {// 45 - }; + new TestAnonymousClassConstructor.InnerStaticPublicString("text") {};// 45 }// 46 static void innerStaticPublicStatic() { - new TestAnonymousClassConstructor.InnerStaticPublic(3L, 4) {// 49 - }; + new TestAnonymousClassConstructor.InnerStaticPublic(3L, 4) {};// 49 }// 50 static void n(String s) { @@ -118,105 +106,132 @@ class 'pkg/TestAnonymousClassConstructor' { method 'innerPrivateString ()V' { 5 4 6 4 - b 6 + b 5 } method 'innerPrivate ()V' { - 5 9 - 6 9 - 7 9 - 8 9 - d 11 + 5 8 + 6 8 + 7 8 + 8 8 + d 9 } method 'innerStaticPrivateString ()V' { - 5 14 - 6 14 - b 16 + 5 12 + 6 12 + b 13 } method 'innerStaticPrivate ()V' { - 5 19 - 6 19 - 7 19 - 8 19 - d 21 + 5 16 + 6 16 + 7 16 + 8 16 + d 17 } method 'innerStaticPrivateStringStatic ()V' { - 4 24 - 5 24 - a 26 + 4 20 + 5 20 + a 21 } method 'innerStaticPrivateStatic ()V' { - 4 29 - 5 29 - 6 29 - 7 29 - c 31 + 4 24 + 5 24 + 6 24 + 7 24 + c 25 } method 'innerPublicString ()V' { - 5 34 - 6 34 - b 36 + 5 28 + 6 28 + b 29 } method 'innerPublic ()V' { - 5 39 - 6 39 - 7 39 - 8 39 - d 41 + 5 32 + 6 32 + 7 32 + 8 32 + d 33 } method 'innerStaticPublicString ()V' { - 5 44 - 6 44 - b 46 + 5 36 + 6 36 + b 37 } method 'innerStaticPublic ()V' { - 5 49 - 6 49 - 7 49 - 8 49 - d 51 + 5 40 + 6 40 + 7 40 + 8 40 + d 41 } method 'innerStaticPublicStringStatic ()V' { - 4 54 - 5 54 - a 56 + 4 44 + 5 44 + a 45 } method 'innerStaticPublicStatic ()V' { - 4 59 - 5 59 - 6 59 - 7 59 - c 61 + 4 48 + 5 48 + 6 48 + 7 48 + c 49 } method 'n (Ljava/lang/String;)V' { - 0 64 - 1 64 - 2 64 - a 64 - b 64 - f 64 - 13 64 - 14 64 - 15 64 - 16 64 - 17 64 - 18 64 - 19 65 + 0 52 + 1 52 + 2 52 + a 52 + b 52 + f 52 + 13 52 + 14 52 + 15 52 + 16 52 + 17 52 + 18 52 + 19 53 } } class 'pkg/TestAnonymousClassConstructor$InnerPrivate' { + method ' (Lpkg/TestAnonymousClassConstructor;JI)V' { + 10 57 + 14 57 + 15 57 + 19 57 + 1a 57 + 1e 57 + 1f 57 + 20 57 + 21 57 + 22 57 + 23 57 + 24 58 + } +} + +class 'pkg/TestAnonymousClassConstructor$InnerPrivateString' { + method ' (Lpkg/TestAnonymousClassConstructor;Ljava/lang/String;)V' { + 9 63 + a 63 + b 63 + c 63 + d 64 + } +} + +class 'pkg/TestAnonymousClassConstructor$InnerPublic' { method ' (Lpkg/TestAnonymousClassConstructor;JI)V' { 10 69 14 69 @@ -233,7 +248,7 @@ class 'pkg/TestAnonymousClassConstructor$InnerPrivate' { } } -class 'pkg/TestAnonymousClassConstructor$InnerPrivateString' { +class 'pkg/TestAnonymousClassConstructor$InnerPublicString' { method ' (Lpkg/TestAnonymousClassConstructor;Ljava/lang/String;)V' { 9 75 a 75 @@ -243,34 +258,33 @@ class 'pkg/TestAnonymousClassConstructor$InnerPrivateString' { } } -class 'pkg/TestAnonymousClassConstructor$InnerPublic' { - method ' (Lpkg/TestAnonymousClassConstructor;JI)V' { +class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivate' { + method ' (JI)V' { + b 81 + f 81 10 81 14 81 - 15 81 + 18 81 19 81 1a 81 - 1e 81 - 1f 81 - 20 81 - 21 81 - 22 81 - 23 81 - 24 82 + 1b 81 + 1c 81 + 1d 81 + 1e 82 } } -class 'pkg/TestAnonymousClassConstructor$InnerPublicString' { - method ' (Lpkg/TestAnonymousClassConstructor;Ljava/lang/String;)V' { - 9 87 - a 87 - b 87 - c 87 - d 88 +class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivateString' { + method ' (Ljava/lang/String;)V' { + 4 87 + 5 87 + 6 87 + 7 87 + 8 88 } } -class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivate' { +class 'pkg/TestAnonymousClassConstructor$InnerStaticPublic' { method ' (JI)V' { b 93 f 93 @@ -286,7 +300,7 @@ class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivate' { } } -class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivateString' { +class 'pkg/TestAnonymousClassConstructor$InnerStaticPublicString' { method ' (Ljava/lang/String;)V' { 4 99 5 99 @@ -296,75 +310,49 @@ class 'pkg/TestAnonymousClassConstructor$InnerStaticPrivateString' { } } -class 'pkg/TestAnonymousClassConstructor$InnerStaticPublic' { - method ' (JI)V' { - b 105 - f 105 - 10 105 - 14 105 - 18 105 - 19 105 - 1a 105 - 1b 105 - 1c 105 - 1d 105 - 1e 106 - } -} - -class 'pkg/TestAnonymousClassConstructor$InnerStaticPublicString' { - method ' (Ljava/lang/String;)V' { - 4 111 - 5 111 - 6 111 - 7 111 - 8 112 - } -} - Lines mapping: 5 <-> 5 -6 <-> 7 -9 <-> 10 -10 <-> 12 -13 <-> 15 -14 <-> 17 -17 <-> 20 -18 <-> 22 -21 <-> 25 -22 <-> 27 -25 <-> 30 -26 <-> 32 -29 <-> 35 -30 <-> 37 -33 <-> 40 -34 <-> 42 -37 <-> 45 -38 <-> 47 -41 <-> 50 -42 <-> 52 -45 <-> 55 -46 <-> 57 -49 <-> 60 -50 <-> 62 -53 <-> 65 -54 <-> 66 -58 <-> 76 -59 <-> 77 -64 <-> 70 -65 <-> 71 -70 <-> 100 -71 <-> 101 -76 <-> 94 -77 <-> 95 -82 <-> 88 -83 <-> 89 -88 <-> 82 -89 <-> 83 -94 <-> 112 -95 <-> 113 -100 <-> 106 -101 <-> 107 +6 <-> 6 +9 <-> 9 +10 <-> 10 +13 <-> 13 +14 <-> 14 +17 <-> 17 +18 <-> 18 +21 <-> 21 +22 <-> 22 +25 <-> 25 +26 <-> 26 +29 <-> 29 +30 <-> 30 +33 <-> 33 +34 <-> 34 +37 <-> 37 +38 <-> 38 +41 <-> 41 +42 <-> 42 +45 <-> 45 +46 <-> 46 +49 <-> 49 +50 <-> 50 +53 <-> 53 +54 <-> 54 +58 <-> 64 +59 <-> 65 +64 <-> 58 +65 <-> 59 +70 <-> 88 +71 <-> 89 +76 <-> 82 +77 <-> 83 +82 <-> 76 +83 <-> 77 +88 <-> 70 +89 <-> 71 +94 <-> 100 +95 <-> 101 +100 <-> 94 +101 <-> 95 Not mapped: 57 63 diff --git a/testData/results/pkg/TestAnonymousClassNaming.dec b/testData/results/pkg/TestAnonymousClassNaming.dec index f48d256f3e..4f348c7678 100644 --- a/testData/results/pkg/TestAnonymousClassNaming.dec +++ b/testData/results/pkg/TestAnonymousClassNaming.dec @@ -2,8 +2,7 @@ package pkg; public class TestAnonymousClassNaming { public void run(int i, final String s) throws Exception { - new Object() /* TestAnonymousClassNaming$1 */ { - }; + new Object() /* TestAnonymousClassNaming$1 */ {}; if (i < 0) {// 6 throw new Exception() /* TestAnonymousClassNaming$2 */ {// 7 public String getMessage() { @@ -14,33 +13,34 @@ public class TestAnonymousClassNaming { }// 14 private static class InnerClass { - Object o = new Object() /* TestAnonymousClassNaming$InnerClass$1 */ { - }; + Object o = new Object() /* TestAnonymousClassNaming$InnerClass$1 */ {}; } } class 'pkg/TestAnonymousClassNaming' { method 'run (ILjava/lang/String;)V' { - 9 6 - a 6 - 16 7 - 17 13 + 9 5 + a 5 + b 5 + c 5 + 16 6 + 17 12 } } class 'pkg/TestAnonymousClassNaming$2' { method 'getMessage ()Ljava/lang/String;' { - 1 9 - 2 9 - 3 9 - 4 9 + 1 8 + 2 8 + 3 8 + 4 8 } } Lines mapping: -6 <-> 7 -7 <-> 8 -10 <-> 10 -14 <-> 14 +6 <-> 6 +7 <-> 7 +10 <-> 9 +14 <-> 13 Not mapped: 5 diff --git a/testData/results/pkg/TestAnonymousClassToLambda.dec b/testData/results/pkg/TestAnonymousClassToLambda.dec new file mode 100644 index 0000000000..6ed994177e --- /dev/null +++ b/testData/results/pkg/TestAnonymousClassToLambda.dec @@ -0,0 +1,38 @@ +package pkg; + +public class TestAnonymousClassToLambda { + public Object test1(final Object o) { + return new Object() {// 5 + public Runnable getRunnable() { + return () -> System.out.println(o);// 7 + } + }; + } +} + +class 'pkg/TestAnonymousClassToLambda' { + method 'test1 (Ljava/lang/Object;)Ljava/lang/Object;' { + 9 4 + } +} + +class 'pkg/TestAnonymousClassToLambda$1' { + method 'getRunnable ()Ljava/lang/Runnable;' { + 9 6 + } + + method 'lambda$getRunnable$0 (Ljava/lang/Object;)V' { + 0 6 + 1 6 + 2 6 + 3 6 + 4 6 + 5 6 + 6 6 + 7 6 + } +} + +Lines mapping: +5 <-> 5 +7 <-> 7 diff --git a/testData/results/pkg/TestAnonymousParamNames.dec b/testData/results/pkg/TestAnonymousParamNames.dec index 810799c81b..411b154907 100644 --- a/testData/results/pkg/TestAnonymousParamNames.dec +++ b/testData/results/pkg/TestAnonymousParamNames.dec @@ -1,8 +1,7 @@ package pkg; public class TestAnonymousParamNames { - private final TestAnonymousParamNames.Clazz reference = new TestAnonymousParamNames.Clazz(0L, false) { - }; + private final TestAnonymousParamNames.Clazz reference = new TestAnonymousParamNames.Clazz(0L, false) {}; private class Clazz { public Clazz(long paramL, boolean paramB) { @@ -12,11 +11,11 @@ public class TestAnonymousParamNames { class 'pkg/TestAnonymousParamNames$Clazz' { method ' (Lpkg/TestAnonymousParamNames;JZ)V' { - 9 8 + 9 7 } } Lines mapping: -25 <-> 9 +25 <-> 8 Not mapped: 24 diff --git a/testData/results/pkg/TestArrayAssign.dec b/testData/results/pkg/TestArrayAssign.dec index 5598f63c4b..16cc93dbea 100644 --- a/testData/results/pkg/TestArrayAssign.dec +++ b/testData/results/pkg/TestArrayAssign.dec @@ -111,6 +111,8 @@ class 'pkg/TestArrayAssign' { 4 4 5 4 6 4 + 7 4 + 8 4 9 5 a 5 b 5 @@ -144,6 +146,8 @@ class 'pkg/TestArrayAssign' { 4 14 5 14 6 14 + 7 14 + 8 14 9 15 a 15 b 15 @@ -196,6 +200,8 @@ class 'pkg/TestArrayAssign' { 4 29 5 29 6 29 + 7 29 + 8 29 9 30 a 30 b 30 @@ -226,6 +232,8 @@ class 'pkg/TestArrayAssign' { 4 35 5 35 6 35 + 7 35 + 8 35 9 36 a 36 b 36 @@ -250,6 +258,8 @@ class 'pkg/TestArrayAssign' { 4 41 5 41 6 41 + 7 41 + 8 41 9 42 a 42 b 42 @@ -340,6 +350,8 @@ class 'pkg/TestArrayAssign' { 4 59 5 59 6 59 + 7 59 + 8 59 9 60 a 60 b 60 @@ -370,6 +382,8 @@ class 'pkg/TestArrayAssign' { 4 65 5 65 6 65 + 7 65 + 8 65 9 66 a 66 b 66 @@ -394,6 +408,8 @@ class 'pkg/TestArrayAssign' { 4 71 5 71 6 71 + 7 71 + 8 71 9 72 a 72 b 72 diff --git a/testData/results/pkg/TestArrayAssign2.dec b/testData/results/pkg/TestArrayAssign2.dec index 2e28086cb9..7000480094 100644 --- a/testData/results/pkg/TestArrayAssign2.dec +++ b/testData/results/pkg/TestArrayAssign2.dec @@ -26,6 +26,8 @@ class 'pkg/TestArrayAssign2' { method 'test (Z[Ljava/lang/Object;)Ljava/lang/Object;' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 6 5 @@ -45,6 +47,8 @@ class 'pkg/TestArrayAssign2' { method 'test1 (Z[Ljava/lang/String;)Ljava/lang/Object;' { 0 12 1 12 + 2 12 + 3 12 4 13 5 13 6 13 diff --git a/testData/results/pkg/TestArrayCopy.dec b/testData/results/pkg/TestArrayCopy.dec index 34b465e5f6..3d91646ec3 100644 --- a/testData/results/pkg/TestArrayCopy.dec +++ b/testData/results/pkg/TestArrayCopy.dec @@ -32,6 +32,8 @@ class 'pkg/TestArrayCopy' { 17 8 18 8 19 8 + 1a 8 + 1b 8 1c 9 1d 9 1e 9 diff --git a/testData/results/pkg/TestArrayDoWhile.dec b/testData/results/pkg/TestArrayDoWhile.dec index d3bdb25bc4..cd0fed2271 100644 --- a/testData/results/pkg/TestArrayDoWhile.dec +++ b/testData/results/pkg/TestArrayDoWhile.dec @@ -43,6 +43,8 @@ class 'pkg/TestArrayDoWhile' { 1a 10 1b 10 1c 10 + 1d 10 + 1e 10 1f 12 20 12 } diff --git a/testData/results/pkg/TestArrayFieldAccess.dec b/testData/results/pkg/TestArrayFieldAccess.dec index 5d9f9e030a..ca4f7a0005 100644 --- a/testData/results/pkg/TestArrayFieldAccess.dec +++ b/testData/results/pkg/TestArrayFieldAccess.dec @@ -101,6 +101,8 @@ class 'pkg/TestArrayFieldAccess' { 15 17 16 17 17 17 + 18 17 + 19 17 1a 20 1b 18 1c 18 @@ -167,6 +169,8 @@ class 'pkg/TestArrayFieldAccess' { c 32 e 32 f 32 + 10 32 + 11 32 12 33 13 33 14 33 @@ -180,6 +184,8 @@ class 'pkg/TestArrayFieldAccess' { 1c 33 1d 33 1e 33 + 1f 33 + 20 33 21 35 } @@ -197,6 +203,8 @@ class 'pkg/TestArrayFieldAccess' { d 38 e 38 f 38 + 10 38 + 11 38 12 39 13 39 14 39 @@ -210,6 +218,8 @@ class 'pkg/TestArrayFieldAccess' { 1c 39 1d 39 1e 39 + 1f 39 + 20 39 21 41 } } diff --git a/testData/results/pkg/TestArrayFieldAccess1.dec b/testData/results/pkg/TestArrayFieldAccess1.dec index c8a1884974..2fe980fd06 100644 --- a/testData/results/pkg/TestArrayFieldAccess1.dec +++ b/testData/results/pkg/TestArrayFieldAccess1.dec @@ -111,6 +111,8 @@ class 'pkg/TestArrayFieldAccess1' { 17 17 18 17 19 17 + 1a 17 + 1b 17 1c 20 1d 18 1e 18 @@ -183,6 +185,8 @@ class 'pkg/TestArrayFieldAccess1' { e 32 10 32 11 32 + 12 32 + 13 32 14 33 15 33 16 33 @@ -198,6 +202,8 @@ class 'pkg/TestArrayFieldAccess1' { 20 33 21 33 22 33 + 23 33 + 24 33 25 35 } @@ -217,6 +223,8 @@ class 'pkg/TestArrayFieldAccess1' { f 38 10 38 11 38 + 12 38 + 13 38 14 39 15 39 16 39 @@ -232,6 +240,8 @@ class 'pkg/TestArrayFieldAccess1' { 20 39 21 39 22 39 + 23 39 + 24 39 25 41 } diff --git a/testData/results/pkg/TestArrayTernary.dec b/testData/results/pkg/TestArrayTernary.dec index e85bdc4b55..0cef91ddb7 100644 --- a/testData/results/pkg/TestArrayTernary.dec +++ b/testData/results/pkg/TestArrayTernary.dec @@ -23,16 +23,22 @@ class 'pkg/TestArrayTernary' { 27 5 28 6 29 6 + 2a 6 + 2b 6 2c 6 30 6 31 6 32 6 33 6 + 34 6 + 35 6 36 6 37 6 3b 6 3c 6 3d 6 + 3e 6 + 3f 6 40 6 44 6 45 6 @@ -40,22 +46,30 @@ class 'pkg/TestArrayTernary' { 47 6 48 6 49 6 + 4a 6 + 4b 6 4c 6 50 6 51 6 52 7 53 7 + 54 7 + 55 7 56 7 5a 7 5b 7 5c 7 5d 7 + 5e 7 + 5f 7 60 7 64 7 65 7 66 7 67 7 68 7 + 69 7 + 6a 7 6b 7 6f 7 70 7 diff --git a/testData/results/pkg/TestAssertJ16.dec b/testData/results/pkg/TestAssertJ16.dec index a3c62672a9..4e57cd44af 100644 --- a/testData/results/pkg/TestAssertJ16.dec +++ b/testData/results/pkg/TestAssertJ16.dec @@ -10,6 +10,8 @@ class 'pkg/TestAssertJ16' { method 'test (I)V' { 6 4 7 4 + 8 4 + 9 4 12 5 } } diff --git a/testData/results/pkg/TestAssertMerge.dec b/testData/results/pkg/TestAssertMerge.dec index 5c787827d6..9e5c7878b9 100644 --- a/testData/results/pkg/TestAssertMerge.dec +++ b/testData/results/pkg/TestAssertMerge.dec @@ -20,12 +20,18 @@ class 'pkg/TestAssertMerge' { 1 4 2 4 3 4 + 4 4 + 5 4 6 4 7 4 + 8 4 + 9 4 11 12 12 5 13 5 14 5 + 15 5 + 16 5 1a 9 1b 9 1c 9 diff --git a/testData/results/pkg/TestAssertSwitchExpression.dec b/testData/results/pkg/TestAssertSwitchExpression.dec index 3aeb19c9ac..1a59f34d69 100644 --- a/testData/results/pkg/TestAssertSwitchExpression.dec +++ b/testData/results/pkg/TestAssertSwitchExpression.dec @@ -15,11 +15,39 @@ class 'pkg/TestAssertSwitchExpression' { 6 4 7 4 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 24 5 25 5 29 6 2a 6 2e 7 + 2f 7 30 4 31 4 32 4 diff --git a/testData/results/pkg/TestAsserts.dec b/testData/results/pkg/TestAsserts.dec index d2b5aa719a..17dda0bf64 100644 --- a/testData/results/pkg/TestAsserts.dec +++ b/testData/results/pkg/TestAsserts.dec @@ -19,12 +19,18 @@ class 'pkg/TestAsserts' { 8 6 9 6 a 6 + b 6 + c 6 1b 8 1c 8 1d 8 + 1e 8 + 1f 8 20 8 21 8 22 8 + 23 8 + 24 8 2d 10 2e 10 } diff --git a/testData/results/pkg/TestAssignmentInDoWhile.dec b/testData/results/pkg/TestAssignmentInDoWhile.dec index c2834b800f..e4ac66a659 100644 --- a/testData/results/pkg/TestAssignmentInDoWhile.dec +++ b/testData/results/pkg/TestAssignmentInDoWhile.dec @@ -72,12 +72,16 @@ class 'pkg/TestAssignmentInDoWhile' { 3 6 4 6 5 6 + 6 6 + 7 6 9 6 a 6 b 6 c 6 d 6 e 6 + f 6 + 10 6 11 9 12 9 13 9 @@ -96,6 +100,8 @@ class 'pkg/TestAssignmentInDoWhile' { 3 15 4 15 5 15 + 6 15 + 7 15 8 16 9 16 a 16 @@ -103,6 +109,8 @@ class 'pkg/TestAssignmentInDoWhile' { c 17 d 17 e 17 + f 17 + 10 17 11 22 12 22 13 22 @@ -124,6 +132,8 @@ class 'pkg/TestAssignmentInDoWhile' { 8 29 9 29 a 29 + b 29 + c 29 d 29 e 29 f 29 @@ -133,6 +143,8 @@ class 'pkg/TestAssignmentInDoWhile' { 14 29 15 29 16 29 + 17 29 + 18 29 19 32 1a 32 1b 32 @@ -154,6 +166,8 @@ class 'pkg/TestAssignmentInDoWhile' { 8 39 9 39 a 39 + b 39 + c 39 d 39 e 39 f 39 @@ -166,6 +180,8 @@ class 'pkg/TestAssignmentInDoWhile' { 17 39 18 39 19 39 + 1a 39 + 1b 39 1c 42 1d 42 1e 42 @@ -187,6 +203,8 @@ class 'pkg/TestAssignmentInDoWhile' { 8 49 9 49 a 49 + b 49 + c 49 d 49 e 49 f 49 @@ -196,10 +214,14 @@ class 'pkg/TestAssignmentInDoWhile' { 14 49 15 49 16 49 + 17 49 + 18 49 19 49 1a 49 1b 49 1c 49 + 1d 49 + 1e 49 1f 52 20 52 21 52 @@ -221,6 +243,8 @@ class 'pkg/TestAssignmentInDoWhile' { 8 59 9 59 a 59 + b 59 + c 59 d 59 e 59 f 59 @@ -230,10 +254,14 @@ class 'pkg/TestAssignmentInDoWhile' { 14 59 15 59 16 59 + 17 59 + 18 59 19 59 1a 59 1b 59 1c 59 + 1d 59 + 1e 59 1f 62 20 62 21 62 diff --git a/testData/results/pkg/TestAssignmentInLoop.dec b/testData/results/pkg/TestAssignmentInLoop.dec index b31a2b6c0b..1bf6c82a5e 100644 --- a/testData/results/pkg/TestAssignmentInLoop.dec +++ b/testData/results/pkg/TestAssignmentInLoop.dec @@ -40,6 +40,8 @@ class 'pkg/TestAssignmentInLoop' { 6 10 9 10 a 10 + b 10 + c 10 d 11 e 11 f 11 @@ -53,6 +55,8 @@ class 'pkg/TestAssignmentInLoop' { 1a 14 1b 14 1c 14 + 1d 14 + 1e 14 1f 15 20 15 21 15 @@ -73,6 +77,8 @@ class 'pkg/TestAssignmentInLoop' { 34 18 36 18 37 18 + 38 18 + 39 18 3a 19 3b 19 3c 19 @@ -85,6 +91,8 @@ class 'pkg/TestAssignmentInLoop' { 46 22 47 22 48 22 + 49 22 + 4a 22 4b 23 4c 23 4d 23 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression1.dec b/testData/results/pkg/TestAssignmentSwitchExpression1.dec index 57b85e3a63..0709773def 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression1.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression1.dec @@ -25,6 +25,68 @@ class 'pkg/TestAssignmentSwitchExpression1' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 2c 4 + 2d 4 + 2e 4 + 2f 4 + 30 4 + 31 4 + 32 4 + 33 4 + 34 4 + 35 4 + 36 4 + 37 4 + 38 4 + 39 4 + 3a 4 + 3b 4 + 3c 4 + 3d 4 + 3e 4 + 3f 4 40 5 41 5 45 6 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression2.dec b/testData/results/pkg/TestAssignmentSwitchExpression2.dec index 3a15a1feed..c2b914fa18 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression2.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression2.dec @@ -15,6 +15,68 @@ class 'pkg/TestAssignmentSwitchExpression2' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 2c 4 + 2d 4 + 2e 4 + 2f 4 + 30 4 + 31 4 + 32 4 + 33 4 + 34 4 + 35 4 + 36 4 + 37 4 + 38 4 + 39 4 + 3a 4 + 3b 4 + 3c 4 + 3d 4 + 3e 4 + 3f 4 40 5 41 5 45 6 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression3.dec b/testData/results/pkg/TestAssignmentSwitchExpression3.dec index 489a68cb39..dc7957669d 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression3.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression3.dec @@ -7,11 +7,11 @@ public class TestAssignmentSwitchExpression3 { Random random = switch (x) {// 7 case -5, -4, -3, -2, -1 -> { int seed = x >> 2;// 14 - yield new Random((long)seed);// 15 + yield new Random(seed);// 15 } default -> throw new IllegalStateException("Unexpected value: " + x);// 17 case 1, 2, 3, 4, 5 -> { - long seed = System.currentTimeMillis() - (long)(x * 1000);// 9 + long seed = System.currentTimeMillis() - x * 1000;// 9 yield new Random(seed);// 10 } case 6, 7, 8, 9, 10 -> new Random(); @@ -24,6 +24,84 @@ class 'pkg/TestAssignmentSwitchExpression3' { method 'test (I)V' { 0 6 1 6 + 2 6 + 3 6 + 4 6 + 5 6 + 6 6 + 7 6 + 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 2c 6 + 2d 6 + 2e 6 + 2f 6 + 30 6 + 31 6 + 32 6 + 33 6 + 34 6 + 35 6 + 36 6 + 37 6 + 38 6 + 39 6 + 3a 6 + 3b 6 + 3c 6 + 3d 6 + 3e 6 + 3f 6 + 40 6 + 41 6 + 42 6 + 43 6 + 44 6 + 45 6 + 46 6 + 47 6 + 48 6 + 49 6 + 4a 6 + 4b 6 + 4c 6 + 4d 6 + 4e 6 + 4f 6 50 13 51 13 52 13 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression4.dec b/testData/results/pkg/TestAssignmentSwitchExpression4.dec index 7e51e0ada4..1bfeb10644 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression4.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression4.dec @@ -35,6 +35,44 @@ class 'pkg/TestAssignmentSwitchExpression4' { 94 9 95 9 a1 6 + a2 6 + a3 6 + a4 6 + a5 6 + a6 6 + a7 6 + a8 6 + a9 6 + aa 6 + ab 6 + ac 6 + ad 6 + ae 6 + af 6 + b0 6 + b1 6 + b2 6 + b3 6 + b4 6 + b5 6 + b6 6 + b7 6 + b8 6 + b9 6 + ba 6 + bb 6 + bc 6 + bd 6 + be 6 + bf 6 + c0 6 + c1 6 + c2 6 + c3 6 + c4 6 + c5 6 + c6 6 + c7 6 c8 7 c9 7 cd 8 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression5.dec b/testData/results/pkg/TestAssignmentSwitchExpression5.dec index 876a4ef908..4e0abf0cc9 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression5.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression5.dec @@ -26,6 +26,8 @@ class 'pkg/TestAssignmentSwitchExpression5' { 1 4 2 6 3 6 + 4 6 + 5 6 6 7 7 7 8 7 @@ -47,6 +49,42 @@ class 'pkg/TestAssignmentSwitchExpression5' { a2 12 a3 12 af 9 + b0 9 + b1 9 + b2 9 + b3 9 + b4 9 + b5 9 + b6 9 + b7 9 + b8 9 + b9 9 + ba 9 + bb 9 + bc 9 + bd 9 + be 9 + bf 9 + c0 9 + c1 9 + c2 9 + c3 9 + c4 9 + c5 9 + c6 9 + c7 9 + c8 9 + c9 9 + ca 9 + cb 9 + cc 9 + cd 9 + ce 9 + cf 9 + d0 9 + d1 9 + d2 9 + d3 9 d4 10 d5 10 d9 11 @@ -85,4 +123,4 @@ Lines mapping: 18 <-> 14 20 <-> 16 22 <-> 19 -23 <-> 20 \ No newline at end of file +23 <-> 20 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression6.dec b/testData/results/pkg/TestAssignmentSwitchExpression6.dec index 2d6ec2828a..b52ca2d3f3 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression6.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression6.dec @@ -26,6 +26,8 @@ class 'pkg/TestAssignmentSwitchExpression6' { 1 4 2 6 3 6 + 4 6 + 5 6 6 7 7 7 8 7 @@ -50,6 +52,42 @@ class 'pkg/TestAssignmentSwitchExpression6' { a2 13 a3 13 af 10 + b0 10 + b1 10 + b2 10 + b3 10 + b4 10 + b5 10 + b6 10 + b7 10 + b8 10 + b9 10 + ba 10 + bb 10 + bc 10 + bd 10 + be 10 + bf 10 + c0 10 + c1 10 + c2 10 + c3 10 + c4 10 + c5 10 + c6 10 + c7 10 + c8 10 + c9 10 + ca 10 + cb 10 + cc 10 + cd 10 + ce 10 + cf 10 + d0 10 + d1 10 + d2 10 + d3 10 d4 11 d5 11 d9 12 @@ -85,4 +123,4 @@ Lines mapping: 17 <-> 14 19 <-> 15 23 <-> 19 -24 <-> 20 \ No newline at end of file +24 <-> 20 diff --git a/testData/results/pkg/TestAssignmentSwitchExpression7.dec b/testData/results/pkg/TestAssignmentSwitchExpression7.dec index 852b7c28aa..a5a7c3ac21 100644 --- a/testData/results/pkg/TestAssignmentSwitchExpression7.dec +++ b/testData/results/pkg/TestAssignmentSwitchExpression7.dec @@ -15,11 +15,38 @@ class 'pkg/TestAssignmentSwitchExpression7' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 5 1d 5 21 6 22 6 26 7 + 27 7 28 4 29 9 2a 9 diff --git a/testData/results/pkg/TestAssignmentTernaryConstantSimplification.dec b/testData/results/pkg/TestAssignmentTernaryConstantSimplification.dec index 75c9446069..44784a6153 100644 --- a/testData/results/pkg/TestAssignmentTernaryConstantSimplification.dec +++ b/testData/results/pkg/TestAssignmentTernaryConstantSimplification.dec @@ -84,6 +84,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'ternaryNotAnd (ZZ)V' { 0 4 1 4 + 2 4 + 3 4 8 4 9 4 a 5 @@ -99,6 +101,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'ifOr (ZZ)V' { 0 10 1 10 + 2 10 + 3 10 4 11 5 11 9 13 @@ -116,6 +120,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'ternaryNotOr (ZZ)V' { 0 20 1 20 + 2 20 + 3 20 4 20 9 20 a 21 @@ -131,6 +137,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'ternaryAnd (ZZ)V' { 0 25 1 25 + 2 25 + 3 25 4 25 9 25 a 26 @@ -146,6 +154,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'redundantIf (Z)V' { 0 31 1 31 + 2 31 + 3 31 4 32 5 32 9 34 @@ -163,6 +173,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'redundantTernary (Z)V' { 0 41 1 41 + 2 41 + 3 41 a 41 b 41 c 41 @@ -176,8 +188,12 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'nestedIf (ZZ)V' { 0 46 1 46 + 2 46 + 3 46 4 47 5 47 + 6 47 + 7 47 8 48 9 48 d 50 @@ -197,8 +213,12 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'nestedTernary (ZZ)V' { 0 60 1 60 + 2 60 + 3 60 4 60 5 60 + 6 60 + 7 60 11 60 12 61 13 61 @@ -213,8 +233,12 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { method 'nestedIfs (ZZZ)V' { 0 66 1 66 + 2 66 + 3 66 4 67 5 67 + 6 67 + 7 67 8 68 9 68 a 68 @@ -223,6 +247,8 @@ class 'pkg/TestAssignmentTernaryConstantSimplification' { 10 70 14 72 15 72 + 16 72 + 17 72 18 73 19 73 1a 73 diff --git a/testData/results/pkg/TestBackwardsExceptionHandler.dec b/testData/results/pkg/TestBackwardsExceptionHandler.dec index 95f2b4c8e8..df94c66470 100644 --- a/testData/results/pkg/TestBackwardsExceptionHandler.dec +++ b/testData/results/pkg/TestBackwardsExceptionHandler.dec @@ -27,6 +27,8 @@ public class TestBackwardsExceptionHandler { class 'pkg/TestBackwardsExceptionHandler' { method 'testExtraReturn (I)V' { 3 9 + 4 9 + 5 9 6 6 7 6 8 6 @@ -38,6 +40,8 @@ class 'pkg/TestBackwardsExceptionHandler' { method 'test (I)V' { 3 20 + 4 20 + 5 20 6 17 7 17 8 17 diff --git a/testData/results/pkg/TestBinaryOperationWrapping.dec b/testData/results/pkg/TestBinaryOperationWrapping.dec index dfc7c6c336..05ff334d14 100644 --- a/testData/results/pkg/TestBinaryOperationWrapping.dec +++ b/testData/results/pkg/TestBinaryOperationWrapping.dec @@ -93,91 +93,151 @@ class 'pkg/TestBinaryOperationWrapping' { 2 47 3 49 4 49 + 5 49 + 6 49 7 49 8 49 + 9 49 + a 49 b 50 c 49 + d 49 + e 49 f 50 10 50 11 49 + 12 49 + 13 49 14 51 15 51 16 49 + 17 49 + 18 49 19 51 1a 51 1b 49 + 1c 49 + 1d 49 1e 52 1f 52 20 49 + 21 49 + 22 49 23 52 24 52 25 49 + 26 49 + 27 49 28 53 29 53 2a 49 + 2b 49 + 2c 49 2d 53 2e 53 2f 49 + 30 49 + 31 49 32 54 33 54 34 49 + 35 49 + 36 49 37 54 38 54 39 49 + 3a 49 + 3b 49 3c 55 3d 55 3e 49 + 3f 49 + 40 49 41 55 42 55 43 49 + 44 49 + 45 49 46 56 47 56 48 49 + 49 49 + 4a 49 4b 56 4c 56 4d 49 + 4e 49 + 4f 49 50 57 51 57 52 49 + 53 49 + 54 49 55 57 56 57 57 49 + 58 49 + 59 49 5a 58 5b 58 5c 49 + 5d 49 + 5e 49 5f 58 60 58 61 49 + 62 49 + 63 49 64 59 65 59 66 49 + 67 49 + 68 49 69 59 6a 59 6b 49 + 6c 49 + 6d 49 6e 60 6f 60 70 49 + 71 49 + 72 49 73 60 74 60 75 49 + 76 49 + 77 49 78 61 79 61 7a 49 + 7b 49 + 7c 49 7d 61 7e 61 7f 49 + 80 49 + 81 49 82 62 83 62 84 49 + 85 49 + 86 49 87 62 88 62 89 49 + 8a 49 + 8b 49 8c 63 8d 63 8e 49 + 8f 49 + 90 49 91 63 92 63 93 49 + 94 49 + 95 49 9b 48 9c 48 9d 48 diff --git a/testData/results/pkg/TestBlankLinesSpaces.dec b/testData/results/pkg/TestBlankLinesSpaces.dec new file mode 100644 index 0000000000..979d65fd24 --- /dev/null +++ b/testData/results/pkg/TestBlankLinesSpaces.dec @@ -0,0 +1,96 @@ +package pkg; + +import java.util.Random; + +public class TestBlankLinesSpaces { + private static final String STRING = longMethodName00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000(); + + private static String longMethodName00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000() { + return null;// 9 + } + + static void takeLambda00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000( + Runnable r + ) { + }// 24 + + static { + takeLambda00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000(// 13 + () -> { + for (int i = 0; i < 10; i++) {// 14 + System.out.println(i);// 15 + } + + if (new Random().nextBoolean()) {// 17 + System.out.println(true);// 18 + } + }// 20 + ); + }// 21 +} + +class 'pkg/TestBlankLinesSpaces' { + method 'longMethodName00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ()Ljava/lang/String;' { + 0 8 + 1 8 + } + + method 'takeLambda00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (Ljava/lang/Runnable;)V' { + 0 14 + } + + method ' ()V' { + b 17 + c 17 + d 17 + e 28 + } + + method 'lambda$static$0 ()V' { + 0 19 + 1 19 + 2 19 + 3 19 + 4 19 + 5 19 + 6 19 + 7 19 + 8 20 + 9 20 + a 20 + b 20 + c 20 + d 20 + e 20 + f 19 + 10 19 + 11 19 + 1c 23 + 1d 23 + 1e 23 + 1f 23 + 20 23 + 21 23 + 22 24 + 23 24 + 24 24 + 25 24 + 26 24 + 27 24 + 28 24 + 29 26 + } +} + +Lines mapping: +9 <-> 9 +13 <-> 18 +14 <-> 20 +15 <-> 21 +17 <-> 24 +18 <-> 25 +20 <-> 27 +21 <-> 29 +24 <-> 15 +Not mapped: +6 diff --git a/testData/results/pkg/TestBooleanAssignment.dec b/testData/results/pkg/TestBooleanAssignment.dec index d24cedef99..7739c7eed7 100644 --- a/testData/results/pkg/TestBooleanAssignment.dec +++ b/testData/results/pkg/TestBooleanAssignment.dec @@ -14,11 +14,15 @@ class 'pkg/TestBooleanAssignment' { method 'test (ZZZ)Z' { 0 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 9 5 a 5 + b 5 + c 5 d 8 e 8 } diff --git a/testData/results/pkg/TestBooleanExpressions.dec b/testData/results/pkg/TestBooleanExpressions.dec index a8f127c78e..0ca7c27849 100644 --- a/testData/results/pkg/TestBooleanExpressions.dec +++ b/testData/results/pkg/TestBooleanExpressions.dec @@ -25,10 +25,14 @@ class 'pkg/TestBooleanExpressions' { method 'test (I)I' { 0 7 1 7 + 2 7 + 3 7 4 7 5 7 6 7 7 7 + 8 7 + 9 7 a 7 b 7 c 7 @@ -39,6 +43,8 @@ class 'pkg/TestBooleanExpressions' { 11 7 12 7 13 7 + 14 7 + 15 7 16 7 17 7 18 7 diff --git a/testData/results/pkg/TestBooleanSwitchExpression1.dec b/testData/results/pkg/TestBooleanSwitchExpression1.dec index 94d1ca42b2..14f900ec43 100644 --- a/testData/results/pkg/TestBooleanSwitchExpression1.dec +++ b/testData/results/pkg/TestBooleanSwitchExpression1.dec @@ -57,30 +57,96 @@ class 'pkg/TestBooleanSwitchExpression1' { method 'test (II)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 6 1d 6 + 1e 6 + 1f 6 23 11 24 11 + 25 11 + 26 11 2a 16 2b 16 + 2c 16 + 2d 16 2e 21 2f 21 30 21 31 21 32 21 33 21 + 34 21 + 35 21 36 7 } method 'test1 (II)V' { 0 27 1 27 + 2 27 + 3 27 + 4 27 + 5 27 + 6 27 + 7 27 + 8 27 + 9 27 + a 27 + b 27 + c 27 + d 27 + e 27 + f 27 + 10 27 + 11 27 + 12 27 + 13 27 + 14 27 + 15 27 + 16 27 + 17 27 + 18 27 + 19 27 + 1a 27 + 1b 27 1c 29 1d 29 + 1e 29 + 1f 29 23 34 24 34 + 25 34 + 26 34 2a 39 2b 39 + 2c 39 + 2d 39 2e 48 2f 48 30 48 @@ -95,6 +161,8 @@ class 'pkg/TestBooleanSwitchExpression1' { 3c 44 3d 44 3e 44 + 3f 44 + 40 44 41 51 42 51 43 51 diff --git a/testData/results/pkg/TestBooleanSwitchExpression2.dec b/testData/results/pkg/TestBooleanSwitchExpression2.dec index f50a34063a..39d4f68db9 100644 --- a/testData/results/pkg/TestBooleanSwitchExpression2.dec +++ b/testData/results/pkg/TestBooleanSwitchExpression2.dec @@ -75,18 +75,52 @@ class 'pkg/TestBooleanSwitchExpression2' { 34 10 35 10 41 4 + 42 4 + 43 4 + 44 4 + 45 4 + 46 4 + 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 5c 6 5d 6 + 5e 6 + 5f 6 63 11 64 11 + 65 11 + 66 11 6a 16 6b 16 + 6c 16 + 6d 16 71 21 72 21 73 21 74 21 75 21 76 21 + 77 21 + 78 21 79 7 } @@ -100,6 +134,32 @@ class 'pkg/TestBooleanSwitchExpression2' { 7 26 8 26 9 26 + a 26 + b 26 + c 26 + d 26 + e 26 + f 26 + 10 26 + 11 26 + 12 26 + 13 26 + 14 26 + 15 26 + 16 26 + 17 26 + 18 26 + 19 26 + 1a 26 + 1b 26 + 1c 26 + 1d 26 + 1e 26 + 1f 26 + 20 26 + 21 26 + 22 26 + 23 26 24 28 25 28 26 28 @@ -107,6 +167,8 @@ class 'pkg/TestBooleanSwitchExpression2' { 28 28 29 28 2a 28 + 2b 28 + 2c 28 2d 29 2e 29 2f 29 @@ -117,18 +179,52 @@ class 'pkg/TestBooleanSwitchExpression2' { 37 33 38 33 39 33 + 3a 33 + 3b 33 3c 34 3d 34 3e 34 3f 40 40 40 41 40 + 42 40 + 43 40 + 44 40 + 45 40 + 46 40 + 47 40 + 48 40 + 49 40 + 4a 40 + 4b 40 + 4c 40 + 4d 40 + 4e 40 + 4f 40 + 50 40 + 51 40 + 52 40 + 53 40 + 54 40 + 55 40 + 56 40 + 57 40 + 58 40 + 59 40 + 5a 40 + 5b 40 5c 42 5d 42 + 5e 42 + 5f 42 63 47 64 47 + 65 47 + 66 47 6a 52 6b 52 + 6c 52 + 6d 52 71 61 72 61 73 61 @@ -143,6 +239,8 @@ class 'pkg/TestBooleanSwitchExpression2' { 7f 57 80 57 81 57 + 82 57 + 83 57 84 64 85 64 86 64 diff --git a/testData/results/pkg/TestBooleanSwitchExpression3.dec b/testData/results/pkg/TestBooleanSwitchExpression3.dec index a6ebe0edfb..795bc0410b 100644 --- a/testData/results/pkg/TestBooleanSwitchExpression3.dec +++ b/testData/results/pkg/TestBooleanSwitchExpression3.dec @@ -72,18 +72,52 @@ class 'pkg/TestBooleanSwitchExpression3' { 2c 5 2d 5 39 4 + 3a 4 + 3b 4 + 3c 4 + 3d 4 + 3e 4 + 3f 4 + 40 4 + 41 4 + 42 4 + 43 4 + 44 4 + 45 4 + 46 4 + 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 54 6 55 6 + 56 6 + 57 6 5b 11 5c 11 + 5d 11 + 5e 11 62 16 63 16 + 64 16 + 65 16 69 21 6a 21 6b 21 6c 21 6d 21 6e 21 + 6f 21 + 70 21 71 7 } @@ -97,6 +131,24 @@ class 'pkg/TestBooleanSwitchExpression3' { 7 26 8 26 9 26 + a 26 + b 26 + c 26 + d 26 + e 26 + f 26 + 10 26 + 11 26 + 12 26 + 13 26 + 14 26 + 15 26 + 16 26 + 17 26 + 18 26 + 19 26 + 1a 26 + 1b 26 1c 28 1d 28 1e 28 @@ -104,6 +156,8 @@ class 'pkg/TestBooleanSwitchExpression3' { 20 28 21 28 22 28 + 23 28 + 24 28 25 29 26 29 27 29 @@ -114,18 +168,52 @@ class 'pkg/TestBooleanSwitchExpression3' { 2f 30 30 30 31 30 + 32 30 + 33 30 34 31 35 31 36 31 37 37 38 37 39 37 + 3a 37 + 3b 37 + 3c 37 + 3d 37 + 3e 37 + 3f 37 + 40 37 + 41 37 + 42 37 + 43 37 + 44 37 + 45 37 + 46 37 + 47 37 + 48 37 + 49 37 + 4a 37 + 4b 37 + 4c 37 + 4d 37 + 4e 37 + 4f 37 + 50 37 + 51 37 + 52 37 + 53 37 54 39 55 39 + 56 39 + 57 39 5b 44 5c 44 + 5d 44 + 5e 44 62 49 63 49 + 64 49 + 65 49 69 58 6a 58 6b 58 @@ -140,6 +228,8 @@ class 'pkg/TestBooleanSwitchExpression3' { 77 54 78 54 79 54 + 7a 54 + 7b 54 7c 61 7d 61 7e 61 diff --git a/testData/results/pkg/TestBooleanSwitchExpression4.dec b/testData/results/pkg/TestBooleanSwitchExpression4.dec index f14dee5802..f946185352 100644 --- a/testData/results/pkg/TestBooleanSwitchExpression4.dec +++ b/testData/results/pkg/TestBooleanSwitchExpression4.dec @@ -109,12 +109,69 @@ class 'pkg/TestBooleanSwitchExpression4' { method 'test (III)V' { 0 5 1 5 + 2 5 + 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 1c 7 1d 7 + 1e 7 + 1f 7 23 12 24 12 + 25 12 + 26 12 + 27 12 + 28 12 + 29 12 + 2a 12 + 2b 12 + 2c 12 + 2d 12 + 2e 12 + 2f 12 + 30 12 + 31 12 + 32 12 + 33 12 + 34 12 + 35 12 + 36 12 + 37 12 + 38 12 + 39 12 + 3a 12 + 3b 12 + 3c 12 + 3d 12 + 3e 12 + 3f 12 46 18 47 18 + 48 18 + 49 18 4b 20 4c 20 4d 20 @@ -130,35 +187,104 @@ class 'pkg/TestBooleanSwitchExpression4' { 5b 23 5c 23 5d 23 + 5e 23 + 5f 23 60 24 61 24 62 24 63 24 + 64 24 + 65 24 69 31 6a 31 + 6b 31 + 6c 31 70 36 71 36 72 36 + 73 36 + 74 36 78 42 79 42 + 7a 42 + 7b 42 7c 47 7d 47 7e 47 7f 47 80 47 81 47 + 82 47 + 83 47 84 8 } method 'test1 (III)V' { 0 54 1 54 + 2 54 + 3 54 + 4 54 + 5 54 + 6 54 + 7 54 + 8 54 + 9 54 + a 54 + b 54 + c 54 + d 54 + e 54 + f 54 + 10 54 + 11 54 + 12 54 + 13 54 + 14 54 + 15 54 + 16 54 + 17 54 + 18 54 + 19 54 + 1a 54 + 1b 54 1c 56 1d 56 + 1e 56 + 1f 56 23 61 24 61 + 25 61 + 26 61 + 27 61 + 28 61 + 29 61 + 2a 61 + 2b 61 + 2c 61 + 2d 61 + 2e 61 + 2f 61 + 30 61 + 31 61 + 32 61 + 33 61 + 34 61 + 35 61 + 36 61 + 37 61 + 38 61 + 39 61 + 3a 61 + 3b 61 + 3c 61 + 3d 61 + 3e 61 + 3f 61 46 67 47 67 + 48 67 + 49 67 4b 69 4c 69 4d 69 @@ -174,17 +300,27 @@ class 'pkg/TestBooleanSwitchExpression4' { 5b 72 5c 72 5d 72 + 5e 72 + 5f 72 60 73 61 73 62 73 63 73 + 64 73 + 65 73 69 80 6a 80 + 6b 80 + 6c 80 70 85 71 85 72 85 + 73 85 + 74 85 78 91 79 91 + 7a 91 + 7b 91 7c 100 7d 100 7e 100 @@ -199,6 +335,8 @@ class 'pkg/TestBooleanSwitchExpression4' { 8a 96 8b 96 8c 96 + 8d 96 + 8e 96 8f 103 90 103 91 103 diff --git a/testData/results/pkg/TestBooleanSwitchExpression5.dec b/testData/results/pkg/TestBooleanSwitchExpression5.dec index e446dd90eb..b00bad30d9 100644 --- a/testData/results/pkg/TestBooleanSwitchExpression5.dec +++ b/testData/results/pkg/TestBooleanSwitchExpression5.dec @@ -99,15 +99,47 @@ class 'pkg/TestBooleanSwitchExpression5' { method 'test (III)V' { 0 5 1 5 + 2 5 + 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 1c 7 1d 7 + 1e 7 + 1f 7 20 11 22 11 23 11 24 12 25 12 + 26 12 + 27 12 2b 17 2c 17 + 2d 17 + 2e 17 2f 17 30 17 32 17 @@ -117,52 +149,100 @@ class 'pkg/TestBooleanSwitchExpression5' { 3a 17 3b 17 3c 17 + 3d 17 + 3e 17 42 22 43 22 + 44 22 + 45 22 46 23 47 23 49 23 4a 23 4b 24 4c 24 + 4d 24 + 4e 24 4f 24 50 24 51 24 52 24 + 53 24 + 54 24 58 28 59 28 5a 28 + 5b 28 + 5c 28 5d 32 5f 32 60 32 61 33 62 33 63 33 + 64 33 + 65 33 69 39 6b 39 6c 39 6d 40 + 6e 40 + 6f 40 70 45 71 45 72 45 73 45 74 45 75 45 + 76 45 + 77 45 78 8 } method 'test1 (III)V' { 0 52 1 52 + 2 52 + 3 52 + 4 52 + 5 52 + 6 52 + 7 52 + 8 52 + 9 52 + a 52 + b 52 + c 52 + d 52 + e 52 + f 52 + 10 52 + 11 52 + 12 52 + 13 52 + 14 52 + 15 52 + 16 52 + 17 52 + 18 52 + 19 52 + 1a 52 + 1b 52 1c 54 1d 54 + 1e 54 + 1f 54 20 55 22 55 23 55 24 56 25 56 + 26 56 + 27 56 2b 62 2c 62 + 2d 62 + 2e 62 2f 62 30 62 32 62 @@ -172,31 +252,45 @@ class 'pkg/TestBooleanSwitchExpression5' { 3a 62 3b 62 3c 62 + 3d 62 + 3e 62 42 67 43 67 + 44 67 + 45 67 46 68 47 68 49 68 4a 68 4b 69 4c 69 + 4d 69 + 4e 69 4f 69 50 69 51 69 52 69 + 53 69 + 54 69 58 72 59 72 5a 72 + 5b 72 + 5c 72 5d 73 5f 73 60 73 61 74 62 74 63 74 + 64 74 + 65 74 69 80 6b 80 6c 80 6d 81 + 6e 81 + 6f 81 70 90 71 90 72 90 @@ -211,6 +305,8 @@ class 'pkg/TestBooleanSwitchExpression5' { 7e 86 7f 86 80 86 + 81 86 + 82 86 83 93 84 93 85 93 diff --git a/testData/results/pkg/TestCaseClasses.dec b/testData/results/pkg/TestCaseClasses.dec index 5615f4586a..3f6c000dba 100644 --- a/testData/results/pkg/TestCaseClasses.dec +++ b/testData/results/pkg/TestCaseClasses.dec @@ -39,21 +39,7 @@ public class Option1 implements TestCaseClasses, Product, Serializable { } public boolean equals(final Object x$0) { - if (this != x$0) { - boolean var10000; - if (x$0 instanceof Option1) { - Option1 var3 = (Option1)x$0; - var10000 = this.value() == var3.value() && var3.canEqual(this); - } else { - var10000 = false; - } - - if (!var10000) { - return false; - } - } - - return true; + return this == x$0 || (x$0 instanceof Option1 var3 ? this.value() == var3.value() && var3.canEqual(this) : false); } public String toString() { @@ -185,151 +171,150 @@ class 'pkg/Option1' { 0 35 1 35 2 35 - 5 37 - 7 37 - 8 37 - 9 37 - a 37 - b 37 - e 38 - f 38 - 10 38 - 11 38 - 12 38 - 13 39 - 14 39 - 15 39 - 16 39 - 17 39 - 18 39 - 19 39 - 1a 39 - 1b 39 - 1e 39 - 1f 39 - 20 39 - 21 39 - 22 39 - 23 39 - 2e 41 - 32 44 - 35 49 - 39 45 - 3a 45 + 3 35 + 4 35 + 5 35 + 7 35 + 8 35 + 9 35 + a 35 + b 35 + c 35 + d 35 + 12 35 + 13 35 + 14 35 + 15 35 + 16 35 + 17 35 + 18 35 + 19 35 + 1a 35 + 1b 35 + 1c 35 + 1d 35 + 1e 35 + 1f 35 + 20 35 + 21 35 + 22 35 + 23 35 + 24 35 + 25 35 + 2e 35 + 32 35 + 33 35 + 34 35 + 3a 35 } method 'toString ()Ljava/lang/String;' { - 0 53 - 1 53 - 2 53 - 3 53 - 4 53 - 5 53 - 6 53 - 7 53 + 0 39 + 1 39 + 2 39 + 3 39 + 4 39 + 5 39 + 6 39 + 7 39 } method 'canEqual (Ljava/lang/Object;)Z' { - 0 57 - 1 57 - 2 57 - 3 57 - 4 57 + 0 43 + 1 43 + 2 43 + 3 43 + 4 43 } method 'productArity ()I' { - 0 61 - 1 61 + 0 47 + 1 47 } method 'productPrefix ()Ljava/lang/String;' { - 0 65 - 1 65 - 2 65 + 0 51 + 1 51 + 2 51 } method 'productElement (I)Ljava/lang/Object;' { - 0 69 - 2 69 - 3 69 - 4 69 - 7 70 - 8 70 - 9 70 - a 70 - b 70 - c 70 - d 70 - e 70 - f 70 - 10 70 - 11 70 - 12 70 - 13 70 - 14 70 - 15 70 - 16 70 - 17 70 - 18 70 - 19 70 - 1a 70 - 1b 70 - 1c 70 - 1d 70 - 1e 70 - 1f 70 + 0 55 + 2 55 + 3 55 + 4 55 + 5 55 + 6 55 + 7 56 + 8 56 + 9 56 + a 56 + b 56 + c 56 + d 56 + 12 58 + 13 58 + 14 58 + 15 58 + 16 58 + 17 58 + 18 58 + 1c 58 + 1d 56 } method 'productElementName (I)Ljava/lang/String;' { - 0 77 - 2 77 - 3 77 - 4 77 - 7 78 - 8 78 - 9 78 - e 80 - f 80 - 10 80 - 11 80 - 12 80 - 13 80 - 14 80 - 18 80 + 0 63 + 2 63 + 3 63 + 4 63 + 5 63 + 6 63 + 7 64 + 8 64 + 9 64 + e 66 + f 66 + 10 66 + 11 66 + 12 66 + 13 66 + 14 66 + 18 66 } method 'value ()I' { - 0 85 - 1 85 - 2 85 - 3 85 - 4 85 + 0 71 + 1 71 + 2 71 + 3 71 + 4 71 } method 'copy (I)Lpkg/Option1;' { - 4 89 - 8 89 + 4 75 + 8 75 } method 'copy$default$1 ()I' { - 0 93 - 1 93 - 2 93 - 3 93 - 4 93 + 0 79 + 1 79 + 2 79 + 3 79 + 4 79 } method '_1 ()I' { - 0 97 - 1 97 - 2 97 - 3 97 - 4 97 + 0 83 + 1 83 + 2 83 + 3 83 + 4 83 } } Lines mapping: -5 <-> 98 +5 <-> 84 // Decompiled companion from pkg/Option1$ package pkg; @@ -453,21 +438,7 @@ public class Option2 implements TestCaseClasses, Product, Serializable { } public boolean equals(final Object x$0) { - if (this != x$0) { - boolean var10000; - if (x$0 instanceof Option2) { - Option2 var3 = (Option2)x$0; - var10000 = this.x() == var3.x() && this.y() == var3.y() && this.z() == var3.z() && var3.canEqual(this); - } else { - var10000 = false; - } - - if (!var10000) { - return false; - } - } - - return true; + return this == x$0 || (x$0 instanceof Option2 var3 ? this.x() == var3.x() && this.y() == var3.y() && this.z() == var3.z() && var3.canEqual(this) : false); } public String toString() { @@ -487,22 +458,12 @@ public class Option2 implements TestCaseClasses, Product, Serializable { } public Object productElement(final int n) { - double var10000; - switch (n) { - case 0: - var10000 = this._1(); - break; - case 1: - var10000 = this._2(); - break; - case 2: - var10000 = this._3(); - break; - default: - throw new IndexOutOfBoundsException(BoxesRunTime.boxToInteger(n).toString()); - } - - return BoxesRunTime.boxToDouble(var10000); + return BoxesRunTime.boxToDouble(switch (n) { + case 0 -> this._1(); + case 1 -> this._2(); + case 2 -> this._3(); + default -> throw new IndexOutOfBoundsException(BoxesRunTime.boxToInteger(n).toString()); + }); } public String productElementName(final int n) { @@ -680,229 +641,282 @@ class 'pkg/Option2' { 0 41 1 41 2 41 - 5 43 - 7 43 - 8 43 - 9 43 - a 43 - b 43 - e 44 - f 44 - 10 44 - 11 44 - 12 44 - 13 45 - 14 45 - 15 45 - 16 45 - 17 45 - 18 45 - 19 45 - 1a 45 - 1b 45 - 1c 45 - 1f 45 - 20 45 - 21 45 - 22 45 - 23 45 - 24 45 - 25 45 - 26 45 - 27 45 - 28 45 - 2b 45 - 2c 45 - 2d 45 - 2e 45 - 2f 45 - 30 45 - 31 45 - 32 45 - 33 45 - 34 45 - 37 45 - 38 45 - 39 45 - 3a 45 - 3b 45 - 3c 45 - 47 47 - 4b 50 - 4e 55 - 52 51 - 53 51 + 3 41 + 4 41 + 5 41 + 7 41 + 8 41 + 9 41 + a 41 + b 41 + c 41 + d 41 + 12 41 + 13 41 + 14 41 + 15 41 + 16 41 + 17 41 + 18 41 + 19 41 + 1a 41 + 1b 41 + 1c 41 + 1d 41 + 1e 41 + 1f 41 + 20 41 + 21 41 + 22 41 + 23 41 + 24 41 + 25 41 + 26 41 + 27 41 + 28 41 + 29 41 + 2a 41 + 2b 41 + 2c 41 + 2d 41 + 2e 41 + 2f 41 + 30 41 + 31 41 + 32 41 + 33 41 + 34 41 + 35 41 + 36 41 + 37 41 + 38 41 + 39 41 + 3a 41 + 3b 41 + 3c 41 + 3d 41 + 3e 41 + 47 41 + 4b 41 + 4c 41 + 4d 41 + 53 41 } method 'toString ()Ljava/lang/String;' { - 0 59 - 1 59 - 2 59 - 3 59 - 4 59 - 5 59 - 6 59 - 7 59 + 0 45 + 1 45 + 2 45 + 3 45 + 4 45 + 5 45 + 6 45 + 7 45 } method 'canEqual (Ljava/lang/Object;)Z' { - 0 63 - 1 63 - 2 63 - 3 63 - 4 63 + 0 49 + 1 49 + 2 49 + 3 49 + 4 49 } method 'productArity ()I' { - 0 67 - 1 67 + 0 53 + 1 53 } method 'productPrefix ()Ljava/lang/String;' { - 0 71 - 1 71 - 2 71 + 0 57 + 1 57 + 2 57 } method 'productElement (I)Ljava/lang/Object;' { - 0 76 - 2 76 - 3 76 - 1c 78 - 1d 78 - 1e 78 - 1f 78 - 20 79 - 23 81 - 24 81 - 25 81 - 26 81 - 27 82 - 2a 84 - 2b 84 - 2c 84 - 2d 84 - 2e 85 - 35 87 - 36 87 - 37 87 - 38 87 - 39 87 - 3a 87 - 3b 87 - 3f 87 - 41 90 - 42 90 - 43 90 - 44 90 + 0 61 + 2 61 + 3 61 + 4 61 + 5 61 + 6 61 + 7 61 + 8 61 + 9 61 + a 61 + b 61 + c 61 + d 61 + e 61 + f 61 + 10 61 + 11 61 + 12 61 + 13 61 + 14 61 + 15 61 + 16 61 + 17 61 + 18 61 + 19 61 + 1a 61 + 1b 61 + 1c 62 + 1d 62 + 1e 62 + 1f 62 + 23 63 + 24 63 + 25 63 + 26 63 + 2a 64 + 2b 64 + 2c 64 + 2d 64 + 35 65 + 36 65 + 37 65 + 38 65 + 39 65 + 3a 65 + 3b 65 + 3f 65 + 41 61 + 42 61 + 43 61 + 44 61 } method 'productElementName (I)Ljava/lang/String;' { - 0 94 - 2 94 - 3 94 - 1c 96 - 1d 96 - 1e 96 - 1f 98 - 20 98 - 21 98 - 22 100 - 23 100 - 24 100 - 29 102 - 2a 102 - 2b 102 - 2c 102 - 2d 102 - 2e 102 - 2f 102 - 33 102 + 0 70 + 2 70 + 3 70 + 4 70 + 5 70 + 6 70 + 7 70 + 8 70 + 9 70 + a 70 + b 70 + c 70 + d 70 + e 70 + f 70 + 10 70 + 11 70 + 12 70 + 13 70 + 14 70 + 15 70 + 16 70 + 17 70 + 18 70 + 19 70 + 1a 70 + 1b 70 + 1c 72 + 1d 72 + 1e 72 + 1f 74 + 20 74 + 21 74 + 22 76 + 23 76 + 24 76 + 29 78 + 2a 78 + 2b 78 + 2c 78 + 2d 78 + 2e 78 + 2f 78 + 33 78 } method 'x ()D' { - 0 107 - 1 107 - 2 107 - 3 107 - 4 107 + 0 83 + 1 83 + 2 83 + 3 83 + 4 83 } method 'y ()D' { - 0 111 - 1 111 - 2 111 - 3 111 - 4 111 + 0 87 + 1 87 + 2 87 + 3 87 + 4 87 } method 'z ()D' { - 0 115 - 1 115 - 2 115 - 3 115 - 4 115 + 0 91 + 1 91 + 2 91 + 3 91 + 4 91 } method 'copy (DDD)Lpkg/Option2;' { - 4 119 - 5 119 - 6 119 - 7 119 - b 119 + 4 95 + 5 95 + 6 95 + 7 95 + b 95 } method 'copy$default$1 ()D' { - 0 123 - 1 123 - 2 123 - 3 123 - 4 123 + 0 99 + 1 99 + 2 99 + 3 99 + 4 99 } method 'copy$default$2 ()D' { - 0 127 - 1 127 - 2 127 - 3 127 - 4 127 + 0 103 + 1 103 + 2 103 + 3 103 + 4 103 } method 'copy$default$3 ()D' { - 0 131 - 1 131 - 2 131 - 3 131 - 4 131 + 0 107 + 1 107 + 2 107 + 3 107 + 4 107 } method '_1 ()D' { - 0 135 - 1 135 - 2 135 - 3 135 - 4 135 + 0 111 + 1 111 + 2 111 + 3 111 + 4 111 } method '_2 ()D' { - 0 139 - 1 139 - 2 139 - 3 139 - 4 139 + 0 115 + 1 115 + 2 115 + 3 115 + 4 115 } method '_3 ()D' { - 0 143 - 1 143 - 2 143 - 3 143 - 4 143 + 0 119 + 1 119 + 2 119 + 3 119 + 4 119 } } Lines mapping: -6 <-> 144 +6 <-> 120 // Decompiled companion from pkg/Option2$ package pkg; @@ -1046,10 +1060,9 @@ public class Option3 implements TestCaseClasses, Product, Serializable { public boolean equals(final Object x$0) { if (this != x$0) { boolean var5; - if (!(x$0 instanceof Option3)) { + if (!(x$0 instanceof Option3 var3)) { var5 = false; } else { - Option3 var3 = (Option3)x$0; List var10000 = this.value(); List var4 = var3.value(); var5 = (var10000 == null ? var4 == null : var10000.equals(var4)) && var3.canEqual(this); @@ -1170,150 +1183,164 @@ class 'pkg/Option3' { 0 32 1 32 2 32 + 3 32 + 4 32 5 34 7 34 8 34 9 34 a 34 b 34 - e 37 - f 37 - 10 37 - 11 37 - 12 37 - 13 38 - 14 38 - 15 38 - 16 38 - 17 39 - 18 39 - 19 39 - 1a 39 - 1b 39 - 1c 39 - 1e 40 - 22 40 - 23 40 - 24 40 - 2a 40 - 2b 40 - 2c 40 - 2d 40 - 2e 40 - 2f 40 - 32 40 - 33 40 - 34 40 - 35 40 - 36 40 - 37 40 + c 34 + d 34 + 12 34 + 13 37 + 14 37 + 15 37 + 16 37 + 17 38 + 18 38 + 19 38 + 1a 38 + 1b 38 + 1c 38 + 1e 39 + 1f 39 + 20 39 + 22 39 + 23 39 + 24 39 + 25 39 + 26 39 + 2a 39 + 2b 39 + 2c 39 + 2d 39 + 2e 39 + 2f 39 + 30 39 + 31 39 + 32 39 + 33 39 + 34 39 + 35 39 + 36 39 + 37 39 + 38 39 + 39 39 42 35 - 46 43 - 49 48 - 4d 44 - 4e 44 + 46 42 + 47 42 + 48 42 + 49 47 + 4d 43 + 4e 43 } method 'toString ()Ljava/lang/String;' { - 0 52 - 1 52 - 2 52 - 3 52 - 4 52 - 5 52 - 6 52 - 7 52 + 0 51 + 1 51 + 2 51 + 3 51 + 4 51 + 5 51 + 6 51 + 7 51 } method 'canEqual (Ljava/lang/Object;)Z' { - 0 56 - 1 56 - 2 56 - 3 56 - 4 56 + 0 55 + 1 55 + 2 55 + 3 55 + 4 55 } method 'productArity ()I' { - 0 60 - 1 60 + 0 59 + 1 59 } method 'productPrefix ()Ljava/lang/String;' { - 0 64 - 1 64 - 2 64 + 0 63 + 1 63 + 2 63 } method 'productElement (I)Ljava/lang/Object;' { - 0 68 - 2 68 - 3 68 - 4 68 - 7 69 - 8 69 - 9 69 - a 69 - b 69 - 10 71 - 11 71 - 12 71 - 13 71 - 14 71 - 15 71 - 16 71 - 1a 71 + 0 67 + 2 67 + 3 67 + 4 67 + 5 67 + 6 67 + 7 68 + 8 68 + 9 68 + a 68 + b 68 + 10 70 + 11 70 + 12 70 + 13 70 + 14 70 + 15 70 + 16 70 + 1a 70 } method 'productElementName (I)Ljava/lang/String;' { - 0 76 - 2 76 - 3 76 - 4 76 - 7 77 - 8 77 - 9 77 - e 79 - f 79 - 10 79 - 11 79 - 12 79 - 13 79 - 14 79 - 18 79 + 0 75 + 2 75 + 3 75 + 4 75 + 5 75 + 6 75 + 7 76 + 8 76 + 9 76 + e 78 + f 78 + 10 78 + 11 78 + 12 78 + 13 78 + 14 78 + 18 78 } method 'value ()Lscala/collection/immutable/List;' { - 0 84 - 1 84 - 2 84 - 3 84 - 4 84 + 0 83 + 1 83 + 2 83 + 3 83 + 4 83 } method 'copy (Lscala/collection/immutable/List;)Lpkg/Option3;' { - 4 88 - 8 88 + 4 87 + 8 87 } method 'copy$default$1 ()Lscala/collection/immutable/List;' { - 0 92 - 1 92 - 2 92 - 3 92 - 4 92 + 0 91 + 1 91 + 2 91 + 3 91 + 4 91 } method '_1 ()Lscala/collection/immutable/List;' { - 0 96 - 1 96 - 2 96 - 3 96 - 4 96 + 0 95 + 1 95 + 2 95 + 3 95 + 4 95 } } Lines mapping: -7 <-> 97 +7 <-> 96 // Decompiled companion from pkg/Option3$ package pkg; diff --git a/testData/results/pkg/TestCastIntersectionJ21.dec b/testData/results/pkg/TestCastIntersectionJ21.dec new file mode 100644 index 0000000000..a19ed62c35 --- /dev/null +++ b/testData/results/pkg/TestCastIntersectionJ21.dec @@ -0,0 +1,128 @@ +package pkg; + +public class TestCastIntersectionJ21 { + public void test1(TestCastIntersectionJ21.I1 i1) { + this.method((TestCastIntersectionJ21.I1 & TestCastIntersectionJ21.I2)i1);// 5 + }// 6 + + public void test2(TestCastIntersectionJ21.I2 i2) { + this.method((TestCastIntersectionJ21.I1 & TestCastIntersectionJ21.I2)i2);// 9 + }// 10 + + public void test3(TestCastIntersectionJ21.I1 i1) { + var i = (TestCastIntersectionJ21.I1 & TestCastIntersectionJ21.I2)i1;// 13 + this.method(i);// 14 + }// 15 + + public void test4(TestCastIntersectionJ21.I2 i2) { + var i = (TestCastIntersectionJ21.I1 & TestCastIntersectionJ21.I2)i2;// 18 + this.method(i);// 19 + }// 20 + + public void test5(TestCastIntersectionJ21.I2 i2) { + var i = (TestCastIntersectionJ21.I1 & TestCastIntersectionJ21.I2)i2;// 23 + ((TestCastIntersectionJ21.I2)i).method();// 24 + }// 25 + + public void method(I i) { + }// 28 + + private static class I1 { + } + + private interface I2 { + void method(); + } +} + +class 'pkg/TestCastIntersectionJ21' { + method 'test1 (Lpkg/TestCastIntersectionJ21$I1;)V' { + 0 4 + 1 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 5 + } + + method 'test2 (Lpkg/TestCastIntersectionJ21$I2;)V' { + 0 8 + 1 8 + 2 8 + 3 8 + 4 8 + 5 8 + 6 8 + 7 8 + 8 9 + } + + method 'test3 (Lpkg/TestCastIntersectionJ21$I1;)V' { + 0 12 + 4 12 + 5 12 + 6 12 + 7 12 + 8 13 + 9 13 + a 13 + b 13 + c 13 + d 14 + } + + method 'test4 (Lpkg/TestCastIntersectionJ21$I2;)V' { + 0 17 + 1 17 + 2 17 + 3 17 + 4 17 + 5 18 + 6 18 + 7 18 + 8 18 + 9 18 + a 19 + } + + method 'test5 (Lpkg/TestCastIntersectionJ21$I2;)V' { + 0 22 + 1 22 + 2 22 + 3 22 + 4 22 + 5 23 + 6 23 + 7 23 + 8 23 + 9 23 + a 23 + b 23 + c 23 + d 23 + e 24 + } + + method 'method (Lpkg/TestCastIntersectionJ21$I1;)V' { + 0 27 + } +} + +Lines mapping: +5 <-> 5 +6 <-> 6 +9 <-> 9 +10 <-> 10 +13 <-> 13 +14 <-> 14 +15 <-> 15 +18 <-> 18 +19 <-> 19 +20 <-> 20 +23 <-> 23 +24 <-> 24 +25 <-> 25 +28 <-> 28 diff --git a/testData/results/pkg/TestCastObjectToPrimitive.dec b/testData/results/pkg/TestCastObjectToPrimitive.dec index 324064c561..95c3e8e222 100644 --- a/testData/results/pkg/TestCastObjectToPrimitive.dec +++ b/testData/results/pkg/TestCastObjectToPrimitive.dec @@ -63,12 +63,16 @@ class 'pkg/TestCastObjectToPrimitive' { 7 17 8 17 9 17 + a 17 + b 17 c 18 d 18 e 18 f 18 10 18 11 18 + 12 18 + 13 18 14 21 15 21 16 21 @@ -79,6 +83,8 @@ class 'pkg/TestCastObjectToPrimitive' { 1b 21 1c 21 1d 21 + 1e 21 + 1f 21 20 22 21 22 22 22 @@ -113,6 +119,8 @@ class 'pkg/TestCastObjectToPrimitive' { 2 31 3 31 4 31 + 5 31 + 6 31 7 31 8 31 9 31 @@ -124,6 +132,8 @@ class 'pkg/TestCastObjectToPrimitive' { f 31 10 31 11 31 + 12 31 + 13 31 14 34 15 34 } @@ -134,6 +144,8 @@ class 'pkg/TestCastObjectToPrimitive' { 2 37 3 37 4 37 + 5 37 + 6 37 7 37 8 37 9 37 @@ -145,6 +157,8 @@ class 'pkg/TestCastObjectToPrimitive' { f 37 10 37 11 37 + 12 37 + 13 37 14 40 15 40 } @@ -161,6 +175,8 @@ class 'pkg/TestCastObjectToPrimitive' { 8 43 9 43 a 43 + b 43 + c 43 d 46 e 46 } diff --git a/testData/results/pkg/TestChainedCFG.dec b/testData/results/pkg/TestChainedCFG.dec index b62b8be766..4951aba880 100644 --- a/testData/results/pkg/TestChainedCFG.dec +++ b/testData/results/pkg/TestChainedCFG.dec @@ -35,34 +35,52 @@ class 'pkg/TestChainedCFG' { 3 6 4 6 5 6 + 6 6 + 7 6 9 8 a 8 b 8 c 8 + d 8 + e 8 13 9 14 9 15 9 16 9 + 17 9 + 18 9 1d 10 1e 10 1f 10 20 10 + 21 10 + 22 10 27 11 28 11 29 11 2a 11 + 2b 11 + 2c 11 31 12 34 12 35 12 + 36 12 + 37 12 3c 13 3f 13 40 13 + 41 13 + 42 13 47 14 4a 14 4b 14 + 4c 14 + 4d 14 52 15 55 15 56 15 + 57 15 + 58 15 } } diff --git a/testData/results/pkg/TestClassCast.dec b/testData/results/pkg/TestClassCast.dec index 80cb51ff2e..db5bb44f21 100644 --- a/testData/results/pkg/TestClassCast.dec +++ b/testData/results/pkg/TestClassCast.dec @@ -20,6 +20,8 @@ class 'pkg/TestClassCast' { 1 7 2 8 3 8 + 4 8 + 5 8 a 9 f 9 10 9 diff --git a/testData/results/pkg/TestClassLambda.dec b/testData/results/pkg/TestClassLambda.dec index c48799b2f5..e3baa6da85 100644 --- a/testData/results/pkg/TestClassLambda.dec +++ b/testData/results/pkg/TestClassLambda.dec @@ -270,12 +270,16 @@ class 'pkg/TestClassLambda' { 3 49 4 49 5 49 + 6 49 + 7 49 8 49 9 49 a 49 b 49 c 49 d 49 + e 49 + f 49 15 49 } diff --git a/testData/results/pkg/TestClassLoop.dec b/testData/results/pkg/TestClassLoop.dec index 480b4d0146..46e73282e5 100644 --- a/testData/results/pkg/TestClassLoop.dec +++ b/testData/results/pkg/TestClassLoop.dec @@ -120,9 +120,13 @@ class 'pkg/TestClassLoop' { 3 10 4 10 5 10 + 6 10 + 7 10 d 10 e 14 f 14 + 10 14 + 11 14 1a 15 27 18 28 18 @@ -130,6 +134,8 @@ class 'pkg/TestClassLoop' { 2a 18 2b 18 2c 18 + 2d 18 + 2e 18 } method 'testCatch ()V' { @@ -139,9 +145,13 @@ class 'pkg/TestClassLoop' { 3 24 4 24 5 24 + 6 24 + 7 24 d 24 e 28 f 28 + 10 28 + 11 28 12 29 16 31 17 32 @@ -161,6 +171,8 @@ class 'pkg/TestClassLoop' { 3 38 4 38 5 38 + 6 38 + 7 38 d 38 e 43 f 43 @@ -168,8 +180,12 @@ class 'pkg/TestClassLoop' { 11 43 12 43 13 43 + 14 43 + 15 43 26 46 27 46 + 28 46 + 29 46 2a 47 2b 47 2c 47 @@ -185,6 +201,8 @@ class 'pkg/TestClassLoop' { 3a 53 3b 53 3c 53 + 3d 53 + 3e 53 } method 'testWhileCombined (Ljava/lang/String;)I' { @@ -212,6 +230,8 @@ class 'pkg/TestClassLoop' { 15 65 16 65 17 65 + 18 65 + 19 65 1a 66 1b 66 1c 66 @@ -224,6 +244,8 @@ class 'pkg/TestClassLoop' { 23 67 24 67 25 67 + 26 67 + 27 67 28 68 29 68 2a 68 @@ -232,8 +254,12 @@ class 'pkg/TestClassLoop' { 30 70 31 70 32 70 + 33 70 + 34 70 35 74 36 74 + 37 74 + 38 74 3d 75 3e 75 42 75 @@ -243,7 +269,11 @@ class 'pkg/TestClassLoop' { 46 79 47 79 48 79 + 49 79 + 4a 79 4b 80 + 4c 80 + 4d 80 4e 83 4f 83 50 65 @@ -258,6 +288,8 @@ class 'pkg/TestClassLoop' { 0 93 1 93 2 93 + 3 93 + 4 93 6 97 7 97 8 97 diff --git a/testData/results/pkg/TestClassSimpleBytecodeMapping.dec b/testData/results/pkg/TestClassSimpleBytecodeMapping.dec index 67ebc91954..b161bef6c5 100644 --- a/testData/results/pkg/TestClassSimpleBytecodeMapping.dec +++ b/testData/results/pkg/TestClassSimpleBytecodeMapping.dec @@ -72,6 +72,8 @@ class 'pkg/TestClassSimpleBytecodeMapping' { 1d 12 1e 12 1f 12 + 20 12 + 21 12 22 13 23 13 24 13 @@ -105,12 +107,16 @@ class 'pkg/TestClassSimpleBytecodeMapping' { 13 25 14 25 15 25 + 16 25 + 17 25 24 27 25 27 26 27 27 27 28 27 29 27 + 2a 27 + 2b 27 2e 29 } diff --git a/testData/results/pkg/TestClassSwitch.dec b/testData/results/pkg/TestClassSwitch.dec index 67a6be2673..b92b481822 100644 --- a/testData/results/pkg/TestClassSwitch.dec +++ b/testData/results/pkg/TestClassSwitch.dec @@ -53,6 +53,32 @@ class 'pkg/TestClassSwitch' { method 'testCaseOrder (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 10 1d 10 1e 10 @@ -67,6 +93,8 @@ class 'pkg/TestClassSwitch' { 27 6 28 6 29 6 + 2a 6 + 2b 6 2c 8 } @@ -76,12 +104,93 @@ class 'pkg/TestClassSwitch' { 2 15 3 16 4 16 + 5 16 + 6 16 + 7 16 + 8 16 + 9 16 + a 16 + b 16 + c 16 + d 16 + e 16 + f 16 + 10 16 + 11 16 + 12 16 + 13 16 + 14 16 + 15 16 + 16 16 + 17 16 + 18 16 + 19 16 + 1a 16 + 1b 16 + 1c 16 + 1d 16 + 1e 16 + 1f 16 + 20 16 + 21 16 + 22 16 + 23 16 + 24 16 + 25 16 + 26 16 + 27 16 + 28 16 + 29 16 + 2a 16 + 2b 16 + 2c 16 + 2d 16 + 2e 16 + 2f 16 + 30 16 + 31 16 + 32 16 + 33 16 + 34 16 + 35 16 + 36 16 + 37 16 + 38 16 + 39 16 + 3a 16 + 3b 16 + 3c 16 + 3d 16 + 3e 16 + 3f 16 + 40 16 + 41 16 + 42 16 + 43 16 + 44 16 + 45 16 + 46 16 + 47 16 + 48 16 + 49 16 + 4a 16 + 4b 16 + 4c 16 + 4d 16 + 4e 16 + 4f 16 + 50 16 + 51 16 + 52 16 + 53 16 54 30 55 30 56 30 57 30 58 30 59 30 + 5a 30 + 5b 30 5c 32 5d 32 5e 32 @@ -103,6 +212,8 @@ class 'pkg/TestClassSwitch' { 70 36 71 37 72 37 + 73 37 + 74 37 75 38 76 38 77 38 diff --git a/testData/results/pkg/TestClassTypes.dec b/testData/results/pkg/TestClassTypes.dec index cb55909627..272c03863a 100644 --- a/testData/results/pkg/TestClassTypes.dec +++ b/testData/results/pkg/TestClassTypes.dec @@ -62,6 +62,8 @@ class 'pkg/TestClassTypes' { b 9 c 9 d 9 + e 9 + f 9 10 10 11 10 15 11 @@ -72,15 +74,21 @@ class 'pkg/TestClassTypes' { 1a 11 1b 11 1c 11 + 1d 11 + 1e 11 1f 12 20 12 21 15 22 15 23 15 + 24 15 + 25 15 26 16 27 16 28 16 29 16 + 2a 16 + 2b 16 2c 18 } @@ -90,12 +98,56 @@ class 'pkg/TestClassTypes' { 2 21 3 21 4 21 + 5 21 + 6 21 c 21 } method 'testSwitchConsts (I)V' { 0 25 1 25 + 2 25 + 3 25 + 4 25 + 5 25 + 6 25 + 7 25 + 8 25 + 9 25 + a 25 + b 25 + c 25 + d 25 + e 25 + f 25 + 10 25 + 11 25 + 12 25 + 13 25 + 14 25 + 15 25 + 16 25 + 17 25 + 18 25 + 19 25 + 1a 25 + 1b 25 + 1c 25 + 1d 25 + 1e 25 + 1f 25 + 20 25 + 21 25 + 22 25 + 23 25 + 24 25 + 25 25 + 26 25 + 27 25 + 28 25 + 29 25 + 2a 25 + 2b 25 2c 27 2d 27 2e 27 @@ -120,6 +172,8 @@ class 'pkg/TestClassTypes' { 45 34 46 34 47 34 + 48 34 + 49 34 4a 36 } @@ -128,6 +182,8 @@ class 'pkg/TestClassTypes' { 1 39 2 40 3 40 + 4 40 + 5 40 a 41 f 41 10 41 diff --git a/testData/results/pkg/TestClassVar.dec b/testData/results/pkg/TestClassVar.dec index 7756a767d7..d025e3cf55 100644 --- a/testData/results/pkg/TestClassVar.dec +++ b/testData/results/pkg/TestClassVar.dec @@ -17,7 +17,7 @@ public class TestClassVar { }// 37 public Long testFieldSSAU1() { - return new Long((long)(this.field_int++));// 40 + return new Long(this.field_int++);// 40 } public void testComplexPropagation() { @@ -45,20 +45,30 @@ class 'pkg/TestClassVar' { 3 7 4 7 5 7 + 6 7 + 7 7 8 9 9 9 a 9 b 9 + c 9 + d 9 1f 11 20 11 21 11 22 11 23 11 + 24 11 + 25 11 26 12 27 12 28 12 29 12 + 2a 12 + 2b 12 2e 7 + 2f 7 + 30 7 34 16 } @@ -79,24 +89,34 @@ class 'pkg/TestClassVar' { 3 25 4 25 5 25 + 6 25 + 7 25 8 26 9 26 a 28 b 28 c 28 d 28 + e 28 + f 28 10 28 11 28 + 12 28 + 13 28 14 29 15 29 16 29 1a 32 1b 32 1c 32 + 1d 32 + 1e 32 1f 33 20 33 21 33 22 33 + 23 33 + 24 33 28 36 } } diff --git a/testData/results/pkg/TestCollectionItr.dec b/testData/results/pkg/TestCollectionItr.dec index bfb471a240..b6406c7052 100644 --- a/testData/results/pkg/TestCollectionItr.dec +++ b/testData/results/pkg/TestCollectionItr.dec @@ -29,4 +29,4 @@ class 'pkg/TestCollectionItr' { Lines mapping: 8 <-> 8 -12 <-> 12 \ No newline at end of file +12 <-> 12 diff --git a/testData/results/pkg/TestComplexIfElseChain.dec b/testData/results/pkg/TestComplexIfElseChain.dec index e53c1678bd..05b8b0b8d3 100644 --- a/testData/results/pkg/TestComplexIfElseChain.dec +++ b/testData/results/pkg/TestComplexIfElseChain.dec @@ -52,7 +52,7 @@ public class TestComplexIfElseChain { } else if (result != 6 && result != 7) {// 52 if (result == 8 || result == 9) {// 54 System.out.println("e");// 55 - return;// 56 58 + return;// 56 } } else { System.out.println("d");// 53 @@ -302,9 +302,13 @@ class 'pkg/TestComplexIfElseChain' { e 7 f 8 10 8 + 11 8 + 12 8 13 8 14 8 15 8 + 16 8 + 17 8 18 9 19 9 1a 9 @@ -316,9 +320,13 @@ class 'pkg/TestComplexIfElseChain' { 23 10 24 10 25 10 + 26 10 + 27 10 28 10 29 10 2a 10 + 2b 10 + 2c 10 2d 11 2e 11 2f 11 @@ -330,9 +338,13 @@ class 'pkg/TestComplexIfElseChain' { 38 12 39 12 3a 12 + 3b 12 + 3c 12 3d 12 3e 12 3f 12 + 40 12 + 41 12 42 13 43 13 44 13 @@ -345,10 +357,14 @@ class 'pkg/TestComplexIfElseChain' { 4e 14 4f 14 50 14 + 51 14 + 52 14 53 14 54 14 55 14 56 14 + 57 14 + 58 14 59 15 5a 15 5b 15 @@ -361,16 +377,22 @@ class 'pkg/TestComplexIfElseChain' { 65 16 66 16 67 16 + 68 16 + 69 16 6a 16 6b 16 6c 16 6d 16 + 6e 16 + 6f 16 70 17 71 17 72 17 73 17 74 17 75 17 + 76 17 + 77 17 78 19 } @@ -389,11 +411,17 @@ class 'pkg/TestComplexIfElseChain' { 12 25 13 25 14 25 + 15 25 + 16 25 17 26 18 26 + 19 26 + 1a 26 1b 26 1c 26 1d 26 + 1e 26 + 1f 26 20 27 21 27 22 27 @@ -405,9 +433,13 @@ class 'pkg/TestComplexIfElseChain' { 2b 28 2c 28 2d 28 + 2e 28 + 2f 28 30 28 31 28 32 28 + 33 28 + 34 28 35 29 36 29 37 29 @@ -419,9 +451,13 @@ class 'pkg/TestComplexIfElseChain' { 40 30 41 30 42 30 + 43 30 + 44 30 45 30 46 30 47 30 + 48 30 + 49 30 4a 31 4b 31 4c 31 @@ -434,10 +470,14 @@ class 'pkg/TestComplexIfElseChain' { 56 32 57 32 58 32 + 59 32 + 5a 32 5b 32 5c 32 5d 32 5e 32 + 5f 32 + 60 32 61 33 62 33 63 33 @@ -450,16 +490,22 @@ class 'pkg/TestComplexIfElseChain' { 6d 34 6e 34 6f 34 + 70 34 + 71 34 72 34 73 34 74 34 75 34 + 76 34 + 77 34 78 35 79 35 7a 35 7b 35 7c 35 7d 35 + 7e 35 + 7f 35 80 25 81 25 82 25 @@ -477,9 +523,13 @@ class 'pkg/TestComplexIfElseChain' { e 44 f 45 10 45 + 11 45 + 12 45 13 45 14 45 15 45 + 16 45 + 17 45 18 46 19 46 1a 46 @@ -491,9 +541,13 @@ class 'pkg/TestComplexIfElseChain' { 23 47 24 47 25 47 + 26 47 + 27 47 28 47 29 47 2a 47 + 2b 47 + 2c 47 2d 48 2e 48 2f 48 @@ -505,9 +559,13 @@ class 'pkg/TestComplexIfElseChain' { 38 49 39 49 3a 49 + 3b 49 + 3c 49 3d 49 3e 49 3f 49 + 40 49 + 41 49 42 50 43 50 44 50 @@ -520,10 +578,14 @@ class 'pkg/TestComplexIfElseChain' { 4e 51 4f 51 50 51 + 51 51 + 52 51 53 51 54 51 55 51 56 51 + 57 51 + 58 51 59 57 5a 57 5b 57 @@ -536,10 +598,14 @@ class 'pkg/TestComplexIfElseChain' { 65 52 66 52 67 52 + 68 52 + 69 52 6a 52 6b 52 6c 52 6d 52 + 6e 52 + 6f 52 70 53 71 53 72 53 @@ -549,11 +615,6 @@ class 'pkg/TestComplexIfElseChain' { 76 53 77 53 78 54 - 79 54 - 7a 54 - 7b 54 - 7c 54 - 7d 54 } method 'testInLoop2 ()V' { @@ -567,9 +628,13 @@ class 'pkg/TestComplexIfElseChain' { e 66 f 67 10 67 + 11 67 + 12 67 13 67 14 67 15 67 + 16 67 + 17 67 18 89 19 89 1a 89 @@ -581,9 +646,13 @@ class 'pkg/TestComplexIfElseChain' { 23 68 24 68 25 68 + 26 68 + 27 68 28 68 29 68 2a 68 + 2b 68 + 2c 68 2d 86 2e 86 2f 86 @@ -595,9 +664,13 @@ class 'pkg/TestComplexIfElseChain' { 38 69 39 69 3a 69 + 3b 69 + 3c 69 3d 69 3e 69 3f 69 + 40 69 + 41 69 42 83 43 83 44 83 @@ -611,10 +684,14 @@ class 'pkg/TestComplexIfElseChain' { 4e 70 4f 70 50 70 + 51 70 + 52 70 53 70 54 70 55 70 56 70 + 57 70 + 58 70 59 79 5a 79 5b 79 @@ -628,10 +705,14 @@ class 'pkg/TestComplexIfElseChain' { 65 71 66 71 67 71 + 68 71 + 69 71 6a 71 6b 71 6c 71 6d 71 + 6e 71 + 6f 71 70 75 71 75 72 75 @@ -655,9 +736,13 @@ class 'pkg/TestComplexIfElseChain' { e 98 f 99 10 99 + 11 99 + 12 99 13 99 14 99 15 99 + 16 99 + 17 99 18 100 19 100 1a 100 @@ -669,9 +754,13 @@ class 'pkg/TestComplexIfElseChain' { 23 101 24 101 25 101 + 26 101 + 27 101 28 101 29 101 2a 101 + 2b 101 + 2c 101 2d 106 2e 106 2f 106 @@ -683,25 +772,37 @@ class 'pkg/TestComplexIfElseChain' { 38 102 39 102 3a 102 + 3b 102 + 3c 102 3d 102 3e 102 3f 102 + 40 102 + 41 102 45 102 46 102 47 102 48 102 + 49 102 + 4a 102 4b 102 4c 102 4d 102 4e 102 + 4f 102 + 50 102 54 102 55 102 56 102 57 102 + 58 102 + 59 102 5a 102 5b 102 5c 102 5d 102 + 5e 102 + 5f 102 66 103 } @@ -719,9 +820,13 @@ class 'pkg/TestComplexIfElseChain' { 11 116 12 117 13 117 + 14 117 + 15 117 16 117 17 117 18 117 + 19 117 + 1a 117 1b 118 1c 118 1d 118 @@ -733,9 +838,13 @@ class 'pkg/TestComplexIfElseChain' { 26 119 27 119 28 119 + 29 119 + 2a 119 2b 119 2c 119 2d 119 + 2e 119 + 2f 119 30 120 31 120 32 120 @@ -747,9 +856,13 @@ class 'pkg/TestComplexIfElseChain' { 3b 121 3c 121 3d 121 + 3e 121 + 3f 121 40 121 41 121 42 121 + 43 121 + 44 121 45 122 46 122 47 122 @@ -762,10 +875,14 @@ class 'pkg/TestComplexIfElseChain' { 51 123 52 123 53 123 + 54 123 + 55 123 56 123 57 123 58 123 59 123 + 5a 123 + 5b 123 5c 124 5d 124 5e 124 @@ -778,19 +895,27 @@ class 'pkg/TestComplexIfElseChain' { 68 125 69 125 6a 125 + 6b 125 + 6c 125 6d 125 6e 125 6f 125 70 125 + 71 125 + 72 125 73 126 74 126 75 126 76 126 77 126 78 126 + 79 126 + 7a 126 7b 128 7c 128 7d 128 + 7e 128 + 7f 128 80 129 } @@ -805,6 +930,33 @@ class 'pkg/TestComplexIfElseChain' { e 133 f 134 10 134 + 11 134 + 12 134 + 13 134 + 14 134 + 15 134 + 16 134 + 17 134 + 18 134 + 19 134 + 1a 134 + 1b 134 + 1c 134 + 1d 134 + 1e 134 + 1f 134 + 20 134 + 21 134 + 22 134 + 23 134 + 24 134 + 25 134 + 26 134 + 27 134 + 28 134 + 29 134 + 2a 134 + 2b 134 2c 136 2d 136 2e 136 @@ -815,9 +967,13 @@ class 'pkg/TestComplexIfElseChain' { 33 137 36 139 37 139 + 38 139 + 39 139 3a 139 3b 139 3c 139 + 3d 139 + 3e 139 3f 140 40 140 41 140 @@ -829,9 +985,13 @@ class 'pkg/TestComplexIfElseChain' { 4a 141 4b 141 4c 141 + 4d 141 + 4e 141 4f 141 50 141 51 141 + 52 141 + 53 141 54 142 55 142 56 142 @@ -843,9 +1003,13 @@ class 'pkg/TestComplexIfElseChain' { 5f 143 60 143 61 143 + 62 143 + 63 143 64 143 65 143 66 143 + 67 143 + 68 143 69 144 6a 144 6b 144 @@ -858,10 +1022,14 @@ class 'pkg/TestComplexIfElseChain' { 75 145 76 145 77 145 + 78 145 + 79 145 7a 145 7b 145 7c 145 7d 145 + 7e 145 + 7f 145 80 146 81 146 82 146 @@ -874,10 +1042,14 @@ class 'pkg/TestComplexIfElseChain' { 8c 147 8d 147 8e 147 + 8f 147 + 90 147 91 147 92 147 93 147 94 147 + 95 147 + 96 147 97 148 98 148 99 148 @@ -891,6 +1063,8 @@ class 'pkg/TestComplexIfElseChain' { a4 152 a5 152 a6 152 + a7 152 + a8 152 a9 155 aa 155 ab 155 @@ -913,6 +1087,33 @@ class 'pkg/TestComplexIfElseChain' { e 160 f 161 10 161 + 11 161 + 12 161 + 13 161 + 14 161 + 15 161 + 16 161 + 17 161 + 18 161 + 19 161 + 1a 161 + 1b 161 + 1c 161 + 1d 161 + 1e 161 + 1f 161 + 20 161 + 21 161 + 22 161 + 23 161 + 24 161 + 25 161 + 26 161 + 27 161 + 28 161 + 29 161 + 2a 161 + 2b 161 2c 163 2d 163 2e 163 @@ -923,9 +1124,13 @@ class 'pkg/TestComplexIfElseChain' { 33 164 36 166 37 166 + 38 166 + 39 166 3a 166 3b 166 3c 166 + 3d 166 + 3e 166 3f 167 40 167 41 167 @@ -937,9 +1142,13 @@ class 'pkg/TestComplexIfElseChain' { 4a 168 4b 168 4c 168 + 4d 168 + 4e 168 4f 168 50 168 51 168 + 52 168 + 53 168 54 184 55 184 56 184 @@ -951,9 +1160,13 @@ class 'pkg/TestComplexIfElseChain' { 5f 169 60 169 61 169 + 62 169 + 63 169 64 169 65 169 66 169 + 67 169 + 68 169 69 170 6a 170 6b 170 @@ -967,10 +1180,14 @@ class 'pkg/TestComplexIfElseChain' { 75 174 76 174 77 174 + 78 174 + 79 174 7a 174 7b 174 7c 174 7d 174 + 7e 174 + 7f 174 80 175 81 175 82 175 @@ -984,10 +1201,14 @@ class 'pkg/TestComplexIfElseChain' { 8c 179 8d 179 8e 179 + 8f 179 + 90 179 91 179 92 179 93 179 94 179 + 95 179 + 96 179 97 180 98 180 99 180 @@ -1010,6 +1231,8 @@ class 'pkg/TestComplexIfElseChain' { ae 190 af 190 b0 190 + b1 190 + b2 190 b3 193 b4 193 b5 193 @@ -1036,11 +1259,17 @@ class 'pkg/TestComplexIfElseChain' { 12 201 13 201 14 201 + 15 201 + 16 201 84 203 85 203 + 86 203 + 87 203 88 203 89 203 8a 203 + 8b 203 + 8c 203 8d 204 8e 204 8f 204 @@ -1052,9 +1281,13 @@ class 'pkg/TestComplexIfElseChain' { 98 205 99 205 9a 205 + 9b 205 + 9c 205 9d 205 9e 205 9f 205 + a0 205 + a1 205 a2 206 a3 206 a4 206 @@ -1066,9 +1299,13 @@ class 'pkg/TestComplexIfElseChain' { ad 207 ae 207 af 207 + b0 207 + b1 207 b2 207 b3 207 b4 207 + b5 207 + b6 207 b7 208 b8 208 b9 208 @@ -1081,10 +1318,14 @@ class 'pkg/TestComplexIfElseChain' { c3 209 c4 209 c5 209 + c6 209 + c7 209 c8 209 c9 209 ca 209 cb 209 + cc 209 + cd 209 ce 210 cf 210 d0 210 @@ -1097,16 +1338,22 @@ class 'pkg/TestComplexIfElseChain' { da 211 db 211 dc 211 + dd 211 + de 211 df 211 e0 211 e1 211 e2 211 + e3 211 + e4 211 e5 212 e6 212 e7 212 e8 212 e9 212 ea 212 + eb 212 + ec 212 ef 215 } @@ -1125,11 +1372,17 @@ class 'pkg/TestComplexIfElseChain' { 12 222 13 222 14 222 + 15 222 + 16 222 84 224 85 224 + 86 224 + 87 224 88 224 89 224 8a 224 + 8b 224 + 8c 224 8d 225 8e 225 8f 225 @@ -1141,9 +1394,13 @@ class 'pkg/TestComplexIfElseChain' { 98 226 99 226 9a 226 + 9b 226 + 9c 226 9d 226 9e 226 9f 226 + a0 226 + a1 226 a2 227 a3 227 a4 227 @@ -1155,9 +1412,13 @@ class 'pkg/TestComplexIfElseChain' { ad 228 ae 228 af 228 + b0 228 + b1 228 b2 228 b3 228 b4 228 + b5 228 + b6 228 b7 229 b8 229 b9 229 @@ -1170,10 +1431,14 @@ class 'pkg/TestComplexIfElseChain' { c3 230 c4 230 c5 230 + c6 230 + c7 230 c8 230 c9 230 ca 230 cb 230 + cc 230 + cd 230 ce 231 cf 231 d0 231 @@ -1186,21 +1451,31 @@ class 'pkg/TestComplexIfElseChain' { da 232 db 232 dc 232 + dd 232 + de 232 df 232 e0 232 e1 232 e2 232 + e3 232 + e4 232 e5 233 e6 233 e7 233 e8 233 e9 233 ea 233 + eb 233 + ec 233 ef 237 f0 237 + f1 237 + f2 237 f3 237 f4 237 f5 237 + f6 237 + f7 237 f8 238 f9 238 fa 238 @@ -1212,9 +1487,13 @@ class 'pkg/TestComplexIfElseChain' { 103 239 104 239 105 239 + 106 239 + 107 239 108 239 109 239 10a 239 + 10b 239 + 10c 239 10d 240 10e 240 10f 240 @@ -1226,9 +1505,13 @@ class 'pkg/TestComplexIfElseChain' { 118 241 119 241 11a 241 + 11b 241 + 11c 241 11d 241 11e 241 11f 241 + 120 241 + 121 241 122 242 123 242 124 242 @@ -1241,10 +1524,14 @@ class 'pkg/TestComplexIfElseChain' { 12e 243 12f 243 130 243 + 131 243 + 132 243 133 243 134 243 135 243 136 243 + 137 243 + 138 243 139 244 13a 244 13b 244 @@ -1257,16 +1544,22 @@ class 'pkg/TestComplexIfElseChain' { 145 245 146 245 147 245 + 148 245 + 149 245 14a 245 14b 245 14c 245 14d 245 + 14e 245 + 14f 245 150 246 151 246 152 246 153 246 154 246 155 246 + 156 246 + 157 246 158 248 } @@ -1285,99 +1578,141 @@ class 'pkg/TestComplexIfElseChain' { 12 255 13 255 14 255 + 15 255 + 16 255 fb 257 fc 257 + fd 257 + fe 257 ff 257 100 257 101 257 + 102 257 + 103 257 104 259 105 259 106 259 107 259 108 259 109 259 + 10a 259 + 10b 259 119 261 11a 261 11b 261 11c 261 11d 261 11e 261 + 11f 261 + 120 261 127 263 128 263 129 263 + 12a 263 + 12b 263 12c 263 12d 263 12e 263 + 12f 263 + 130 263 131 265 132 265 133 265 134 265 135 265 136 265 + 137 265 + 138 265 146 267 147 267 148 267 149 267 14a 267 14b 267 + 14c 267 + 14d 267 154 269 155 269 156 269 + 157 269 + 158 269 159 269 15a 269 15b 269 + 15c 269 + 15d 269 15e 271 15f 271 160 271 161 271 162 271 163 271 + 164 271 + 165 271 173 273 174 273 175 273 176 273 177 273 178 273 + 179 273 + 17a 273 181 275 182 275 183 275 184 275 + 185 275 + 186 275 187 275 188 275 189 275 18a 275 + 18b 275 + 18c 275 18d 277 18e 277 18f 277 190 277 191 277 192 277 + 193 277 + 194 277 1a2 279 1a3 279 1a4 279 1a5 279 1a6 279 1a7 279 + 1a8 279 + 1a9 279 1b0 281 1b1 281 1b2 281 1b3 281 + 1b4 281 + 1b5 281 1b6 281 1b7 281 1b8 281 1b9 281 + 1ba 281 + 1bb 281 1bc 283 1bd 283 1be 283 1bf 283 1c0 283 1c1 283 + 1c2 283 + 1c3 283 1d1 285 1d2 285 1d3 285 1d4 285 1d5 285 1d6 285 + 1d7 285 + 1d8 285 1df 289 } } @@ -1423,7 +1758,6 @@ Lines mapping: 54 <-> 53 55 <-> 54 56 <-> 55 -58 <-> 55 62 <-> 64 65 <-> 67 67 <-> 68 @@ -1564,6 +1898,7 @@ Lines mapping: 277 <-> 286 281 <-> 290 Not mapped: +58 59 81 95 diff --git a/testData/results/pkg/TestCompoundAssignment.dec b/testData/results/pkg/TestCompoundAssignment.dec index c2241787b2..9e5646b778 100644 --- a/testData/results/pkg/TestCompoundAssignment.dec +++ b/testData/results/pkg/TestCompoundAssignment.dec @@ -217,6 +217,8 @@ class 'pkg/TestCompoundAssignment' { 1 43 2 43 3 43 + 4 43 + 5 43 6 43 a 43 b 43 @@ -226,6 +228,8 @@ class 'pkg/TestCompoundAssignment' { 11 44 12 44 13 44 + 14 44 + 15 44 16 44 1a 44 1b 44 @@ -235,6 +239,8 @@ class 'pkg/TestCompoundAssignment' { 21 45 22 45 23 45 + 24 45 + 25 45 26 45 2a 45 2b 45 @@ -244,6 +250,8 @@ class 'pkg/TestCompoundAssignment' { 31 46 32 46 33 46 + 34 46 + 35 46 36 46 3a 46 3b 46 @@ -253,6 +261,8 @@ class 'pkg/TestCompoundAssignment' { 41 47 42 47 43 47 + 44 47 + 45 47 46 47 4a 47 4b 47 @@ -262,6 +272,8 @@ class 'pkg/TestCompoundAssignment' { 51 48 52 48 53 48 + 54 48 + 55 48 56 48 5a 48 5b 48 @@ -271,6 +283,8 @@ class 'pkg/TestCompoundAssignment' { 61 49 62 49 63 49 + 64 49 + 65 49 66 49 6a 49 6b 49 @@ -280,6 +294,8 @@ class 'pkg/TestCompoundAssignment' { 71 50 72 50 73 50 + 74 50 + 75 50 76 50 7a 50 7b 50 @@ -289,6 +305,8 @@ class 'pkg/TestCompoundAssignment' { 81 51 82 51 83 51 + 84 51 + 85 51 86 51 8a 51 8b 51 @@ -299,6 +317,8 @@ class 'pkg/TestCompoundAssignment' { 91 52 92 52 93 52 + 94 52 + 95 52 96 52 9a 52 9b 52 diff --git a/testData/results/pkg/TestCompoundAssignmentReplace.dec b/testData/results/pkg/TestCompoundAssignmentReplace.dec index a13f5b9fc3..17e2d6d1ba 100644 --- a/testData/results/pkg/TestCompoundAssignmentReplace.dec +++ b/testData/results/pkg/TestCompoundAssignmentReplace.dec @@ -35,6 +35,8 @@ class 'pkg/TestCompoundAssignmentReplace' { f 12 10 13 11 13 + 12 13 + 13 13 15 14 17 14 18 17 diff --git a/testData/results/pkg/TestConflictingLvtNamer.dec b/testData/results/pkg/TestConflictingLvtNamer.dec new file mode 100644 index 0000000000..bb64fc92ad --- /dev/null +++ b/testData/results/pkg/TestConflictingLvtNamer.dec @@ -0,0 +1,159 @@ +package pkg; + +import java.util.function.Supplier; + +public class TestConflictingLvtNamer { + public static Supplier method(int i, int j, int k, int l, int m, int n) { + int o = l - i + 1;// 12 + int p = m - j + 1;// 13 + int q = n - k + 1;// 14 + int r = o * p * q;// 15 + return () -> new Object() {// 16 + private final TestConflictingLvtNamer.Position cursor = new TestConflictingLvtNamer.Position(); + private int index; + + void innerMethod() { + int ix = this.index % o;// 21 + int jx = this.index / o;// 22 + int kx = jx % p;// 23 + int lx = jx / p;// 24 + this.index++;// 25 + this.cursor.set(i + ix, j + kx, k + lx);// 26 + }// 27 + }; + } + + public static final class Position { + public void set(int i, int j, int k) { + }// 8 + } +} + +class 'pkg/TestConflictingLvtNamer' { + method 'method (IIIIII)Ljava/util/function/Supplier;' { + 0 6 + 1 6 + 2 6 + 3 6 + 4 6 + 5 6 + 6 6 + 7 7 + 8 7 + 9 7 + a 7 + b 7 + c 7 + d 7 + e 7 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 2d 10 + } + + method 'lambda$method$0 (IIIII)Ljava/lang/Object;' { + d 10 + } +} + +class 'pkg/TestConflictingLvtNamer$1' { + method 'innerMethod ()V' { + 0 15 + 1 15 + 2 15 + 3 15 + 5 15 + 6 15 + 7 15 + 8 15 + 9 15 + a 16 + b 16 + c 16 + d 16 + f 16 + 10 16 + 11 16 + 12 16 + 13 16 + 14 17 + 16 17 + 17 17 + 18 17 + 19 17 + 1a 17 + 1b 18 + 1d 18 + 1e 18 + 1f 18 + 20 18 + 21 18 + 22 18 + 23 19 + 25 19 + 26 19 + 27 19 + 29 19 + 2d 20 + 2e 20 + 2f 20 + 30 20 + 32 20 + 33 20 + 34 20 + 35 20 + 36 20 + 38 20 + 39 20 + 3a 20 + 3b 20 + 3c 20 + 3e 20 + 3f 20 + 40 20 + 41 20 + 42 20 + 43 20 + 44 20 + 45 20 + 46 20 + 47 21 + } +} + +class 'pkg/TestConflictingLvtNamer$Position' { + method 'set (III)V' { + 0 27 + } +} + +Lines mapping: +8 <-> 28 +12 <-> 7 +13 <-> 8 +14 <-> 9 +15 <-> 10 +16 <-> 11 +21 <-> 16 +22 <-> 17 +23 <-> 18 +24 <-> 19 +25 <-> 20 +26 <-> 21 +27 <-> 22 diff --git a/testData/results/pkg/TestConstType.dec b/testData/results/pkg/TestConstType.dec index 0517a96cb6..4c6c1d0448 100644 --- a/testData/results/pkg/TestConstType.dec +++ b/testData/results/pkg/TestConstType.dec @@ -101,6 +101,32 @@ class 'pkg/TestConstType' { method 'setLineBreak (C)V' { 0 7 1 7 + 2 7 + 3 7 + 4 7 + 5 7 + 6 7 + 7 7 + 8 7 + 9 7 + a 7 + b 7 + c 7 + d 7 + e 7 + f 7 + 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 1c 9 1d 9 1e 9 @@ -112,6 +138,8 @@ class 'pkg/TestConstType' { 26 12 27 12 28 12 + 29 12 + 2a 12 2b 14 } @@ -134,6 +162,8 @@ class 'pkg/TestConstType' { 5 21 6 21 7 21 + 8 21 + 9 21 a 22 b 22 c 22 @@ -380,10 +410,14 @@ class 'pkg/TestConstType' { 0 60 1 60 2 60 + 3 60 + 4 60 5 60 6 60 7 60 8 60 + 9 60 + a 60 b 61 c 61 d 61 @@ -391,10 +425,14 @@ class 'pkg/TestConstType' { f 62 10 62 11 62 + 12 62 + 13 62 14 62 15 62 16 62 17 62 + 18 62 + 19 62 1a 63 1b 63 1c 63 @@ -403,11 +441,15 @@ class 'pkg/TestConstType' { 1f 64 20 64 21 64 + 22 64 + 23 64 24 64 25 64 26 64 27 64 28 64 + 29 64 + 2a 64 2b 65 2c 65 2d 65 @@ -416,11 +458,15 @@ class 'pkg/TestConstType' { 30 66 31 66 32 66 + 33 66 + 34 66 35 66 36 66 37 66 38 66 39 66 + 3a 66 + 3b 66 3c 67 3d 67 3e 67 @@ -428,10 +474,14 @@ class 'pkg/TestConstType' { 40 69 41 69 42 69 + 43 69 + 44 69 45 69 46 69 47 69 48 69 + 49 69 + 4a 69 4b 69 4c 69 4e 69 @@ -441,6 +491,56 @@ class 'pkg/TestConstType' { method 'getTypeMaxValue (C)I' { 0 75 1 75 + 2 75 + 3 75 + 4 75 + 5 75 + 6 75 + 7 75 + 8 75 + 9 75 + a 75 + b 75 + c 75 + d 75 + e 75 + f 75 + 10 75 + 11 75 + 12 75 + 13 75 + 14 75 + 15 75 + 16 75 + 17 75 + 18 75 + 19 75 + 1a 75 + 1b 75 + 1c 75 + 1d 75 + 1e 75 + 1f 75 + 20 75 + 21 75 + 22 75 + 23 75 + 24 75 + 25 75 + 26 75 + 27 75 + 28 75 + 29 75 + 2a 75 + 2b 75 + 2c 75 + 2d 75 + 2e 75 + 2f 75 + 30 75 + 31 75 + 32 75 + 33 75 34 86 35 86 36 86 diff --git a/testData/results/pkg/TestConstructorSwitchExpression1.dec b/testData/results/pkg/TestConstructorSwitchExpression1.dec index f15f804f19..112d0d4fc3 100644 --- a/testData/results/pkg/TestConstructorSwitchExpression1.dec +++ b/testData/results/pkg/TestConstructorSwitchExpression1.dec @@ -19,6 +19,35 @@ class 'pkg/TestConstructorSwitchExpression1' { method ' (I)V' { 1 4 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 20 5 21 5 25 6 @@ -26,6 +55,7 @@ class 'pkg/TestConstructorSwitchExpression1' { 2a 8 2b 8 2f 7 + 30 7 31 4 32 4 33 4 diff --git a/testData/results/pkg/TestConstructorSwitchExpression2.dec b/testData/results/pkg/TestConstructorSwitchExpression2.dec index 8dd1105671..10afb25d34 100644 --- a/testData/results/pkg/TestConstructorSwitchExpression2.dec +++ b/testData/results/pkg/TestConstructorSwitchExpression2.dec @@ -17,6 +17,15 @@ class 'pkg/TestConstructorSwitchExpression2' { method ' (I)V' { 1 4 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 c 6 d 6 e 6 diff --git a/testData/results/pkg/TestConstructorSwitchExpression3.dec b/testData/results/pkg/TestConstructorSwitchExpression3.dec index e3d9933d45..a78d292890 100644 --- a/testData/results/pkg/TestConstructorSwitchExpression3.dec +++ b/testData/results/pkg/TestConstructorSwitchExpression3.dec @@ -55,6 +55,31 @@ class 'pkg/TestConstructorSwitchExpression3' { 8 18 9 18 a 18 + b 18 + c 18 + d 18 + e 18 + f 18 + 10 18 + 11 18 + 12 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 19 18 + 1a 18 + 1b 18 + 1c 18 + 1d 18 + 1e 18 + 1f 18 + 20 18 + 21 18 + 22 18 + 23 18 24 19 28 20 2c 21 @@ -65,6 +90,32 @@ class 'pkg/TestConstructorSwitchExpression3' { 3b 24 3c 24 3d 24 + 3e 24 + 3f 24 + 40 24 + 41 24 + 42 24 + 43 24 + 44 24 + 45 24 + 46 24 + 47 24 + 48 24 + 49 24 + 4a 24 + 4b 24 + 4c 24 + 4d 24 + 4e 24 + 4f 24 + 50 24 + 51 24 + 52 24 + 53 24 + 54 24 + 55 24 + 56 24 + 57 24 58 25 5c 26 60 27 diff --git a/testData/results/pkg/TestDanglingBoxingCall.dec b/testData/results/pkg/TestDanglingBoxingCall.dec index ea6feb86ef..4be49c9c9e 100644 --- a/testData/results/pkg/TestDanglingBoxingCall.dec +++ b/testData/results/pkg/TestDanglingBoxingCall.dec @@ -21,6 +21,8 @@ class 'pkg/TestDanglingBoxingCall' { 4 4 5 4 6 4 + 7 4 + 8 4 9 5 a 5 b 5 diff --git a/testData/results/pkg/TestDebugSymbols.dec b/testData/results/pkg/TestDebugSymbols.dec index 1300ffd36f..dcbc8997eb 100644 --- a/testData/results/pkg/TestDebugSymbols.dec +++ b/testData/results/pkg/TestDebugSymbols.dec @@ -5,7 +5,7 @@ class TestDebugSymbols { String text = "text";// 21 long prolonged = 42L;// 22 float decimated = (float)prolonged / 10.0F;// 23 - double doubled = (double)(2.0F * decimated);// 24 + double doubled = 2.0F * decimated;// 24 return (text + ":" + prolonged + ":" + decimated + ":" + doubled).length();// 25 } } diff --git a/testData/results/pkg/TestDefiniteAssignment.dec b/testData/results/pkg/TestDefiniteAssignment.dec index 614f039688..b70363ce68 100644 --- a/testData/results/pkg/TestDefiniteAssignment.dec +++ b/testData/results/pkg/TestDefiniteAssignment.dec @@ -56,9 +56,7 @@ public class TestDefiniteAssignment { double cFake = 0.01;// 48 System.out.println(cFake);// 49 - if ((double)n < 1.0 - (double)n && (cFake = (double)(n + 5)) > cFake * cFake - cFake / 2.0// 53 - ? !((double)n > cFake) - : !((double)n < 5.0 - (cFake = (double)n))) { + if (n < 1.0 - n && (cFake = n + 5) > cFake * cFake - cFake / 2.0 ? !(n > cFake) : !(n < 5.0 - (cFake = n))) {// 53 cFake += 5.0;// 57 } else { System.out.println(cFake);// 54 @@ -67,7 +65,7 @@ public class TestDefiniteAssignment { System.out.println(cFake);// 59 double d; - if ((d = (double)n) > 0.0) {// 63 + if ((d = n) > 0.0) {// 63 System.out.println(d);// 64 } }// 67 @@ -158,6 +156,8 @@ class 'pkg/TestDefiniteAssignment' { method 'testExample16$1$$1 (I)V' { 0 7 1 7 + 2 7 + 3 7 4 7 5 7 6 7 @@ -166,11 +166,15 @@ class 'pkg/TestDefiniteAssignment' { 9 7 b 7 c 7 + d 7 + e 7 f 8 10 8 11 8 12 8 13 8 + 14 8 + 15 8 16 10 } @@ -179,6 +183,8 @@ class 'pkg/TestDefiniteAssignment' { 2 13 3 13 4 13 + 5 13 + 6 13 a 14 b 14 c 14 @@ -196,15 +202,21 @@ class 'pkg/TestDefiniteAssignment' { 0 23 1 23 2 23 + 3 23 + 4 23 5 24 7 24 8 25 9 25 + a 25 + b 25 c 30 d 30 e 31 f 31 10 31 + 11 31 + 12 31 16 35 17 35 18 35 @@ -221,22 +233,32 @@ class 'pkg/TestDefiniteAssignment' { method 'testAssignments (IZ)V' { 0 42 1 42 + 2 42 + 3 42 4 43 6 43 7 44 + 8 44 + 9 44 a 44 b 44 d 44 e 44 f 44 10 44 + 11 44 + 12 44 13 45 14 45 15 45 16 45 17 45 + 18 45 + 19 45 1a 50 1b 50 + 1c 50 + 1d 50 1e 50 22 50 23 50 @@ -244,6 +266,8 @@ class 'pkg/TestDefiniteAssignment' { 26 50 27 50 28 50 + 29 50 + 2a 50 2b 53 2c 53 2d 53 @@ -258,6 +282,8 @@ class 'pkg/TestDefiniteAssignment' { 39 51 3a 51 3b 51 + 3c 51 + 3d 51 3e 56 3f 56 40 56 @@ -279,6 +305,8 @@ class 'pkg/TestDefiniteAssignment' { 50 58 51 58 52 58 + 53 58 + 54 58 55 58 56 58 57 58 @@ -299,207 +327,263 @@ class 'pkg/TestDefiniteAssignment' { 67 58 68 58 69 58 - 6c 60 - 6d 60 - 6e 60 - 6f 60 - 70 60 - 71 60 - 72 60 - 74 60 - 75 60 - 76 60 - 77 60 - 78 60 - 7e 59 - 7f 59 - 80 59 - 81 59 - 82 59 - 83 59 - 86 63 - 87 63 - 88 63 - 89 63 - 8a 63 - 8b 63 - 8c 63 - 8d 63 - 90 64 - 91 64 - 92 64 - 94 64 - 95 64 - 9b 61 - 9c 61 - 9d 61 - 9f 61 - a0 61 - a1 67 - a2 67 - a3 67 - a4 67 - a5 67 - a6 67 - a7 67 - a8 67 - a9 69 - aa 69 - ac 69 - ad 69 - ae 69 - af 69 - b0 69 - bb 69 - be 70 - bf 70 - c0 70 - c1 70 - c2 70 - c3 70 - c6 72 + 6a 58 + 6b 58 + 6c 58 + 6d 58 + 6e 58 + 6f 58 + 70 58 + 71 58 + 72 58 + 74 58 + 75 58 + 76 58 + 77 58 + 78 58 + 79 58 + 7a 58 + 7e 58 + 7f 58 + 80 58 + 81 58 + 82 58 + 83 58 + 84 58 + 85 58 + 86 61 + 87 61 + 88 61 + 89 61 + 8a 61 + 8b 61 + 8c 61 + 8d 61 + 90 62 + 91 62 + 92 62 + 94 62 + 95 62 + 9b 59 + 9c 59 + 9d 59 + 9f 59 + a0 59 + a1 65 + a2 65 + a3 65 + a4 65 + a5 65 + a6 65 + a7 65 + a8 65 + a9 67 + aa 67 + ac 67 + ad 67 + ae 67 + af 67 + b0 67 + b1 67 + b2 67 + bb 67 + bc 67 + bd 67 + be 68 + bf 68 + c0 68 + c1 68 + c2 68 + c3 68 + c4 68 + c5 68 + c6 70 } method 'testBooleanNormalness (I)V' { - 0 75 - 1 75 - 2 75 - 3 75 - 4 77 - 5 77 - 6 77 - 9 77 - a 77 - b 77 - d 77 - e 77 - 12 77 - 15 77 - 16 77 - 19 78 - 1a 78 - 1b 78 - 1c 78 - 1d 78 - 1e 78 - 21 81 - 22 81 - 23 81 - 24 82 - 25 82 - 26 82 - 27 82 - 28 82 - 29 82 - 2a 82 - 2b 83 + 0 73 + 1 73 + 2 73 + 3 73 + 4 75 + 5 75 + 6 75 + 7 75 + 8 75 + 9 75 + a 75 + b 75 + d 75 + e 75 + f 75 + 10 75 + 12 75 + 15 75 + 16 75 + 17 75 + 18 75 + 19 76 + 1a 76 + 1b 76 + 1c 76 + 1d 76 + 1e 76 + 1f 76 + 20 76 + 21 79 + 22 79 + 23 79 + 24 80 + 25 80 + 26 80 + 27 80 + 28 80 + 29 80 + 2a 80 + 2b 81 } method 'testBooleanNormalnessInline (I)V' { - 0 86 - 1 86 - 2 86 - 3 86 - 4 88 - 5 88 - 6 88 - 9 88 - a 88 - b 88 - d 88 - e 88 - 12 88 - 15 88 - 16 88 - 1e 88 - 1f 88 - 20 88 - 22 89 - 23 89 - 24 89 - 25 90 - 26 90 - 27 90 - 28 90 - 29 90 - 2a 90 - 2b 90 - 2c 91 + 0 84 + 1 84 + 2 84 + 3 84 + 4 86 + 5 86 + 6 86 + 7 86 + 8 86 + 9 86 + a 86 + b 86 + d 86 + e 86 + f 86 + 10 86 + 12 86 + 15 86 + 16 86 + 17 86 + 18 86 + 1e 86 + 1f 86 + 20 86 + 22 87 + 23 87 + 24 87 + 25 88 + 26 88 + 27 88 + 28 88 + 29 88 + 2a 88 + 2b 88 + 2c 89 } method 'nestedTernaries (III)V' { - 0 96 - 1 96 - 4 97 - 5 97 - 6 97 - 9 101 - b 101 - c 101 - d 102 - 13 106 - 15 106 - 16 106 - 17 107 - 1a 107 - 1b 107 - 1c 107 - 1f 112 - 20 112 - 21 112 - 22 112 - 23 112 - 24 112 - 27 120 - 28 120 - 2b 121 - 2c 121 - 2d 121 - 30 125 - 32 125 - 33 125 - 34 126 - 3a 130 - 3c 130 - 3d 130 - 3e 131 - 41 131 - 42 131 - 43 131 - 46 136 - 47 136 - 48 136 - 49 136 - 4a 136 - 4d 136 - 4e 136 - 4f 136 - 51 136 - 52 136 - 53 136 - 54 136 - 5a 142 - 5c 142 - 5d 142 - 5e 143 - 60 143 - 61 143 - 62 144 - 65 149 - 66 149 - 67 149 - 68 149 - 69 149 - 6a 149 - 6d 152 - 6e 152 - 6f 152 - 70 152 - 71 152 - 72 152 - 73 152 - 74 152 - 75 153 + 0 94 + 1 94 + 2 94 + 3 94 + 4 95 + 5 95 + 6 95 + 7 95 + 8 95 + 9 99 + b 99 + c 99 + d 100 + e 100 + f 100 + 13 104 + 15 104 + 16 104 + 17 105 + 18 105 + 19 105 + 1a 105 + 1b 105 + 1c 105 + 1d 105 + 1e 105 + 1f 110 + 20 110 + 21 110 + 22 110 + 23 110 + 24 110 + 25 110 + 26 110 + 27 118 + 28 118 + 29 118 + 2a 118 + 2b 119 + 2c 119 + 2d 119 + 2e 119 + 2f 119 + 30 123 + 32 123 + 33 123 + 34 124 + 35 124 + 36 124 + 3a 128 + 3c 128 + 3d 128 + 3e 129 + 3f 129 + 40 129 + 41 129 + 42 129 + 43 129 + 44 129 + 45 129 + 46 134 + 47 134 + 48 134 + 49 134 + 4a 134 + 4b 134 + 4c 134 + 4d 134 + 4e 134 + 4f 134 + 51 134 + 52 134 + 53 134 + 54 134 + 55 134 + 56 134 + 5a 140 + 5c 140 + 5d 140 + 5e 141 + 60 141 + 61 141 + 62 142 + 63 142 + 64 142 + 65 147 + 66 147 + 67 147 + 68 147 + 69 147 + 6a 147 + 6b 147 + 6c 147 + 6d 150 + 6e 150 + 6f 150 + 70 150 + 71 150 + 72 150 + 73 150 + 74 150 + 75 151 } } @@ -526,27 +610,27 @@ Lines mapping: 48 <-> 57 49 <-> 58 53 <-> 59 -54 <-> 64 -55 <-> 65 -57 <-> 62 -59 <-> 68 -63 <-> 70 -64 <-> 71 -67 <-> 73 -71 <-> 76 -72 <-> 78 -73 <-> 79 -75 <-> 82 -76 <-> 83 -77 <-> 84 -81 <-> 87 -82 <-> 89 -83 <-> 90 -84 <-> 91 -85 <-> 92 -89 <-> 97 -90 <-> 113 -94 <-> 121 -97 <-> 150 -99 <-> 153 -100 <-> 154 +54 <-> 62 +55 <-> 63 +57 <-> 60 +59 <-> 66 +63 <-> 68 +64 <-> 69 +67 <-> 71 +71 <-> 74 +72 <-> 76 +73 <-> 77 +75 <-> 80 +76 <-> 81 +77 <-> 82 +81 <-> 85 +82 <-> 87 +83 <-> 88 +84 <-> 89 +85 <-> 90 +89 <-> 95 +90 <-> 111 +94 <-> 119 +97 <-> 148 +99 <-> 151 +100 <-> 152 diff --git a/testData/results/pkg/TestDoWhileMerge.dec b/testData/results/pkg/TestDoWhileMerge.dec index 219c079ddc..7a832054db 100644 --- a/testData/results/pkg/TestDoWhileMerge.dec +++ b/testData/results/pkg/TestDoWhileMerge.dec @@ -58,6 +58,8 @@ class 'pkg/TestDoWhileMerge' { 2 4 3 4 4 4 + 5 4 + 6 4 7 6 8 6 9 6 @@ -72,12 +74,16 @@ class 'pkg/TestDoWhileMerge' { 12 7 13 7 14 7 + 15 7 + 16 7 17 8 18 10 1c 10 1d 10 1e 10 1f 10 + 20 10 + 21 10 22 12 23 12 24 12 @@ -106,11 +112,15 @@ class 'pkg/TestDoWhileMerge' { 2 19 3 19 4 19 + 5 19 + 6 19 7 20 8 20 9 20 a 20 b 20 + c 20 + d 20 e 23 f 23 10 23 @@ -125,13 +135,19 @@ class 'pkg/TestDoWhileMerge' { 19 24 1a 24 1b 24 + 1c 24 + 1d 24 1e 25 1f 27 20 27 + 21 27 + 22 27 23 27 24 27 25 27 26 27 + 27 27 + 28 27 29 19 2a 19 2b 19 @@ -152,11 +168,15 @@ class 'pkg/TestDoWhileMerge' { 2 34 3 34 4 34 + 5 34 + 6 34 7 35 8 35 9 35 a 35 b 35 + c 35 + d 35 e 38 f 38 10 38 @@ -171,13 +191,19 @@ class 'pkg/TestDoWhileMerge' { 19 39 1a 39 1b 39 + 1c 39 + 1d 39 1e 40 1f 43 20 43 + 21 43 + 22 43 23 43 24 43 25 43 26 43 + 27 43 + 28 43 2c 47 2d 47 2e 47 diff --git a/testData/results/pkg/TestDoWhileTrue.dec b/testData/results/pkg/TestDoWhileTrue.dec index 417c49afa3..9c6dafb891 100644 --- a/testData/results/pkg/TestDoWhileTrue.dec +++ b/testData/results/pkg/TestDoWhileTrue.dec @@ -20,6 +20,8 @@ class 'pkg/TestDoWhileTrue' { 6 6 7 6 8 6 + 9 6 + a 6 e 8 } } diff --git a/testData/results/pkg/TestDoubleForeach.dec b/testData/results/pkg/TestDoubleForeach.dec index eea7c6a62b..757cec1a68 100644 --- a/testData/results/pkg/TestDoubleForeach.dec +++ b/testData/results/pkg/TestDoubleForeach.dec @@ -147,6 +147,8 @@ class 'pkg/TestDoubleForeach' { 39 31 3a 31 3b 31 + 3c 31 + 3d 31 3e 32 3f 32 40 32 @@ -164,6 +166,8 @@ class 'pkg/TestDoubleForeach' { 4f 35 50 35 51 35 + 52 35 + 53 35 54 36 55 36 56 36 diff --git a/testData/results/pkg/TestDoubleNestedClass.dec b/testData/results/pkg/TestDoubleNestedClass.dec index de767178f7..1418770854 100644 --- a/testData/results/pkg/TestDoubleNestedClass.dec +++ b/testData/results/pkg/TestDoubleNestedClass.dec @@ -20,8 +20,7 @@ public abstract class TestDoubleNestedClass { private static final TestDoubleNestedClass INNER2 = new TestDoubleNestedClass() { @Override Object test() { - return new Object() { - }; + return new Object() {}; } }; @@ -33,13 +32,13 @@ public abstract class TestDoubleNestedClass { Supplier foo(int var1) { byte var2 = 10; return () -> new TestDoubleNestedClass() { - @Override - Object test() { - int var1x = Child1.this.x + var1; - int var2x = var1 + var2; - return Child1.this.x + var1x + var2x; - } - }; + @Override + Object test() { + int var1x = Child1.this.x + var1; + int var2x = var1 + var2; + return Child1.this.x + var1x + var2x; + } + }; } } } @@ -70,52 +69,52 @@ class 'pkg/TestDoubleNestedClass$2' { class 'pkg/TestDoubleNestedClass$Child1' { method 'foo (I)Ljava/util/function/Supplier;' { - 0 33 - 1 33 - 2 33 - b 34 + 0 32 + 1 32 + 2 32 + b 33 } method 'lambda$foo$0 (II)Lpkg/TestDoubleNestedClass;' { - a 34 + a 33 } } class 'pkg/TestDoubleNestedClass$Child1$1' { method 'test ()Ljava/lang/Object;' { - 1 37 - 2 37 - 3 37 - 4 37 - 5 37 - 6 37 - 8 37 - 9 37 - a 37 - b 37 - c 37 - e 38 - f 38 - 10 38 - 12 38 - 13 38 - 14 38 - 15 38 - 16 38 - 18 39 - 19 39 - 1a 39 - 1b 39 - 1c 39 - 1d 39 - 1e 39 - 1f 39 - 20 39 - 21 39 - 22 39 - 23 39 - 24 39 - 25 39 + 1 36 + 2 36 + 3 36 + 4 36 + 5 36 + 6 36 + 8 36 + 9 36 + a 36 + b 36 + c 36 + e 37 + f 37 + 10 37 + 12 37 + 13 37 + 14 37 + 15 37 + 16 37 + 18 38 + 19 38 + 1a 38 + 1b 38 + 1c 38 + 1d 38 + 1e 38 + 1f 38 + 20 38 + 21 38 + 22 38 + 23 38 + 24 38 + 25 38 } } diff --git a/testData/results/pkg/TestDoublePopAfterJump.dec b/testData/results/pkg/TestDoublePopAfterJump.dec index ee88d99f74..884c1af9fb 100644 --- a/testData/results/pkg/TestDoublePopAfterJump.dec +++ b/testData/results/pkg/TestDoublePopAfterJump.dec @@ -14,7 +14,7 @@ public final class TestDoublePopAfterJump { var10001 = var10004; } - return (double)var10001 / (double)var10000;// 44 45 46 + return (double)var10001 / var10000;// 44 45 46 } public static final void fizzBuzz() { @@ -64,6 +64,8 @@ class 'pkg/TestDoublePopAfterJump' { 2 8 3 10 5 10 + 6 10 + 7 10 b 11 e 10 15 16 @@ -81,10 +83,14 @@ class 'pkg/TestDoublePopAfterJump' { 6 23 7 23 8 23 + 9 23 + a 23 b 24 e 25 f 25 10 25 + 11 25 + 12 25 15 26 16 26 17 26 @@ -92,10 +98,14 @@ class 'pkg/TestDoublePopAfterJump' { 19 26 1b 27 1d 30 + 1e 30 + 1f 30 20 31 22 34 23 34 24 34 + 25 34 + 26 34 29 35 2a 35 2b 35 @@ -103,6 +113,8 @@ class 'pkg/TestDoublePopAfterJump' { 2d 35 2f 36 31 39 + 32 39 + 33 39 34 40 37 41 38 41 @@ -123,6 +135,8 @@ class 'pkg/TestDoublePopAfterJump' { 0 51 1 52 3 54 + 4 54 + 5 54 b 56 } } diff --git a/testData/results/pkg/TestDuplicateAssignmentInSwitchExpr.dec b/testData/results/pkg/TestDuplicateAssignmentInSwitchExpr.dec index 2a8726f52b..e47c3bf709 100644 --- a/testData/results/pkg/TestDuplicateAssignmentInSwitchExpr.dec +++ b/testData/results/pkg/TestDuplicateAssignmentInSwitchExpr.dec @@ -17,6 +17,24 @@ class 'pkg/TestDuplicateAssignmentInSwitchExpr' { method 'foo (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 14 7 16 7 1a 9 diff --git a/testData/results/pkg/TestDuplicateSwitchLocals.dec b/testData/results/pkg/TestDuplicateSwitchLocals.dec index 419ce7084c..a93015f1dd 100644 --- a/testData/results/pkg/TestDuplicateSwitchLocals.dec +++ b/testData/results/pkg/TestDuplicateSwitchLocals.dec @@ -33,6 +33,36 @@ class 'pkg/TestDuplicateSwitchLocals' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 20 6 21 6 22 6 @@ -41,6 +71,8 @@ class 'pkg/TestDuplicateSwitchLocals' { 25 8 26 8 27 8 + 28 8 + 29 8 2a 9 2b 9 2c 9 @@ -61,6 +93,8 @@ class 'pkg/TestDuplicateSwitchLocals' { 41 15 42 15 43 15 + 44 15 + 45 15 46 16 47 16 48 16 @@ -81,6 +115,8 @@ class 'pkg/TestDuplicateSwitchLocals' { 5d 21 5e 21 5f 21 + 60 21 + 61 21 62 24 63 24 64 24 @@ -90,6 +126,8 @@ class 'pkg/TestDuplicateSwitchLocals' { 68 25 69 25 6a 25 + 6b 25 + 6c 25 6d 28 } } diff --git a/testData/results/pkg/TestEmptyBlocks.dec b/testData/results/pkg/TestEmptyBlocks.dec index 7a3a45ff44..1117f8db04 100644 --- a/testData/results/pkg/TestEmptyBlocks.dec +++ b/testData/results/pkg/TestEmptyBlocks.dec @@ -33,6 +33,8 @@ class 'pkg/TestEmptyBlocks' { 8 13 9 13 a 13 + b 13 + c 13 d 14 e 14 f 14 @@ -43,6 +45,8 @@ class 'pkg/TestEmptyBlocks' { 2b 20 2c 20 2d 20 + 2e 20 + 2f 20 30 22 } } diff --git a/testData/results/pkg/TestEmptyLambda.dec b/testData/results/pkg/TestEmptyLambda.dec new file mode 100644 index 0000000000..26564e0901 --- /dev/null +++ b/testData/results/pkg/TestEmptyLambda.dec @@ -0,0 +1,6 @@ +package pkg; + +public class TestEmptyLambda { + public static final Runnable EMPTY_LAMBDA = () -> {}; +} + diff --git a/testData/results/pkg/TestEnum.dec b/testData/results/pkg/TestEnum.dec index 04665013f7..adc0629f70 100644 --- a/testData/results/pkg/TestEnum.dec +++ b/testData/results/pkg/TestEnum.dec @@ -94,6 +94,37 @@ class 'pkg/TestEnum' { 3 30 7 30 8 30 + 9 30 + a 30 + b 30 + c 30 + d 30 + e 30 + f 30 + 10 30 + 11 30 + 12 30 + 13 30 + 14 30 + 15 30 + 16 30 + 17 30 + 18 30 + 19 30 + 1a 30 + 1b 30 + 1c 30 + 1d 30 + 1e 30 + 1f 30 + 20 30 + 21 30 + 22 30 + 23 30 + 24 30 + 25 30 + 26 30 + 27 30 28 32 29 32 2a 32 @@ -127,17 +158,37 @@ class 'pkg/TestEnum' { 4c 41 4d 41 4e 41 + 4f 41 + 50 41 54 44 55 44 56 44 5a 44 5b 44 + 5c 44 + 5d 44 + 5e 44 + 5f 44 + 60 44 + 61 44 + 62 44 + 63 44 + 64 44 + 65 44 + 66 44 + 67 44 + 68 44 + 69 44 + 6a 44 + 6b 44 6c 46 6d 46 6e 46 6f 46 70 46 71 46 + 72 46 + 73 46 74 48 } } diff --git a/testData/results/pkg/TestExceptionElse.dec b/testData/results/pkg/TestExceptionElse.dec index 85d7b652a6..aeaa118536 100644 --- a/testData/results/pkg/TestExceptionElse.dec +++ b/testData/results/pkg/TestExceptionElse.dec @@ -33,6 +33,8 @@ class 'pkg/TestExceptionElse' { 3 6 4 6 5 6 + 6 6 + 7 6 8 8 9 8 a 8 @@ -40,6 +42,8 @@ class 'pkg/TestExceptionElse' { c 8 d 8 e 8 + f 8 + 10 8 11 9 12 9 13 9 @@ -55,6 +59,8 @@ class 'pkg/TestExceptionElse' { 1d 10 1e 10 1f 10 + 20 10 + 21 10 22 11 23 11 24 11 @@ -70,11 +76,15 @@ class 'pkg/TestExceptionElse' { 31 12 32 12 33 12 + 34 12 + 35 12 36 12 37 12 38 12 39 12 3a 12 + 3b 12 + 3c 12 3d 13 3e 13 3f 13 @@ -87,6 +97,8 @@ class 'pkg/TestExceptionElse' { 49 14 4a 14 4b 14 + 4c 14 + 4d 14 4e 21 4f 21 50 21 @@ -102,11 +114,15 @@ class 'pkg/TestExceptionElse' { 5d 15 5e 15 5f 15 + 60 15 + 61 15 62 15 63 15 64 15 65 15 66 15 + 67 15 + 68 15 69 19 6a 19 6b 19 diff --git a/testData/results/pkg/TestFieldSingleAccess.dec b/testData/results/pkg/TestFieldSingleAccess.dec index 5baf35ee5e..e6a7dd206f 100644 --- a/testData/results/pkg/TestFieldSingleAccess.dec +++ b/testData/results/pkg/TestFieldSingleAccess.dec @@ -28,6 +28,8 @@ class 'pkg/TestFieldSingleAccess' { 2 7 3 7 5 7 + 6 7 + 7 7 8 8 9 8 a 8 @@ -48,6 +50,8 @@ class 'pkg/TestFieldSingleAccess' { 7 13 8 13 a 13 + b 13 + c 13 } method 'test1 ()V' { diff --git a/testData/results/pkg/TestFinallyBlockVariableUse.dec b/testData/results/pkg/TestFinallyBlockVariableUse.dec index c93d4449ee..b4c749ff90 100644 --- a/testData/results/pkg/TestFinallyBlockVariableUse.dec +++ b/testData/results/pkg/TestFinallyBlockVariableUse.dec @@ -41,12 +41,16 @@ class 'pkg/TestFinallyBlockVariableUse' { 3 4 4 4 5 4 + 6 4 + 7 4 8 8 9 8 a 8 b 8 c 8 d 8 + e 8 + f 8 10 11 11 11 12 11 @@ -74,6 +78,8 @@ class 'pkg/TestFinallyBlockVariableUse' { 57 19 58 19 59 19 + 5a 19 + 5b 19 5c 20 63 20 64 20 @@ -90,6 +96,8 @@ class 'pkg/TestFinallyBlockVariableUse' { 78 20 79 20 7b 20 + 7c 20 + 7d 20 } method 'condition (I)Z' { @@ -97,6 +105,8 @@ class 'pkg/TestFinallyBlockVariableUse' { 2 28 3 28 4 28 + 5 28 + 6 28 c 28 } diff --git a/testData/results/pkg/TestFinallyThrow.dec b/testData/results/pkg/TestFinallyThrow.dec index 364820d090..e837b28081 100644 --- a/testData/results/pkg/TestFinallyThrow.dec +++ b/testData/results/pkg/TestFinallyThrow.dec @@ -53,8 +53,12 @@ class 'pkg/TestFinallyThrow' { 2 6 3 6 4 6 + 5 6 + 6 6 2f 9 30 9 + 31 9 + 32 9 3a 10 45 12 47 13 @@ -65,6 +69,8 @@ class 'pkg/TestFinallyThrow' { 4e 15 4f 15 50 15 + 51 15 + 52 15 } method 'test1 (Ljava/lang/RuntimeException;)V' { @@ -73,11 +79,15 @@ class 'pkg/TestFinallyThrow' { 2 23 3 23 4 23 + 5 23 + 6 23 7 24 8 24 9 25 a 26 b 26 + c 26 + d 26 e 31 f 31 } @@ -95,6 +105,8 @@ class 'pkg/TestFinallyThrow' { 9 38 a 39 b 39 + c 39 + d 39 14 44 15 44 } diff --git a/testData/results/pkg/TestFloatInvertedIfConditionEarlyExit.dec b/testData/results/pkg/TestFloatInvertedIfConditionEarlyExit.dec index 7221ba92a2..bd1a736ca8 100644 --- a/testData/results/pkg/TestFloatInvertedIfConditionEarlyExit.dec +++ b/testData/results/pkg/TestFloatInvertedIfConditionEarlyExit.dec @@ -22,6 +22,8 @@ class 'pkg/TestFloatInvertedIfConditionEarlyExit' { 1 4 2 4 3 4 + 4 4 + 5 4 6 7 7 5 8 5 @@ -45,6 +47,8 @@ class 'pkg/TestFloatInvertedIfConditionEarlyExit' { a 11 b 11 c 11 + d 11 + e 11 12 12 13 12 14 12 @@ -55,6 +59,8 @@ class 'pkg/TestFloatInvertedIfConditionEarlyExit' { 26 12 27 12 28 12 + 29 12 + 2a 12 2b 10 2d 10 32 15 diff --git a/testData/results/pkg/TestForContinue.dec b/testData/results/pkg/TestForContinue.dec index 29d0304e52..3bc54df408 100644 --- a/testData/results/pkg/TestForContinue.dec +++ b/testData/results/pkg/TestForContinue.dec @@ -17,14 +17,20 @@ class 'pkg/TestForContinue' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 8 5 9 5 + a 5 + b 5 f 6 10 6 11 6 12 6 13 6 + 14 6 + 15 6 16 4 17 4 18 4 diff --git a/testData/results/pkg/TestForCyclicVarDef.dec b/testData/results/pkg/TestForCyclicVarDef.dec index 5a511c9645..2f17b7645a 100644 --- a/testData/results/pkg/TestForCyclicVarDef.dec +++ b/testData/results/pkg/TestForCyclicVarDef.dec @@ -47,6 +47,8 @@ class 'pkg/TestForCyclicVarDef' { 6 5 7 5 8 5 + 9 5 + a 5 b 14 c 6 d 6 diff --git a/testData/results/pkg/TestForeachMultiDimensionalArray.dec b/testData/results/pkg/TestForeachMultiDimensionalArray.dec index abc80cbc3c..efff5d42bf 100644 --- a/testData/results/pkg/TestForeachMultiDimensionalArray.dec +++ b/testData/results/pkg/TestForeachMultiDimensionalArray.dec @@ -37,6 +37,23 @@ class 'pkg/TestForeachMultiDimensionalArray' { 18 8 19 9 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 + 24 9 + 25 9 + 26 9 + 27 9 + 28 9 + 29 9 + 2a 9 + 2b 9 2c 12 2d 12 2e 12 diff --git a/testData/results/pkg/TestForeachMultipleLoops.dec b/testData/results/pkg/TestForeachMultipleLoops.dec index 8c7ed64b43..68fcbf8011 100644 --- a/testData/results/pkg/TestForeachMultipleLoops.dec +++ b/testData/results/pkg/TestForeachMultipleLoops.dec @@ -102,6 +102,8 @@ class 'pkg/TestForeachMultipleLoops' { method 'test (Ljava/lang/Object;Ljava/util/Map;I)V' { 0 8 1 8 + 2 8 + 3 8 4 9 5 9 6 9 @@ -149,6 +151,8 @@ class 'pkg/TestForeachMultipleLoops' { 3a 12 3b 13 3c 13 + 3d 13 + 3e 13 46 14 47 14 4b 14 @@ -161,6 +165,8 @@ class 'pkg/TestForeachMultipleLoops' { 58 16 59 16 5a 16 + 5b 16 + 5c 16 60 20 61 20 62 20 @@ -177,9 +183,13 @@ class 'pkg/TestForeachMultipleLoops' { 6d 24 6e 24 6f 24 + 70 24 + 71 24 72 25 73 25 74 25 + 75 25 + 76 25 7a 29 7b 29 7c 29 @@ -194,21 +204,29 @@ class 'pkg/TestForeachMultipleLoops' { 88 31 89 31 8a 31 + 8b 31 + 8c 31 8d 35 8e 35 8f 35 90 35 91 35 + 92 35 + 93 35 97 36 99 37 9a 37 9b 37 + 9c 37 + 9d 37 a1 41 } method 'test1 (Ljava/lang/Object;Ljava/util/Map;I)V' { 0 44 1 44 + 2 44 + 3 44 4 45 5 45 6 45 @@ -238,6 +256,8 @@ class 'pkg/TestForeachMultipleLoops' { 1e 53 1f 53 20 53 + 21 53 + 22 53 23 57 24 57 25 57 @@ -264,6 +284,8 @@ class 'pkg/TestForeachMultipleLoops' { 3a 58 3b 59 3c 59 + 3d 59 + 3e 59 46 60 47 60 4b 60 @@ -277,6 +299,8 @@ class 'pkg/TestForeachMultipleLoops' { 58 64 59 64 5a 64 + 5b 64 + 5c 64 60 65 61 65 62 65 @@ -293,9 +317,13 @@ class 'pkg/TestForeachMultipleLoops' { 6d 71 6e 71 6f 71 + 70 71 + 71 71 72 72 73 72 74 72 + 75 72 + 76 72 7a 76 7b 76 7c 76 @@ -311,6 +339,8 @@ class 'pkg/TestForeachMultipleLoops' { 88 80 89 80 8a 80 + 8b 80 + 8c 80 8d 84 8e 84 8f 84 @@ -339,6 +369,8 @@ class 'pkg/TestForeachMultipleLoops' { b0 85 b1 85 b2 85 + b3 85 + b4 85 b8 86 b9 86 ba 86 @@ -352,10 +384,14 @@ class 'pkg/TestForeachMultipleLoops' { c5 91 c6 91 c7 91 + c8 91 + c9 91 cd 92 cf 93 d0 93 d1 93 + d2 93 + d3 93 d7 54 } } @@ -410,4 +446,4 @@ Not mapped: 71 74 80 -81 \ No newline at end of file +81 diff --git a/testData/results/pkg/TestForeachVardef.dec b/testData/results/pkg/TestForeachVardef.dec index 90f3b39a23..9a2086dcdb 100644 --- a/testData/results/pkg/TestForeachVardef.dec +++ b/testData/results/pkg/TestForeachVardef.dec @@ -50,6 +50,8 @@ class 'pkg/TestForeachVardef' { 8 8 9 8 a 8 + b 8 + c 8 d 9 e 9 f 9 @@ -96,6 +98,8 @@ class 'pkg/TestForeachVardef' { 41 16 42 16 43 16 + 44 16 + 45 16 46 16 47 16 4b 16 @@ -112,6 +116,8 @@ class 'pkg/TestForeachVardef' { 4 24 5 24 6 24 + 7 24 + 8 24 9 25 a 25 b 25 @@ -122,6 +128,8 @@ class 'pkg/TestForeachVardef' { 10 27 11 27 12 27 + 13 27 + 14 27 15 28 16 28 17 28 diff --git a/testData/results/pkg/TestGenericArrays.dec b/testData/results/pkg/TestGenericArrays.dec index 599978f7ba..000745b9cf 100644 --- a/testData/results/pkg/TestGenericArrays.dec +++ b/testData/results/pkg/TestGenericArrays.dec @@ -37,4 +37,4 @@ Lines mapping: 9 <-> 9 10 <-> 10 Not mapped: -7 \ No newline at end of file +7 diff --git a/testData/results/pkg/TestGenericCastCall.dec b/testData/results/pkg/TestGenericCastCall.dec index 8c9addc3fd..e326b6dd4a 100644 --- a/testData/results/pkg/TestGenericCastCall.dec +++ b/testData/results/pkg/TestGenericCastCall.dec @@ -59,8 +59,12 @@ class 'pkg/TestGenericCastCall' { e 10 f 10 10 10 + 11 10 + 12 10 13 10 14 10 + 15 10 + 16 10 17 11 18 11 19 13 @@ -89,8 +93,12 @@ class 'pkg/TestGenericCastCall' { e 19 f 19 10 19 + 11 19 + 12 19 13 19 14 19 + 15 19 + 16 19 17 20 18 20 19 22 diff --git a/testData/results/pkg/TestGenericCasts.dec b/testData/results/pkg/TestGenericCasts.dec index 5b7f509ead..6f8296bb0d 100644 --- a/testData/results/pkg/TestGenericCasts.dec +++ b/testData/results/pkg/TestGenericCasts.dec @@ -134,6 +134,8 @@ class 'pkg/TestGenericCasts' { 8 21 9 21 a 21 + b 21 + c 21 d 22 e 22 f 22 @@ -181,11 +183,17 @@ class 'pkg/TestGenericCasts' { 2 29 3 29 4 29 + 5 29 + 6 29 7 30 8 30 9 30 a 30 10 30 + 11 30 + 12 30 + 13 30 + 14 30 15 33 16 33 17 33 @@ -315,4 +323,4 @@ Lines mapping: 68 <-> 71 73 <-> 42 Not mapped: -23 \ No newline at end of file +23 diff --git a/testData/results/pkg/TestGenericComparison.dec b/testData/results/pkg/TestGenericComparison.dec index 8611a6d70d..3bcc422d2d 100644 --- a/testData/results/pkg/TestGenericComparison.dec +++ b/testData/results/pkg/TestGenericComparison.dec @@ -35,6 +35,8 @@ class 'pkg/TestGenericComparison' { e 6 f 6 10 6 + 11 6 + 12 6 13 8 } @@ -47,4 +49,4 @@ class 'pkg/TestGenericComparison' { Lines mapping: 7 <-> 7 10 <-> 9 -13 <-> 12 \ No newline at end of file +13 <-> 12 diff --git a/testData/results/pkg/TestGenericObjectType.dec b/testData/results/pkg/TestGenericObjectType.dec index f51325ae96..fbf0f5259b 100644 --- a/testData/results/pkg/TestGenericObjectType.dec +++ b/testData/results/pkg/TestGenericObjectType.dec @@ -46,4 +46,4 @@ class 'pkg/TestGenericObjectType' { Lines mapping: 11 <-> 11 15 <-> 15 -19 <-> 19 \ No newline at end of file +19 <-> 19 diff --git a/testData/results/pkg/TestGenericSubclassTypes.dec b/testData/results/pkg/TestGenericSubclassTypes.dec index 9e2cf8a729..d74a351c17 100644 --- a/testData/results/pkg/TestGenericSubclassTypes.dec +++ b/testData/results/pkg/TestGenericSubclassTypes.dec @@ -73,4 +73,4 @@ class 'pkg/TestGenericSubclassTypes$Constant' { Lines mapping: 16 <-> 21 23 <-> 11 -27 <-> 15 \ No newline at end of file +27 <-> 15 diff --git a/testData/results/pkg/TestGenericSuper.dec b/testData/results/pkg/TestGenericSuper.dec index 873193f0d0..03be249ac9 100644 --- a/testData/results/pkg/TestGenericSuper.dec +++ b/testData/results/pkg/TestGenericSuper.dec @@ -126,4 +126,4 @@ Lines mapping: 26 <-> 21 27 <-> 22 28 <-> 23 -29 <-> 24 \ No newline at end of file +29 <-> 24 diff --git a/testData/results/pkg/TestGenericWildcard.dec b/testData/results/pkg/TestGenericWildcard.dec index 359c3f748f..c3d45400c4 100644 --- a/testData/results/pkg/TestGenericWildcard.dec +++ b/testData/results/pkg/TestGenericWildcard.dec @@ -108,11 +108,15 @@ class 'pkg/TestGenericWildcard' { method 'castOptional (ZLpkg/TestGenericWildcard;)Ljava/util/Optional;' { 0 26 1 26 + 2 26 + 3 26 4 26 5 26 6 26 7 26 b 26 + c 26 + d 26 e 26 } @@ -217,4 +221,4 @@ Lines mapping: 66 <-> 79 76 <-> 60 Not mapped: -43 \ No newline at end of file +43 diff --git a/testData/results/pkg/TestGenerics.dec b/testData/results/pkg/TestGenerics.dec index c63632f67b..9edafcdcbf 100644 --- a/testData/results/pkg/TestGenerics.dec +++ b/testData/results/pkg/TestGenerics.dec @@ -283,4 +283,4 @@ Lines mapping: Not mapped: 50 56 -63 \ No newline at end of file +63 diff --git a/testData/results/pkg/TestGenericsHierarchy.dec b/testData/results/pkg/TestGenericsHierarchy.dec index b8ea512dae..5c32a689eb 100644 --- a/testData/results/pkg/TestGenericsHierarchy.dec +++ b/testData/results/pkg/TestGenericsHierarchy.dec @@ -34,6 +34,8 @@ class 'pkg/TestGenericsHierarchy' { 18 11 19 12 1a 12 + 1b 12 + 1c 12 1d 13 1e 13 1f 16 @@ -110,4 +112,4 @@ Lines mapping: 24 <-> 21 25 <-> 22 39 <-> 25 -40 <-> 26 \ No newline at end of file +40 <-> 26 diff --git a/testData/results/pkg/TestGenericsInvocUnchecked.dec b/testData/results/pkg/TestGenericsInvocUnchecked.dec index 029d780922..e262e87fae 100644 --- a/testData/results/pkg/TestGenericsInvocUnchecked.dec +++ b/testData/results/pkg/TestGenericsInvocUnchecked.dec @@ -47,4 +47,4 @@ Lines mapping: 11 <-> 5 12 <-> 6 15 <-> 9 -16 <-> 10 \ No newline at end of file +16 <-> 10 diff --git a/testData/results/pkg/TestGenericsTernary.dec b/testData/results/pkg/TestGenericsTernary.dec index 643ebdfe53..182608deb2 100644 --- a/testData/results/pkg/TestGenericsTernary.dec +++ b/testData/results/pkg/TestGenericsTernary.dec @@ -35,6 +35,8 @@ class 'pkg/TestGenericsTernary' { e 10 f 10 10 10 + 11 10 + 12 10 13 10 17 10 18 10 @@ -43,6 +45,8 @@ class 'pkg/TestGenericsTernary' { method 'accept (Ljava/lang/Object;)Z' { 0 14 1 14 + 2 14 + 3 14 9 14 } } diff --git a/testData/results/pkg/TestGroovyClass.dec b/testData/results/pkg/TestGroovyClass.dec index bfae933e69..d6a62f29e6 100644 --- a/testData/results/pkg/TestGroovyClass.dec +++ b/testData/results/pkg/TestGroovyClass.dec @@ -265,6 +265,8 @@ class 'pkg/TestGroovyClass' { 2 39 3 39 5 39 + 6 39 + 7 39 8 40 a 42 c 42 @@ -352,6 +354,8 @@ class 'pkg/TestGroovyClass$Inner' { 2 86 3 86 5 86 + 6 86 + 7 86 8 87 a 89 c 89 @@ -405,6 +409,8 @@ class 'pkg/TestGroovyClass$Nested' { 2 114 3 114 5 114 + 6 114 + 7 114 8 115 a 117 c 117 diff --git a/testData/results/pkg/TestGroovyTryCatch.dec b/testData/results/pkg/TestGroovyTryCatch.dec index b212688564..92f263e3db 100644 --- a/testData/results/pkg/TestGroovyTryCatch.dec +++ b/testData/results/pkg/TestGroovyTryCatch.dec @@ -222,6 +222,8 @@ class 'pkg/TestGroovyTryCatch' { 2 52 3 52 5 52 + 6 52 + 7 52 8 53 a 55 c 55 diff --git a/testData/results/pkg/TestIfElseSwitch.dec b/testData/results/pkg/TestIfElseSwitch.dec index e706411f01..44c2c4b661 100644 --- a/testData/results/pkg/TestIfElseSwitch.dec +++ b/testData/results/pkg/TestIfElseSwitch.dec @@ -38,14 +38,20 @@ class 'pkg/TestIfElseSwitch' { 1 4 2 4 3 4 + 4 4 + 5 4 6 4 7 4 8 4 9 4 + a 4 + b 4 c 5 d 5 e 6 f 6 + 10 6 + 11 6 12 7 13 7 14 8 @@ -54,39 +60,80 @@ class 'pkg/TestIfElseSwitch' { 17 8 18 8 19 8 + 1a 8 + 1b 8 1c 8 1d 8 1e 8 1f 8 20 8 21 8 + 22 8 + 23 8 24 9 25 9 26 10 27 10 + 28 10 + 29 10 2a 10 2b 10 + 2c 10 + 2d 10 2e 11 2f 11 30 12 31 12 32 12 + 33 12 + 34 12 35 12 36 12 37 12 38 12 39 12 + 3a 12 + 3b 12 3c 13 3d 13 3e 13 3f 13 40 13 41 13 + 42 13 + 43 13 44 14 45 14 46 16 47 16 48 16 + 49 16 + 4a 16 + 4b 16 + 4c 16 + 4d 16 + 4e 16 + 4f 16 + 50 16 + 51 16 + 52 16 + 53 16 + 54 16 + 55 16 + 56 16 + 57 16 + 58 16 + 59 16 + 5a 16 + 5b 16 + 5c 16 + 5d 16 + 5e 16 + 5f 16 + 60 16 + 61 16 + 62 16 + 63 16 64 18 65 18 66 20 @@ -96,12 +143,16 @@ class 'pkg/TestIfElseSwitch' { 6a 22 6b 22 6c 22 + 6d 22 + 6e 22 74 22 75 25 76 25 77 25 78 25 79 25 + 7a 25 + 7b 25 7c 26 7d 26 7e 26 diff --git a/testData/results/pkg/TestIfElseTernary1.dec b/testData/results/pkg/TestIfElseTernary1.dec index ac2f546aa1..4c245897aa 100644 --- a/testData/results/pkg/TestIfElseTernary1.dec +++ b/testData/results/pkg/TestIfElseTernary1.dec @@ -123,13 +123,19 @@ class 'pkg/TestIfElseTernary1' { method 'test0 (ZIII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 f 4 + 10 4 + 11 4 12 7 13 7 14 7 @@ -142,23 +148,35 @@ class 'pkg/TestIfElseTernary1' { 1e 5 1f 5 20 5 + 21 5 + 22 5 23 9 } method 'test1 (ZIII)V' { 0 12 1 12 + 2 12 + 3 12 4 12 5 12 6 12 + 7 12 + 8 12 9 12 a 12 + b 12 + c 12 10 12 11 12 + 12 12 + 13 12 17 12 18 12 19 12 1a 12 + 1b 12 + 1c 12 1d 15 1e 15 1f 15 @@ -171,27 +189,39 @@ class 'pkg/TestIfElseTernary1' { 29 13 2a 13 2b 13 + 2c 13 + 2d 13 2e 17 } method 'test2 (ZIII)V' { 0 20 1 20 + 2 20 + 3 20 4 20 5 20 6 20 + 7 20 + 8 20 c 20 d 20 e 20 f 20 + 10 20 + 11 20 12 20 13 20 14 20 15 20 + 16 20 + 17 20 1b 20 1c 20 1d 20 1e 20 + 1f 20 + 20 20 21 23 22 23 23 23 @@ -204,31 +234,47 @@ class 'pkg/TestIfElseTernary1' { 2d 21 2e 21 2f 21 + 30 21 + 31 21 32 25 } method 'test3 (ZIII)V' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 6 28 + 7 28 + 8 28 9 28 a 28 + b 28 + c 28 10 28 11 28 + 12 28 + 13 28 17 28 18 28 19 28 1a 28 + 1b 28 + 1c 28 1d 28 1e 28 1f 28 20 28 + 21 28 + 22 28 26 28 27 28 28 28 29 28 + 2a 28 + 2b 28 2c 31 2d 31 2e 31 @@ -241,31 +287,43 @@ class 'pkg/TestIfElseTernary1' { 38 29 39 29 3a 29 + 3b 29 + 3c 29 3d 33 } method 'test4 (ZIII)V' { 0 36 1 36 + 2 36 + 3 36 4 36 5 36 6 36 7 36 8 36 9 36 + a 36 + b 36 f 36 10 36 11 36 12 36 13 36 14 36 + 15 36 + 16 36 17 36 18 36 19 36 + 1a 36 + 1b 36 1f 36 20 36 21 36 22 36 + 23 36 + 24 36 25 39 26 39 27 39 @@ -278,35 +336,51 @@ class 'pkg/TestIfElseTernary1' { 31 37 32 37 33 37 + 34 37 + 35 37 36 41 } method 'test5 (ZIII)V' { 0 44 1 44 + 2 44 + 3 44 4 44 5 44 6 44 7 44 8 44 9 44 + a 44 + b 44 f 44 10 44 11 44 12 44 13 44 14 44 + 15 44 + 16 44 17 44 18 44 19 44 + 1a 44 + 1b 44 1c 44 1d 44 + 1e 44 + 1f 44 23 44 24 44 + 25 44 + 26 44 2a 44 2b 44 2c 44 2d 44 + 2e 44 + 2f 44 30 47 31 47 32 47 @@ -319,39 +393,55 @@ class 'pkg/TestIfElseTernary1' { 3c 45 3d 45 3e 45 + 3f 45 + 40 45 41 49 } method 'test6 (ZIII)V' { 0 52 1 52 + 2 52 + 3 52 4 52 5 52 6 52 7 52 8 52 9 52 + a 52 + b 52 f 52 10 52 11 52 12 52 13 52 14 52 + 15 52 + 16 52 17 52 18 52 19 52 + 1a 52 + 1b 52 1f 52 20 52 21 52 22 52 + 23 52 + 24 52 25 52 26 52 27 52 28 52 + 29 52 + 2a 52 2e 52 2f 52 30 52 31 52 + 32 52 + 33 52 34 55 35 55 36 55 @@ -364,43 +454,63 @@ class 'pkg/TestIfElseTernary1' { 40 53 41 53 42 53 + 43 53 + 44 53 45 57 } method 'test7 (ZIII)V' { 0 60 1 60 + 2 60 + 3 60 4 60 5 60 6 60 7 60 8 60 9 60 + a 60 + b 60 f 60 10 60 11 60 12 60 13 60 14 60 + 15 60 + 16 60 17 60 18 60 19 60 + 1a 60 + 1b 60 1c 60 1d 60 + 1e 60 + 1f 60 23 60 24 60 + 25 60 + 26 60 2a 60 2b 60 2c 60 2d 60 + 2e 60 + 2f 60 30 60 31 60 32 60 33 60 + 34 60 + 35 60 39 60 3a 60 3b 60 3c 60 + 3d 60 + 3e 60 3f 63 40 63 41 63 @@ -413,6 +523,8 @@ class 'pkg/TestIfElseTernary1' { 4b 61 4c 61 4d 61 + 4e 61 + 4f 61 50 65 } @@ -420,34 +532,50 @@ class 'pkg/TestIfElseTernary1' { 0 68 1 68 2 68 + 3 68 + 4 68 5 68 6 68 7 68 8 68 + 9 68 + a 68 b 68 c 68 d 68 + e 68 + f 68 13 68 14 68 15 68 + 16 68 + 17 68 18 68 19 68 1a 68 1b 68 + 1c 68 + 1d 68 1e 68 1f 68 20 68 21 68 22 68 23 68 + 24 68 + 25 68 26 68 27 68 28 68 29 68 2a 68 2b 68 + 2c 68 + 2d 68 31 68 32 68 + 33 68 + 34 68 35 71 36 71 37 71 @@ -460,6 +588,8 @@ class 'pkg/TestIfElseTernary1' { 41 69 42 69 43 69 + 44 69 + 45 69 46 73 } @@ -467,33 +597,49 @@ class 'pkg/TestIfElseTernary1' { 0 76 1 76 2 76 + 3 76 + 4 76 5 76 6 76 7 76 8 76 + 9 76 + a 76 b 76 c 76 + d 76 + e 76 12 76 13 76 14 76 + 15 76 + 16 76 17 76 18 76 19 76 1a 76 + 1b 76 + 1c 76 1d 76 1e 76 1f 76 20 76 21 76 22 76 + 23 76 + 24 76 25 76 26 76 27 76 28 76 29 76 2a 76 + 2b 76 + 2c 76 30 76 31 76 + 32 76 + 33 76 34 79 35 79 36 79 @@ -506,6 +652,8 @@ class 'pkg/TestIfElseTernary1' { 40 77 41 77 42 77 + 43 77 + 44 77 45 81 } @@ -518,20 +666,36 @@ class 'pkg/TestIfElseTernary1' { b 86 c 87 d 87 + e 87 + f 87 10 87 11 87 + 12 87 + 13 87 14 87 15 87 + 16 87 + 17 87 18 87 19 87 + 1a 87 + 1b 87 1f 87 20 87 + 21 87 + 22 87 23 87 24 87 + 25 87 + 26 87 2a 87 2b 87 + 2c 87 + 2d 87 2e 87 2f 87 + 30 87 + 31 87 32 88 36 88 37 89 diff --git a/testData/results/pkg/TestIfElseTernary1J17.dec b/testData/results/pkg/TestIfElseTernary1J17.dec index cb332de55a..285d655323 100644 --- a/testData/results/pkg/TestIfElseTernary1J17.dec +++ b/testData/results/pkg/TestIfElseTernary1J17.dec @@ -123,13 +123,19 @@ class 'pkg/TestIfElseTernary1J17' { method 'test0 (ZIII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 f 4 + 10 4 + 11 4 12 7 13 7 14 7 @@ -142,23 +148,35 @@ class 'pkg/TestIfElseTernary1J17' { 1e 5 1f 5 20 5 + 21 5 + 22 5 23 9 } method 'test1 (ZIII)V' { 0 12 1 12 + 2 12 + 3 12 4 12 5 12 6 12 + 7 12 + 8 12 9 12 a 12 + b 12 + c 12 10 12 11 12 + 12 12 + 13 12 17 12 18 12 19 12 1a 12 + 1b 12 + 1c 12 1d 15 1e 15 1f 15 @@ -171,27 +189,39 @@ class 'pkg/TestIfElseTernary1J17' { 29 13 2a 13 2b 13 + 2c 13 + 2d 13 2e 17 } method 'test2 (ZIII)V' { 0 20 1 20 + 2 20 + 3 20 4 20 5 20 6 20 + 7 20 + 8 20 c 20 d 20 e 20 f 20 + 10 20 + 11 20 12 20 13 20 14 20 15 20 + 16 20 + 17 20 1b 20 1c 20 1d 20 1e 20 + 1f 20 + 20 20 21 23 22 23 23 23 @@ -204,31 +234,47 @@ class 'pkg/TestIfElseTernary1J17' { 2d 21 2e 21 2f 21 + 30 21 + 31 21 32 25 } method 'test3 (ZIII)V' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 6 28 + 7 28 + 8 28 9 28 a 28 + b 28 + c 28 10 28 11 28 + 12 28 + 13 28 17 28 18 28 19 28 1a 28 + 1b 28 + 1c 28 1d 28 1e 28 1f 28 20 28 + 21 28 + 22 28 26 28 27 28 28 28 29 28 + 2a 28 + 2b 28 2c 31 2d 31 2e 31 @@ -241,31 +287,43 @@ class 'pkg/TestIfElseTernary1J17' { 38 29 39 29 3a 29 + 3b 29 + 3c 29 3d 33 } method 'test4 (ZIII)V' { 0 36 1 36 + 2 36 + 3 36 4 36 5 36 6 36 7 36 8 36 9 36 + a 36 + b 36 f 36 10 36 11 36 12 36 13 36 14 36 + 15 36 + 16 36 17 36 18 36 19 36 + 1a 36 + 1b 36 1f 36 20 36 21 36 22 36 + 23 36 + 24 36 25 39 26 39 27 39 @@ -278,35 +336,51 @@ class 'pkg/TestIfElseTernary1J17' { 31 37 32 37 33 37 + 34 37 + 35 37 36 41 } method 'test5 (ZIII)V' { 0 44 1 44 + 2 44 + 3 44 4 44 5 44 6 44 7 44 8 44 9 44 + a 44 + b 44 f 44 10 44 11 44 12 44 13 44 14 44 + 15 44 + 16 44 17 44 18 44 19 44 + 1a 44 + 1b 44 1c 44 1d 44 + 1e 44 + 1f 44 23 44 24 44 + 25 44 + 26 44 2a 44 2b 44 2c 44 2d 44 + 2e 44 + 2f 44 30 47 31 47 32 47 @@ -319,39 +393,55 @@ class 'pkg/TestIfElseTernary1J17' { 3c 45 3d 45 3e 45 + 3f 45 + 40 45 41 49 } method 'test6 (ZIII)V' { 0 52 1 52 + 2 52 + 3 52 4 52 5 52 6 52 7 52 8 52 9 52 + a 52 + b 52 f 52 10 52 11 52 12 52 13 52 14 52 + 15 52 + 16 52 17 52 18 52 19 52 + 1a 52 + 1b 52 1f 52 20 52 21 52 22 52 + 23 52 + 24 52 25 52 26 52 27 52 28 52 + 29 52 + 2a 52 2e 52 2f 52 30 52 31 52 + 32 52 + 33 52 34 55 35 55 36 55 @@ -364,43 +454,63 @@ class 'pkg/TestIfElseTernary1J17' { 40 53 41 53 42 53 + 43 53 + 44 53 45 57 } method 'test7 (ZIII)V' { 0 60 1 60 + 2 60 + 3 60 4 60 5 60 6 60 7 60 8 60 9 60 + a 60 + b 60 f 60 10 60 11 60 12 60 13 60 14 60 + 15 60 + 16 60 17 60 18 60 19 60 + 1a 60 + 1b 60 1c 60 1d 60 + 1e 60 + 1f 60 23 60 24 60 + 25 60 + 26 60 2a 60 2b 60 2c 60 2d 60 + 2e 60 + 2f 60 30 60 31 60 32 60 33 60 + 34 60 + 35 60 39 60 3a 60 3b 60 3c 60 + 3d 60 + 3e 60 3f 63 40 63 41 63 @@ -413,6 +523,8 @@ class 'pkg/TestIfElseTernary1J17' { 4b 61 4c 61 4d 61 + 4e 61 + 4f 61 50 65 } @@ -420,34 +532,50 @@ class 'pkg/TestIfElseTernary1J17' { 0 68 1 68 2 68 + 3 68 + 4 68 5 68 6 68 7 68 8 68 + 9 68 + a 68 b 68 c 68 d 68 + e 68 + f 68 13 68 14 68 15 68 + 16 68 + 17 68 18 68 19 68 1a 68 1b 68 + 1c 68 + 1d 68 1e 68 1f 68 20 68 21 68 22 68 23 68 + 24 68 + 25 68 26 68 27 68 28 68 29 68 2a 68 2b 68 + 2c 68 + 2d 68 31 68 32 68 + 33 68 + 34 68 35 71 36 71 37 71 @@ -460,6 +588,8 @@ class 'pkg/TestIfElseTernary1J17' { 41 69 42 69 43 69 + 44 69 + 45 69 46 73 } @@ -467,33 +597,49 @@ class 'pkg/TestIfElseTernary1J17' { 0 76 1 76 2 76 + 3 76 + 4 76 5 76 6 76 7 76 8 76 + 9 76 + a 76 b 76 c 76 + d 76 + e 76 12 76 13 76 14 76 + 15 76 + 16 76 17 76 18 76 19 76 1a 76 + 1b 76 + 1c 76 1d 76 1e 76 1f 76 20 76 21 76 22 76 + 23 76 + 24 76 25 76 26 76 27 76 28 76 29 76 2a 76 + 2b 76 + 2c 76 30 76 31 76 + 32 76 + 33 76 34 79 35 79 36 79 @@ -506,6 +652,8 @@ class 'pkg/TestIfElseTernary1J17' { 40 77 41 77 42 77 + 43 77 + 44 77 45 81 } @@ -518,20 +666,36 @@ class 'pkg/TestIfElseTernary1J17' { b 86 c 87 d 87 + e 87 + f 87 10 87 11 87 + 12 87 + 13 87 14 87 15 87 + 16 87 + 17 87 18 87 19 87 + 1a 87 + 1b 87 1f 87 20 87 + 21 87 + 22 87 23 87 24 87 + 25 87 + 26 87 2a 87 2b 87 + 2c 87 + 2d 87 2e 87 2f 87 + 30 87 + 31 87 32 88 36 88 37 89 diff --git a/testData/results/pkg/TestIfLoop.dec b/testData/results/pkg/TestIfLoop.dec index 16106e20d1..c9cb49096b 100644 --- a/testData/results/pkg/TestIfLoop.dec +++ b/testData/results/pkg/TestIfLoop.dec @@ -67,27 +67,39 @@ class 'pkg/TestIfLoop' { method 'testCompoundCondition (II)I' { 0 7 1 7 + 2 7 + 3 7 4 7 5 7 6 7 + 7 7 + 8 7 9 8 a 8 + b 8 + c 8 d 9 e 9 f 9 10 9 11 9 12 9 + 13 9 + 14 9 15 9 16 9 17 9 18 9 + 19 9 + 1a 9 1b 10 1c 10 1d 14 1e 14 1f 14 20 14 + 21 14 + 22 14 23 15 24 15 25 15 @@ -104,6 +116,8 @@ class 'pkg/TestIfLoop' { 4 23 5 23 6 23 + 7 23 + 8 23 9 24 a 24 b 24 @@ -112,6 +126,8 @@ class 'pkg/TestIfLoop' { e 24 f 24 10 24 + 11 24 + 12 24 13 28 14 28 15 28 @@ -166,16 +182,24 @@ class 'pkg/TestIfLoop' { 1f 37 20 37 21 37 + 22 37 + 23 37 24 37 25 37 26 37 27 37 + 28 37 + 29 37 2a 37 2b 37 + 2c 37 + 2d 37 2e 37 2f 37 30 37 31 37 + 32 37 + 33 37 35 38 36 38 37 38 @@ -206,10 +230,14 @@ class 'pkg/TestIfLoop' { method 'testElseIf (I)I' { 0 43 1 43 + 2 43 + 3 43 4 44 5 44 6 44 7 44 + 8 44 + 9 44 a 45 b 45 c 45 @@ -217,6 +245,8 @@ class 'pkg/TestIfLoop' { 11 46 12 46 13 46 + 14 46 + 15 46 16 47 17 47 18 47 @@ -224,6 +254,8 @@ class 'pkg/TestIfLoop' { 1d 48 1e 48 1f 48 + 20 48 + 21 48 22 49 23 49 24 49 @@ -231,12 +263,16 @@ class 'pkg/TestIfLoop' { 29 50 2a 50 2b 50 + 2c 50 + 2d 50 2f 51 31 51 35 53 36 53 37 53 38 53 + 39 53 + 3a 53 3b 57 3c 57 3d 57 diff --git a/testData/results/pkg/TestIfPatternMatchMethod.dec b/testData/results/pkg/TestIfPatternMatchMethod.dec index f5cf156a4e..a8332520d4 100644 --- a/testData/results/pkg/TestIfPatternMatchMethod.dec +++ b/testData/results/pkg/TestIfPatternMatchMethod.dec @@ -29,6 +29,8 @@ class 'pkg/TestIfPatternMatchMethod' { 7 4 8 4 9 4 + a 4 + b 4 10 4 11 5 12 5 @@ -40,6 +42,8 @@ class 'pkg/TestIfPatternMatchMethod' { 18 5 19 5 1a 5 + 1b 5 + 1c 5 1d 7 } @@ -52,6 +56,8 @@ class 'pkg/TestIfPatternMatchMethod' { 5 10 6 10 7 10 + 8 10 + 9 10 a 11 b 11 c 11 @@ -70,6 +76,8 @@ class 'pkg/TestIfPatternMatchMethod' { 19 12 1a 12 1b 12 + 1c 12 + 1d 12 1e 14 } @@ -82,10 +90,14 @@ class 'pkg/TestIfPatternMatchMethod' { 5 17 6 17 7 17 + 8 17 + 9 17 a 17 b 17 f 17 10 17 + 11 17 + 12 17 13 17 } } diff --git a/testData/results/pkg/TestIfTernary1.dec b/testData/results/pkg/TestIfTernary1.dec index 1f6bfca8f9..cb40a65496 100644 --- a/testData/results/pkg/TestIfTernary1.dec +++ b/testData/results/pkg/TestIfTernary1.dec @@ -66,240 +66,352 @@ class 'pkg/TestIfTernary1' { method 'test0 (ZIII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 f 4 + 10 4 + 11 4 12 5 13 5 14 5 15 5 16 5 + 17 5 + 18 5 19 7 } method 'test1 (ZIII)V' { 0 10 1 10 + 2 10 + 3 10 4 10 5 10 6 10 + 7 10 + 8 10 9 10 a 10 + b 10 + c 10 10 10 11 10 + 12 10 + 13 10 17 10 18 10 19 10 1a 10 + 1b 10 + 1c 10 1d 11 1e 11 1f 11 20 11 21 11 + 22 11 + 23 11 24 13 } method 'test2 (ZIII)V' { 0 16 1 16 + 2 16 + 3 16 4 16 5 16 6 16 + 7 16 + 8 16 c 16 d 16 e 16 f 16 + 10 16 + 11 16 12 16 13 16 14 16 15 16 + 16 16 + 17 16 1b 16 1c 16 1d 16 1e 16 + 1f 16 + 20 16 21 17 22 17 23 17 24 17 25 17 + 26 17 + 27 17 28 19 } method 'test3 (ZIII)V' { 0 22 1 22 + 2 22 + 3 22 4 22 5 22 6 22 + 7 22 + 8 22 9 22 a 22 + b 22 + c 22 10 22 11 22 + 12 22 + 13 22 17 22 18 22 19 22 1a 22 + 1b 22 + 1c 22 1d 22 1e 22 1f 22 20 22 + 21 22 + 22 22 26 22 27 22 28 22 29 22 + 2a 22 + 2b 22 2c 23 2d 23 2e 23 2f 23 30 23 + 31 23 + 32 23 33 25 } method 'test4 (ZIII)V' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 6 28 7 28 8 28 9 28 + a 28 + b 28 f 28 10 28 11 28 12 28 13 28 14 28 + 15 28 + 16 28 17 28 18 28 19 28 + 1a 28 + 1b 28 1f 28 20 28 21 28 22 28 + 23 28 + 24 28 25 29 26 29 27 29 28 29 29 29 + 2a 29 + 2b 29 2c 31 } method 'test5 (ZIII)V' { 0 34 1 34 + 2 34 + 3 34 4 34 5 34 6 34 7 34 8 34 9 34 + a 34 + b 34 f 34 10 34 11 34 12 34 13 34 14 34 + 15 34 + 16 34 17 34 18 34 19 34 + 1a 34 + 1b 34 1c 34 1d 34 + 1e 34 + 1f 34 23 34 24 34 + 25 34 + 26 34 2a 34 2b 34 2c 34 2d 34 + 2e 34 + 2f 34 30 35 31 35 32 35 33 35 34 35 + 35 35 + 36 35 37 37 } method 'test6 (ZIII)V' { 0 40 1 40 + 2 40 + 3 40 4 40 5 40 6 40 7 40 8 40 9 40 + a 40 + b 40 f 40 10 40 11 40 12 40 13 40 14 40 + 15 40 + 16 40 17 40 18 40 19 40 + 1a 40 + 1b 40 1f 40 20 40 21 40 22 40 + 23 40 + 24 40 25 40 26 40 27 40 28 40 + 29 40 + 2a 40 2e 40 2f 40 30 40 31 40 + 32 40 + 33 40 34 41 35 41 36 41 37 41 38 41 + 39 41 + 3a 41 3b 43 } method 'test7 (ZIII)V' { 0 46 1 46 + 2 46 + 3 46 4 46 5 46 6 46 7 46 8 46 9 46 + a 46 + b 46 f 46 10 46 11 46 12 46 13 46 14 46 + 15 46 + 16 46 17 46 18 46 19 46 + 1a 46 + 1b 46 1c 46 1d 46 + 1e 46 + 1f 46 23 46 24 46 + 25 46 + 26 46 2a 46 2b 46 2c 46 2d 46 + 2e 46 + 2f 46 30 46 31 46 32 46 33 46 + 34 46 + 35 46 39 46 3a 46 3b 46 3c 46 + 3d 46 + 3e 46 3f 47 40 47 41 47 42 47 43 47 + 44 47 + 45 47 46 49 } @@ -307,39 +419,57 @@ class 'pkg/TestIfTernary1' { 0 52 1 52 2 52 + 3 52 + 4 52 5 52 6 52 7 52 8 52 + 9 52 + a 52 b 52 c 52 d 52 + e 52 + f 52 13 52 14 52 15 52 + 16 52 + 17 52 18 52 19 52 1a 52 1b 52 + 1c 52 + 1d 52 1e 52 1f 52 20 52 21 52 22 52 23 52 + 24 52 + 25 52 26 52 27 52 28 52 29 52 2a 52 2b 52 + 2c 52 + 2d 52 31 52 32 52 + 33 52 + 34 52 35 53 36 53 37 53 38 53 39 53 + 3a 53 + 3b 53 3c 55 } @@ -347,38 +477,56 @@ class 'pkg/TestIfTernary1' { 0 58 1 58 2 58 + 3 58 + 4 58 5 58 6 58 7 58 8 58 + 9 58 + a 58 b 58 c 58 + d 58 + e 58 12 58 13 58 14 58 + 15 58 + 16 58 17 58 18 58 19 58 1a 58 + 1b 58 + 1c 58 1d 58 1e 58 1f 58 20 58 21 58 22 58 + 23 58 + 24 58 25 58 26 58 27 58 28 58 29 58 2a 58 + 2b 58 + 2c 58 30 58 31 58 + 32 58 + 33 58 34 59 35 59 36 59 37 59 38 59 + 39 59 + 3a 59 3b 61 } } diff --git a/testData/results/pkg/TestIfTernary1J17.dec b/testData/results/pkg/TestIfTernary1J17.dec index a83f34c950..959f87627d 100644 --- a/testData/results/pkg/TestIfTernary1J17.dec +++ b/testData/results/pkg/TestIfTernary1J17.dec @@ -66,240 +66,352 @@ class 'pkg/TestIfTernary1J17' { method 'test0 (ZIII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 f 4 + 10 4 + 11 4 12 5 13 5 14 5 15 5 16 5 + 17 5 + 18 5 19 7 } method 'test1 (ZIII)V' { 0 10 1 10 + 2 10 + 3 10 4 10 5 10 6 10 + 7 10 + 8 10 9 10 a 10 + b 10 + c 10 10 10 11 10 + 12 10 + 13 10 17 10 18 10 19 10 1a 10 + 1b 10 + 1c 10 1d 11 1e 11 1f 11 20 11 21 11 + 22 11 + 23 11 24 13 } method 'test2 (ZIII)V' { 0 16 1 16 + 2 16 + 3 16 4 16 5 16 6 16 + 7 16 + 8 16 c 16 d 16 e 16 f 16 + 10 16 + 11 16 12 16 13 16 14 16 15 16 + 16 16 + 17 16 1b 16 1c 16 1d 16 1e 16 + 1f 16 + 20 16 21 17 22 17 23 17 24 17 25 17 + 26 17 + 27 17 28 19 } method 'test3 (ZIII)V' { 0 22 1 22 + 2 22 + 3 22 4 22 5 22 6 22 + 7 22 + 8 22 9 22 a 22 + b 22 + c 22 10 22 11 22 + 12 22 + 13 22 17 22 18 22 19 22 1a 22 + 1b 22 + 1c 22 1d 22 1e 22 1f 22 20 22 + 21 22 + 22 22 26 22 27 22 28 22 29 22 + 2a 22 + 2b 22 2c 23 2d 23 2e 23 2f 23 30 23 + 31 23 + 32 23 33 25 } method 'test4 (ZIII)V' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 6 28 7 28 8 28 9 28 + a 28 + b 28 f 28 10 28 11 28 12 28 13 28 14 28 + 15 28 + 16 28 17 28 18 28 19 28 + 1a 28 + 1b 28 1f 28 20 28 21 28 22 28 + 23 28 + 24 28 25 29 26 29 27 29 28 29 29 29 + 2a 29 + 2b 29 2c 31 } method 'test5 (ZIII)V' { 0 34 1 34 + 2 34 + 3 34 4 34 5 34 6 34 7 34 8 34 9 34 + a 34 + b 34 f 34 10 34 11 34 12 34 13 34 14 34 + 15 34 + 16 34 17 34 18 34 19 34 + 1a 34 + 1b 34 1c 34 1d 34 + 1e 34 + 1f 34 23 34 24 34 + 25 34 + 26 34 2a 34 2b 34 2c 34 2d 34 + 2e 34 + 2f 34 30 35 31 35 32 35 33 35 34 35 + 35 35 + 36 35 37 37 } method 'test6 (ZIII)V' { 0 40 1 40 + 2 40 + 3 40 4 40 5 40 6 40 7 40 8 40 9 40 + a 40 + b 40 f 40 10 40 11 40 12 40 13 40 14 40 + 15 40 + 16 40 17 40 18 40 19 40 + 1a 40 + 1b 40 1f 40 20 40 21 40 22 40 + 23 40 + 24 40 25 40 26 40 27 40 28 40 + 29 40 + 2a 40 2e 40 2f 40 30 40 31 40 + 32 40 + 33 40 34 41 35 41 36 41 37 41 38 41 + 39 41 + 3a 41 3b 43 } method 'test7 (ZIII)V' { 0 46 1 46 + 2 46 + 3 46 4 46 5 46 6 46 7 46 8 46 9 46 + a 46 + b 46 f 46 10 46 11 46 12 46 13 46 14 46 + 15 46 + 16 46 17 46 18 46 19 46 + 1a 46 + 1b 46 1c 46 1d 46 + 1e 46 + 1f 46 23 46 24 46 + 25 46 + 26 46 2a 46 2b 46 2c 46 2d 46 + 2e 46 + 2f 46 30 46 31 46 32 46 33 46 + 34 46 + 35 46 39 46 3a 46 3b 46 3c 46 + 3d 46 + 3e 46 3f 47 40 47 41 47 42 47 43 47 + 44 47 + 45 47 46 49 } @@ -307,39 +419,57 @@ class 'pkg/TestIfTernary1J17' { 0 52 1 52 2 52 + 3 52 + 4 52 5 52 6 52 7 52 8 52 + 9 52 + a 52 b 52 c 52 d 52 + e 52 + f 52 13 52 14 52 15 52 + 16 52 + 17 52 18 52 19 52 1a 52 1b 52 + 1c 52 + 1d 52 1e 52 1f 52 20 52 21 52 22 52 23 52 + 24 52 + 25 52 26 52 27 52 28 52 29 52 2a 52 2b 52 + 2c 52 + 2d 52 31 52 32 52 + 33 52 + 34 52 35 53 36 53 37 53 38 53 39 53 + 3a 53 + 3b 53 3c 55 } @@ -347,38 +477,56 @@ class 'pkg/TestIfTernary1J17' { 0 58 1 58 2 58 + 3 58 + 4 58 5 58 6 58 7 58 8 58 + 9 58 + a 58 b 58 c 58 + d 58 + e 58 12 58 13 58 14 58 + 15 58 + 16 58 17 58 18 58 19 58 1a 58 + 1b 58 + 1c 58 1d 58 1e 58 1f 58 20 58 21 58 22 58 + 23 58 + 24 58 25 58 26 58 27 58 28 58 29 58 2a 58 + 2b 58 + 2c 58 30 58 31 58 + 32 58 + 33 58 34 59 35 59 36 59 37 59 38 59 + 39 59 + 3a 59 3b 61 } } diff --git a/testData/results/pkg/TestIfTernary2.dec b/testData/results/pkg/TestIfTernary2.dec index ef4ec0865e..815013b3a8 100644 --- a/testData/results/pkg/TestIfTernary2.dec +++ b/testData/results/pkg/TestIfTernary2.dec @@ -46,8 +46,12 @@ class 'pkg/TestIfTernary2' { method 'test (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 + 6 4 + 7 4 b 4 c 4 d 4 @@ -56,9 +60,13 @@ class 'pkg/TestIfTernary2' { 10 4 14 4 15 4 + 16 4 + 17 4 18 4 19 4 1a 4 + 1b 4 + 1c 4 20 4 21 4 22 4 @@ -69,18 +77,30 @@ class 'pkg/TestIfTernary2' { method 'test1 (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;' { 0 8 1 8 + 2 8 + 3 8 4 8 5 8 + 6 8 + 7 8 b 8 c 8 d 8 + e 8 + f 8 10 9 11 9 + 12 9 + 13 9 14 9 15 9 16 9 + 17 9 + 18 9 1c 9 1d 9 + 1e 9 + 1f 9 20 9 21 9 23 9 @@ -93,28 +113,44 @@ class 'pkg/TestIfTernary2' { method 'test2 (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V' { 0 16 1 16 + 2 16 + 3 16 4 16 5 16 + 6 16 + 7 16 b 16 c 16 d 16 + e 16 + f 16 10 17 11 17 + 12 17 + 13 17 14 17 15 17 16 17 + 17 17 + 18 17 1c 17 1d 17 + 1e 17 + 1f 17 20 18 21 18 22 18 23 18 24 18 + 25 18 + 26 18 27 21 28 21 29 21 2a 21 2b 21 + 2c 21 + 2d 21 2e 24 2f 24 30 24 @@ -128,19 +164,29 @@ class 'pkg/TestIfTernary2' { method 'test3 (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 + 6 28 + 7 28 b 28 c 28 d 28 + e 28 + f 28 10 29 11 29 12 29 13 29 14 29 + 15 29 + 16 29 17 31 18 31 19 31 + 1a 31 + 1b 31 1c 32 1d 32 1e 32 @@ -149,12 +195,16 @@ class 'pkg/TestIfTernary2' { 24 35 25 35 26 35 + 27 35 + 28 35 29 36 2a 36 2b 36 2c 36 2d 36 2e 36 + 2f 36 + 30 36 31 40 32 40 33 40 diff --git a/testData/results/pkg/TestIfTernary3.dec b/testData/results/pkg/TestIfTernary3.dec index d21264f36b..9de62280e3 100644 --- a/testData/results/pkg/TestIfTernary3.dec +++ b/testData/results/pkg/TestIfTernary3.dec @@ -14,6 +14,8 @@ class 'pkg/TestIfTernary3' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 b 4 c 4 10 4 @@ -23,6 +25,8 @@ class 'pkg/TestIfTernary3' { 17 4 18 4 19 4 + 1a 4 + 1b 4 26 4 27 4 2b 4 @@ -32,11 +36,15 @@ class 'pkg/TestIfTernary3' { 32 4 33 4 34 4 + 35 4 + 36 4 37 5 38 5 39 5 3a 5 3b 5 + 3c 5 + 3d 5 3e 8 3f 8 40 8 diff --git a/testData/results/pkg/TestIfTernaryReturn.dec b/testData/results/pkg/TestIfTernaryReturn.dec index 369d02123e..8c9538438b 100644 --- a/testData/results/pkg/TestIfTernaryReturn.dec +++ b/testData/results/pkg/TestIfTernaryReturn.dec @@ -24,12 +24,18 @@ class 'pkg/TestIfTernaryReturn' { method 'test (ZII)I' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 11 4 13 4 } @@ -37,9 +43,13 @@ class 'pkg/TestIfTernaryReturn' { method 'test1 (ZII)I' { 0 8 1 8 + 2 8 + 3 8 4 9 5 9 6 9 + 7 9 + 8 9 9 10 a 10 b 10 @@ -52,6 +62,8 @@ class 'pkg/TestIfTernaryReturn' { 12 13 13 13 14 13 + 15 13 + 16 13 17 14 18 14 19 14 diff --git a/testData/results/pkg/TestIffSimplification.dec b/testData/results/pkg/TestIffSimplification.dec index 1598c23440..aa1020e975 100644 --- a/testData/results/pkg/TestIffSimplification.dec +++ b/testData/results/pkg/TestIffSimplification.dec @@ -34,6 +34,8 @@ class 'pkg/TestIffSimplification' { method 'simpleIff (Z[I)I' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 @@ -46,6 +48,8 @@ class 'pkg/TestIffSimplification' { method 'simpleIf (Z[I)I' { 0 8 1 8 + 2 8 + 3 8 4 8 5 8 6 8 @@ -57,8 +61,12 @@ class 'pkg/TestIffSimplification' { method 'nestedIf (ZZ[I)I' { 0 12 1 12 + 2 12 + 3 12 4 13 5 13 + 6 13 + 7 13 8 13 9 13 a 13 @@ -75,9 +83,13 @@ class 'pkg/TestIffSimplification' { 0 20 1 20 2 20 + 3 20 + 4 20 5 21 6 21 7 21 + 8 21 + 9 21 a 21 e 21 f 21 @@ -85,10 +97,14 @@ class 'pkg/TestIffSimplification' { 11 22 12 22 13 22 + 14 22 + 15 22 16 23 17 23 18 23 19 23 + 1a 23 + 1b 23 1c 23 20 23 21 23 @@ -105,11 +121,15 @@ class 'pkg/TestIffSimplification' { 2c 24 2d 24 2e 24 + 2f 24 + 30 24 31 25 32 25 33 25 34 25 35 25 + 36 25 + 37 25 38 25 3c 25 3d 25 @@ -119,6 +139,8 @@ class 'pkg/TestIffSimplification' { 41 27 42 27 43 27 + 44 27 + 45 27 46 27 4a 27 4b 27 diff --git a/testData/results/pkg/TestIllegalMethodNames.dec b/testData/results/pkg/TestIllegalMethodNames.dec index bc7a0671ea..72044a6801 100644 --- a/testData/results/pkg/TestIllegalMethodNames.dec +++ b/testData/results/pkg/TestIllegalMethodNames.dec @@ -69,6 +69,8 @@ class 'pkg/TestIllegalMethodNames' { 3 17 4 17 5 17 + 6 17 + 7 17 d 17 } diff --git a/testData/results/pkg/TestIllegalVarName.dec b/testData/results/pkg/TestIllegalVarName.dec index c92aaf5c25..0fd8b3f3d5 100644 --- a/testData/results/pkg/TestIllegalVarName.dec +++ b/testData/results/pkg/TestIllegalVarName.dec @@ -5,11 +5,11 @@ import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 1, xi = 48, - d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0007¨\u0006\b"}, - d2 = {"Lpkg/TestIllegalVarName;", "", "()V", "m", "", "this", "enum", "", "vineflower_testDataKotlin"} + d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0016\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\b¨\u0006\t"}, + d2 = {"Lpkg/TestIllegalVarName;", "", "", "()V", "m", "", "this", "enum", "", "vineflower_testDataKotlin"} ) public final class TestIllegalVarName { @NotNull diff --git a/testData/results/pkg/TestInUse.dec b/testData/results/pkg/TestInUse.dec index c053b2122a..682d09ebab 100644 --- a/testData/results/pkg/TestInUse.dec +++ b/testData/results/pkg/TestInUse.dec @@ -47,6 +47,8 @@ class 'pkg/TestInUse' { 13 15 14 15 15 15 + 16 15 + 17 15 18 17 19 17 } diff --git a/testData/results/pkg/TestInfiniteLoop.dec b/testData/results/pkg/TestInfiniteLoop.dec index 4bffbb4f2d..5ac2ac0f87 100644 --- a/testData/results/pkg/TestInfiniteLoop.dec +++ b/testData/results/pkg/TestInfiniteLoop.dec @@ -75,6 +75,8 @@ class 'pkg/TestInfiniteLoop' { 0 29 1 29 2 29 + 3 29 + 4 29 5 32 6 32 } @@ -89,6 +91,8 @@ class 'pkg/TestInfiniteLoop' { 1 43 2 44 3 44 + 4 44 + 5 44 6 45 7 45 } @@ -98,10 +102,14 @@ class 'pkg/TestInfiniteLoop' { 1 53 2 54 3 54 + 4 54 + 5 54 6 55 7 55 8 55 9 56 + a 56 + b 56 f 61 } @@ -110,6 +118,8 @@ class 'pkg/TestInfiniteLoop' { 1 64 2 64 3 65 + 4 65 + 5 65 } } diff --git a/testData/results/pkg/TestInlineAssignments.dec b/testData/results/pkg/TestInlineAssignments.dec index d6bc2bdbb8..7a5d514260 100644 --- a/testData/results/pkg/TestInlineAssignments.dec +++ b/testData/results/pkg/TestInlineAssignments.dec @@ -40,6 +40,8 @@ class 'pkg/TestInlineAssignments' { a 8 b 8 c 8 + d 8 + e 8 14 8 15 8 16 8 @@ -54,6 +56,8 @@ class 'pkg/TestInlineAssignments' { e 13 f 13 10 13 + 11 13 + 12 13 18 13 19 13 1a 13 @@ -69,6 +73,8 @@ class 'pkg/TestInlineAssignments' { 9 18 a 18 b 18 + c 18 + d 18 13 18 14 18 15 18 diff --git a/testData/results/pkg/TestInlineNoSuccessor.dec b/testData/results/pkg/TestInlineNoSuccessor.dec index f3f8927679..e6cbc1d870 100644 --- a/testData/results/pkg/TestInlineNoSuccessor.dec +++ b/testData/results/pkg/TestInlineNoSuccessor.dec @@ -38,6 +38,8 @@ class 'pkg/TestInlineNoSuccessor' { 3 4 4 4 5 4 + 6 4 + 7 4 8 5 9 5 a 5 @@ -47,6 +49,8 @@ class 'pkg/TestInlineNoSuccessor' { e 6 f 6 10 6 + 11 6 + 12 6 13 7 14 7 15 10 @@ -56,6 +60,8 @@ class 'pkg/TestInlineNoSuccessor' { 19 10 1a 10 1b 10 + 1c 10 + 1d 10 1e 14 1f 14 20 14 @@ -63,6 +69,8 @@ class 'pkg/TestInlineNoSuccessor' { 22 14 23 14 24 14 + 25 14 + 26 14 27 15 28 15 29 15 @@ -77,6 +85,8 @@ class 'pkg/TestInlineNoSuccessor' { 32 16 33 16 34 16 + 35 16 + 36 16 37 17 38 17 39 17 @@ -84,11 +94,15 @@ class 'pkg/TestInlineNoSuccessor' { 3b 17 3c 17 3d 17 + 3e 17 + 3f 17 40 21 41 21 42 21 43 21 44 21 + 45 21 + 46 21 47 24 48 24 49 24 diff --git a/testData/results/pkg/TestInlineSwitchExpression1.dec b/testData/results/pkg/TestInlineSwitchExpression1.dec index 5850edc377..9c241b52c2 100644 --- a/testData/results/pkg/TestInlineSwitchExpression1.dec +++ b/testData/results/pkg/TestInlineSwitchExpression1.dec @@ -23,6 +23,42 @@ class 'pkg/TestInlineSwitchExpression1' { 6 6 a 6 b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 2c 6 + 2d 6 + 2e 6 + 2f 6 30 7 31 7 32 7 diff --git a/testData/results/pkg/TestInlineSwitchExpression2.dec b/testData/results/pkg/TestInlineSwitchExpression2.dec index b7f1830cf4..8bfd18f66f 100644 --- a/testData/results/pkg/TestInlineSwitchExpression2.dec +++ b/testData/results/pkg/TestInlineSwitchExpression2.dec @@ -30,12 +30,47 @@ class 'pkg/TestInlineSwitchExpression2' { 5 7 9 7 a 7 + b 7 + c 7 + d 7 + e 7 + f 7 + 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 2d 9 2e 9 2f 9 30 9 32 9 33 11 + 34 11 + 35 11 37 13 38 13 3a 13 diff --git a/testData/results/pkg/TestInlineSwitchExpression3.dec b/testData/results/pkg/TestInlineSwitchExpression3.dec index 1ca443c7b1..60ae7b3a41 100644 --- a/testData/results/pkg/TestInlineSwitchExpression3.dec +++ b/testData/results/pkg/TestInlineSwitchExpression3.dec @@ -19,6 +19,42 @@ class 'pkg/TestInlineSwitchExpression3' { 6 6 a 6 b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 2c 6 + 2d 6 + 2e 6 + 2f 6 30 7 34 8 40 6 diff --git a/testData/results/pkg/TestInlineSwitchExpression4.dec b/testData/results/pkg/TestInlineSwitchExpression4.dec index 556422deef..4dc660ac76 100644 --- a/testData/results/pkg/TestInlineSwitchExpression4.dec +++ b/testData/results/pkg/TestInlineSwitchExpression4.dec @@ -23,13 +23,35 @@ class 'pkg/TestInlineSwitchExpression4' { method 'test (I)Ljava/lang/String;' { 0 5 1 5 + 2 5 + 3 5 4 6 5 6 + 6 6 + 7 6 + 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 10 8 11 8 15 11 16 11 + 17 11 + 18 11 + 19 11 + 1a 11 + 1b 11 + 1c 11 + 1d 11 + 1e 11 + 1f 11 20 13 + 21 13 22 17 } } diff --git a/testData/results/pkg/TestInlineSwitchExpression5.dec b/testData/results/pkg/TestInlineSwitchExpression5.dec index 04c211bae5..a6ff27ea4a 100644 --- a/testData/results/pkg/TestInlineSwitchExpression5.dec +++ b/testData/results/pkg/TestInlineSwitchExpression5.dec @@ -26,11 +26,40 @@ class 'pkg/TestInlineSwitchExpression5' { 2 7 3 7 4 7 + 5 7 + 6 7 + 7 7 + 8 7 + 9 7 + a 7 + b 7 + c 7 + d 7 + e 7 + f 7 + 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 20 8 24 9 25 9 29 10 2a 7 + 2b 7 + 2c 7 2d 15 2e 15 2f 15 diff --git a/testData/results/pkg/TestInlineSwitchExpression6.dec b/testData/results/pkg/TestInlineSwitchExpression6.dec index 3e6c61b35f..fb37dd5448 100644 --- a/testData/results/pkg/TestInlineSwitchExpression6.dec +++ b/testData/results/pkg/TestInlineSwitchExpression6.dec @@ -27,15 +27,35 @@ class 'pkg/TestInlineSwitchExpression6' { 2 6 3 6 4 6 + 5 6 + 6 6 7 7 8 7 9 7 a 9 b 9 + c 9 + d 9 + e 9 + f 9 + 10 9 + 11 9 + 12 9 + 13 9 + 14 9 + 15 9 + 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 1c 10 20 12 21 12 22 12 + 23 12 + 24 12 25 15 26 9 2a 19 @@ -50,4 +70,4 @@ Lines mapping: 10 <-> 11 13 <-> 13 17 <-> 16 -21 <-> 20 \ No newline at end of file +21 <-> 20 diff --git a/testData/results/pkg/TestInlineSwitchExpression7.dec b/testData/results/pkg/TestInlineSwitchExpression7.dec new file mode 100644 index 0000000000..ecd25a2b95 --- /dev/null +++ b/testData/results/pkg/TestInlineSwitchExpression7.dec @@ -0,0 +1,106 @@ +package pkg; + +public enum TestInlineSwitchExpression7 { + A, + B, + C; + + private int get() { + return this.ordinal();// 9 + } + + public int test(TestInlineSwitchExpression7 in) { + return switch (in) {// 13 + case A -> { + int a = this.get();// 15 + yield a + 1;// 16 + } + case B -> { + int b = this.get();// 19 + yield b + 2;// 20 + } + case C -> { + int c = this.get();// 23 + yield c + 3;// 24 + } + }; + } +} + +class 'pkg/TestInlineSwitchExpression7' { + method 'get ()I' { + 0 8 + 1 8 + 2 8 + 3 8 + 4 8 + } + + method 'test (Lpkg/TestInlineSwitchExpression7;)I' { + 3 12 + 7 12 + 8 12 + 9 12 + a 12 + b 12 + c 12 + d 12 + e 12 + f 12 + 10 12 + 11 12 + 12 12 + 13 12 + 14 12 + 15 12 + 16 12 + 17 12 + 18 12 + 19 12 + 1a 12 + 1b 12 + 1c 12 + 1d 12 + 1e 12 + 1f 12 + 20 12 + 21 12 + 22 12 + 23 12 + 24 14 + 25 14 + 26 14 + 27 14 + 28 14 + 29 15 + 2a 15 + 2b 15 + 2f 18 + 30 18 + 31 18 + 32 18 + 33 18 + 34 19 + 35 19 + 36 19 + 3a 22 + 3b 22 + 3c 22 + 3d 22 + 3e 22 + 3f 23 + 40 23 + 41 23 + 4d 12 + } +} + +Lines mapping: +9 <-> 9 +13 <-> 13 +15 <-> 15 +16 <-> 16 +19 <-> 19 +20 <-> 20 +23 <-> 23 +24 <-> 24 diff --git a/testData/results/pkg/TestInnerClasses2J21.dec b/testData/results/pkg/TestInnerClasses2J21.dec new file mode 100644 index 0000000000..3ab76ff5a9 --- /dev/null +++ b/testData/results/pkg/TestInnerClasses2J21.dec @@ -0,0 +1,43 @@ +package pkg; + +public class TestInnerClasses2J21 { + private void test() { + new TestInnerClasses2J21.Inner().new Inner2(true, true);// 5 + }// 6 + + private class Inner { + private class Inner2 { + private Inner2(boolean nonFinal, final boolean finalB) { + TestInnerClasses2J21.this.test();// 11 + }// 12 + } + } +} + +class 'pkg/TestInnerClasses2J21' { + method 'test ()V' { + c 4 + d 4 + 12 5 + } +} + +class 'pkg/TestInnerClasses2J21$Inner$Inner2' { + method ' (Lpkg/TestInnerClasses2J21$Inner;ZZ)V' { + 5 10 + 6 10 + 7 10 + 8 10 + 9 10 + a 10 + b 11 + } +} + +Lines mapping: +5 <-> 5 +6 <-> 6 +11 <-> 11 +12 <-> 12 +Not mapped: +10 diff --git a/testData/results/pkg/TestInnerClasses3J21.dec b/testData/results/pkg/TestInnerClasses3J21.dec new file mode 100644 index 0000000000..204d7edf1f --- /dev/null +++ b/testData/results/pkg/TestInnerClasses3J21.dec @@ -0,0 +1,64 @@ +package pkg; + +public class TestInnerClasses3J21 { + private int i = 0; + + private class Inner { + private int j; + + Inner() { + this(0);// 9 + }// 10 + + Inner(int i) { + this.j = i;// 13 + }// 14 + + private void setI() { + TestInnerClasses3J21.this.i = this.j;// 17 + }// 18 + } +} + +class 'pkg/TestInnerClasses3J21$Inner' { + method ' (Lpkg/TestInnerClasses3J21;)V' { + 2 9 + 3 9 + 4 9 + 5 9 + 6 10 + } + + method ' (Lpkg/TestInnerClasses3J21;I)V' { + 9 13 + a 13 + b 13 + c 13 + d 13 + e 14 + } + + method 'setI ()V' { + 1 17 + 2 17 + 3 17 + 4 17 + 5 17 + 6 17 + 7 17 + 8 17 + 9 17 + a 17 + b 18 + } +} + +Lines mapping: +9 <-> 10 +10 <-> 11 +13 <-> 14 +14 <-> 15 +17 <-> 18 +18 <-> 19 +Not mapped: +12 diff --git a/testData/results/pkg/TestInnerClasses4J21.dec b/testData/results/pkg/TestInnerClasses4J21.dec new file mode 100644 index 0000000000..d73cbddfc4 --- /dev/null +++ b/testData/results/pkg/TestInnerClasses4J21.dec @@ -0,0 +1,21 @@ +package pkg; + +import java.util.List; + +public class TestInnerClasses4J21 { + private class Inner { + Inner(double d, List l) { + }// 9 + } +} + +class 'pkg/TestInnerClasses4J21$Inner' { + method ' (Lpkg/TestInnerClasses4J21;DLjava/util/List;)V' { + 4 7 + } +} + +Lines mapping: +9 <-> 8 +Not mapped: +7 diff --git a/testData/results/pkg/TestInnerClassesJ21.dec b/testData/results/pkg/TestInnerClassesJ21.dec index 98eebf7bde..2876b8d701 100644 --- a/testData/results/pkg/TestInnerClassesJ21.dec +++ b/testData/results/pkg/TestInnerClassesJ21.dec @@ -10,7 +10,7 @@ public class TestInnerClassesJ21 { private final long z; private final String v; - public TestInner(int param2, long param3, String param5) { + public TestInner(int x, long z, String v) { this.x = x;// 11 this.z = z;// 12 this.v = v;// 13 @@ -61,4 +61,4 @@ Lines mapping: 18 <-> 5 19 <-> 6 Not mapped: -9 \ No newline at end of file +9 diff --git a/testData/results/pkg/TestInstanceGeneric.dec b/testData/results/pkg/TestInstanceGeneric.dec index 4c0731f74f..8687f31e27 100644 --- a/testData/results/pkg/TestInstanceGeneric.dec +++ b/testData/results/pkg/TestInstanceGeneric.dec @@ -43,4 +43,4 @@ Lines mapping: 9 <-> 8 13 <-> 12 15 <-> 13 -16 <-> 14 \ No newline at end of file +16 <-> 14 diff --git a/testData/results/pkg/TestIntBoolMerge.dec b/testData/results/pkg/TestIntBoolMerge.dec index 7eaf0599da..e14685a0e8 100644 --- a/testData/results/pkg/TestIntBoolMerge.dec +++ b/testData/results/pkg/TestIntBoolMerge.dec @@ -74,6 +74,8 @@ class 'pkg/TestIntBoolMerge' { e 17 f 17 10 17 + 11 17 + 12 17 13 18 14 18 15 18 @@ -128,4 +130,4 @@ Lines mapping: 28 <-> 27 29 <-> 28 33 <-> 31 -37 <-> 34 \ No newline at end of file +37 <-> 34 diff --git a/testData/results/pkg/TestInvertedFloatComparison.dec b/testData/results/pkg/TestInvertedFloatComparison.dec index 6fc3e9f26e..e7d4f2d2b4 100644 --- a/testData/results/pkg/TestInvertedFloatComparison.dec +++ b/testData/results/pkg/TestInvertedFloatComparison.dec @@ -72,6 +72,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 4 2 4 3 4 + 4 4 + 5 4 b 4 } @@ -79,6 +81,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 8 1 8 2 8 + 3 8 + 4 8 a 8 } @@ -87,6 +91,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 12 2 12 3 12 + 4 12 + 5 12 b 12 } @@ -94,6 +100,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 16 1 16 2 16 + 3 16 + 4 16 a 16 } @@ -102,6 +110,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 20 2 20 3 20 + 4 20 + 5 20 b 20 } @@ -109,6 +119,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 24 1 24 2 24 + 3 24 + 4 24 a 24 } @@ -117,6 +129,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 28 2 28 3 28 + 4 28 + 5 28 b 28 } @@ -124,6 +138,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 32 1 32 2 32 + 3 32 + 4 32 a 32 } @@ -132,6 +148,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 36 2 36 3 36 + 4 36 + 5 36 b 36 } @@ -139,6 +157,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 40 1 40 2 40 + 3 40 + 4 40 a 40 } @@ -147,6 +167,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 44 2 44 3 44 + 4 44 + 5 44 b 44 } @@ -154,6 +176,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 48 1 48 2 48 + 3 48 + 4 48 a 48 } @@ -162,6 +186,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 52 2 52 3 52 + 4 52 + 5 52 b 52 } @@ -169,6 +195,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 56 1 56 2 56 + 3 56 + 4 56 a 56 } @@ -177,6 +205,8 @@ class 'pkg/TestInvertedFloatComparison' { 1 60 2 60 3 60 + 4 60 + 5 60 b 60 } @@ -184,6 +214,8 @@ class 'pkg/TestInvertedFloatComparison' { 0 64 1 64 2 64 + 3 64 + 4 64 a 64 } } diff --git a/testData/results/pkg/TestIrreducible.dec b/testData/results/pkg/TestIrreducible.dec index 32585643b4..e95957de17 100644 --- a/testData/results/pkg/TestIrreducible.dec +++ b/testData/results/pkg/TestIrreducible.dec @@ -31,6 +31,8 @@ class 'pkg/TestIrreducible' { 2 7 3 7 4 7 + 5 7 + 6 7 a 10 b 10 c 10 @@ -43,24 +45,32 @@ class 'pkg/TestIrreducible' { 13 11 14 11 15 11 + 16 11 + 17 11 1b 12 1c 12 1d 12 1e 12 1f 12 20 12 + 21 12 + 22 12 23 20 24 20 25 20 26 20 27 20 28 20 + 29 20 + 2a 20 2b 14 2c 14 2d 14 2e 14 2f 14 30 14 + 31 14 + 32 14 33 19 34 19 35 19 diff --git a/testData/results/pkg/TestIterationOverGenericsWithoutLvt.dec b/testData/results/pkg/TestIterationOverGenericsWithoutLvt.dec index 4b905f9082..583784a070 100644 --- a/testData/results/pkg/TestIterationOverGenericsWithoutLvt.dec +++ b/testData/results/pkg/TestIterationOverGenericsWithoutLvt.dec @@ -75,6 +75,8 @@ class 'pkg/TestIterationOverGenericsWithoutLvt' { 21 10 22 10 23 10 + 24 10 + 25 10 26 11 27 11 28 11 @@ -186,6 +188,8 @@ class 'pkg/TestIterationOverGenericsWithoutLvt' { 1c 35 1d 36 1e 36 + 1f 36 + 20 36 21 37 22 37 23 37 @@ -202,8 +206,11 @@ class 'pkg/TestIterationOverGenericsWithoutLvt' { 31 40 32 40 33 40 + 34 40 + 35 40 36 40 3a 40 + 3b 40 3c 40 40 44 41 44 diff --git a/testData/results/pkg/TestItrLoop.dec b/testData/results/pkg/TestItrLoop.dec index b60de97483..4e6b1a816b 100644 --- a/testData/results/pkg/TestItrLoop.dec +++ b/testData/results/pkg/TestItrLoop.dec @@ -148,4 +148,4 @@ Not mapped: 14 20 26 -32 \ No newline at end of file +32 diff --git a/testData/results/pkg/TestKotlinConstructorKt.dec b/testData/results/pkg/TestKotlinConstructorKt.dec index f52df664a1..a3a0498657 100644 --- a/testData/results/pkg/TestKotlinConstructorKt.dec +++ b/testData/results/pkg/TestKotlinConstructorKt.dec @@ -5,31 +5,29 @@ import java.util.Collection; import java.util.List; import kotlin.Metadata; import kotlin.collections.CollectionsKt; +import kotlin.jvm.internal.Intrinsics; +import kotlin.jvm.internal.SourceDebugExtension; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 2, xi = 48, d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u001e\n\u0002\u0010\u000e\n\u0000\u001a\u001e\u0010\u0000\u001a\b\u0012\u0004\u0012\u00020\u00020\u00012\u000e\u0010\u0003\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00050\u0004H\u0002¨\u0006\u0006"}, d2 = {"foo", "", "Lpkg/Mapping;", "list", "", "", "vineflower_testDataKotlin"} ) +@SourceDebugExtension({"SMAP\nTestKotlinConstructor.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TestKotlinConstructor.kt\npkg/TestKotlinConstructorKt\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,11:1\n1557#2:12\n1628#2,3:13\n*S KotlinDebug\n*F\n+ 1 TestKotlinConstructor.kt\npkg/TestKotlinConstructorKt\n*L\n4#1:12\n4#1:13,3\n*E\n"}) public final class TestKotlinConstructorKt { private static final List foo(Collection list) { Iterable $this$map$iv = list; int $i$f$map = 0; - Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10)); + var destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10)); int $i$f$mapTo = 0; for (Object item$iv$iv : $this$map$iv) {// 12 13 String it = (String)item$iv$iv; int $i$a$-map-TestKotlinConstructorKt$foo$1 = 0; - Mapping var10000 = new Mapping; - if (it == null) {// 5 - throw new NullPointerException("null cannot be cast to non-null type kotlin.String"); - } - - var10000./* $VF: Unable to resugar constructor */(it); - destination$iv$iv.add(var10000);// 14 + Intrinsics.checkNotNull(it, "null cannot be cast to non-null type kotlin.String");// 5 + destination$iv$iv.add(new Mapping(it));// 14 } return CollectionsKt.toList(destination$iv$iv);// 4 6 15 @@ -38,93 +36,90 @@ public final class TestKotlinConstructorKt { class 'pkg/TestKotlinConstructorKt' { method 'foo (Ljava/util/Collection;)Ljava/util/List;' { - 0 17 - 1 17 - 2 17 - 3 17 - 4 17 - 5 18 - 6 18 - 7 22 - d 19 - e 19 - f 19 - 10 19 - 11 19 - 12 19 - 16 19 - 17 19 - 18 19 - 19 19 - 1a 19 - 1b 20 - 1c 20 - 1d 20 - 1e 22 - 1f 22 - 20 22 - 21 22 - 22 22 - 23 22 - 24 22 - 25 22 - 30 22 - 31 22 - 32 22 - 33 22 - 34 22 - 35 22 - 36 22 - 37 22 - 38 22 - 39 31 - 3a 31 - 3b 23 - 3c 23 - 3d 23 - 3e 23 - 3f 23 - 40 23 - 41 23 - 44 24 - 45 24 - 46 24 - 4b 26 - 4c 26 - 4e 26 - 56 27 - 57 27 - 5b 27 - 5c 30 - 5d 30 - 5e 30 - 5f 31 - 60 31 - 62 31 - 63 31 - 64 31 - 65 31 - 66 31 - 6b 34 - 6c 34 - 6d 34 - 6e 34 - 6f 34 - 71 34 - 72 34 - 73 34 - 74 34 - 75 34 - 76 34 - 77 34 + 0 20 + 1 20 + 2 20 + 3 20 + 4 20 + 5 21 + 6 21 + 7 25 + d 22 + e 22 + f 22 + 10 22 + 11 22 + 12 22 + 16 22 + 17 22 + 18 22 + 19 22 + 1a 22 + 1b 23 + 1c 23 + 1d 23 + 1e 25 + 1f 25 + 20 25 + 21 25 + 22 25 + 23 25 + 24 25 + 25 25 + 30 25 + 31 25 + 32 25 + 33 25 + 34 25 + 35 25 + 36 25 + 37 25 + 38 25 + 39 29 + 3a 29 + 3b 26 + 3c 26 + 3d 26 + 3e 26 + 3f 26 + 40 26 + 41 26 + 44 27 + 45 27 + 46 27 + 4b 28 + 4c 28 + 4d 28 + 4e 28 + 4f 28 + 50 28 + 51 28 + 52 29 + 53 29 + 57 29 + 58 29 + 5a 29 + 5b 29 + 5c 29 + 5d 29 + 5e 29 + 63 32 + 64 32 + 69 32 + 6a 32 + 6b 32 + 6c 32 + 6d 32 + 6e 32 + 6f 32 } } Lines mapping: -4 <-> 35 -5 <-> 27 -6 <-> 35 -12 <-> 23 -13 <-> 23 -14 <-> 32 -15 <-> 35 +4 <-> 33 +5 <-> 29 +6 <-> 33 +12 <-> 26 +13 <-> 26 +14 <-> 30 +15 <-> 33 diff --git a/testData/results/pkg/TestKotlinEnumWhen.dec b/testData/results/pkg/TestKotlinEnumWhen.dec index f66da1dbcc..4093f0ccda 100644 --- a/testData/results/pkg/TestKotlinEnumWhen.dec +++ b/testData/results/pkg/TestKotlinEnumWhen.dec @@ -3,13 +3,15 @@ package pkg; import kotlin.DeprecationLevel; import kotlin.Metadata; import kotlin.NoWhenBranchMatchedException; +import kotlin.enums.EnumEntries; +import org.jetbrains.annotations.NotNull; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 1, xi = 48, - d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\b\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0003\u001a\u00020\u0004J\u0006\u0010\u0005\u001a\u00020\u0004J\u0006\u0010\u0006\u001a\u00020\u0004J\u0006\u0010\u0007\u001a\u00020\u0004J\u0006\u0010\b\u001a\u00020\u0004j\u0002\b\tj\u0002\b\nj\u0002\b\u000b¨\u0006\f"}, - d2 = {"Lpkg/TestKotlinEnumWhen;", "", "(Ljava/lang/String;I)V", "testAnotherEnum", "", "testConsecutive", "testConsecutiveMixed", "testExpression", "testStatement", "FIRST", "SECOND", "THIRD", "vineflower_testDataKotlin"} + d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0005\b\u0086\u0081\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0006\u0010\u0007\u001a\u00020\bJ\u0006\u0010\t\u001a\u00020\bJ\u0006\u0010\n\u001a\u00020\bJ\u0006\u0010\u000b\u001a\u00020\bJ\u0006\u0010\f\u001a\u00020\bj\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006¨\u0006\r"}, + d2 = {"Lpkg/TestKotlinEnumWhen;", "", "", "(Ljava/lang/String;I)V", "FIRST", "SECOND", "THIRD", "testStatement", "", "testExpression", "testAnotherEnum", "testConsecutive", "testConsecutiveMixed", "vineflower_testDataKotlin"} ) public enum TestKotlinEnumWhen { FIRST, @@ -26,26 +28,19 @@ public enum TestKotlinEnumWhen { break; case THIRD: System.out.println("third!");// 10 - } - }// 12 - - public final void testExpression() { - String var10000; - switch (this) {// 16 - case FIRST: - var10000 = "first!";// 17 - break; - case SECOND: - var10000 = "second!";// 18 - break; - case THIRD: - var10000 = "third!";// 19 break; default: throw new NoWhenBranchMatchedException(); } + }// 12 - String var1 = var10000; + public final void testExpression() { + String var1 = switch (this) {// 16 + case FIRST -> "first!";// 17 + case SECOND -> "second!";// 18 + case THIRD -> "third!";// 19 + default -> throw new NoWhenBranchMatchedException(); + }; System.out.println(var1);// 15 }// 22 @@ -60,6 +55,9 @@ public enum TestKotlinEnumWhen { break; case HIDDEN: System.out.println("hidden " + level);// 31 + break; + default: + throw new NoWhenBranchMatchedException(); } }// 33 @@ -73,6 +71,9 @@ public enum TestKotlinEnumWhen { break; case THIRD: System.out.println("third!");// 39 + break; + default: + throw new NoWhenBranchMatchedException(); } switch (this) {// 42 @@ -84,11 +85,14 @@ public enum TestKotlinEnumWhen { break; case THIRD: System.out.println("third, again!");// 45 + break; + default: + throw new NoWhenBranchMatchedException(); } }// 47 public final void testConsecutiveMixed() { - DeprecationLevel level = testConsecutiveMixed$getLevel-0();// 53 + DeprecationLevel level = testConsecutiveMixed$getLevel$0();// 53 switch (level) { case WARNING: System.out.println("warning " + level);// 54 @@ -98,6 +102,9 @@ public enum TestKotlinEnumWhen { break; case HIDDEN: System.out.println("hidden " + level);// 56 + break; + default: + throw new NoWhenBranchMatchedException(); } switch (this) {// 59 @@ -109,297 +116,518 @@ public enum TestKotlinEnumWhen { break; case THIRD: System.out.println("third!");// 62 + break; + default: + throw new NoWhenBranchMatchedException(); } }// 64 + @NotNull + public static EnumEntries getEntries() { + return $ENTRIES;// 65 + } + private static final DeprecationLevel testAnotherEnum$getLevel() { throw new Exception();// 26 } - private static final DeprecationLevel testConsecutiveMixed$getLevel_0/* $VF was: testConsecutiveMixed$getLevel-0*/() { + private static final DeprecationLevel testConsecutiveMixed$getLevel$0() { throw new Exception();// 51 } } class 'pkg/TestKotlinEnumWhen' { method 'testStatement ()V' { - 0 19 - 8 19 - 9 19 - 24 21 - 25 21 - 26 21 - 27 21 - 28 21 - 2a 21 - 2b 21 - 2c 21 - 2d 22 - 30 24 - 31 24 - 32 24 - 33 24 - 34 24 - 36 24 - 37 24 - 38 24 - 39 25 - 3c 27 - 3d 27 - 3e 27 - 3f 27 - 40 27 - 42 27 - 45 29 + 0 21 + 8 21 + 9 21 + a 21 + b 21 + c 21 + d 21 + e 21 + f 21 + 10 21 + 11 21 + 12 21 + 13 21 + 14 21 + 15 21 + 16 21 + 17 21 + 18 21 + 19 21 + 1a 21 + 1b 21 + 1c 21 + 1d 21 + 1e 21 + 1f 21 + 20 21 + 21 21 + 22 21 + 23 21 + 24 23 + 25 23 + 26 23 + 27 23 + 28 23 + 2a 23 + 2b 23 + 2c 23 + 2d 24 + 30 26 + 31 26 + 32 26 + 33 26 + 34 26 + 36 26 + 37 26 + 38 26 + 39 27 + 3c 29 + 3d 29 + 3e 29 + 3f 29 + 40 29 + 42 29 + 43 29 + 44 29 + 45 30 + 4f 32 + 50 34 } method 'testExpression ()V' { - 0 33 - 8 33 - 9 33 - 24 35 - 25 35 - 26 36 - 29 38 - 2a 38 - 2b 39 - 2e 41 - 2f 41 - 30 42 - 3a 44 - 3b 47 - 3c 48 - 3d 48 - 3e 48 - 3f 48 - 40 48 - 41 48 - 42 48 - 43 49 + 0 37 + 8 37 + 9 37 + a 37 + b 37 + c 37 + d 37 + e 37 + f 37 + 10 37 + 11 37 + 12 37 + 13 37 + 14 37 + 15 37 + 16 37 + 17 37 + 18 37 + 19 37 + 1a 37 + 1b 37 + 1c 37 + 1d 37 + 1e 37 + 1f 37 + 20 37 + 21 37 + 22 37 + 23 37 + 24 38 + 25 38 + 29 39 + 2a 39 + 2e 40 + 2f 40 + 3a 41 + 3b 37 + 3c 43 + 3d 43 + 3e 43 + 3f 43 + 40 43 + 41 43 + 42 43 + 43 44 } method 'testAnotherEnum ()V' { - 0 52 - 1 52 - 2 52 - 3 52 - 7 53 - b 53 - c 53 - 28 55 - 29 55 - 2a 55 - 2b 55 - 2c 55 - 2d 55 - 2e 55 - 2f 55 - 30 55 - 32 55 - 33 55 - 34 55 - 35 56 - 38 58 - 39 58 - 3a 58 - 3b 58 - 3c 58 - 3d 58 - 3e 58 - 3f 58 - 40 58 - 42 58 - 43 58 - 44 58 - 45 59 - 48 61 - 49 61 - 4a 61 - 4b 61 - 4c 61 - 4d 61 - 4e 61 - 4f 61 - 50 61 - 52 61 - 55 63 + 0 47 + 1 47 + 2 47 + 3 47 + 7 48 + b 48 + c 48 + d 48 + e 48 + f 48 + 10 48 + 11 48 + 12 48 + 13 48 + 14 48 + 15 48 + 16 48 + 17 48 + 18 48 + 19 48 + 1a 48 + 1b 48 + 1c 48 + 1d 48 + 1e 48 + 1f 48 + 20 48 + 21 48 + 22 48 + 23 48 + 24 48 + 25 48 + 26 48 + 27 48 + 28 50 + 29 50 + 2a 50 + 2b 50 + 2c 50 + 2d 50 + 2e 50 + 2f 50 + 30 50 + 32 50 + 33 50 + 34 50 + 35 51 + 38 53 + 39 53 + 3a 53 + 3b 53 + 3c 53 + 3d 53 + 3e 53 + 3f 53 + 40 53 + 42 53 + 43 53 + 44 53 + 45 54 + 48 56 + 49 56 + 4a 56 + 4b 56 + 4c 56 + 4d 56 + 4e 56 + 4f 56 + 50 56 + 52 56 + 53 56 + 54 56 + 55 57 + 5f 59 + 60 61 } method 'testConsecutive ()V' { - 0 66 - 8 66 - 9 66 - 24 68 - 25 68 - 26 68 - 27 68 - 28 68 - 2a 68 - 2b 68 - 2c 68 - 2d 69 - 30 71 - 31 71 - 32 71 - 33 71 - 34 71 - 36 71 - 37 71 - 38 71 - 39 72 - 3c 74 - 3d 74 - 3e 74 - 3f 74 - 40 74 - 42 74 - 45 77 - 4d 77 - 4e 77 - 68 79 - 69 79 - 6a 79 - 6b 79 - 6c 79 - 6e 79 - 6f 79 - 70 79 - 71 80 - 74 82 - 75 82 - 76 82 - 77 82 - 78 82 - 7a 82 - 7b 82 - 7c 82 - 7d 83 - 80 85 - 81 85 - 82 85 - 83 85 - 84 85 - 86 85 - 89 87 + 0 64 + 8 64 + 9 64 + a 64 + b 64 + c 64 + d 64 + e 64 + f 64 + 10 64 + 11 64 + 12 64 + 13 64 + 14 64 + 15 64 + 16 64 + 17 64 + 18 64 + 19 64 + 1a 64 + 1b 64 + 1c 64 + 1d 64 + 1e 64 + 1f 64 + 20 64 + 21 64 + 22 64 + 23 64 + 24 66 + 25 66 + 26 66 + 27 66 + 28 66 + 2a 66 + 2b 66 + 2c 66 + 2d 67 + 30 69 + 31 69 + 32 69 + 33 69 + 34 69 + 36 69 + 37 69 + 38 69 + 39 70 + 3c 72 + 3d 72 + 3e 72 + 3f 72 + 40 72 + 42 72 + 43 72 + 44 72 + 45 73 + 4f 75 + 50 78 + 58 78 + 59 78 + 5a 78 + 5b 78 + 5c 78 + 5d 78 + 5e 78 + 5f 78 + 60 78 + 61 78 + 62 78 + 63 78 + 64 78 + 65 78 + 66 78 + 67 78 + 68 78 + 69 78 + 6a 78 + 6b 78 + 6c 78 + 6d 78 + 6e 78 + 6f 78 + 70 78 + 71 78 + 72 78 + 73 78 + 74 80 + 75 80 + 76 80 + 77 80 + 78 80 + 7a 80 + 7b 80 + 7c 80 + 7d 81 + 80 83 + 81 83 + 82 83 + 83 83 + 84 83 + 86 83 + 87 83 + 88 83 + 89 84 + 8c 86 + 8d 86 + 8e 86 + 8f 86 + 90 86 + 92 86 + 93 86 + 94 86 + 95 87 + 9f 89 + a0 91 } method 'testConsecutiveMixed ()V' { - 0 90 - 1 90 - 2 90 - 3 90 - 7 91 - b 91 - c 91 - 28 93 - 29 93 - 2a 93 - 2b 93 - 2c 93 - 2d 93 - 2e 93 - 2f 93 - 30 93 - 32 93 - 33 93 - 34 93 - 35 94 - 38 96 - 39 96 - 3a 96 - 3b 96 - 3c 96 - 3d 96 - 3e 96 - 3f 96 - 40 96 - 42 96 - 43 96 - 44 96 - 45 97 - 48 99 - 49 99 - 4a 99 - 4b 99 - 4c 99 - 4d 99 - 4e 99 - 4f 99 - 50 99 - 52 99 - 55 102 - 5d 102 - 5e 102 - 78 104 - 79 104 - 7a 104 - 7b 104 - 7c 104 - 7e 104 - 7f 104 - 80 104 - 81 105 - 84 107 - 85 107 - 86 107 - 87 107 - 88 107 - 8a 107 - 8b 107 - 8c 107 - 8d 108 - 90 110 - 91 110 - 92 110 - 93 110 - 94 110 - 96 110 - 99 112 + 0 94 + 1 94 + 2 94 + 3 94 + 7 95 + b 95 + c 95 + d 95 + e 95 + f 95 + 10 95 + 11 95 + 12 95 + 13 95 + 14 95 + 15 95 + 16 95 + 17 95 + 18 95 + 19 95 + 1a 95 + 1b 95 + 1c 95 + 1d 95 + 1e 95 + 1f 95 + 20 95 + 21 95 + 22 95 + 23 95 + 24 95 + 25 95 + 26 95 + 27 95 + 28 97 + 29 97 + 2a 97 + 2b 97 + 2c 97 + 2d 97 + 2e 97 + 2f 97 + 30 97 + 32 97 + 33 97 + 34 97 + 35 98 + 38 100 + 39 100 + 3a 100 + 3b 100 + 3c 100 + 3d 100 + 3e 100 + 3f 100 + 40 100 + 42 100 + 43 100 + 44 100 + 45 101 + 48 103 + 49 103 + 4a 103 + 4b 103 + 4c 103 + 4d 103 + 4e 103 + 4f 103 + 50 103 + 52 103 + 53 103 + 54 103 + 55 104 + 5f 106 + 60 109 + 68 109 + 69 109 + 6a 109 + 6b 109 + 6c 109 + 6d 109 + 6e 109 + 6f 109 + 70 109 + 71 109 + 72 109 + 73 109 + 74 109 + 75 109 + 76 109 + 77 109 + 78 109 + 79 109 + 7a 109 + 7b 109 + 7c 109 + 7d 109 + 7e 109 + 7f 109 + 80 109 + 81 109 + 82 109 + 83 109 + 84 111 + 85 111 + 86 111 + 87 111 + 88 111 + 8a 111 + 8b 111 + 8c 111 + 8d 112 + 90 114 + 91 114 + 92 114 + 93 114 + 94 114 + 96 114 + 97 114 + 98 114 + 99 115 + 9c 117 + 9d 117 + 9e 117 + 9f 117 + a0 117 + a2 117 + a3 117 + a4 117 + a5 118 + af 120 + b0 122 + } + + method 'getEntries ()Lkotlin/enums/EnumEntries;' { + 0 126 + 1 126 + 2 126 + 3 126 } method 'testAnotherEnum$getLevel ()Lkotlin/DeprecationLevel;' { - 7 115 + 7 130 } - method 'testConsecutiveMixed$getLevel-0 ()Lkotlin/DeprecationLevel;' { - 7 119 + method 'testConsecutiveMixed$getLevel$0 ()Lkotlin/DeprecationLevel;' { + 7 134 } } Lines mapping: -7 <-> 20 -8 <-> 22 -9 <-> 25 -10 <-> 28 -12 <-> 30 -15 <-> 49 -16 <-> 34 -17 <-> 36 -18 <-> 39 -19 <-> 42 -22 <-> 50 -26 <-> 116 -28 <-> 53 -29 <-> 56 -30 <-> 59 -31 <-> 62 -33 <-> 64 -36 <-> 67 -37 <-> 69 -38 <-> 72 -39 <-> 75 -42 <-> 78 -43 <-> 80 -44 <-> 83 -45 <-> 86 -47 <-> 88 -51 <-> 120 -53 <-> 91 -54 <-> 94 -55 <-> 97 -56 <-> 100 -59 <-> 103 -60 <-> 105 -61 <-> 108 -62 <-> 111 -64 <-> 113 +7 <-> 22 +8 <-> 24 +9 <-> 27 +10 <-> 30 +12 <-> 35 +15 <-> 44 +16 <-> 38 +17 <-> 39 +18 <-> 40 +19 <-> 41 +22 <-> 45 +26 <-> 131 +28 <-> 48 +29 <-> 51 +30 <-> 54 +31 <-> 57 +33 <-> 62 +36 <-> 65 +37 <-> 67 +38 <-> 70 +39 <-> 73 +42 <-> 79 +43 <-> 81 +44 <-> 84 +45 <-> 87 +47 <-> 92 +51 <-> 135 +53 <-> 95 +54 <-> 98 +55 <-> 101 +56 <-> 104 +59 <-> 110 +60 <-> 112 +61 <-> 115 +62 <-> 118 +64 <-> 123 +65 <-> 127 diff --git a/testData/results/pkg/TestLabeledBreaks.dec b/testData/results/pkg/TestLabeledBreaks.dec index ebbe8b89c3..e4db8290f0 100644 --- a/testData/results/pkg/TestLabeledBreaks.dec +++ b/testData/results/pkg/TestLabeledBreaks.dec @@ -63,12 +63,16 @@ class 'pkg/TestLabeledBreaks' { 8 5 9 5 a 5 + b 5 + c 5 10 6 11 6 12 6 13 6 14 6 15 6 + 16 6 + 17 6 18 8 } @@ -78,6 +82,8 @@ class 'pkg/TestLabeledBreaks' { 2 14 3 14 4 14 + 5 14 + 6 14 7 15 8 15 9 15 @@ -89,9 +95,13 @@ class 'pkg/TestLabeledBreaks' { f 16 10 16 11 16 + 12 16 + 13 16 17 20 18 20 19 20 + 1a 20 + 1b 20 1f 21 20 21 21 21 @@ -110,6 +120,8 @@ class 'pkg/TestLabeledBreaks' { 30 27 31 27 32 27 + 33 27 + 34 27 35 31 36 31 37 31 @@ -127,6 +139,8 @@ class 'pkg/TestLabeledBreaks' { 2 35 3 35 4 35 + 5 35 + 6 35 7 36 8 36 9 36 @@ -138,15 +152,21 @@ class 'pkg/TestLabeledBreaks' { f 37 10 37 11 37 + 12 37 + 13 37 17 38 18 38 19 38 + 1a 38 + 1b 38 1f 42 20 42 21 42 22 42 23 42 24 42 + 25 42 + 26 42 27 45 28 45 29 45 diff --git a/testData/results/pkg/TestLambdaGenericCall.dec b/testData/results/pkg/TestLambdaGenericCall.dec index a0ca6b0985..cbf16e2c0e 100644 --- a/testData/results/pkg/TestLambdaGenericCall.dec +++ b/testData/results/pkg/TestLambdaGenericCall.dec @@ -144,4 +144,4 @@ Lines mapping: 26 <-> 22 28 <-> 23 29 <-> 24 -30 <-> 25 \ No newline at end of file +30 <-> 25 diff --git a/testData/results/pkg/TestLambdaLocalCapture.dec b/testData/results/pkg/TestLambdaLocalCapture.dec index 1f45cba447..1cbdb0db48 100644 --- a/testData/results/pkg/TestLambdaLocalCapture.dec +++ b/testData/results/pkg/TestLambdaLocalCapture.dec @@ -38,6 +38,8 @@ class 'pkg/TestLambdaLocalCapture' { a 6 b 6 c 6 + d 6 + e 6 f 7 10 7 11 7 @@ -46,6 +48,8 @@ class 'pkg/TestLambdaLocalCapture' { 14 7 15 7 16 7 + 17 7 + 18 7 19 8 1a 8 1b 8 diff --git a/testData/results/pkg/TestListEquals.dec b/testData/results/pkg/TestListEquals.dec index 3ab984dcbd..1db590f6f2 100644 --- a/testData/results/pkg/TestListEquals.dec +++ b/testData/results/pkg/TestListEquals.dec @@ -19,6 +19,8 @@ class 'pkg/TestListEquals' { 2 7 3 7 4 7 + 5 7 + 6 7 c 7 } } diff --git a/testData/results/pkg/TestLocalClassesSwitch.dec b/testData/results/pkg/TestLocalClassesSwitch.dec index 4af2914873..6b5b4b35e9 100644 --- a/testData/results/pkg/TestLocalClassesSwitch.dec +++ b/testData/results/pkg/TestLocalClassesSwitch.dec @@ -89,9 +89,29 @@ class 'pkg/TestLocalClassesSwitch' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 1c 12 1d 13 1e 13 + 1f 13 + 20 13 29 22 2a 23 2b 23 @@ -103,6 +123,32 @@ class 'pkg/TestLocalClassesSwitch' { method 'test1 (I)V' { 0 29 1 29 + 2 29 + 3 29 + 4 29 + 5 29 + 6 29 + 7 29 + 8 29 + 9 29 + a 29 + b 29 + c 29 + d 29 + e 29 + f 29 + 10 29 + 11 29 + 12 29 + 13 29 + 14 29 + 15 29 + 16 29 + 17 29 + 18 29 + 19 29 + 1a 29 + 1b 29 24 37 25 38 26 38 @@ -125,6 +171,16 @@ class 'pkg/TestLocalClassesSwitch' { method 'test2 (I)V' { 0 64 1 64 + 2 64 + 3 64 + 4 64 + 5 64 + 6 64 + 7 64 + 8 64 + 9 64 + a 64 + b 64 14 72 15 73 16 73 diff --git a/testData/results/pkg/TestLocalEnum.dec b/testData/results/pkg/TestLocalEnum.dec index 5147e2f6ff..5a256b77df 100644 --- a/testData/results/pkg/TestLocalEnum.dec +++ b/testData/results/pkg/TestLocalEnum.dec @@ -15,10 +15,14 @@ class 'pkg/TestLocalEnum' { method 'test (I)V' { 0 9 1 9 + 2 9 + 3 9 4 9 5 9 6 9 a 9 + b 9 + c 9 d 9 e 10 } diff --git a/testData/results/pkg/TestLocalScopeClash.dec b/testData/results/pkg/TestLocalScopeClash.dec index fab6d546fe..4cb129d05d 100644 --- a/testData/results/pkg/TestLocalScopeClash.dec +++ b/testData/results/pkg/TestLocalScopeClash.dec @@ -69,8 +69,12 @@ class 'pkg/TestLocalScopeClash' { 2e 17 30 18 31 18 + 32 18 + 33 18 34 18 35 18 + 36 18 + 37 18 3e 18 3f 19 40 19 diff --git a/testData/results/pkg/TestLocalScopes.dec b/testData/results/pkg/TestLocalScopes.dec index 8880348ca5..090135fbff 100644 --- a/testData/results/pkg/TestLocalScopes.dec +++ b/testData/results/pkg/TestLocalScopes.dec @@ -26,6 +26,8 @@ class 'pkg/TestLocalScopes' { 5 6 6 6 7 6 + 8 6 + 9 6 b 7 d 7 e 6 @@ -39,6 +41,8 @@ class 'pkg/TestLocalScopes' { 19 12 1a 12 1b 12 + 1c 12 + 1d 12 1f 13 21 13 22 12 diff --git a/testData/results/pkg/TestLocalVariableMerge.dec b/testData/results/pkg/TestLocalVariableMerge.dec index 44ebb5c847..f87222add7 100644 --- a/testData/results/pkg/TestLocalVariableMerge.dec +++ b/testData/results/pkg/TestLocalVariableMerge.dec @@ -38,6 +38,8 @@ class 'pkg/TestLocalVariableMerge' { 2 8 3 8 4 8 + 5 8 + 6 8 7 9 8 9 9 9 @@ -53,6 +55,8 @@ class 'pkg/TestLocalVariableMerge' { 13 12 14 12 15 12 + 16 12 + 17 12 18 13 19 13 1a 13 @@ -74,35 +78,47 @@ class 'pkg/TestLocalVariableMerge' { 2a 18 2b 18 2c 18 + 2d 18 + 2e 18 2f 19 30 19 31 19 32 19 33 19 34 19 + 35 19 + 36 19 37 22 38 22 39 22 3a 22 3b 22 + 3c 22 + 3d 22 3e 23 3f 23 40 23 41 23 42 23 43 23 + 44 23 + 45 23 46 26 47 26 48 26 49 26 4a 26 4b 26 + 4c 26 + 4d 26 4e 27 4f 27 50 27 51 27 52 27 53 27 + 54 27 + 55 27 56 30 } } diff --git a/testData/results/pkg/TestLocalVariableMergeSwitch.dec b/testData/results/pkg/TestLocalVariableMergeSwitch.dec index 5ca6fb89fb..1c68ae8e74 100644 --- a/testData/results/pkg/TestLocalVariableMergeSwitch.dec +++ b/testData/results/pkg/TestLocalVariableMergeSwitch.dec @@ -23,6 +23,8 @@ class 'pkg/TestLocalVariableMergeSwitch' { method 'test (Ljava/lang/String;I)V' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 6 5 @@ -30,6 +32,31 @@ class 'pkg/TestLocalVariableMergeSwitch' { 8 6 9 7 a 7 + b 7 + c 7 + d 7 + e 7 + f 7 + 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 24 9 25 9 26 9 diff --git a/testData/results/pkg/TestLocalsNames.dec b/testData/results/pkg/TestLocalsNames.dec index d54d30db1f..6752b74b14 100644 --- a/testData/results/pkg/TestLocalsNames.dec +++ b/testData/results/pkg/TestLocalsNames.dec @@ -15,7 +15,7 @@ public class TestLocalsNames { } long elapsed = System.currentTimeMillis() - start;// 31 - System.out.println("took " + elapsed + "ms (" + elapsed / (long)files.length + "ms per dir)");// 32 + System.out.println("took " + elapsed + "ms (" + elapsed / files.length + "ms per dir)");// 32 } }// 34 } @@ -27,6 +27,8 @@ class 'pkg/TestLocalsNames' { 2 6 3 6 4 6 + 5 6 + 6 6 7 7 8 7 9 7 @@ -111,6 +113,8 @@ class 'pkg/TestLocalsNames' { b7 17 b8 17 b9 17 + ba 17 + bb 17 bc 19 } } diff --git a/testData/results/pkg/TestLoopBreak.dec b/testData/results/pkg/TestLoopBreak.dec index db7320bf28..d820dcfefa 100644 --- a/testData/results/pkg/TestLoopBreak.dec +++ b/testData/results/pkg/TestLoopBreak.dec @@ -18,6 +18,8 @@ class 'pkg/TestLoopBreak' { 1 4 2 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 @@ -25,6 +27,8 @@ class 'pkg/TestLoopBreak' { a 5 b 5 c 5 + d 5 + e 5 12 6 13 6 14 6 diff --git a/testData/results/pkg/TestLoopBreak2.dec b/testData/results/pkg/TestLoopBreak2.dec index 7343e98f99..659ffa1f28 100644 --- a/testData/results/pkg/TestLoopBreak2.dec +++ b/testData/results/pkg/TestLoopBreak2.dec @@ -19,6 +19,8 @@ class 'pkg/TestLoopBreak2' { 1 4 2 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 @@ -26,6 +28,8 @@ class 'pkg/TestLoopBreak2' { a 5 b 5 c 5 + d 5 + e 5 12 6 13 6 14 6 diff --git a/testData/results/pkg/TestLoopBreak3.dec b/testData/results/pkg/TestLoopBreak3.dec index ae286241d8..5a41f2dbc2 100644 --- a/testData/results/pkg/TestLoopBreak3.dec +++ b/testData/results/pkg/TestLoopBreak3.dec @@ -29,6 +29,8 @@ class 'pkg/TestLoopBreak3' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 8 5 9 5 @@ -43,10 +45,14 @@ class 'pkg/TestLoopBreak3' { 12 7 13 7 14 7 + 15 7 + 16 7 17 8 18 8 19 8 1a 8 + 1b 8 + 1c 8 1d 9 1e 9 1f 9 @@ -54,6 +60,8 @@ class 'pkg/TestLoopBreak3' { 21 9 22 9 23 9 + 24 9 + 25 9 26 10 27 10 28 10 @@ -63,6 +71,8 @@ class 'pkg/TestLoopBreak3' { 2c 10 2d 11 2e 11 + 2f 11 + 30 11 31 15 32 15 33 15 diff --git a/testData/results/pkg/TestLoopBreak4.dec b/testData/results/pkg/TestLoopBreak4.dec index c41954fcb2..ebcce10801 100644 --- a/testData/results/pkg/TestLoopBreak4.dec +++ b/testData/results/pkg/TestLoopBreak4.dec @@ -44,6 +44,8 @@ class 'pkg/TestLoopBreak4' { 4 4 5 4 6 4 + 7 4 + 8 4 9 5 a 5 b 5 @@ -51,6 +53,8 @@ class 'pkg/TestLoopBreak4' { d 5 e 5 f 5 + 10 5 + 11 5 12 6 13 6 14 6 @@ -67,10 +71,14 @@ class 'pkg/TestLoopBreak4' { 1f 8 20 8 21 8 + 22 8 + 23 8 24 9 25 9 26 9 27 9 + 28 9 + 29 9 2a 10 2b 10 2c 10 @@ -78,6 +86,8 @@ class 'pkg/TestLoopBreak4' { 2e 10 2f 10 30 10 + 31 10 + 32 10 33 11 34 11 35 11 @@ -87,6 +97,8 @@ class 'pkg/TestLoopBreak4' { 39 11 3a 12 3b 12 + 3c 12 + 3d 12 3e 16 3f 16 40 16 @@ -99,6 +111,8 @@ class 'pkg/TestLoopBreak4' { 47 17 48 17 49 17 + 4a 17 + 4b 17 4c 18 4d 18 4e 18 @@ -107,6 +121,8 @@ class 'pkg/TestLoopBreak4' { 51 18 52 18 53 18 + 54 18 + 55 18 56 19 57 19 58 19 @@ -119,6 +135,8 @@ class 'pkg/TestLoopBreak4' { 5f 20 60 20 61 20 + 62 20 + 63 20 67 24 68 24 69 24 diff --git a/testData/results/pkg/TestLoopBreakException.dec b/testData/results/pkg/TestLoopBreakException.dec index 067e4436e0..f59e7b1a1a 100644 --- a/testData/results/pkg/TestLoopBreakException.dec +++ b/testData/results/pkg/TestLoopBreakException.dec @@ -23,6 +23,8 @@ class 'pkg/TestLoopBreakException' { 1 4 2 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 @@ -30,6 +32,8 @@ class 'pkg/TestLoopBreakException' { a 5 b 5 c 5 + d 5 + e 5 12 6 13 6 14 6 @@ -42,6 +46,8 @@ class 'pkg/TestLoopBreakException' { 1b 11 1c 11 1d 11 + 1e 11 + 1f 11 20 12 21 12 29 14 diff --git a/testData/results/pkg/TestLoopFinally.dec b/testData/results/pkg/TestLoopFinally.dec index 6c3ee508f4..716ce5f13f 100644 --- a/testData/results/pkg/TestLoopFinally.dec +++ b/testData/results/pkg/TestLoopFinally.dec @@ -185,12 +185,18 @@ class 'pkg/TestLoopFinally' { 3 4 4 4 5 4 + 6 4 + 7 4 8 6 9 6 a 6 b 6 c 6 + d 6 + e 6 27 4 + 28 4 + 29 4 2b 8 2c 8 2d 8 @@ -202,12 +208,16 @@ class 'pkg/TestLoopFinally' { 33 9 34 9 35 9 + 36 9 + 37 9 3b 13 3c 13 3d 13 3e 13 3f 13 40 13 + 41 13 + 42 13 4b 17 4c 17 4d 17 @@ -226,11 +236,15 @@ class 'pkg/TestLoopFinally' { 3 21 4 21 5 21 + 6 21 + 7 21 8 23 9 23 a 23 b 23 c 23 + d 23 + e 23 43 25 44 25 45 25 @@ -242,6 +256,8 @@ class 'pkg/TestLoopFinally' { 4b 26 4c 26 4d 26 + 4e 26 + 4f 26 50 35 51 35 52 35 @@ -254,6 +270,8 @@ class 'pkg/TestLoopFinally' { 5b 27 5c 27 5d 27 + 5e 27 + 5f 27 60 28 61 28 62 28 @@ -269,6 +287,8 @@ class 'pkg/TestLoopFinally' { 6e 32 6f 32 70 32 + 71 32 + 72 32 75 21 76 21 77 21 @@ -290,11 +310,15 @@ class 'pkg/TestLoopFinally' { 3 44 4 44 5 44 + 6 44 + 7 44 8 46 9 46 a 46 b 46 c 46 + d 46 + e 46 20 48 21 48 22 48 @@ -306,6 +330,8 @@ class 'pkg/TestLoopFinally' { 28 49 29 49 2a 49 + 2b 49 + 2c 49 30 44 31 44 32 44 @@ -324,6 +350,8 @@ class 'pkg/TestLoopFinally' { 0 62 1 62 2 62 + 3 62 + 4 62 5 63 10 63 11 66 @@ -338,6 +366,8 @@ class 'pkg/TestLoopFinally' { 1a 67 1b 67 1c 67 + 1d 67 + 1e 67 1f 68 2a 68 2b 71 @@ -352,15 +382,21 @@ class 'pkg/TestLoopFinally' { 34 72 35 72 36 72 + 37 72 + 38 72 39 73 44 73 4e 76 4f 76 50 76 + 51 76 + 52 76 58 80 59 80 5a 80 5b 80 + 5c 80 + 5d 80 5e 82 5f 82 60 82 @@ -377,15 +413,21 @@ class 'pkg/TestLoopFinally' { 1 89 2 89 3 89 + 4 89 + 5 89 6 90 11 90 1b 93 1c 93 1d 93 + 1e 93 + 1f 93 25 97 26 97 27 97 28 97 + 29 97 + 2a 97 2b 94 2c 94 } @@ -395,15 +437,21 @@ class 'pkg/TestLoopFinally' { 1 105 2 105 3 105 + 4 105 + 5 105 6 106 7 106 20 111 21 111 22 111 + 23 111 + 24 111 2b 115 2c 115 2d 115 2e 115 + 2f 115 + 30 115 31 112 32 112 33 108 @@ -425,6 +473,8 @@ class 'pkg/TestLoopFinally' { 9 128 a 128 b 128 + c 128 + d 128 16 129 17 130 26 136 @@ -433,6 +483,8 @@ class 'pkg/TestLoopFinally' { 29 136 2a 136 2b 136 + 2c 136 + 2d 136 } method 'testConditionalBreakInFinally ()V' { @@ -443,8 +495,15 @@ class 'pkg/TestLoopFinally' { 4 143 5 143 6 143 + 7 143 + 8 143 9 158 a 145 + b 145 + c 145 + d 145 + e 145 + f 145 1a 146 1b 147 1c 147 @@ -452,11 +511,15 @@ class 'pkg/TestLoopFinally' { 1e 147 1f 147 20 147 + 21 147 + 22 147 2e 149 2f 149 30 149 31 149 32 149 + 33 149 + 34 149 38 154 39 154 43 150 @@ -478,6 +541,8 @@ class 'pkg/TestLoopFinally' { 4 165 5 165 6 165 + 7 165 + 8 165 19 176 2f 167 32 170 @@ -491,6 +556,8 @@ class 'pkg/TestLoopFinally' { 3a 172 3b 172 3c 172 + 3d 172 + 3e 172 3f 173 40 173 41 173 diff --git a/testData/results/pkg/TestLoopMerging2.dec b/testData/results/pkg/TestLoopMerging2.dec index 9a34d7fe34..2b474cf449 100644 --- a/testData/results/pkg/TestLoopMerging2.dec +++ b/testData/results/pkg/TestLoopMerging2.dec @@ -40,6 +40,8 @@ class 'pkg/TestLoopMerging2' { a 7 b 7 c 7 + d 7 + e 7 f 8 10 8 12 8 @@ -53,6 +55,8 @@ class 'pkg/TestLoopMerging2' { 1d 11 1e 11 1f 11 + 20 11 + 21 11 22 12 23 12 24 12 @@ -76,6 +80,8 @@ class 'pkg/TestLoopMerging2' { 4 17 5 17 6 17 + 7 17 + 8 17 9 17 a 17 b 17 @@ -83,6 +89,8 @@ class 'pkg/TestLoopMerging2' { d 17 e 17 f 17 + 10 17 + 11 17 12 26 13 18 14 18 @@ -92,6 +100,8 @@ class 'pkg/TestLoopMerging2' { 18 20 19 20 1a 20 + 1b 20 + 1c 20 1d 21 1e 21 1f 21 @@ -121,4 +131,4 @@ Lines mapping: 24 <-> 22 26 <-> 25 Not mapped: -27 \ No newline at end of file +27 diff --git a/testData/results/pkg/TestLoopReturn.dec b/testData/results/pkg/TestLoopReturn.dec index 12b3d44623..892f2a4362 100644 --- a/testData/results/pkg/TestLoopReturn.dec +++ b/testData/results/pkg/TestLoopReturn.dec @@ -75,9 +75,13 @@ class 'pkg/TestLoopReturn' { 2 4 3 4 4 4 + 5 4 + 6 4 7 6 b 7 c 7 + d 7 + e 7 f 8 10 12 11 12 @@ -92,8 +96,12 @@ class 'pkg/TestLoopReturn' { method 'test1a (ZZ)V' { 0 16 1 16 + 2 16 + 3 16 4 17 5 17 + 6 17 + 7 17 8 18 9 22 a 22 @@ -108,8 +116,12 @@ class 'pkg/TestLoopReturn' { method 'test1b (ZZ)V' { 0 26 1 26 + 2 26 + 3 26 4 27 5 27 + 6 27 + 7 27 8 28 9 31 } @@ -117,6 +129,8 @@ class 'pkg/TestLoopReturn' { method 'test2 (Z)V' { 0 34 1 34 + 2 34 + 3 34 4 37 5 35 6 35 @@ -133,8 +147,12 @@ class 'pkg/TestLoopReturn' { 2 40 3 40 4 40 + 5 40 + 6 40 7 42 8 42 + 9 42 + a 42 b 45 c 43 d 43 @@ -151,8 +169,12 @@ class 'pkg/TestLoopReturn' { 2 48 3 48 4 48 + 5 48 + 6 48 7 50 8 50 + 9 50 + a 50 b 54 c 54 d 54 @@ -189,6 +211,8 @@ class 'pkg/TestLoopReturn' { f 61 10 61 11 61 + 12 61 + 13 61 17 66 18 66 19 66 diff --git a/testData/results/pkg/TestMethodHandles.dec b/testData/results/pkg/TestMethodHandles.dec index 0484c05591..1706ff1f9f 100644 --- a/testData/results/pkg/TestMethodHandles.dec +++ b/testData/results/pkg/TestMethodHandles.dec @@ -12,33 +12,33 @@ public class TestMethodHandles { public void test1() throws Throwable { MethodHandle abs = LOOKUP.findStatic(Math.class, "abs", MethodType.methodType(long.class, long.class));// 10 int a = -5;// 11 - long b = (long)abs.invokeExact((long)a);// 12 + long b = (long)abs.invokeExact(a);// 12 System.out.println(b);// 13 }// 14 public int test2() throws Throwable { MethodHandle abs = LOOKUP.findStatic(Math.class, "abs", MethodType.methodType(long.class, long.class));// 17 int a = -5;// 18 - return (int)(long)abs.invokeExact((long)a);// 19 + return (int)(long)abs.invokeExact(a);// 19 } public void test3() throws Throwable { MethodHandle abs = LOOKUP.findStatic(Math.class, "abs", MethodType.methodType(long.class, long.class));// 23 int a = -5;// 24 - long b = (long)abs.invoke((long)a);// 25 + long b = (long)abs.invoke(a);// 25 System.out.println(b);// 26 }// 27 public int test4() throws Throwable { MethodHandle abs = LOOKUP.findStatic(Math.class, "abs", MethodType.methodType(long.class, long.class));// 30 int a = -5;// 31 - return (int)(long)abs.invoke((long)a);// 32 + return (int)(long)abs.invoke(a);// 32 } public void test5() throws Throwable { MethodHandle println = LOOKUP.findVirtual(PrintStream.class, "println", MethodType.methodType(void.class, long.class));// 36 int a = -5;// 37 - println.invokeExact(System.out, (long)a);// 38 + println.invokeExact(System.out, a);// 38 }// 39 } diff --git a/testData/results/pkg/TestMixedCompoundAssignment.dec b/testData/results/pkg/TestMixedCompoundAssignment.dec index 14008b4b08..dd8639edd6 100644 --- a/testData/results/pkg/TestMixedCompoundAssignment.dec +++ b/testData/results/pkg/TestMixedCompoundAssignment.dec @@ -2,53 +2,53 @@ package pkg; public class TestMixedCompoundAssignment { public int testSimpleIntFloat(int i, float j) { - i = (int)((float)i + j);// 5 - i = (int)((float)i - j);// 6 - i = (int)((float)i * j);// 7 - return (int)((float)i / j);// 8 10 + i = (int)(i + j);// 5 + i = (int)(i - j);// 6 + i = (int)(i * j);// 7 + return (int)(i / j);// 8 10 } public int testSimpleIntLong(int i, long j) { - i = (int)((long)i + j);// 14 - i = (int)((long)i - j);// 15 - i = (int)((long)i * j);// 16 - i = (int)((long)i / j);// 17 - i = (int)((long)i & j);// 18 - i = (int)((long)i | j);// 19 - i = (int)((long)i ^ j);// 20 + i = (int)(i + j);// 14 + i = (int)(i - j);// 15 + i = (int)(i * j);// 16 + i = (int)(i / j);// 17 + i = (int)(i & j);// 18 + i = (int)(i | j);// 19 + i = (int)(i ^ j);// 20 i >>= (int)j;// 21 i <<= (int)j;// 22 return i >>> (int)j;// 23 25 } public double testSimpleDoubleLong(double i, long j) { - i += (double)j;// 29 - i -= (double)j;// 30 - i *= (double)j;// 31 - return i / (double)j;// 32 34 + i += j;// 29 + i -= j;// 30 + i *= j;// 31 + return i / j;// 32 34 } public int testNestedIntLongDouble(int i, long j, double k) { long var9; - i = (int)((long)i + (var9 = (long)((double)j + k)));// 38 - i = (int)((long)i - (j = (long)((double)var9 - k)));// 39 + i = (int)(i + (var9 = (long)(j + k)));// 38 + i = (int)(i - (j = (long)(var9 - k)));// 39 long var11; - i = (int)((long)i * (var11 = (long)((double)j * k)));// 40 - return (int)((long)i / (long)((double)var11 / k));// 41 44 + i = (int)(i * (var11 = (long)(j * k)));// 40 + return (int)(i / (long)(var11 / k));// 41 44 } public long testNestedLongIntLong(long i, int j, long k) { int var15; - i += (long)(var15 = (int)((long)j + k));// 48 - i -= (long)(j = (int)((long)var15 - k));// 49 + i += var15 = (int)(j + k);// 48 + i -= j = (int)(var15 - k);// 49 int var17; - i *= (long)(var17 = (int)((long)j * k));// 50 - i /= (long)(j = (int)((long)var17 / k));// 51 + i *= var17 = (int)(j * k);// 50 + i /= j = (int)(var17 / k);// 51 int var19; - i &= (long)(var19 = (int)((long)j & k));// 52 - i |= (long)(j = (int)((long)var19 | k));// 53 + i &= var19 = (int)(j & k);// 52 + i |= j = (int)(var19 | k);// 53 int var21; - i ^= (long)(var21 = (int)((long)j ^ k));// 54 + i ^= var21 = (int)(j ^ k);// 54 i >>= j = var21 >> (int)k;// 55 int var23; i <<= var23 = j << (int)k;// 56 @@ -57,25 +57,25 @@ public class TestMixedCompoundAssignment { public void testArrayIntDouble(int[] holder, int i, double inc) { for (int j = 0; j < i; j++) {// 64 - holder[j] = (int)((double)holder[j] + inc);// 65 + holder[j] = (int)(holder[j] + inc);// 65 } }// 67 public void testArrayIntLong(int[] holder, int i, long inc) { for (int j = 0; j < i; j++) {// 70 - holder[j] = (int)((long)holder[j] + inc);// 71 + holder[j] = (int)(holder[j] + inc);// 71 } }// 73 public void testArrayDoubleInt(double[] holder, int i, int inc) { for (int j = 0; j < i; j++) {// 76 - holder[j] += (double)inc;// 77 + holder[j] += inc;// 77 } }// 79 public void testNestedArrayByteFloatLongDouble(byte[] outer, float[] holder, long[] inner, int i, double inc) { for (int j = 0; j < i; j++) {// 82 - outer[i + ~j] = (byte)((int)((float)outer[i + ~j] + (holder[j] -= (float)(inner[j * 3 % i] = (long)((double)inner[j * 3 % i] + inc)))));// 83 + outer[i + ~j] = (byte)(outer[i + ~j] + (holder[j] -= (float)(inner[j * 3 % i] = (long)(inner[j * 3 % i] + inc))));// 83 } }// 85 } @@ -328,6 +328,8 @@ class 'pkg/TestMixedCompoundAssignment' { 4 58 5 58 6 58 + 7 58 + 8 58 9 59 a 59 b 59 @@ -351,6 +353,8 @@ class 'pkg/TestMixedCompoundAssignment' { 4 64 5 64 6 64 + 7 64 + 8 64 9 65 a 65 b 65 @@ -374,6 +378,8 @@ class 'pkg/TestMixedCompoundAssignment' { 4 70 5 70 6 70 + 7 70 + 8 70 9 71 a 71 b 71 @@ -395,6 +401,8 @@ class 'pkg/TestMixedCompoundAssignment' { 5 76 6 76 7 76 + 8 76 + 9 76 a 77 b 77 c 77 diff --git a/testData/results/pkg/TestMultiBoolean.dec b/testData/results/pkg/TestMultiBoolean.dec index 884dc0801c..4ceeda5b41 100644 --- a/testData/results/pkg/TestMultiBoolean.dec +++ b/testData/results/pkg/TestMultiBoolean.dec @@ -24,48 +24,80 @@ class 'pkg/TestMultiBoolean' { method 'test (Z)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 + 6 4 + 7 4 8 5 9 5 a 5 b 5 c 5 + d 5 + e 5 f 8 10 8 + 11 8 + 12 8 13 8 14 8 + 15 8 + 16 8 17 9 18 9 19 9 1a 9 1b 9 + 1c 9 + 1d 9 1e 12 1f 12 + 20 12 + 21 12 22 12 23 12 + 24 12 + 25 12 26 12 27 12 + 28 12 + 29 12 2a 13 2b 13 2c 13 2d 13 2e 13 + 2f 13 + 30 13 31 16 32 16 + 33 16 + 34 16 35 16 36 16 + 37 16 + 38 16 39 16 3a 16 + 3b 16 + 3c 16 3d 16 3e 16 + 3f 16 + 40 16 41 16 42 16 + 43 16 + 44 16 45 17 46 17 47 17 48 17 49 17 + 4a 17 + 4b 17 4c 19 } } diff --git a/testData/results/pkg/TestMultiCast.dec b/testData/results/pkg/TestMultiCast.dec index 42a0868055..37c4f4980f 100644 --- a/testData/results/pkg/TestMultiCast.dec +++ b/testData/results/pkg/TestMultiCast.dec @@ -2,7 +2,7 @@ package pkg; public class TestMultiCast { public void test(double arg1, double arg2) { - useNumbers((double)((int)arg1), (double)((int)arg2));// 5 + useNumbers((int)arg1, (int)arg2);// 5 }// 6 private static void useNumbers(double arg1, double arg2) { diff --git a/testData/results/pkg/TestMultipleStaticBlocks.dec b/testData/results/pkg/TestMultipleStaticBlocks.dec index 02242d41c0..34e9debb7d 100644 --- a/testData/results/pkg/TestMultipleStaticBlocks.dec +++ b/testData/results/pkg/TestMultipleStaticBlocks.dec @@ -4,12 +4,12 @@ public class TestMultipleStaticBlocks { private static int i; static { - byte value = (byte)((int)(Math.random() * 8.0));// 7 + byte value = (byte)(Math.random() * 8.0);// 7 if (value > 4) {// 8 i = 1;// 9 } - value = (byte)((short)((int)(Math.random() * 8.0)));// 14 + value = (byte)((short)(Math.random() * 8.0));// 14 if (value > 4) {// 15 i = 2;// 16 } @@ -31,8 +31,12 @@ class 'pkg/TestMultipleStaticBlocks' { a 7 b 7 c 7 + d 7 + e 7 f 8 10 8 + 11 8 + 12 8 13 11 14 11 15 11 @@ -46,8 +50,12 @@ class 'pkg/TestMultipleStaticBlocks' { 1d 12 1e 12 1f 12 + 20 12 + 21 12 22 13 23 13 + 24 13 + 25 13 26 15 } } diff --git a/testData/results/pkg/TestNamedSuspendFun2Kt.dec b/testData/results/pkg/TestNamedSuspendFun2Kt.dec index 98b5a00e8e..ce3796a143 100644 --- a/testData/results/pkg/TestNamedSuspendFun2Kt.dec +++ b/testData/results/pkg/TestNamedSuspendFun2Kt.dec @@ -11,19 +11,19 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 2, xi = 48, - d1 = {"\u0000\n\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\u001a\u0011\u0010\u0000\u001a\u00020\u0001H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010\u0002\u001a\u0011\u0010\u0003\u001a\u00020\u0001H\u0086@ø\u0001\u0000¢\u0006\u0002\u0010\u0002\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u0004"}, - d2 = {"bar", "", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "foo2", "vineflower_testDataKotlin"} + d1 = {"\u0000\n\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\u001a\u000e\u0010\u0000\u001a\u00020\u0001H\u0086@¢\u0006\u0002\u0010\u0002\u001a\u000e\u0010\u0003\u001a\u00020\u0001H\u0086@¢\u0006\u0002\u0010\u0002¨\u0006\u0004"}, + d2 = {"foo2", "", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "bar", "vineflower_testDataKotlin"} ) public final class TestNamedSuspendFun2Kt { // $VF: Handled exception range with multiple entry points by splitting it - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions + // $VF: Duplicated exception handlers to handle obfuscated exceptions // $VF: Irreducible bytecode was duplicated to produce valid code // $VF: Could not inline inconsistent finally blocks @Nullable - public static final Object foo2(@NotNull Continuation var0) { + public static final Object foo2(@NotNull Continuation $completion) { Continuation $continuation; @DebugMetadata( @@ -36,7 +36,7 @@ public final class TestNamedSuspendFun2Kt { c = "pkg.TestNamedSuspendFun2Kt" ) @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 3, xi = 48 ) @@ -57,111 +57,117 @@ public final class TestNamedSuspendFun2Kt { } } - label261: { - if (var0 instanceof NamelessClass_1) { - $continuation = (NamelessClass_1)var0; + label272: { + if ($completion instanceof NamelessClass_1) { + $continuation = (NamelessClass_1)$completion; if (($continuation.label & -2147483648) != 0) { $continuation.label -= -2147483648; - break label261; + break label272; } } - $continuation = new NamelessClass_1(var0); + $continuation = new NamelessClass_1($completion); } Object var4; - label279: { - Throwable var10000; - label250: { - Object $result = $continuation.result; - var4 = IntrinsicsKt.getCOROUTINE_SUSPENDED(); - switch ($continuation.label) { - case 0: + label261: { + Object $result = $continuation.result; + var4 = IntrinsicsKt.getCOROUTINE_SUSPENDED(); + switch ($continuation.label) { + case 0: + ResultKt.throwOnFailure($result); + break; + case 1: + Object var10000; + try { ResultKt.throwOnFailure($result); - break; - case 1: - try { - ResultKt.throwOnFailure($result); - var10000 = (Throwable)$result; - } catch (Throwable var19) { - var10000 = var19; - boolean var10001 = false; - break label250; + var10000 = $result; + } catch (Throwable var18) { + $continuation.L$0 = var18; + $continuation.label = 4; + if (bar($continuation) == var4) { + return var4;// 2 } - try { - int x = ((Number)var10000).intValue();// 5 - if (x == 0) {// 6 - break label279; - } - } catch (Throwable var17) { - var10000 = var17; - boolean var25 = false; - break label250; - } + throw var18; + } - $continuation.label = 3; + try { + int x = ((Number)var10000).intValue();// 5 + if (x == 0) {// 6 + break label261; + } + } catch (Throwable var19) { + $continuation.L$0 = var19; + $continuation.label = 4; if (bar($continuation) == var4) { return var4; } - break; - case 2: - ResultKt.throwOnFailure($result); - return Boxing.boxInt(1);// 2 7 8 9 11 - case 3: - ResultKt.throwOnFailure($result); - break; - case 4: - Throwable x = (Throwable)$continuation.L$0; - ResultKt.throwOnFailure($result); - throw x; - default: - throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); - } - while (true) { - try { - $continuation.label = 1; - var10000 = (Throwable)bar($continuation);// 4 - } catch (Throwable var18) { - var10000 = var18; - boolean var26 = false; - break; + throw var19; } - if (var10000 == var4) { + $continuation.label = 3; + if (bar($continuation) == var4) { return var4; } + break; + case 2: + ResultKt.throwOnFailure($result); + return Boxing.boxInt(1);// 11 + case 3: + ResultKt.throwOnFailure($result); + break; + case 4: + Throwable x = (Throwable)$continuation.L$0; + ResultKt.throwOnFailure($result); + throw x; + default: + throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); + } - try { - int var22 = ((Number)var10000).intValue(); - if (var22 == 0) { - break label279; - } - } catch (Throwable var20) { - var10000 = var20; - boolean var27 = false; - break; + while (true) { + Object var23; + try { + $continuation.label = 1; + var23 = bar($continuation);// 4 + } catch (Throwable var17) { + $continuation.L$0 = var17; + $continuation.label = 4; + if (bar($continuation) == var4) { + return var4; } - $continuation.label = 3; + throw var17; + } + + if (var23 == var4) { + return var4; + } + + try { + int var22 = ((Number)var23).intValue(); + if (var22 == 0) { + break; + } + } catch (Throwable var20) { + $continuation.L$0 = var20; + $continuation.label = 4; if (bar($continuation) == var4) { return var4; } + + throw var20; } - } - Throwable x = var10000; - $continuation.L$0 = x; - $continuation.label = 4; - if (bar($continuation) == var4) { - return var4; + $continuation.label = 3; + if (bar($continuation) == var4) { + return var4; + } } - - throw x; } - $continuation.label = 2; + $continuation.label = 2;// 8 return bar($continuation) == var4 ? var4 : Boxing.boxInt(1); } @@ -210,6 +216,8 @@ class 'pkg/TestNamedSuspendFun2Kt' { 2 60 3 60 4 60 + 5 60 + 6 60 7 61 8 61 9 61 @@ -223,6 +231,8 @@ class 'pkg/TestNamedSuspendFun2Kt' { 11 62 12 62 13 62 + 14 62 + 15 62 16 63 1b 63 1c 63 @@ -232,165 +242,193 @@ class 'pkg/TestNamedSuspendFun2Kt' { 21 64 28 68 2c 68 - 2d 75 - 2e 75 - 2f 75 - 30 75 - 31 75 - 32 76 - 33 76 - 34 76 - 35 76 - 36 76 - 37 77 - 38 77 - 39 77 - 3a 77 - 3b 77 - 5c 79 - 5d 79 - 62 124 - 63 123 - 64 123 - 65 123 - 66 123 - 67 123 - 68 124 - 6c 131 - 6d 131 - 6e 131 - 71 132 - 72 132 - 73 132 - 75 83 - 76 83 - 77 83 - 78 83 - 79 84 - 7a 92 - 7b 92 - 7c 92 - 7d 92 - 7e 92 - 7f 92 - 80 92 - 81 93 - 82 93 - 85 164 - 86 163 - 87 163 - 88 163 - 89 163 - 8a 163 - 8b 164 - 8c 164 - 8d 164 - 8f 164 - 90 164 - 91 164 - 94 164 - 95 164 - 97 108 - 98 108 - 99 108 - 9a 108 - 9d 109 - 9e 109 - 9f 109 - a0 103 - a1 102 - a2 102 - a3 102 - a4 102 - a5 102 - a6 103 - a7 103 - a8 103 - a9 109 - aa 103 - ab 103 - ac 103 - ad 109 - ae 109 - af 104 - b0 104 - b1 104 - b2 109 - b3 109 - b4 109 - b5 109 - b6 109 - b7 109 - b8 109 - b9 109 - ba 109 - bb 109 - bc 109 - bd 109 - be 109 - bf 109 - c0 109 - c1 109 - c2 109 - c3 109 - c4 109 - c5 109 - c6 109 - c7 109 - c8 109 - c9 109 - ca 109 - cb 109 - cc 109 - cd 109 - ce 109 - cf 109 - d0 109 - d1 109 - d2 109 - d3 109 - d4 109 - d5 109 - d6 109 - d7 109 - d8 109 - d9 109 - da 109 - db 109 - dc 109 - dd 109 - de 109 - df 109 - e0 109 - e1 109 - e2 109 - e3 109 - e4 109 - e5 109 - e6 109 - ec 118 - ed 118 - f1 118 + 2d 73 + 2e 73 + 2f 73 + 30 73 + 31 73 + 32 74 + 33 74 + 34 74 + 35 74 + 36 74 + 37 75 + 38 75 + 39 75 + 3a 75 + 3b 75 + 3c 75 + 3d 75 + 3e 75 + 3f 75 + 40 75 + 41 75 + 42 75 + 43 75 + 44 75 + 45 75 + 46 75 + 47 75 + 48 75 + 49 75 + 4a 75 + 4b 75 + 4c 75 + 4d 75 + 4e 75 + 4f 75 + 50 75 + 51 75 + 52 75 + 53 75 + 54 75 + 55 75 + 56 75 + 57 75 + 58 75 + 59 75 + 5a 75 + 5b 75 + 5c 77 + 5d 77 + 5e 77 + 5f 77 + 62 132 + 63 131 + 64 131 + 65 131 + 66 131 + 67 131 + 68 132 + 69 132 + 6a 132 + 6c 143 + 6d 143 + 6e 143 + 6f 143 + 70 143 + 71 144 + 72 144 + 73 144 + 75 82 + 76 82 + 77 82 + 78 82 + 79 83 + 7a 95 + 7b 95 + 7c 95 + 7d 95 + 7e 95 + 7f 95 + 80 95 + 81 96 + 82 96 + 83 96 + 84 96 + 85 170 + 86 169 + 87 169 + 88 169 + 89 169 + 8a 169 + 8b 170 + 8c 170 + 8d 170 + 8f 170 + 90 170 + 91 170 + 92 170 + 93 170 + 94 170 + 95 170 + 97 115 + 98 115 + 99 115 + 9a 115 + 9d 116 + a0 110 + a1 109 + a2 109 + a3 109 + a4 109 + a5 109 + a6 110 + a7 110 + a8 110 + aa 110 + ab 110 + ac 110 + ad 110 + ae 110 + af 111 + b0 111 + b1 111 + b2 118 + b3 118 + b4 118 + b5 118 + bc 136 + bd 134 + be 134 + bf 134 + c0 134 + c1 134 + c2 135 + c3 135 + c4 135 + c5 135 + c6 135 + c7 136 + c8 136 + c9 136 + cb 136 + cc 136 + cd 136 + ce 136 + cf 136 + d0 88 + d1 88 + d2 88 + d3 121 + d4 121 + d5 121 + d6 121 + d7 121 + d8 121 + d9 121 + da 121 + db 122 + dc 122 + dd 122 + de 122 + e1 91 + e2 91 + e3 116 + e4 116 + e5 116 + ec 125 + ed 125 + f1 125 } method 'bar (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;' { - 0 169 - 1 169 - 2 169 - 3 169 - 4 169 + 0 175 + 1 175 + 2 175 + 3 175 + 4 175 } } Lines mapping: -2 <-> 110 -4 <-> 125 -5 <-> 93 -6 <-> 94 -7 <-> 110 -8 <-> 110 -9 <-> 110 -11 <-> 110 -14 <-> 170 +2 <-> 89 +4 <-> 133 +5 <-> 96 +6 <-> 97 +8 <-> 170 +11 <-> 117 +14 <-> 176 Not mapped: 3 +9 diff --git a/testData/results/pkg/TestNestedFor.dec b/testData/results/pkg/TestNestedFor.dec index a7b0999eb6..e678887496 100644 --- a/testData/results/pkg/TestNestedFor.dec +++ b/testData/results/pkg/TestNestedFor.dec @@ -27,6 +27,8 @@ class 'pkg/TestNestedFor' { 5 6 6 6 7 6 + 8 6 + 9 6 a 7 b 7 c 7 @@ -40,6 +42,8 @@ class 'pkg/TestNestedFor' { 15 7 16 7 17 7 + 18 7 + 19 7 1a 8 1b 8 1c 8 diff --git a/testData/results/pkg/TestNestedLambdas.dec b/testData/results/pkg/TestNestedLambdas.dec index 13db63c0e3..61d41a754a 100644 --- a/testData/results/pkg/TestNestedLambdas.dec +++ b/testData/results/pkg/TestNestedLambdas.dec @@ -41,6 +41,8 @@ class 'pkg/TestNestedLambdas' { method 'lambda$test$2 (I)I' { 0 5 1 5 + 2 5 + 3 5 a 6 b 6 c 6 @@ -51,6 +53,8 @@ class 'pkg/TestNestedLambdas' { method 'lambda$null$1 (II)I' { 0 6 1 6 + 2 6 + 3 6 b 6 c 6 d 6 diff --git a/testData/results/pkg/TestNestedLoops.dec b/testData/results/pkg/TestNestedLoops.dec index 47f7fc4a7d..eab27f8882 100644 --- a/testData/results/pkg/TestNestedLoops.dec +++ b/testData/results/pkg/TestNestedLoops.dec @@ -53,6 +53,8 @@ class 'pkg/TestNestedLoops' { b 11 c 11 d 11 + e 11 + f 11 10 14 11 14 12 14 @@ -79,6 +81,8 @@ class 'pkg/TestNestedLoops' { 30 15 31 15 32 15 + 33 15 + 34 15 35 17 36 17 37 17 @@ -94,6 +98,8 @@ class 'pkg/TestNestedLoops' { 42 18 43 18 44 18 + 45 18 + 46 18 47 15 48 15 49 15 @@ -110,6 +116,8 @@ class 'pkg/TestNestedLoops' { b 31 c 31 d 31 + e 31 + f 31 13 32 14 32 15 32 @@ -136,6 +144,8 @@ class 'pkg/TestNestedLoops' { 33 33 34 33 35 33 + 36 33 + 37 33 38 35 39 35 3a 35 @@ -151,6 +161,8 @@ class 'pkg/TestNestedLoops' { 45 36 46 36 47 36 + 48 36 + 49 36 4d 33 4e 33 4f 33 diff --git a/testData/results/pkg/TestNestedLoops2.dec b/testData/results/pkg/TestNestedLoops2.dec index adc8ebeebc..6daa9547a7 100644 --- a/testData/results/pkg/TestNestedLoops2.dec +++ b/testData/results/pkg/TestNestedLoops2.dec @@ -26,9 +26,13 @@ class 'pkg/TestNestedLoops2' { 3 5 4 5 5 5 + 6 5 + 7 5 8 8 9 8 a 8 + b 8 + c 8 e 9 f 9 10 9 diff --git a/testData/results/pkg/TestNestedTernaryAssign.dec b/testData/results/pkg/TestNestedTernaryAssign.dec index d4419a8853..80ec314fed 100644 --- a/testData/results/pkg/TestNestedTernaryAssign.dec +++ b/testData/results/pkg/TestNestedTernaryAssign.dec @@ -47,8 +47,12 @@ class 'pkg/TestNestedTernaryAssign' { method 'test (ZZZ)V' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 + 6 5 + 7 5 8 6 9 6 d 8 @@ -57,43 +61,62 @@ class 'pkg/TestNestedTernaryAssign' { 10 8 14 10 15 10 + 16 10 + 17 10 18 11 19 11 1d 13 1e 13 + 1f 13 + 20 13 23 15 } method 'test2 (ZZZ)V' { 0 18 1 18 + 2 18 + 3 18 4 19 5 19 + 6 19 + 7 19 8 19 9 19 d 19 e 19 12 21 13 21 + 14 21 + 15 21 16 21 17 21 1b 21 + 1c 21 1f 23 } method 'test3 (ZZII)V' { 0 26 1 26 + 2 26 + 3 26 4 26 5 26 6 26 + 7 26 + 8 26 9 26 d 26 + e 26 f 26 + 10 26 + 11 26 12 26 16 26 17 26 1b 26 + 1c 26 1d 26 1e 26 1f 27 @@ -110,14 +133,21 @@ class 'pkg/TestNestedTernaryAssign' { method 'test4 (ZII)V' { 0 31 1 31 + 2 31 + 3 31 4 31 5 31 6 31 + 7 31 + 8 31 c 31 d 31 e 31 + f 31 + 10 31 11 31 15 31 + 16 31 17 31 18 31 19 31 @@ -127,28 +157,42 @@ class 'pkg/TestNestedTernaryAssign' { method 'test5 (ZZII)V' { 0 35 1 35 + 2 35 + 3 35 4 35 5 35 6 35 7 35 + 8 35 + 9 35 d 35 e 35 f 35 10 35 + 11 35 + 12 35 13 35 17 35 + 18 35 19 35 1a 35 + 1b 35 + 1c 35 1d 35 1e 35 1f 35 20 35 + 21 35 + 22 35 26 35 27 35 28 35 29 35 + 2a 35 + 2b 35 2c 35 30 35 + 31 35 32 35 33 35 34 35 diff --git a/testData/results/pkg/TestNestedTernaryCondition.dec b/testData/results/pkg/TestNestedTernaryCondition.dec index f98929bc3d..874cdfe93e 100644 --- a/testData/results/pkg/TestNestedTernaryCondition.dec +++ b/testData/results/pkg/TestNestedTernaryCondition.dec @@ -14,14 +14,21 @@ class 'pkg/TestNestedTernaryCondition' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 11 7 15 5 + 16 5 19 9 } } diff --git a/testData/results/pkg/TestNextGaussian.dec b/testData/results/pkg/TestNextGaussian.dec index 754c7098c1..011ddae33c 100644 --- a/testData/results/pkg/TestNextGaussian.dec +++ b/testData/results/pkg/TestNextGaussian.dec @@ -37,6 +37,8 @@ class 'pkg/TestNextGaussian' { 2 7 3 7 4 7 + 5 7 + 6 7 7 8 8 8 9 8 @@ -87,6 +89,8 @@ class 'pkg/TestNextGaussian' { 39 18 3a 18 3b 18 + 3c 18 + 3d 18 3e 20 3f 20 40 20 diff --git a/testData/results/pkg/TestNoUse.dec b/testData/results/pkg/TestNoUse.dec index 45900e268d..ede7355bb6 100644 --- a/testData/results/pkg/TestNoUse.dec +++ b/testData/results/pkg/TestNoUse.dec @@ -77,6 +77,8 @@ class 'pkg/TestNoUse' { 15 7 19 8 1a 8 + 1b 8 + 1c 8 1d 9 1e 9 1f 9 @@ -115,6 +117,8 @@ class 'pkg/TestNoUse' { 18 17 19 18 1a 18 + 1b 18 + 1c 18 1d 19 1e 19 1f 19 @@ -153,6 +157,8 @@ class 'pkg/TestNoUse' { 15 27 19 28 1a 28 + 1b 28 + 1c 28 1d 29 1e 29 1f 29 @@ -184,6 +190,8 @@ class 'pkg/TestNoUse' { f 37 12 38 13 38 + 14 38 + 15 38 17 39 18 39 19 39 @@ -223,6 +231,8 @@ class 'pkg/TestNoUse' { 18 51 19 52 1a 52 + 1b 52 + 1c 52 1d 53 1e 53 1f 53 diff --git a/testData/results/pkg/TestNumberCasts.dec b/testData/results/pkg/TestNumberCasts.dec new file mode 100644 index 0000000000..620f05e44a --- /dev/null +++ b/testData/results/pkg/TestNumberCasts.dec @@ -0,0 +1,488 @@ +package pkg; + +public class TestNumberCasts { + private static void b(byte b) { + }// 5 + + private static void s(short s) { + }// 8 + + private static void i(int i) { + }// 11 + + private static void l(long l) { + }// 14 + + private static void f(float f) { + }// 17 + + private static void d(double d) { + }// 20 + + public void test() { + byte b = 127;// 23 + b(b);// 24 + s(b);// 25 + i(b);// 26 + l(b);// 27 + f(b);// 28 + d(b);// 29 + s((short)(b * b));// 30 + s((short)(b + b));// 31 + s((short)(-b - b));// 32 + short s = 32767;// 34 + b((byte)s);// 35 + s(s);// 36 + i(s);// 37 + l(s);// 38 + f(s);// 39 + d(s);// 40 + i(s * s);// 41 + i(s + s);// 42 + i(-s - s);// 43 + int i = 2147483647;// 45 + b((byte)i);// 46 + s((short)i);// 47 + i(i);// 48 + l(i);// 49 + f(i);// 50 + d(i);// 51 + l(i * i);// 52 + l(i + b);// 53 + l(i * i);// 54 + l((long)i * i);// 55 + l((long)i + i);// 56 + l((long)(-i) - i);// 57 + l((long)i + b);// 58 + long l = 9223372036854775807L;// 60 + b((byte)l);// 61 + s((short)l);// 62 + i((int)l);// 63 + l(l);// 64 + f((float)l);// 65 + d(l);// 66 + float f = 3.4028235E38F;// 68 + b((byte)f);// 69 + s((short)f);// 70 + i((int)f);// 71 + l((long)f);// 72 + f(f);// 73 + d(f);// 74 + double d = 1.7976931348623157E308;// 76 + b((byte)d);// 77 + s((short)d);// 78 + i((int)d);// 79 + l((long)d);// 80 + f((float)d);// 81 + d(d);// 82 + }// 83 +} + +class 'pkg/TestNumberCasts' { + method 'b (B)V' { + 0 4 + } + + method 's (S)V' { + 0 7 + } + + method 'i (I)V' { + 0 10 + } + + method 'l (J)V' { + 0 13 + } + + method 'f (F)V' { + 0 16 + } + + method 'd (D)V' { + 0 19 + } + + method 'test ()V' { + 0 22 + 1 22 + 2 22 + 3 23 + 4 23 + 5 23 + 6 23 + 7 24 + 8 24 + 9 24 + a 24 + b 24 + c 25 + d 25 + e 25 + f 25 + 10 26 + 11 26 + 12 26 + 13 26 + 14 26 + 15 27 + 16 27 + 17 27 + 18 27 + 19 27 + 1a 28 + 1b 28 + 1c 28 + 1d 28 + 1e 28 + 1f 29 + 20 29 + 21 29 + 22 29 + 23 29 + 24 29 + 25 29 + 26 30 + 27 30 + 28 30 + 29 30 + 2a 30 + 2b 30 + 2c 30 + 2d 31 + 2e 31 + 2f 31 + 30 31 + 31 31 + 32 31 + 33 31 + 34 31 + 35 32 + 36 32 + 37 32 + 38 32 + 39 33 + 3a 33 + 3b 33 + 3c 33 + 3d 33 + 3e 34 + 3f 34 + 40 34 + 41 34 + 42 35 + 43 35 + 44 35 + 45 35 + 46 36 + 47 36 + 48 36 + 49 36 + 4a 36 + 4b 37 + 4c 37 + 4d 37 + 4e 37 + 4f 37 + 50 38 + 51 38 + 52 38 + 53 38 + 54 38 + 55 39 + 56 39 + 57 39 + 58 39 + 59 39 + 5a 39 + 5b 40 + 5c 40 + 5d 40 + 5e 40 + 5f 40 + 60 40 + 61 41 + 62 41 + 63 41 + 64 41 + 65 41 + 66 41 + 67 41 + 68 42 + 69 42 + 6a 42 + 6b 43 + 6c 43 + 6d 43 + 6e 43 + 6f 43 + 70 44 + 71 44 + 72 44 + 73 44 + 74 44 + 75 45 + 76 45 + 77 45 + 78 45 + 79 46 + 7a 46 + 7b 46 + 7c 46 + 7d 46 + 7e 47 + 7f 47 + 80 47 + 81 47 + 82 47 + 83 48 + 84 48 + 85 48 + 86 48 + 87 48 + 88 49 + 89 49 + 8a 49 + 8b 49 + 8c 49 + 8d 49 + 8e 49 + 8f 50 + 90 50 + 91 50 + 92 50 + 93 50 + 94 50 + 95 50 + 96 51 + 97 51 + 98 51 + 99 51 + 9a 51 + 9b 51 + 9c 51 + 9d 52 + 9e 52 + 9f 52 + a0 52 + a1 52 + a2 52 + a3 52 + a4 52 + a5 53 + a6 53 + a7 53 + a8 53 + a9 53 + aa 53 + ab 53 + ac 53 + ad 54 + ae 54 + af 54 + b0 54 + b1 54 + b2 54 + b3 54 + b4 54 + b5 54 + b6 55 + b7 55 + b8 55 + b9 55 + ba 55 + bb 55 + bc 55 + bd 55 + be 56 + bf 56 + c0 56 + c1 56 + c2 56 + c3 57 + c4 57 + c5 57 + c6 57 + c7 57 + c8 57 + c9 57 + ca 58 + cb 58 + cc 58 + cd 58 + ce 58 + cf 58 + d0 58 + d1 59 + d2 59 + d3 59 + d4 59 + d5 59 + d6 59 + d7 60 + d8 60 + d9 60 + da 60 + db 60 + dc 61 + dd 61 + de 61 + df 61 + e0 61 + e1 61 + e2 62 + e3 62 + e4 62 + e5 62 + e6 62 + e7 62 + e8 63 + e9 63 + ea 63 + eb 63 + ec 64 + ed 64 + ee 64 + ef 64 + f0 64 + f1 64 + f2 64 + f3 65 + f4 65 + f5 65 + f6 65 + f7 65 + f8 65 + f9 65 + fa 66 + fb 66 + fc 66 + fd 66 + fe 66 + ff 66 + 100 67 + 101 67 + 102 67 + 103 67 + 104 67 + 105 67 + 106 68 + 107 68 + 108 68 + 109 68 + 10a 68 + 10b 69 + 10c 69 + 10d 69 + 10e 69 + 10f 69 + 110 69 + 111 70 + 112 70 + 113 70 + 114 70 + 115 70 + 116 71 + 117 71 + 118 71 + 119 71 + 11a 71 + 11b 71 + 11c 71 + 11d 72 + 11e 72 + 11f 72 + 120 72 + 121 72 + 122 72 + 123 72 + 124 73 + 125 73 + 126 73 + 127 73 + 128 73 + 129 73 + 12a 74 + 12b 74 + 12c 74 + 12d 74 + 12e 74 + 12f 74 + 130 75 + 131 75 + 132 75 + 133 75 + 134 75 + 135 75 + 136 76 + 137 76 + 138 76 + 139 76 + 13a 76 + 13b 77 + } +} + +Lines mapping: +5 <-> 5 +8 <-> 8 +11 <-> 11 +14 <-> 14 +17 <-> 17 +20 <-> 20 +23 <-> 23 +24 <-> 24 +25 <-> 25 +26 <-> 26 +27 <-> 27 +28 <-> 28 +29 <-> 29 +30 <-> 30 +31 <-> 31 +32 <-> 32 +34 <-> 33 +35 <-> 34 +36 <-> 35 +37 <-> 36 +38 <-> 37 +39 <-> 38 +40 <-> 39 +41 <-> 40 +42 <-> 41 +43 <-> 42 +45 <-> 43 +46 <-> 44 +47 <-> 45 +48 <-> 46 +49 <-> 47 +50 <-> 48 +51 <-> 49 +52 <-> 50 +53 <-> 51 +54 <-> 52 +55 <-> 53 +56 <-> 54 +57 <-> 55 +58 <-> 56 +60 <-> 57 +61 <-> 58 +62 <-> 59 +63 <-> 60 +64 <-> 61 +65 <-> 62 +66 <-> 63 +68 <-> 64 +69 <-> 65 +70 <-> 66 +71 <-> 67 +72 <-> 68 +73 <-> 69 +74 <-> 70 +76 <-> 71 +77 <-> 72 +78 <-> 73 +79 <-> 74 +80 <-> 75 +81 <-> 76 +82 <-> 77 +83 <-> 78 diff --git a/testData/results/pkg/TestNumberDisambiguation.dec b/testData/results/pkg/TestNumberDisambiguation.dec new file mode 100644 index 0000000000..26613185c1 --- /dev/null +++ b/testData/results/pkg/TestNumberDisambiguation.dec @@ -0,0 +1,384 @@ +package pkg; + +public class TestNumberDisambiguation { + public void foo(byte b) { + }// 5 + + public void foo(short s) { + }// 8 + + public void foo(char c) { + }// 11 + + public void foo(int i) { + }// 14 + + public void foo(long l) { + }// 17 + + public void foo(float f) { + }// 20 + + public void foo(double d) { + }// 23 + + public void bar(byte a, byte b) { + }// 26 + + public void bar(short a, short b) { + }// 29 + + public void bar(char a, char b) { + }// 32 + + public void bar(int a, int b) { + }// 35 + + public void bar(long a, long b) { + }// 38 + + public void bar(float a, float b) { + }// 41 + + public void bar(double a, double b) { + }// 44 + + public void baz(int a, byte b, byte c) { + }// 47 + + public void baz(int a, short b, short c) { + }// 50 + + public void baz(int a, char b, char c) { + }// 53 + + public void baz(int a, int b, int c) { + }// 56 + + public void baz(int a, long b, long c) { + }// 59 + + public void baz(int a, float b, float c) { + }// 62 + + public void baz(int a, double b, double c) { + }// 65 + + public void test() { + int i = 24;// 68 + this.foo((byte)i);// 69 + this.foo((short)i);// 70 + this.foo((char)i);// 71 + this.foo(i);// 72 + this.foo((long)i);// 73 + this.foo((float)i);// 74 + this.foo((double)i);// 75 + this.bar((byte)0, (byte)i);// 77 + this.bar((short)0, (short)i);// 78 + this.bar('\u0000', (char)i);// 79 + this.bar(0, i);// 80 + this.bar(0L, (long)i);// 81 + this.bar(0.0F, (float)i);// 82 + this.bar(0.0, (double)i);// 83 + this.baz(0, (byte)127, (byte)i);// 85 + this.baz(0, (short)32767, (short)i);// 86 + this.baz(0, '\uffff', (char)i);// 87 + this.baz(0, 2147483647, i);// 88 + this.baz(0, 9223372036854775807L, (long)i);// 89 + this.baz(0, 3.4028235E38F, (float)i);// 90 + this.baz(0, 1.7976931348623157E308, (double)i);// 91 + }// 92 +} + +class 'pkg/TestNumberDisambiguation' { + method 'foo (B)V' { + 0 4 + } + + method 'foo (S)V' { + 0 7 + } + + method 'foo (C)V' { + 0 10 + } + + method 'foo (I)V' { + 0 13 + } + + method 'foo (J)V' { + 0 16 + } + + method 'foo (F)V' { + 0 19 + } + + method 'foo (D)V' { + 0 22 + } + + method 'bar (BB)V' { + 0 25 + } + + method 'bar (SS)V' { + 0 28 + } + + method 'bar (CC)V' { + 0 31 + } + + method 'bar (II)V' { + 0 34 + } + + method 'bar (JJ)V' { + 0 37 + } + + method 'bar (FF)V' { + 0 40 + } + + method 'bar (DD)V' { + 0 43 + } + + method 'baz (IBB)V' { + 0 46 + } + + method 'baz (ISS)V' { + 0 49 + } + + method 'baz (ICC)V' { + 0 52 + } + + method 'baz (III)V' { + 0 55 + } + + method 'baz (IJJ)V' { + 0 58 + } + + method 'baz (IFF)V' { + 0 61 + } + + method 'baz (IDD)V' { + 0 64 + } + + method 'test ()V' { + 0 67 + 1 67 + 2 67 + 3 68 + 4 68 + 5 68 + 6 68 + 7 68 + 8 68 + 9 69 + a 69 + b 69 + c 69 + d 69 + e 69 + f 70 + 10 70 + 11 70 + 12 70 + 13 70 + 14 70 + 15 71 + 16 71 + 17 71 + 18 71 + 19 71 + 1a 72 + 1b 72 + 1c 72 + 1d 72 + 1e 72 + 1f 72 + 20 73 + 21 73 + 22 73 + 23 73 + 24 73 + 25 73 + 26 74 + 27 74 + 28 74 + 29 74 + 2a 74 + 2b 74 + 2c 75 + 2d 75 + 2e 75 + 2f 75 + 30 75 + 31 75 + 32 75 + 33 76 + 34 76 + 35 76 + 36 76 + 37 76 + 38 76 + 39 76 + 3a 77 + 3b 77 + 3c 77 + 3d 77 + 3e 77 + 3f 77 + 40 77 + 41 78 + 42 78 + 43 78 + 44 78 + 45 78 + 46 78 + 47 79 + 48 79 + 49 79 + 4a 79 + 4b 79 + 4c 79 + 4d 79 + 4e 80 + 4f 80 + 50 80 + 51 80 + 52 80 + 53 80 + 54 80 + 55 81 + 56 81 + 57 81 + 58 81 + 59 81 + 5a 81 + 5b 81 + 5c 82 + 5d 82 + 5e 82 + 5f 82 + 60 82 + 61 82 + 62 82 + 63 82 + 64 82 + 65 83 + 66 83 + 67 83 + 68 83 + 69 83 + 6a 83 + 6b 83 + 6c 83 + 6d 83 + 6e 83 + 6f 84 + 70 84 + 71 84 + 72 84 + 73 84 + 74 84 + 75 84 + 76 84 + 77 84 + 78 85 + 79 85 + 7a 85 + 7b 85 + 7c 85 + 7d 85 + 7e 85 + 7f 85 + 80 86 + 81 86 + 82 86 + 83 86 + 84 86 + 85 86 + 86 86 + 87 86 + 88 86 + 89 86 + 8a 87 + 8b 87 + 8c 87 + 8d 87 + 8e 87 + 8f 87 + 90 87 + 91 87 + 92 87 + 93 88 + 94 88 + 95 88 + 96 88 + 97 88 + 98 88 + 99 88 + 9a 88 + 9b 88 + 9c 88 + 9d 89 + } +} + +Lines mapping: +5 <-> 5 +8 <-> 8 +11 <-> 11 +14 <-> 14 +17 <-> 17 +20 <-> 20 +23 <-> 23 +26 <-> 26 +29 <-> 29 +32 <-> 32 +35 <-> 35 +38 <-> 38 +41 <-> 41 +44 <-> 44 +47 <-> 47 +50 <-> 50 +53 <-> 53 +56 <-> 56 +59 <-> 59 +62 <-> 62 +65 <-> 65 +68 <-> 68 +69 <-> 69 +70 <-> 70 +71 <-> 71 +72 <-> 72 +73 <-> 73 +74 <-> 74 +75 <-> 75 +77 <-> 76 +78 <-> 77 +79 <-> 78 +80 <-> 79 +81 <-> 80 +82 <-> 81 +83 <-> 82 +85 <-> 83 +86 <-> 84 +87 <-> 85 +88 <-> 86 +89 <-> 87 +90 <-> 88 +91 <-> 89 +92 <-> 90 diff --git a/testData/results/pkg/TestObject.dec b/testData/results/pkg/TestObject.dec index 2394b2e503..88966a6b17 100644 --- a/testData/results/pkg/TestObject.dec +++ b/testData/results/pkg/TestObject.dec @@ -113,11 +113,15 @@ class 'pkg/TestObject$' { 0 26 1 26 2 26 + 3 26 + 4 26 5 27 6 27 7 29 8 29 9 29 + a 29 + b 29 c 29 e 29 f 29 diff --git a/testData/results/pkg/TestObjectBitwise.dec b/testData/results/pkg/TestObjectBitwise.dec index 9792f57f5b..3b766e91d9 100644 --- a/testData/results/pkg/TestObjectBitwise.dec +++ b/testData/results/pkg/TestObjectBitwise.dec @@ -4,27 +4,27 @@ public abstract class TestObjectBitwise { abstract T get(); public boolean test(int i) { - return ((Long)this.obj() & (long)i) == 0L;// 7 + return ((Long)this.obj() & i) == 0L;// 7 } public boolean testn(int i) { - return ((Long)this.num() & (long)i) == 0L;// 11 + return ((Long)this.num() & i) == 0L;// 11 } public boolean testg(int i) { - return ((Long)this.get() & (long)i) == 0L;// 15 + return ((Long)this.get() & i) == 0L;// 15 } public boolean test1(int i) { - return ((Long)this.obj() | (long)i) == 0L;// 50 + return ((Long)this.obj() | i) == 0L;// 50 } public boolean test3(int i) { - return (Long)this.obj() + (long)i == 0L;// 54 + return (Long)this.obj() + i == 0L;// 54 } public boolean test4(int i) { - return (Long)this.obj() % (long)i == 0L;// 58 + return (Long)this.obj() % i == 0L;// 58 } public Object obj() { @@ -43,17 +43,17 @@ public abstract class TestObjectBitwise { } public boolean testg_inner(int i) { - return (this.get() & (long)i) == 0L;// 27 + return (this.get() & i) == 0L;// 27 } public boolean testg_inner2(int i) { long l = this.get();// 31 - return (l & (long)i) == 0L;// 32 + return (l & i) == 0L;// 32 } public boolean testg_inner3(int i) { long l = this.other.get();// 36 - return (l & (long)i) == 0L;// 37 + return (l & i) == 0L;// 37 } public boolean testg_inner4(int i) { @@ -61,7 +61,7 @@ public abstract class TestObjectBitwise { long l2 = (Long)this.other.num();// 42 long l3 = (Long)this.obj();// 43 long l4 = (Long)this.num();// 44 - return (l & (long)i & l2 & l3 & l4) == 0L;// 45 + return (l & i & l2 & l3 & l4) == 0L;// 45 } } } @@ -84,6 +84,8 @@ class 'pkg/TestObjectBitwise' { d 6 e 6 f 6 + 10 6 + 11 6 17 6 } @@ -104,6 +106,8 @@ class 'pkg/TestObjectBitwise' { d 10 e 10 f 10 + 10 10 + 11 10 17 10 } @@ -124,6 +128,8 @@ class 'pkg/TestObjectBitwise' { d 14 e 14 f 14 + 10 14 + 11 14 17 14 } @@ -144,6 +150,8 @@ class 'pkg/TestObjectBitwise' { d 18 e 18 f 18 + 10 18 + 11 18 17 18 } @@ -164,6 +172,8 @@ class 'pkg/TestObjectBitwise' { d 22 e 22 f 22 + 10 22 + 11 22 17 22 } @@ -184,6 +194,8 @@ class 'pkg/TestObjectBitwise' { d 26 e 26 f 26 + 10 26 + 11 26 17 26 } @@ -233,6 +245,8 @@ class 'pkg/TestObjectBitwise$Inner' { a 45 b 45 c 45 + d 45 + e 45 14 45 } @@ -252,6 +266,8 @@ class 'pkg/TestObjectBitwise$Inner' { c 50 d 50 e 50 + f 50 + 10 50 16 50 } @@ -274,6 +290,8 @@ class 'pkg/TestObjectBitwise$Inner' { 12 55 13 55 14 55 + 15 55 + 16 55 1c 55 } @@ -347,6 +365,8 @@ class 'pkg/TestObjectBitwise$Inner' { 42 63 43 63 44 63 + 45 63 + 46 63 4c 63 } } diff --git a/testData/results/pkg/TestObjectPhi.dec b/testData/results/pkg/TestObjectPhi.dec index 824bb21cf9..34516ca03b 100644 --- a/testData/results/pkg/TestObjectPhi.dec +++ b/testData/results/pkg/TestObjectPhi.dec @@ -20,6 +20,8 @@ class 'pkg/TestObjectPhi' { 2 4 3 5 4 5 + 5 5 + 6 5 7 6 8 6 c 8 diff --git a/testData/results/pkg/TestOldECJInner.dec b/testData/results/pkg/TestOldECJInner.dec index 0b7b87b1c6..1a6c6c61db 100644 --- a/testData/results/pkg/TestOldECJInner.dec +++ b/testData/results/pkg/TestOldECJInner.dec @@ -30,7 +30,11 @@ class 'pkg/TestOldECJInner' { 1 6 2 6 3 6 + 4 6 + 5 6 d 7 + e 7 + f 7 10 10 11 10 12 10 diff --git a/testData/results/pkg/TestPPMMLoop.dec b/testData/results/pkg/TestPPMMLoop.dec index dec2d0425a..3e29959392 100644 --- a/testData/results/pkg/TestPPMMLoop.dec +++ b/testData/results/pkg/TestPPMMLoop.dec @@ -33,6 +33,8 @@ class 'pkg/TestPPMMLoop' { 2 4 3 4 4 4 + 5 4 + 6 4 e 5 12 5 13 5 @@ -48,6 +50,8 @@ class 'pkg/TestPPMMLoop' { 2 10 3 10 4 10 + 5 10 + 6 10 e 11 12 11 13 11 @@ -64,6 +68,8 @@ class 'pkg/TestPPMMLoop' { 2 16 3 16 4 16 + 5 16 + 6 16 e 17 12 17 13 17 @@ -79,6 +85,8 @@ class 'pkg/TestPPMMLoop' { 2 22 3 22 4 22 + 5 22 + 6 22 e 23 12 23 13 23 diff --git a/testData/results/pkg/TestPPMMPhi.dec b/testData/results/pkg/TestPPMMPhi.dec index c3ae15843d..92cfc2b4db 100644 --- a/testData/results/pkg/TestPPMMPhi.dec +++ b/testData/results/pkg/TestPPMMPhi.dec @@ -27,6 +27,8 @@ class 'pkg/TestPPMMPhi' { 4 4 5 5 6 5 + 7 5 + 8 5 9 6 a 6 b 6 diff --git a/testData/results/pkg/TestPatternMatching.dec b/testData/results/pkg/TestPatternMatching.dec index 04c72452e5..5db83e7576 100644 --- a/testData/results/pkg/TestPatternMatching.dec +++ b/testData/results/pkg/TestPatternMatching.dec @@ -60,11 +60,7 @@ public class TestPatternMatching { }// 55 public boolean testReturn(Object obj) { - if (obj instanceof String s && s.length() > 5) {// 58 - return true; - } - - return false; + return obj instanceof String s && s.length() > 5;// 58 } public int testReturnTernary(Object obj) { @@ -72,7 +68,7 @@ public class TestPatternMatching { } public int testReturnTernaryComplex(Object obj) { - return (!(obj instanceof String s) || s.length() <= 5) && !(obj instanceof Integer) ? 1 : 4;// 66 + return !(obj instanceof String s && s.length() > 5) && !(obj instanceof Integer) ? 1 : 4;// 66 } public void testLoop(Object obj) { @@ -84,12 +80,10 @@ public class TestPatternMatching { }// 76 public void testSimpleReturn(Object obj) { - if (obj instanceof String str && str.length() > 5) {// 79 80 - return;// 81 + if (!(obj instanceof String str && str.length() > 5)) {// 79 80 + System.out.println("test");// 85 } - - System.out.println("test");// 85 - }// 86 + }// 81 86 public void testMessyLVT(Object obj) { String a = "a";// 90 @@ -115,6 +109,8 @@ class 'pkg/TestPatternMatching' { 4 4 5 4 6 4 + 7 4 + 8 4 d 4 e 5 f 5 @@ -124,6 +120,8 @@ class 'pkg/TestPatternMatching' { 13 5 14 5 15 5 + 16 5 + 17 5 18 7 } @@ -134,6 +132,8 @@ class 'pkg/TestPatternMatching' { 4 10 5 10 6 10 + 7 10 + 8 10 d 10 11 11 12 11 @@ -141,6 +141,8 @@ class 'pkg/TestPatternMatching' { 14 11 15 11 16 11 + 17 11 + 18 11 19 13 } @@ -151,6 +153,8 @@ class 'pkg/TestPatternMatching' { 4 16 5 16 6 16 + 7 16 + 8 16 d 16 e 16 f 16 @@ -159,6 +163,8 @@ class 'pkg/TestPatternMatching' { 12 16 13 16 14 16 + 15 16 + 16 16 17 17 18 17 19 17 @@ -167,6 +173,8 @@ class 'pkg/TestPatternMatching' { 1c 17 1d 17 1e 17 + 1f 17 + 20 17 21 19 } @@ -230,6 +238,8 @@ class 'pkg/TestPatternMatching' { 4 37 5 37 6 37 + 7 37 + 8 37 9 42 a 42 b 42 @@ -251,19 +261,12 @@ class 'pkg/TestPatternMatching' { 1b 39 1c 39 1d 39 - 1e 43 - 1f 43 - 20 43 21 43 - 22 43 - 23 43 24 43 25 43 26 43 27 43 28 44 - 29 44 - 2a 44 } method 'testInvertedLoopUnused (Ljava/lang/Object;)V' { @@ -273,14 +276,14 @@ class 'pkg/TestPatternMatching' { 4 47 5 47 6 47 + 7 47 + 8 47 9 52 a 52 b 52 c 52 d 52 e 53 - f 53 - 10 53 11 48 12 48 13 48 @@ -294,9 +297,6 @@ class 'pkg/TestPatternMatching' { 1b 49 1c 49 1d 49 - 1e 53 - 1f 53 - 20 53 } method 'testCompoundLoop (Ljava/lang/Object;)V' { @@ -306,6 +306,8 @@ class 'pkg/TestPatternMatching' { 4 56 5 56 6 56 + 7 56 + 8 56 d 56 e 56 f 56 @@ -314,6 +316,8 @@ class 'pkg/TestPatternMatching' { 12 56 13 56 14 56 + 15 56 + 16 56 17 57 18 57 19 57 @@ -330,6 +334,8 @@ class 'pkg/TestPatternMatching' { 4 62 5 62 6 62 + 7 62 + 8 62 d 62 e 62 f 62 @@ -337,34 +343,68 @@ class 'pkg/TestPatternMatching' { 11 62 12 62 13 62 - 16 63 - 1a 66 - 1b 63 + 14 62 + 15 62 + 1b 62 } method 'testReturnTernary (Ljava/lang/Object;)I' { + 0 66 + 2 66 + 3 66 + 4 66 + 5 66 + 6 66 + 7 66 + 8 66 + d 66 + e 66 + f 66 + 10 66 + 11 66 + 15 66 + 16 66 + } + + method 'testReturnTernaryComplex (Ljava/lang/Object;)I' { 0 70 2 70 3 70 4 70 5 70 6 70 + 7 70 + 8 70 d 70 e 70 f 70 10 70 11 70 + 12 70 + 13 70 + 14 70 15 70 16 70 + 17 70 + 18 70 + 19 70 + 1a 70 + 1b 70 + 1c 70 + 1d 70 + 21 70 + 22 70 } - method 'testReturnTernaryComplex (Ljava/lang/Object;)I' { + method 'testLoop (Ljava/lang/Object;)V' { 0 74 2 74 3 74 4 74 5 74 6 74 + 7 74 + 8 74 d 74 e 74 f 74 @@ -372,130 +412,116 @@ class 'pkg/TestPatternMatching' { 11 74 12 74 13 74 + 14 74 + 15 74 16 74 - 17 74 - 18 74 - 19 74 - 1a 74 - 1d 74 - 21 74 - 22 74 - } - - method 'testLoop (Ljava/lang/Object;)V' { - 0 78 - 2 78 - 3 78 - 4 78 - 5 78 - 6 78 - d 78 - e 78 - f 78 - 10 78 - 11 78 - 12 78 - 13 78 - 14 78 - 17 79 - 18 79 - 19 79 - 1a 79 - 1b 79 - 1c 79 - 1d 80 - 1e 80 - 1f 80 - 20 80 - 21 80 - 22 80 - 23 81 - 24 81 - 25 81 - 26 81 - 27 81 - 28 81 - 29 81 - 2d 83 + 17 75 + 18 75 + 19 75 + 1a 75 + 1b 75 + 1c 75 + 1d 76 + 1e 76 + 1f 76 + 20 76 + 21 76 + 22 76 + 23 77 + 24 77 + 25 77 + 26 77 + 27 77 + 28 77 + 29 77 + 2d 79 } method 'testSimpleReturn (Ljava/lang/Object;)V' { - 0 86 - 2 86 - 3 86 - 4 86 - 5 86 - 6 86 - d 86 - e 86 - f 86 - 10 86 - 11 86 - 12 86 - 13 86 - 16 87 - 17 90 - 18 90 - 19 90 - 1a 90 - 1b 90 - 1c 90 - 1d 90 - 1e 90 - 1f 91 + 0 82 + 2 82 + 3 82 + 4 82 + 5 82 + 6 82 + 7 82 + 8 82 + d 82 + e 82 + f 82 + 10 82 + 11 82 + 12 82 + 13 82 + 14 82 + 15 82 + 16 85 + 17 83 + 18 83 + 19 83 + 1a 83 + 1b 83 + 1c 83 + 1d 83 + 1e 83 + 1f 85 } method 'testMessyLVT (Ljava/lang/Object;)V' { - 0 94 - 1 94 - 2 94 - 3 95 - 4 95 - 5 95 - 6 96 - 7 96 - 8 96 - 9 96 - a 97 - b 97 - c 97 - d 97 - e 98 - f 98 - 10 98 - 11 98 - 12 99 - 13 99 - 14 99 - 15 99 - 16 100 - 17 100 - 18 100 - 19 100 - 1a 101 - 1b 101 - 1c 101 - 1d 101 - 1e 102 - 1f 102 - 20 102 - 21 102 - 22 103 - 24 103 - 25 103 - 26 103 - 27 103 - 28 103 - 2f 103 - 30 104 - 31 104 - 32 104 - 33 104 - 34 104 - 35 104 - 36 104 - 37 104 - 3a 106 + 0 88 + 1 88 + 2 88 + 3 89 + 4 89 + 5 89 + 6 90 + 7 90 + 8 90 + 9 90 + a 91 + b 91 + c 91 + d 91 + e 92 + f 92 + 10 92 + 11 92 + 12 93 + 13 93 + 14 93 + 15 93 + 16 94 + 17 94 + 18 94 + 19 94 + 1a 95 + 1b 95 + 1c 95 + 1d 95 + 1e 96 + 1f 96 + 20 96 + 21 96 + 22 97 + 24 97 + 25 97 + 26 97 + 27 97 + 28 97 + 29 97 + 2a 97 + 2f 97 + 30 98 + 31 98 + 32 98 + 33 98 + 34 98 + 35 98 + 36 98 + 37 98 + 38 98 + 39 98 + 3a 100 } } @@ -527,30 +553,30 @@ Lines mapping: 53 <-> 58 55 <-> 60 58 <-> 63 -62 <-> 71 -66 <-> 75 -70 <-> 79 -71 <-> 80 -72 <-> 81 -74 <-> 82 -76 <-> 84 -79 <-> 87 -80 <-> 87 -81 <-> 88 -85 <-> 91 -86 <-> 92 -90 <-> 95 -91 <-> 96 -92 <-> 97 -93 <-> 98 -94 <-> 99 -95 <-> 100 -96 <-> 101 -97 <-> 102 -98 <-> 103 -100 <-> 104 -101 <-> 105 -103 <-> 107 +62 <-> 67 +66 <-> 71 +70 <-> 75 +71 <-> 76 +72 <-> 77 +74 <-> 78 +76 <-> 80 +79 <-> 83 +80 <-> 83 +81 <-> 86 +85 <-> 84 +86 <-> 86 +90 <-> 89 +91 <-> 90 +92 <-> 91 +93 <-> 92 +94 <-> 93 +95 <-> 94 +96 <-> 95 +97 <-> 96 +98 <-> 97 +100 <-> 98 +101 <-> 99 +103 <-> 101 Not mapped: 42 -49 +49 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatching17.dec b/testData/results/pkg/TestPatternMatching17.dec index 6e6bfc84cb..5360304d6c 100644 --- a/testData/results/pkg/TestPatternMatching17.dec +++ b/testData/results/pkg/TestPatternMatching17.dec @@ -65,11 +65,7 @@ public class TestPatternMatching17 { }// 55 public boolean testReturn(Object obj) { - if (obj instanceof String s && s.length() > 5) {// 58 - return true; - } - - return false; + return obj instanceof String s && s.length() > 5;// 58 } public int testReturnTernary(Object obj) { @@ -77,7 +73,7 @@ public class TestPatternMatching17 { } public int testReturnTernaryComplex(Object obj) { - return (!(obj instanceof String s) || s.length() <= 5) && !(obj instanceof Integer) ? 1 : 4;// 66 + return !(obj instanceof String s && s.length() > 5) && !(obj instanceof Integer) ? 1 : 4;// 66 } public void testLoop(Object obj) { @@ -89,12 +85,10 @@ public class TestPatternMatching17 { }// 76 public void testSimpleReturn(Object obj) { - if (obj instanceof String str && str.length() > 5) {// 79 80 - return;// 81 + if (!(obj instanceof String str && str.length() > 5)) {// 79 80 + System.out.println("test");// 85 } - - System.out.println("test");// 85 - }// 86 + }// 81 86 public void testMessyLVT(Object obj) { String a = "a";// 90 @@ -179,11 +173,7 @@ public class TestPatternMatching17 { }// 172 public String multiCombo(Object o, String s) { - if (o instanceof String s2 && !s.isEmpty()) {// 175 - return s2 + s;// 176 - } - - return s;// 178 + return o instanceof String s2 && !s.isEmpty() ? s2 + s : s;// 175 176 178 } } @@ -194,6 +184,8 @@ class 'pkg/TestPatternMatching17' { 2 9 3 9 4 9 + 5 9 + 6 9 b 9 c 10 d 10 @@ -203,6 +195,8 @@ class 'pkg/TestPatternMatching17' { 11 10 12 10 13 10 + 14 10 + 15 10 16 12 } @@ -212,6 +206,8 @@ class 'pkg/TestPatternMatching17' { 2 15 3 15 4 15 + 5 15 + 6 15 b 15 f 16 10 16 @@ -219,6 +215,8 @@ class 'pkg/TestPatternMatching17' { 12 16 13 16 14 16 + 15 16 + 16 16 17 18 } @@ -228,6 +226,8 @@ class 'pkg/TestPatternMatching17' { 2 21 3 21 4 21 + 5 21 + 6 21 b 21 c 21 d 21 @@ -236,6 +236,8 @@ class 'pkg/TestPatternMatching17' { 10 21 11 21 12 21 + 13 21 + 14 21 15 22 16 22 17 22 @@ -244,6 +246,8 @@ class 'pkg/TestPatternMatching17' { 1a 22 1b 22 1c 22 + 1d 22 + 1e 22 1f 24 } @@ -304,6 +308,8 @@ class 'pkg/TestPatternMatching17' { 2 42 3 42 4 42 + 5 42 + 6 42 7 47 8 47 9 47 @@ -325,19 +331,12 @@ class 'pkg/TestPatternMatching17' { 19 44 1a 44 1b 44 - 1c 48 - 1d 48 - 1e 48 1f 48 - 20 48 - 21 48 22 48 23 48 24 48 25 48 26 49 - 27 49 - 28 49 } method 'testInvertedLoopUnused (Ljava/lang/Object;)V' { @@ -346,14 +345,14 @@ class 'pkg/TestPatternMatching17' { 2 52 3 52 4 52 + 5 52 + 6 52 7 57 8 57 9 57 a 57 b 57 c 58 - d 58 - e 58 f 53 10 53 11 53 @@ -367,9 +366,6 @@ class 'pkg/TestPatternMatching17' { 19 54 1a 54 1b 54 - 1c 58 - 1d 58 - 1e 58 } method 'testCompoundLoop (Ljava/lang/Object;)V' { @@ -378,6 +374,8 @@ class 'pkg/TestPatternMatching17' { 2 61 3 61 4 61 + 5 61 + 6 61 b 61 c 61 d 61 @@ -386,6 +384,8 @@ class 'pkg/TestPatternMatching17' { 10 61 11 61 12 61 + 13 61 + 14 61 15 62 16 62 17 62 @@ -401,6 +401,8 @@ class 'pkg/TestPatternMatching17' { 2 67 3 67 4 67 + 5 67 + 6 67 b 67 c 67 d 67 @@ -408,32 +410,65 @@ class 'pkg/TestPatternMatching17' { f 67 10 67 11 67 - 14 68 - 18 71 - 19 68 + 12 67 + 13 67 + 19 67 } method 'testReturnTernary (Ljava/lang/Object;)I' { + 0 71 + 1 71 + 2 71 + 3 71 + 4 71 + 5 71 + 6 71 + b 71 + c 71 + d 71 + e 71 + f 71 + 13 71 + 14 71 + } + + method 'testReturnTernaryComplex (Ljava/lang/Object;)I' { 0 75 1 75 2 75 3 75 4 75 + 5 75 + 6 75 b 75 c 75 d 75 e 75 f 75 + 10 75 + 11 75 + 12 75 13 75 14 75 + 15 75 + 16 75 + 17 75 + 18 75 + 19 75 + 1a 75 + 1b 75 + 1f 75 + 20 75 } - method 'testReturnTernaryComplex (Ljava/lang/Object;)I' { + method 'testLoop (Ljava/lang/Object;)V' { 0 79 1 79 2 79 3 79 4 79 + 5 79 + 6 79 b 79 c 79 d 79 @@ -441,352 +476,377 @@ class 'pkg/TestPatternMatching17' { f 79 10 79 11 79 + 12 79 + 13 79 14 79 - 15 79 - 16 79 - 17 79 - 18 79 - 1b 79 - 1f 79 - 20 79 - } - - method 'testLoop (Ljava/lang/Object;)V' { - 0 83 - 1 83 - 2 83 - 3 83 - 4 83 - b 83 - c 83 - d 83 - e 83 - f 83 - 10 83 - 11 83 - 12 83 - 15 84 - 16 84 - 17 84 - 18 84 - 19 84 - 1a 84 - 1b 85 - 1c 85 - 1d 85 - 1e 85 - 1f 85 - 20 85 - 21 86 - 22 86 - 23 86 - 24 86 - 25 86 - 26 86 - 27 86 - 2b 88 + 15 80 + 16 80 + 17 80 + 18 80 + 19 80 + 1a 80 + 1b 81 + 1c 81 + 1d 81 + 1e 81 + 1f 81 + 20 81 + 21 82 + 22 82 + 23 82 + 24 82 + 25 82 + 26 82 + 27 82 + 2b 84 } method 'testSimpleReturn (Ljava/lang/Object;)V' { - 0 91 - 1 91 - 2 91 - 3 91 - 4 91 - b 91 - c 91 - d 91 - e 91 - f 91 - 10 91 - 11 91 - 14 92 - 15 95 - 16 95 - 17 95 - 18 95 - 19 95 - 1a 95 - 1b 95 - 1c 95 - 1d 96 + 0 87 + 1 87 + 2 87 + 3 87 + 4 87 + 5 87 + 6 87 + b 87 + c 87 + d 87 + e 87 + f 87 + 10 87 + 11 87 + 12 87 + 13 87 + 14 90 + 15 88 + 16 88 + 17 88 + 18 88 + 19 88 + 1a 88 + 1b 88 + 1c 88 + 1d 90 } method 'testMessyLVT (Ljava/lang/Object;)V' { - 0 99 - 1 99 - 2 99 - 3 100 - 4 100 - 5 100 - 6 101 - 7 101 - 8 101 - 9 101 - a 102 - b 102 - c 102 - d 102 - e 103 - f 103 - 10 103 - 11 103 - 12 104 - 13 104 - 14 104 - 15 104 - 16 105 - 17 105 - 18 105 - 19 105 - 1a 106 - 1b 106 - 1c 106 - 1d 106 - 1e 107 - 1f 107 - 20 107 - 21 107 - 22 108 - 23 108 - 24 108 - 25 108 - 26 108 - 2d 108 - 2e 109 - 2f 109 - 30 109 - 31 109 - 32 109 - 33 109 - 34 109 - 35 109 - 38 111 + 0 93 + 1 93 + 2 93 + 3 94 + 4 94 + 5 94 + 6 95 + 7 95 + 8 95 + 9 95 + a 96 + b 96 + c 96 + d 96 + e 97 + f 97 + 10 97 + 11 97 + 12 98 + 13 98 + 14 98 + 15 98 + 16 99 + 17 99 + 18 99 + 19 99 + 1a 100 + 1b 100 + 1c 100 + 1d 100 + 1e 101 + 1f 101 + 20 101 + 21 101 + 22 102 + 23 102 + 24 102 + 25 102 + 26 102 + 27 102 + 28 102 + 2d 102 + 2e 103 + 2f 103 + 30 103 + 31 103 + 32 103 + 33 103 + 34 103 + 35 103 + 36 103 + 37 103 + 38 105 } method 'testEmptyHead ()V' { - 0 114 - 1 114 - 2 114 - 3 114 - 4 114 - 5 114 - 6 114 - 7 114 - a 115 - b 115 - c 115 - d 115 - e 115 - 11 116 - 12 116 - 13 116 - 14 116 - 15 116 - 1a 119 - 1b 119 - 1c 119 - 1d 119 - 1e 119 - 1f 119 - 20 119 - 21 119 - 22 119 - 23 119 - 24 119 - 25 119 - 26 120 - 27 120 - 28 120 - 29 120 - 2a 120 - 2d 121 - 2e 121 - 2f 121 - 30 121 - 31 121 - 32 121 - 33 121 - 37 123 - 38 123 - 39 123 - 3a 123 - 3b 123 - 3e 126 + 0 108 + 1 108 + 2 108 + 3 108 + 4 108 + 5 108 + 6 108 + 7 108 + 8 108 + 9 108 + a 109 + b 109 + c 109 + d 109 + e 109 + f 109 + 10 109 + 11 110 + 12 110 + 13 110 + 14 110 + 15 110 + 16 110 + 17 110 + 18 110 + 19 110 + 1a 113 + 1b 113 + 1c 113 + 1d 113 + 1e 113 + 1f 113 + 20 113 + 21 113 + 22 113 + 23 113 + 24 113 + 25 113 + 26 114 + 27 114 + 28 114 + 29 114 + 2a 114 + 2b 114 + 2c 114 + 2d 115 + 2e 115 + 2f 115 + 30 115 + 31 115 + 32 115 + 33 115 + 37 117 + 38 117 + 39 117 + 3a 117 + 3b 117 + 3c 117 + 3d 117 + 3e 120 } method 'reassign (Ljava/lang/Object;)V' { - 0 129 - 1 129 - 2 129 - 3 131 - 4 131 - 5 131 - 6 131 - 7 131 - 8 131 - b 132 - c 132 - d 132 - e 132 - f 132 - 12 133 - 13 133 - 14 133 - 18 134 - 19 134 - 1a 134 - 1b 134 - 1c 134 - 1f 135 - 20 135 - 21 135 - 22 135 - 23 135 - 24 131 - 25 131 - 26 131 - 2a 139 - 2b 139 - 2c 139 - 2d 139 - 2e 139 - 2f 139 - 30 139 - 31 140 + 0 123 + 1 123 + 2 123 + 3 125 + 4 125 + 5 125 + 6 125 + 7 125 + 8 125 + 9 125 + a 125 + b 126 + c 126 + d 126 + e 126 + f 126 + 10 126 + 11 126 + 12 127 + 13 127 + 14 127 + 18 128 + 19 128 + 1a 128 + 1b 128 + 1c 128 + 1d 128 + 1e 128 + 1f 129 + 20 129 + 21 129 + 22 129 + 23 129 + 24 125 + 25 125 + 26 125 + 2a 133 + 2b 133 + 2c 133 + 2d 133 + 2e 133 + 2f 133 + 30 133 + 31 134 } method 'reassignCopy (Ljava/lang/Object;)V' { - 0 143 - 1 143 - 2 143 - 3 145 - 4 145 - 5 145 - 6 145 - 7 145 - 8 145 - b 146 - c 146 - d 146 - e 146 - f 146 - 12 147 - 13 147 - 14 147 - 18 148 - 19 148 - 1a 148 - 1b 148 - 1c 148 - 23 148 - 24 148 - 25 149 - 26 149 - 27 149 - 28 145 - 29 145 - 2a 145 - 2e 153 - 2f 153 - 30 153 - 31 153 - 32 153 - 33 153 - 34 153 - 35 154 + 0 137 + 1 137 + 2 137 + 3 139 + 4 139 + 5 139 + 6 139 + 7 139 + 8 139 + 9 139 + a 139 + b 140 + c 140 + d 140 + e 140 + f 140 + 10 140 + 11 140 + 12 141 + 13 141 + 14 141 + 18 142 + 19 142 + 1a 142 + 1b 142 + 1c 142 + 1d 142 + 1e 142 + 23 142 + 24 142 + 25 143 + 26 143 + 27 143 + 28 139 + 29 139 + 2a 139 + 2e 147 + 2f 147 + 30 147 + 31 147 + 32 147 + 33 147 + 34 147 + 35 148 } method 'reassignField (Ljava/lang/Object;Ljava/lang/String;)V' { - 0 157 - 1 157 - 2 157 - 3 157 - 4 157 - 5 157 - 8 158 - 9 158 - a 158 - b 158 - c 158 - f 159 - 10 159 - 11 159 - 15 160 - 16 160 - 17 160 - 18 160 - 19 160 - 1c 161 - 1d 161 - 1e 161 - 1f 161 - 20 161 - 21 157 - 22 157 - 23 157 - 27 165 - 28 165 - 29 165 - 2a 165 - 2b 165 - 2c 165 - 2d 165 - 2e 166 + 0 151 + 1 151 + 2 151 + 3 151 + 4 151 + 5 151 + 6 151 + 7 151 + 8 152 + 9 152 + a 152 + b 152 + c 152 + d 152 + e 152 + f 153 + 10 153 + 11 153 + 15 154 + 16 154 + 17 154 + 18 154 + 19 154 + 1a 154 + 1b 154 + 1c 155 + 1d 155 + 1e 155 + 1f 155 + 20 155 + 21 151 + 22 151 + 23 151 + 27 159 + 28 159 + 29 159 + 2a 159 + 2b 159 + 2c 159 + 2d 159 + 2e 160 } method 'reassignNoUse (Ljava/lang/Object;)V' { - 0 169 - 1 169 - 2 169 - 3 171 - 4 171 - 5 171 - 6 171 - 7 171 - 8 171 - b 172 - c 172 - d 172 - e 172 - f 172 - 12 173 - 13 173 - 14 173 - 18 174 - 19 174 - 1a 174 - 1b 174 - 1c 174 - 23 174 - 24 171 - 25 171 - 26 171 - 2a 178 + 0 163 + 1 163 + 2 163 + 3 165 + 4 165 + 5 165 + 6 165 + 7 165 + 8 165 + 9 165 + a 165 + b 166 + c 166 + d 166 + e 166 + f 166 + 10 166 + 11 166 + 12 167 + 13 167 + 14 167 + 18 168 + 19 168 + 1a 168 + 1b 168 + 1c 168 + 1d 168 + 1e 168 + 23 168 + 24 165 + 25 165 + 26 165 + 2a 172 } method 'multiCombo (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String;' { - 0 181 - 1 181 - 2 181 - 3 181 - 4 181 - b 181 - c 181 - d 181 - e 181 - f 181 - 10 181 - 13 182 - 14 182 - 15 182 - 16 182 - 17 182 - 18 182 - 19 182 - 1a 182 - 1b 185 - 1c 185 + 0 175 + 1 175 + 2 175 + 3 175 + 4 175 + 5 175 + 6 175 + b 175 + c 175 + d 175 + e 175 + f 175 + 10 175 + 11 175 + 12 175 + 13 175 + 14 175 + 15 175 + 16 175 + 17 175 + 18 175 + 19 175 + 1b 175 } } @@ -818,71 +878,71 @@ Lines mapping: 53 <-> 63 55 <-> 65 58 <-> 68 -62 <-> 76 -66 <-> 80 -70 <-> 84 -71 <-> 85 -72 <-> 86 -74 <-> 87 -76 <-> 89 -79 <-> 92 -80 <-> 92 -81 <-> 93 -85 <-> 96 -86 <-> 97 -90 <-> 100 -91 <-> 101 -92 <-> 102 -93 <-> 103 -94 <-> 104 -95 <-> 105 -96 <-> 106 -97 <-> 107 -98 <-> 108 -100 <-> 109 -101 <-> 110 -103 <-> 112 -111 <-> 115 -112 <-> 116 -113 <-> 117 -116 <-> 120 -117 <-> 121 -118 <-> 122 -120 <-> 124 -123 <-> 127 -126 <-> 130 -127 <-> 132 -128 <-> 133 -129 <-> 134 -130 <-> 135 -131 <-> 136 -135 <-> 140 -136 <-> 141 -139 <-> 144 -140 <-> 146 -141 <-> 147 -142 <-> 148 -143 <-> 149 -144 <-> 150 -148 <-> 154 -149 <-> 155 -152 <-> 158 -153 <-> 159 -154 <-> 160 -155 <-> 161 -156 <-> 162 -160 <-> 166 -161 <-> 167 -164 <-> 170 -165 <-> 172 -166 <-> 173 -167 <-> 174 -168 <-> 175 -169 <-> 175 -172 <-> 179 -175 <-> 182 -176 <-> 183 -178 <-> 186 +62 <-> 72 +66 <-> 76 +70 <-> 80 +71 <-> 81 +72 <-> 82 +74 <-> 83 +76 <-> 85 +79 <-> 88 +80 <-> 88 +81 <-> 91 +85 <-> 89 +86 <-> 91 +90 <-> 94 +91 <-> 95 +92 <-> 96 +93 <-> 97 +94 <-> 98 +95 <-> 99 +96 <-> 100 +97 <-> 101 +98 <-> 102 +100 <-> 103 +101 <-> 104 +103 <-> 106 +111 <-> 109 +112 <-> 110 +113 <-> 111 +116 <-> 114 +117 <-> 115 +118 <-> 116 +120 <-> 118 +123 <-> 121 +126 <-> 124 +127 <-> 126 +128 <-> 127 +129 <-> 128 +130 <-> 129 +131 <-> 130 +135 <-> 134 +136 <-> 135 +139 <-> 138 +140 <-> 140 +141 <-> 141 +142 <-> 142 +143 <-> 143 +144 <-> 144 +148 <-> 148 +149 <-> 149 +152 <-> 152 +153 <-> 153 +154 <-> 154 +155 <-> 155 +156 <-> 156 +160 <-> 160 +161 <-> 161 +164 <-> 164 +165 <-> 166 +166 <-> 167 +167 <-> 168 +168 <-> 169 +169 <-> 169 +172 <-> 173 +175 <-> 176 +176 <-> 176 +178 <-> 176 Not mapped: 42 -49 +49 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatching17AlreadyUsed.dec b/testData/results/pkg/TestPatternMatching17AlreadyUsed.dec index 6bdcfaecd1..0a18ee4b78 100644 --- a/testData/results/pkg/TestPatternMatching17AlreadyUsed.dec +++ b/testData/results/pkg/TestPatternMatching17AlreadyUsed.dec @@ -166,6 +166,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { c 6 d 6 e 6 + f 6 + 10 6 15 6 16 7 17 7 @@ -175,6 +177,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 7 1c 7 1d 7 + 1e 7 + 1f 7 20 9 } @@ -194,6 +198,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { c 14 d 14 e 14 + f 14 + 10 14 15 14 16 15 17 15 @@ -203,6 +209,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 15 1c 15 1d 15 + 1e 15 + 1f 15 20 17 } @@ -222,6 +230,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { c 22 d 22 e 22 + f 22 + 10 22 15 22 16 23 17 23 @@ -231,6 +241,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 23 1c 23 1d 23 + 1e 23 + 1f 23 20 25 } @@ -250,6 +262,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { c 30 d 30 e 30 + f 30 + 10 30 15 30 16 31 17 31 @@ -259,6 +273,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 31 1c 31 1d 31 + 1e 31 + 1f 31 20 33 } @@ -271,6 +287,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 37 6 37 7 37 + 8 37 + 9 37 e 37 f 38 10 38 @@ -280,6 +298,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 14 38 15 38 16 38 + 17 38 + 18 38 19 40 } @@ -292,6 +312,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 44 6 44 7 44 + 8 44 + 9 44 e 44 f 45 10 45 @@ -311,6 +333,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 21 47 22 47 23 47 + 24 47 + 25 47 26 49 } @@ -323,6 +347,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 53 6 53 7 53 + 8 53 + 9 53 a 54 b 54 c 54 @@ -351,6 +377,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 6 63 7 63 8 63 + 9 63 + a 63 b 64 c 64 d 64 @@ -358,6 +386,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { f 64 10 64 11 64 + 12 64 + 13 64 1a 64 1b 65 1c 65 @@ -367,6 +397,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 20 65 21 65 22 65 + 23 65 + 24 65 25 63 26 63 27 63 @@ -383,6 +415,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 6 73 7 73 8 73 + 9 73 + a 73 b 74 c 74 d 74 @@ -390,6 +424,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { f 74 10 74 11 74 + 12 74 + 13 74 14 75 15 75 16 75 @@ -422,6 +458,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 84 6 84 7 84 + 8 84 + 9 84 e 84 f 85 10 85 @@ -431,11 +469,15 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 14 85 15 85 16 85 + 17 85 + 18 85 19 88 1a 88 1b 88 1c 88 1d 88 + 1e 88 + 1f 88 24 88 25 89 26 89 @@ -445,6 +487,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 2a 89 2b 89 2c 89 + 2d 89 + 2e 89 2f 91 } @@ -457,6 +501,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 95 6 95 7 95 + 8 95 + 9 95 e 95 f 96 10 96 @@ -466,11 +512,15 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 14 96 15 96 16 96 + 17 96 + 18 96 19 99 1a 99 1b 99 1c 99 1d 99 + 1e 99 + 1f 99 24 99 25 100 26 100 @@ -480,11 +530,15 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 2a 100 2b 100 2c 100 + 2d 100 + 2e 100 2f 103 30 103 31 103 32 103 33 103 + 34 103 + 35 103 3a 103 3b 104 3c 104 @@ -494,11 +548,15 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 40 104 41 104 42 104 + 43 104 + 44 104 45 107 46 107 47 107 48 107 49 107 + 4a 107 + 4b 107 50 107 51 108 52 108 @@ -508,6 +566,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 56 108 57 108 58 108 + 59 108 + 5a 108 5b 110 } @@ -520,6 +580,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 114 6 114 7 114 + 8 114 + 9 114 a 115 b 115 c 115 @@ -540,6 +602,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 119 1c 119 1d 119 + 1e 119 + 1f 119 20 120 21 120 22 120 @@ -567,6 +631,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 5 128 6 128 7 128 + 8 128 + 9 128 a 129 b 129 c 129 @@ -587,6 +653,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 1b 133 1c 133 1d 133 + 1e 133 + 1f 133 20 134 21 134 22 134 @@ -607,6 +675,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 31 138 32 138 33 138 + 34 138 + 35 138 36 139 37 139 38 139 @@ -627,6 +697,8 @@ class 'pkg/TestPatternMatching17AlreadyUsed' { 47 143 48 143 49 143 + 4a 143 + 4b 143 4c 144 4d 144 4e 144 @@ -740,4 +812,4 @@ Lines mapping: 159 <-> 144 160 <-> 145 162 <-> 148 -163 <-> 149 \ No newline at end of file +163 <-> 149 diff --git a/testData/results/pkg/TestPatternMatching17Fake.dec b/testData/results/pkg/TestPatternMatching17Fake.dec index b80824cc5a..d7d14fcd8b 100644 --- a/testData/results/pkg/TestPatternMatching17Fake.dec +++ b/testData/results/pkg/TestPatternMatching17Fake.dec @@ -35,10 +35,10 @@ public class TestPatternMatching17Fake { public void testClash(Object obj) { if (obj instanceof String s) {// 39 - System.out.println(s.length());// 40 42 43 44 + System.out.println(s.length());// 44 } else { - int s = 0; - System.out.println(s); + int s = 0;// 40 + System.out.println(s);// 42 } }// 46 @@ -64,6 +64,8 @@ class 'pkg/TestPatternMatching17Fake' { 2 4 3 4 4 4 + 5 4 + 6 4 b 4 c 5 d 5 @@ -75,11 +77,15 @@ class 'pkg/TestPatternMatching17Fake' { 13 5 14 5 15 5 + 16 5 + 17 5 18 8 19 8 1a 8 1b 8 1c 8 + 1d 8 + 1e 8 23 8 24 9 25 9 @@ -91,6 +97,8 @@ class 'pkg/TestPatternMatching17Fake' { 2b 9 2c 9 2d 9 + 2e 9 + 2f 9 30 11 } @@ -100,6 +108,8 @@ class 'pkg/TestPatternMatching17Fake' { 2 14 3 14 4 14 + 5 14 + 6 14 b 14 c 15 d 15 @@ -111,6 +121,8 @@ class 'pkg/TestPatternMatching17Fake' { 13 15 14 15 15 15 + 16 15 + 17 15 18 17 } @@ -120,6 +132,8 @@ class 'pkg/TestPatternMatching17Fake' { 2 20 3 20 4 20 + 5 20 + 6 20 b 20 c 21 d 21 @@ -131,6 +145,8 @@ class 'pkg/TestPatternMatching17Fake' { 13 21 14 21 15 21 + 16 21 + 17 21 18 23 } @@ -140,6 +156,8 @@ class 'pkg/TestPatternMatching17Fake' { 2 26 3 26 4 26 + 5 26 + 6 26 7 27 8 27 9 27 @@ -153,11 +171,15 @@ class 'pkg/TestPatternMatching17Fake' { 11 27 12 27 13 27 + 14 27 + 15 27 16 30 17 30 18 30 19 30 1a 30 + 1b 30 + 1c 30 21 30 22 31 23 31 @@ -169,6 +191,8 @@ class 'pkg/TestPatternMatching17Fake' { 29 31 2a 31 2b 31 + 2c 31 + 2d 31 2e 33 } @@ -178,25 +202,22 @@ class 'pkg/TestPatternMatching17Fake' { 2 36 3 36 4 36 + 5 36 + 6 36 b 36 c 37 d 37 e 37 - f 37 - 10 37 - 11 37 - 12 37 - 13 37 - 14 37 - 15 37 - 16 37 - 17 37 - 18 37 - 19 37 - 1a 37 + f 39 + 10 39 + 11 40 + 12 40 + 13 40 + 14 40 + 15 40 + 16 40 + 17 40 1b 37 - 1c 37 - 1d 37 1e 37 1f 37 20 37 @@ -212,6 +233,8 @@ class 'pkg/TestPatternMatching17Fake' { 4 46 5 46 6 46 + 7 46 + 8 46 9 47 a 47 b 47 @@ -223,6 +246,8 @@ class 'pkg/TestPatternMatching17Fake' { 11 48 12 48 13 48 + 14 48 + 15 48 16 49 17 49 18 49 @@ -235,11 +260,15 @@ class 'pkg/TestPatternMatching17Fake' { 1f 49 20 53 21 53 + 22 53 + 23 53 24 54 25 54 26 54 27 54 28 54 + 29 54 + 2a 54 2b 56 } } @@ -264,9 +293,8 @@ Lines mapping: 34 <-> 32 36 <-> 34 39 <-> 37 -40 <-> 38 -42 <-> 38 -43 <-> 38 +40 <-> 40 +42 <-> 41 44 <-> 38 46 <-> 43 49 <-> 46 @@ -277,3 +305,5 @@ Lines mapping: 58 <-> 54 59 <-> 55 61 <-> 57 +Not mapped: +43 diff --git a/testData/results/pkg/TestPatternMatching17FakeLoops.dec b/testData/results/pkg/TestPatternMatching17FakeLoops.dec index a65b5345c0..ac2b9cef2c 100644 --- a/testData/results/pkg/TestPatternMatching17FakeLoops.dec +++ b/testData/results/pkg/TestPatternMatching17FakeLoops.dec @@ -40,20 +40,11 @@ public class TestPatternMatching17FakeLoops { }// 39 void test4x(Object o) { - while (true) { - label13: - if (o.hashCode() >= 0) {// 42 - if (o instanceof String x && !x.isEmpty()) { - break label13; - } - - return;// 46 - } - + while (o.hashCode() < 0 || o instanceof String x && !x.isEmpty()) {// 42 String s = (String)o;// 43 System.out.println(s);// 44 } - } + }// 46 void test4B(Object o) { while (o.hashCode() < 0 || o instanceof String var2) {// 49 @@ -65,21 +56,13 @@ public class TestPatternMatching17FakeLoops { }// 54 void test4xB(Object o) { - while (true) { - label13: - if (o.hashCode() >= 0) {// 57 - if (o instanceof String x && !x.isEmpty()) { - break label13; - } - - System.out.println("bye");// 61 - return;// 62 - } - + while (o.hashCode() < 0 || o instanceof String x && !x.isEmpty()) {// 57 String s = (String)o;// 58 System.out.println(s);// 59 } - } + + System.out.println("bye");// 61 + }// 62 void test3Swap(Object o) { while (o instanceof String || o.hashCode() < 0) {// 65 @@ -210,11 +193,15 @@ class 'pkg/TestPatternMatching17FakeLoops' { 2 19 3 19 4 19 + 5 19 + 6 19 7 19 8 19 9 19 a 19 b 19 + c 19 + d 19 e 20 f 20 10 20 @@ -236,11 +223,15 @@ class 'pkg/TestPatternMatching17FakeLoops' { 2 26 3 26 4 26 + 5 26 + 6 26 7 26 8 26 9 26 a 26 b 26 + c 26 + d 26 e 27 f 27 10 27 @@ -270,6 +261,8 @@ class 'pkg/TestPatternMatching17FakeLoops' { 2 35 3 35 4 35 + 5 35 + 6 35 7 35 8 35 9 35 @@ -291,364 +284,412 @@ class 'pkg/TestPatternMatching17FakeLoops' { } method 'test4x (Ljava/lang/Object;)V' { - 0 44 - 1 44 - 2 44 - 3 44 - 4 44 - 7 45 - 8 45 - 9 45 - a 45 - b 45 - 12 45 - 13 45 - 14 45 - 15 45 - 16 45 - 17 45 - 1a 52 - 1b 52 - 1c 52 - 1d 52 - 1e 52 - 1f 53 - 20 53 - 21 53 - 22 53 - 23 53 - 24 53 - 25 53 - 29 49 + 0 42 + 1 42 + 2 42 + 3 42 + 4 42 + 5 42 + 6 42 + 7 42 + 8 42 + 9 42 + a 42 + b 42 + c 42 + d 42 + 12 42 + 13 42 + 14 42 + 15 42 + 16 42 + 17 42 + 18 42 + 19 42 + 1a 43 + 1b 43 + 1c 43 + 1d 43 + 1e 43 + 1f 44 + 20 44 + 21 44 + 22 44 + 23 44 + 24 44 + 25 44 + 29 46 } method 'test4B (Ljava/lang/Object;)V' { + 0 49 + 1 49 + 2 49 + 3 49 + 4 49 + 5 49 + 6 49 + 7 49 + 8 49 + 9 49 + a 49 + 12 49 + 13 50 + 14 50 + 15 50 + 16 50 + 17 50 + 18 51 + 19 51 + 1a 51 + 1b 51 + 1c 51 + 1d 51 + 1e 51 + 22 54 + 23 54 + 24 54 + 25 54 + 26 54 + 27 54 + 28 54 + 29 54 + 2a 55 + } + + method 'test4xB (Ljava/lang/Object;)V' { 0 58 1 58 2 58 3 58 4 58 + 5 58 + 6 58 7 58 8 58 9 58 a 58 + b 58 + c 58 + d 58 12 58 - 13 59 - 14 59 - 15 59 - 16 59 - 17 59 - 18 60 - 19 60 - 1a 60 - 1b 60 - 1c 60 - 1d 60 - 1e 60 - 22 63 - 23 63 - 24 63 - 25 63 - 26 63 - 27 63 - 28 63 + 13 58 + 14 58 + 15 58 + 16 58 + 17 58 + 18 58 + 19 58 + 1a 59 + 1b 59 + 1c 59 + 1d 59 + 1e 59 + 1f 60 + 20 60 + 21 60 + 22 60 + 23 60 + 24 60 + 25 60 29 63 - 2a 64 + 2a 63 + 2b 63 + 2c 63 + 2d 63 + 2e 63 + 2f 63 + 30 63 + 31 64 } - method 'test4xB (Ljava/lang/Object;)V' { - 0 69 - 1 69 - 2 69 - 3 69 - 4 69 - 7 70 - 8 70 - 9 70 - a 70 - b 70 - 12 70 - 13 70 - 14 70 - 15 70 - 16 70 - 17 70 - 1a 78 - 1b 78 - 1c 78 - 1d 78 - 1e 78 + method 'test3Swap (Ljava/lang/Object;)V' { + 0 67 + 1 67 + 2 67 + 3 67 + 4 67 + 5 67 + 6 67 + 7 67 + 8 67 + 9 67 + a 67 + b 67 + c 67 + d 67 + e 68 + f 68 + 10 68 + 11 68 + 12 68 + 13 69 + 14 69 + 15 69 + 16 69 + 17 69 + 18 69 + 19 69 + 1d 71 + } + + method 'test3BSwap (Ljava/lang/Object;)V' { + 0 74 + 1 74 + 2 74 + 3 74 + 4 74 + 5 74 + 6 74 + 7 74 + 8 74 + 9 74 + a 74 + b 74 + c 74 + d 74 + e 75 + f 75 + 10 75 + 11 75 + 12 75 + 13 76 + 14 76 + 15 76 + 16 76 + 17 76 + 18 76 + 19 76 + 1d 79 + 1e 79 1f 79 20 79 21 79 22 79 23 79 24 79 - 25 79 - 29 74 - 2a 74 - 2b 74 - 2c 74 - 2d 74 - 2e 74 - 2f 74 - 30 74 - 31 75 - } - - method 'test3Swap (Ljava/lang/Object;)V' { - 0 84 - 1 84 - 2 84 - 3 84 - 4 84 - 7 84 - 8 84 - 9 84 - a 84 - b 84 - e 85 - f 85 - 10 85 - 11 85 - 12 85 - 13 86 - 14 86 - 15 86 - 16 86 - 17 86 - 18 86 - 19 86 - 1d 88 - } - - method 'test3BSwap (Ljava/lang/Object;)V' { - 0 91 - 1 91 - 2 91 - 3 91 - 4 91 - 7 91 - 8 91 - 9 91 - a 91 - b 91 - e 92 - f 92 - 10 92 - 11 92 - 12 92 - 13 93 - 14 93 - 15 93 - 16 93 - 17 93 - 18 93 - 19 93 - 1d 96 - 1e 96 - 1f 96 - 20 96 - 21 96 - 22 96 - 23 96 - 24 96 - 25 97 + 25 80 } method 'test4Swap (Ljava/lang/Object;)V' { - 0 100 - 1 100 - 2 100 - 3 100 - 4 100 - b 100 - f 100 - 10 100 - 11 100 - 12 100 - 13 100 - 16 101 - 17 101 - 18 101 - 19 101 - 1a 101 - 1b 102 - 1c 102 - 1d 102 - 1e 102 - 1f 102 - 20 102 - 21 102 - 25 104 + 0 83 + 1 83 + 2 83 + 3 83 + 4 83 + 5 83 + 6 83 + b 83 + f 83 + 10 83 + 11 83 + 12 83 + 13 83 + 14 83 + 15 83 + 16 84 + 17 84 + 18 84 + 19 84 + 1a 84 + 1b 85 + 1c 85 + 1d 85 + 1e 85 + 1f 85 + 20 85 + 21 85 + 25 87 } method 'test4xSwap (Ljava/lang/Object;)V' { - 0 107 - 1 107 - 2 107 - 3 107 - 4 107 - b 107 - c 107 - d 107 - e 107 - f 107 - 10 107 - 13 107 - 14 107 - 15 107 - 16 107 - 17 107 - 1a 108 - 1b 108 - 1c 108 - 1d 108 - 1e 108 - 1f 109 - 20 109 - 21 109 - 22 109 - 23 109 - 24 109 - 25 109 - 29 111 + 0 90 + 1 90 + 2 90 + 3 90 + 4 90 + 5 90 + 6 90 + b 90 + c 90 + d 90 + e 90 + f 90 + 10 90 + 11 90 + 12 90 + 13 90 + 14 90 + 15 90 + 16 90 + 17 90 + 18 90 + 19 90 + 1a 91 + 1b 91 + 1c 91 + 1d 91 + 1e 91 + 1f 92 + 20 92 + 21 92 + 22 92 + 23 92 + 24 92 + 25 92 + 29 94 } method 'test4BSwap (Ljava/lang/Object;)V' { - 0 114 - 1 114 - 2 114 - 3 114 - 4 114 - b 114 - f 114 - 10 114 - 11 114 - 12 114 - 13 114 - 16 115 - 17 115 - 18 115 - 19 115 - 1a 115 - 1b 116 - 1c 116 - 1d 116 - 1e 116 - 1f 116 - 20 116 - 21 116 - 25 119 - 26 119 - 27 119 - 28 119 - 29 119 - 2a 119 - 2b 119 - 2c 119 - 2d 120 + 0 97 + 1 97 + 2 97 + 3 97 + 4 97 + 5 97 + 6 97 + b 97 + f 97 + 10 97 + 11 97 + 12 97 + 13 97 + 14 97 + 15 97 + 16 98 + 17 98 + 18 98 + 19 98 + 1a 98 + 1b 99 + 1c 99 + 1d 99 + 1e 99 + 1f 99 + 20 99 + 21 99 + 25 102 + 26 102 + 27 102 + 28 102 + 29 102 + 2a 102 + 2b 102 + 2c 102 + 2d 103 } method 'test4xBSwap (Ljava/lang/Object;)V' { - 0 123 - 1 123 - 2 123 - 3 123 - 4 123 - b 123 - c 123 - d 123 - e 123 - f 123 - 10 123 - 13 123 - 14 123 - 15 123 - 16 123 - 17 123 - 1a 124 - 1b 124 - 1c 124 - 1d 124 - 1e 124 - 1f 125 - 20 125 - 21 125 - 22 125 - 23 125 - 24 125 - 25 125 - 29 128 - 2a 128 - 2b 128 - 2c 128 - 2d 128 - 2e 128 - 2f 128 - 30 128 - 31 129 + 0 106 + 1 106 + 2 106 + 3 106 + 4 106 + 5 106 + 6 106 + b 106 + c 106 + d 106 + e 106 + f 106 + 10 106 + 11 106 + 12 106 + 13 106 + 14 106 + 15 106 + 16 106 + 17 106 + 18 106 + 19 106 + 1a 107 + 1b 107 + 1c 107 + 1d 107 + 1e 107 + 1f 108 + 20 108 + 21 108 + 22 108 + 23 108 + 24 108 + 25 108 + 29 111 + 2a 111 + 2b 111 + 2c 111 + 2d 111 + 2e 111 + 2f 111 + 30 111 + 31 112 } method 'testSet (Ljava/lang/Object;)V' { - 0 132 - 1 132 - 2 132 - 3 134 - 4 134 - 5 134 - 6 134 - a 135 - b 135 - c 135 - d 135 - e 135 - 12 138 - 13 138 - 14 138 - 15 138 - 16 138 - 17 138 - 18 138 - 19 139 + 0 115 + 1 115 + 2 115 + 3 117 + 4 117 + 5 117 + 6 117 + a 118 + b 118 + c 118 + d 118 + e 118 + 12 121 + 13 121 + 14 121 + 15 121 + 16 121 + 17 121 + 18 121 + 19 122 } method 'testModifyLeak (Ljava/lang/Object;)V' { - 0 142 - 1 142 - 2 144 - 3 144 - 4 144 - 5 144 - 9 145 - a 145 - b 145 - c 145 - d 145 - e 146 - f 146 - 10 146 - 11 146 - 12 146 - 13 146 - 16 147 - 17 147 - 18 147 - 19 147 - 1a 147 - 1b 147 - 1c 147 - 1d 147 - 1e 147 - 1f 147 - 23 151 - 24 151 - 27 152 - 28 152 - 29 152 - 2a 152 - 2b 152 - 2e 154 + 0 125 + 1 125 + 2 127 + 3 127 + 4 127 + 5 127 + 9 128 + a 128 + b 128 + c 128 + d 128 + e 129 + f 129 + 10 129 + 11 129 + 12 129 + 13 129 + 14 129 + 15 129 + 16 130 + 17 130 + 18 130 + 19 130 + 1a 130 + 1b 130 + 1c 130 + 1d 130 + 1e 130 + 1f 130 + 23 134 + 24 134 + 25 134 + 26 134 + 27 135 + 28 135 + 29 135 + 2a 135 + 2b 135 + 2c 135 + 2d 135 + 2e 137 } } @@ -674,60 +715,60 @@ Lines mapping: 36 <-> 37 37 <-> 38 39 <-> 40 -42 <-> 45 -43 <-> 53 -44 <-> 54 -46 <-> 50 -49 <-> 59 -50 <-> 60 -51 <-> 61 -53 <-> 64 -54 <-> 65 -57 <-> 70 -58 <-> 79 -59 <-> 80 -61 <-> 75 -62 <-> 76 -65 <-> 85 -66 <-> 86 -67 <-> 87 -69 <-> 89 -72 <-> 92 -73 <-> 93 -74 <-> 94 -77 <-> 97 -78 <-> 98 -81 <-> 101 -82 <-> 102 -83 <-> 103 -85 <-> 105 -88 <-> 108 -89 <-> 109 -90 <-> 110 -92 <-> 112 -95 <-> 115 -96 <-> 116 -97 <-> 117 -99 <-> 120 -100 <-> 121 -103 <-> 124 -104 <-> 125 -105 <-> 126 -107 <-> 129 -108 <-> 130 -112 <-> 133 -113 <-> 135 -114 <-> 136 -117 <-> 139 -118 <-> 140 -122 <-> 143 -123 <-> 145 -124 <-> 146 -126 <-> 147 -127 <-> 148 -131 <-> 152 -132 <-> 153 -134 <-> 155 +42 <-> 43 +43 <-> 44 +44 <-> 45 +46 <-> 47 +49 <-> 50 +50 <-> 51 +51 <-> 52 +53 <-> 55 +54 <-> 56 +57 <-> 59 +58 <-> 60 +59 <-> 61 +61 <-> 64 +62 <-> 65 +65 <-> 68 +66 <-> 69 +67 <-> 70 +69 <-> 72 +72 <-> 75 +73 <-> 76 +74 <-> 77 +77 <-> 80 +78 <-> 81 +81 <-> 84 +82 <-> 85 +83 <-> 86 +85 <-> 88 +88 <-> 91 +89 <-> 92 +90 <-> 93 +92 <-> 95 +95 <-> 98 +96 <-> 99 +97 <-> 100 +99 <-> 103 +100 <-> 104 +103 <-> 107 +104 <-> 108 +105 <-> 109 +107 <-> 112 +108 <-> 113 +112 <-> 116 +113 <-> 118 +114 <-> 119 +117 <-> 122 +118 <-> 123 +122 <-> 126 +123 <-> 128 +124 <-> 129 +126 <-> 130 +127 <-> 131 +131 <-> 135 +132 <-> 136 +134 <-> 138 Not mapped: 8 15 @@ -742,4 +783,4 @@ Not mapped: 84 91 98 -106 +106 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatching17FakeLoopsInverted.dec b/testData/results/pkg/TestPatternMatching17FakeLoopsInverted.dec index 3abcc47bc1..736fd23056 100644 --- a/testData/results/pkg/TestPatternMatching17FakeLoopsInverted.dec +++ b/testData/results/pkg/TestPatternMatching17FakeLoopsInverted.dec @@ -15,7 +15,7 @@ public class TestPatternMatching17FakeLoopsInverted { } String x = (String)o; - }// 15 + } void test3(Object o) { while (o.hashCode() >= 0 && !(o instanceof String)) {// 19 @@ -41,11 +41,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 39 void test4x(Object o) { - while (o.hashCode() >= 0) {// 42 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 42 String s = (String)o;// 43 System.out.println(s);// 44 } @@ -61,11 +57,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 54 void test4xB(Object o) { - while (o.hashCode() >= 0) {// 57 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 57 String s = (String)o;// 58 System.out.println(s);// 59 } @@ -97,7 +89,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 85 void test4xSwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 88 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 88 String s = (String)o;// 89 System.out.println(s);// 90 } @@ -113,7 +105,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 100 void test4xBSwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 103 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 103 String s = (String)o;// 104 System.out.println(s);// 105 } @@ -148,7 +140,7 @@ public class TestPatternMatching17FakeLoopsInverted { } String x = (String)o; - String var4 = (String)o;// 133 134 + String var4 = (String)o;// 134 System.out.println(var4.hashCode() + var4.length());// 135 } @@ -173,11 +165,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 156 void test4xA(Object o) { - while (o.hashCode() >= 0) {// 159 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 159 String s = (String)o;// 160 System.out.println(s);// 161 } @@ -207,7 +195,7 @@ public class TestPatternMatching17FakeLoopsInverted { }// 187 void test4xASwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 190 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 190 String s = (String)o;// 191 System.out.println(s);// 192 } @@ -235,6 +223,8 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 8 5 9 5 @@ -259,14 +249,14 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 11 3 11 4 11 + 5 11 + 6 11 7 16 8 16 9 16 a 16 b 16 c 17 - d 17 - e 17 f 12 10 12 11 12 @@ -279,9 +269,6 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 18 13 19 13 1a 13 - 1b 17 - 1c 17 - 1d 17 } method 'test3 (Ljava/lang/Object;)V' { @@ -290,11 +277,15 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 20 3 20 4 20 + 5 20 + 6 20 7 20 8 20 9 20 a 20 b 20 + c 20 + d 20 e 21 f 21 10 21 @@ -316,11 +307,15 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 27 3 27 4 27 + 5 27 + 6 27 7 27 8 27 9 27 a 27 b 27 + c 27 + d 27 e 28 f 28 10 28 @@ -350,11 +345,15 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 36 3 36 4 36 + 5 36 + 6 36 7 36 8 36 9 36 a 36 b 36 + c 36 + d 36 12 36 16 37 17 37 @@ -377,742 +376,815 @@ class 'pkg/TestPatternMatching17FakeLoopsInverted' { 2 43 3 43 4 43 - 7 44 - 8 44 - 9 44 - a 44 - b 44 - 12 44 - 13 44 - 14 44 - 15 44 - 16 44 - 17 44 - 1a 48 - 1b 48 - 1c 48 - 1d 48 - 1e 48 - 1f 49 - 20 49 - 21 49 - 22 49 - 23 49 - 24 49 - 25 49 - 29 51 + 5 43 + 6 43 + 7 43 + 8 43 + 9 43 + a 43 + b 43 + c 43 + d 43 + 12 43 + 13 43 + 14 43 + 15 43 + 16 43 + 17 43 + 18 43 + 19 43 + 1a 44 + 1b 44 + 1c 44 + 1d 44 + 1e 44 + 1f 45 + 20 45 + 21 45 + 22 45 + 23 45 + 24 45 + 25 45 + 29 47 } method 'test4B (Ljava/lang/Object;)V' { - 0 54 - 1 54 - 2 54 - 3 54 - 4 54 - 7 54 - 8 54 - 9 54 - a 54 - b 54 - 12 54 - 16 55 - 17 55 - 18 55 - 19 55 - 1a 55 - 1b 56 - 1c 56 - 1d 56 - 1e 56 - 1f 56 - 20 56 - 21 56 - 25 59 - 26 59 - 27 59 - 28 59 - 29 59 - 2a 59 - 2b 59 - 2c 59 - 2d 60 + 0 50 + 1 50 + 2 50 + 3 50 + 4 50 + 5 50 + 6 50 + 7 50 + 8 50 + 9 50 + a 50 + b 50 + c 50 + d 50 + 12 50 + 16 51 + 17 51 + 18 51 + 19 51 + 1a 51 + 1b 52 + 1c 52 + 1d 52 + 1e 52 + 1f 52 + 20 52 + 21 52 + 25 55 + 26 55 + 27 55 + 28 55 + 29 55 + 2a 55 + 2b 55 + 2c 55 + 2d 56 } method 'test4xB (Ljava/lang/Object;)V' { - 0 63 - 1 63 - 2 63 - 3 63 - 4 63 - 7 64 - 8 64 - 9 64 - a 64 - b 64 - 12 64 - 13 64 - 14 64 - 15 64 - 16 64 - 17 64 - 1a 68 - 1b 68 - 1c 68 - 1d 68 - 1e 68 - 1f 69 - 20 69 - 21 69 - 22 69 - 23 69 - 24 69 - 25 69 - 29 72 - 2a 72 - 2b 72 - 2c 72 - 2d 72 - 2e 72 - 2f 72 - 30 72 - 31 73 + 0 59 + 1 59 + 2 59 + 3 59 + 4 59 + 5 59 + 6 59 + 7 59 + 8 59 + 9 59 + a 59 + b 59 + c 59 + d 59 + 12 59 + 13 59 + 14 59 + 15 59 + 16 59 + 17 59 + 18 59 + 19 59 + 1a 60 + 1b 60 + 1c 60 + 1d 60 + 1e 60 + 1f 61 + 20 61 + 21 61 + 22 61 + 23 61 + 24 61 + 25 61 + 29 64 + 2a 64 + 2b 64 + 2c 64 + 2d 64 + 2e 64 + 2f 64 + 30 64 + 31 65 } method 'test3Swap (Ljava/lang/Object;)V' { - 0 76 - 1 76 - 2 76 - 3 76 - 4 76 - 7 76 - 8 76 - 9 76 - a 76 - b 76 - e 77 - f 77 - 10 77 - 11 77 - 12 77 - 13 78 - 14 78 - 15 78 - 16 78 - 17 78 - 18 78 - 19 78 - 1d 80 + 0 68 + 1 68 + 2 68 + 3 68 + 4 68 + 5 68 + 6 68 + 7 68 + 8 68 + 9 68 + a 68 + b 68 + c 68 + d 68 + e 69 + f 69 + 10 69 + 11 69 + 12 69 + 13 70 + 14 70 + 15 70 + 16 70 + 17 70 + 18 70 + 19 70 + 1d 72 } method 'test3BSwap (Ljava/lang/Object;)V' { - 0 83 - 1 83 - 2 83 - 3 83 - 4 83 - 7 83 - 8 83 - 9 83 - a 83 - b 83 - e 84 + 0 75 + 1 75 + 2 75 + 3 75 + 4 75 + 5 75 + 6 75 + 7 75 + 8 75 + 9 75 + a 75 + b 75 + c 75 + d 75 + e 76 + f 76 + 10 76 + 11 76 + 12 76 + 13 77 + 14 77 + 15 77 + 16 77 + 17 77 + 18 77 + 19 77 + 1d 80 + 1e 80 + 1f 80 + 20 80 + 21 80 + 22 80 + 23 80 + 24 80 + 25 81 + } + + method 'test4Swap (Ljava/lang/Object;)V' { + 0 84 + 1 84 + 2 84 + 3 84 + 4 84 + 5 84 + 6 84 + b 84 f 84 10 84 11 84 12 84 - 13 85 - 14 85 - 15 85 + 13 84 + 14 84 + 15 84 16 85 17 85 18 85 19 85 - 1d 88 - 1e 88 - 1f 88 - 20 88 - 21 88 - 22 88 - 23 88 - 24 88 - 25 89 + 1a 85 + 1b 86 + 1c 86 + 1d 86 + 1e 86 + 1f 86 + 20 86 + 21 86 + 25 88 } - method 'test4Swap (Ljava/lang/Object;)V' { - 0 92 - 1 92 - 2 92 - 3 92 - 4 92 - b 92 - f 92 - 10 92 - 11 92 - 12 92 - 13 92 - 16 93 - 17 93 - 18 93 - 19 93 - 1a 93 - 1b 94 - 1c 94 - 1d 94 - 1e 94 - 1f 94 - 20 94 - 21 94 - 25 96 + method 'test4xSwap (Ljava/lang/Object;)V' { + 0 91 + 1 91 + 2 91 + 3 91 + 4 91 + 5 91 + 6 91 + b 91 + c 91 + d 91 + e 91 + f 91 + 10 91 + 11 91 + 12 91 + 13 91 + 14 91 + 15 91 + 16 91 + 17 91 + 18 91 + 19 91 + 1a 92 + 1b 92 + 1c 92 + 1d 92 + 1e 92 + 1f 93 + 20 93 + 21 93 + 22 93 + 23 93 + 24 93 + 25 93 + 29 95 } - method 'test4xSwap (Ljava/lang/Object;)V' { - 0 99 - 1 99 - 2 99 - 3 99 - 4 99 - b 99 - c 99 - d 99 - e 99 - f 99 - 13 99 - 14 99 - 15 99 + method 'test4BSwap (Ljava/lang/Object;)V' { + 0 98 + 1 98 + 2 98 + 3 98 + 4 98 + 5 98 + 6 98 + b 98 + f 98 + 10 98 + 11 98 + 12 98 + 13 98 + 14 98 + 15 98 16 99 17 99 - 1a 100 + 18 99 + 19 99 + 1a 99 1b 100 1c 100 1d 100 1e 100 - 1f 101 - 20 101 - 21 101 - 22 101 - 23 101 - 24 101 - 25 101 + 1f 100 + 20 100 + 21 100 + 25 103 + 26 103 + 27 103 + 28 103 29 103 + 2a 103 + 2b 103 + 2c 103 + 2d 104 } - method 'test4BSwap (Ljava/lang/Object;)V' { - 0 106 - 1 106 - 2 106 - 3 106 - 4 106 - b 106 - f 106 - 10 106 - 11 106 - 12 106 - 13 106 + method 'test4xBSwap (Ljava/lang/Object;)V' { + 0 107 + 1 107 + 2 107 + 3 107 + 4 107 + 5 107 + 6 107 + b 107 + c 107 + d 107 + e 107 + f 107 + 10 107 + 11 107 + 12 107 + 13 107 + 14 107 + 15 107 16 107 17 107 18 107 19 107 - 1a 107 + 1a 108 1b 108 1c 108 1d 108 1e 108 - 1f 108 - 20 108 - 21 108 - 25 111 - 26 111 - 27 111 - 28 111 - 29 111 - 2a 111 - 2b 111 - 2c 111 + 1f 109 + 20 109 + 21 109 + 22 109 + 23 109 + 24 109 + 25 109 + 29 112 + 2a 112 + 2b 112 + 2c 112 2d 112 + 2e 112 + 2f 112 + 30 112 + 31 113 } - method 'test4xBSwap (Ljava/lang/Object;)V' { - 0 115 - 1 115 - 2 115 - 3 115 - 4 115 - b 115 - c 115 - d 115 - e 115 - f 115 - 13 115 - 14 115 - 15 115 - 16 115 - 17 115 - 1a 116 - 1b 116 - 1c 116 - 1d 116 - 1e 116 - 1f 117 - 20 117 - 21 117 - 22 117 - 23 117 - 24 117 - 25 117 - 29 120 - 2a 120 - 2b 120 - 2c 120 - 2d 120 - 2e 120 - 2f 120 - 30 120 - 31 121 + method 'testSet (Ljava/lang/Object;)V' { + 0 116 + 1 116 + 2 116 + 3 118 + 4 118 + 5 118 + 6 118 + 7 118 + 8 118 + 9 118 + a 119 + b 119 + c 119 + d 119 + e 119 + 12 122 + 13 122 + 14 122 + 15 122 + 16 122 + 17 122 + 18 122 + 19 123 } - method 'testSet (Ljava/lang/Object;)V' { - 0 124 - 1 124 - 2 124 + method 'test1A (Ljava/lang/Object;)V' { + 0 126 + 1 126 + 2 126 3 126 4 126 5 126 6 126 - 7 126 + 7 127 + 8 127 + 9 127 a 127 b 127 - c 127 - d 127 - e 127 - 12 130 - 13 130 - 14 130 - 15 130 - 16 130 - 17 130 - 18 130 + c 128 + d 128 + e 128 + f 128 + 10 128 + 11 128 + 12 128 + 13 128 + 14 128 + 15 128 19 131 - } - - method 'test1A (Ljava/lang/Object;)V' { - 0 134 - 1 134 - 2 134 - 3 134 - 4 134 - 7 135 - 8 135 - 9 135 - a 135 - b 135 - c 136 - d 136 - e 136 - f 136 - 10 136 - 11 136 - 12 136 - 13 136 - 14 136 - 15 136 - 19 139 - 1a 139 - 1b 139 - 1c 139 - 1d 139 - 1e 140 - 1f 140 - 20 140 - 21 140 - 22 140 - 23 140 - 24 140 - 25 140 - 26 140 - 27 140 - 28 140 - 29 140 - 2a 140 - 2b 140 - 2c 140 - 2d 141 + 1a 131 + 1b 131 + 1c 131 + 1d 131 + 1e 132 + 1f 132 + 20 132 + 21 132 + 22 132 + 23 132 + 24 132 + 25 132 + 26 132 + 27 132 + 28 132 + 29 132 + 2a 132 + 2b 132 + 2c 132 + 2d 133 } method 'test2A (Ljava/lang/Object;)V' { - 0 144 - 1 144 - 2 144 - 3 144 - 4 144 - 7 149 - 8 149 - 9 149 - a 149 - b 149 - c 150 - d 150 - e 150 - f 145 - 10 145 - 11 145 - 12 145 - 13 145 - 14 146 - 15 146 - 16 146 - 17 146 - 18 146 - 19 146 - 1a 146 - 1b 150 - 1c 150 - 1d 150 - 1e 150 - 1f 150 - 20 150 - 21 150 - 22 151 - 23 151 - 24 151 - 25 151 - 26 151 - 27 151 - 28 151 - 29 151 - 2a 151 - 2b 151 - 2c 151 - 2d 151 - 2e 151 - 2f 152 - 30 152 - 31 152 + 0 136 + 1 136 + 2 136 + 3 136 + 4 136 + 5 136 + 6 136 + 7 141 + 8 141 + 9 141 + a 141 + b 141 + c 142 + f 137 + 10 137 + 11 137 + 12 137 + 13 137 + 14 138 + 15 138 + 16 138 + 17 138 + 18 138 + 19 138 + 1a 138 + 1e 142 + 1f 142 + 20 142 + 22 143 + 23 143 + 24 143 + 26 143 + 27 143 + 28 143 + 2a 143 + 2b 143 + 2c 143 + 2e 143 + 2f 143 + 30 143 } method 'test3A (Ljava/lang/Object;)V' { - 0 155 - 1 155 - 2 155 - 3 155 - 4 155 - 7 155 - 8 155 - 9 155 - a 155 - b 155 - e 156 - f 156 - 10 156 - 11 156 - 12 156 - 13 157 - 14 157 - 15 157 - 16 157 - 17 157 - 18 157 - 19 157 - 1d 160 - 1e 160 - 1f 160 - 20 160 - 21 160 - 22 161 - 23 161 - 24 161 - 25 161 - 26 161 - 27 161 - 28 161 - 29 161 - 2a 161 - 2b 161 - 2c 161 - 2d 161 - 2e 161 - 2f 161 - 30 161 - 31 162 + 0 147 + 1 147 + 2 147 + 3 147 + 4 147 + 5 147 + 6 147 + 7 147 + 8 147 + 9 147 + a 147 + b 147 + c 147 + d 147 + e 148 + f 148 + 10 148 + 11 148 + 12 148 + 13 149 + 14 149 + 15 149 + 16 149 + 17 149 + 18 149 + 19 149 + 1d 152 + 1e 152 + 1f 152 + 20 152 + 21 152 + 22 153 + 23 153 + 24 153 + 25 153 + 26 153 + 27 153 + 28 153 + 29 153 + 2a 153 + 2b 153 + 2c 153 + 2d 153 + 2e 153 + 2f 153 + 30 153 + 31 154 } method 'test4A (Ljava/lang/Object;)V' { - 0 165 - 1 165 - 2 165 - 3 165 - 4 165 - 7 165 - 8 165 - 9 165 - a 165 - b 165 - 12 165 - 16 166 - 17 166 - 18 166 - 19 166 - 1a 166 - 1b 167 - 1c 167 - 1d 167 - 1e 167 - 1f 167 - 20 167 - 21 167 - 25 170 - 26 170 - 27 170 - 28 170 - 29 170 - 2a 171 - 2b 171 - 2c 171 - 2d 171 - 2e 171 - 2f 171 - 30 171 - 31 171 - 32 171 - 33 171 - 34 171 - 35 171 - 36 171 - 37 171 - 38 171 - 39 172 + 0 157 + 1 157 + 2 157 + 3 157 + 4 157 + 5 157 + 6 157 + 7 157 + 8 157 + 9 157 + a 157 + b 157 + c 157 + d 157 + 12 157 + 16 158 + 17 158 + 18 158 + 19 158 + 1a 158 + 1b 159 + 1c 159 + 1d 159 + 1e 159 + 1f 159 + 20 159 + 21 159 + 25 162 + 26 162 + 27 162 + 28 162 + 29 162 + 2a 163 + 2b 163 + 2c 163 + 2d 163 + 2e 163 + 2f 163 + 30 163 + 31 163 + 32 163 + 33 163 + 34 163 + 35 163 + 36 163 + 37 163 + 38 163 + 39 164 } method 'test4xA (Ljava/lang/Object;)V' { - 0 175 - 1 175 - 2 175 - 3 175 - 4 175 - 7 176 - 8 176 - 9 176 - a 176 - b 176 - 12 176 - 13 176 - 14 176 - 15 176 - 16 176 - 17 176 - 1a 180 - 1b 180 - 1c 180 - 1d 180 - 1e 180 - 1f 181 - 20 181 - 21 181 - 22 181 - 23 181 - 24 181 - 25 181 - 29 184 - 2a 184 - 2b 184 - 2c 184 - 2d 184 - 2e 185 - 2f 185 - 30 185 - 31 185 - 32 185 - 33 185 - 34 185 - 35 185 - 36 185 - 37 185 - 38 185 - 39 185 - 3a 185 - 3b 185 - 3c 185 - 3d 186 + 0 167 + 1 167 + 2 167 + 3 167 + 4 167 + 5 167 + 6 167 + 7 167 + 8 167 + 9 167 + a 167 + b 167 + c 167 + d 167 + 12 167 + 13 167 + 14 167 + 15 167 + 16 167 + 17 167 + 18 167 + 19 167 + 1a 168 + 1b 168 + 1c 168 + 1d 168 + 1e 168 + 1f 169 + 20 169 + 21 169 + 22 169 + 23 169 + 24 169 + 25 169 + 29 172 + 2a 172 + 2b 172 + 2c 172 + 2d 172 + 2e 173 + 2f 173 + 30 173 + 31 173 + 32 173 + 33 173 + 34 173 + 35 173 + 36 173 + 37 173 + 38 173 + 39 173 + 3a 173 + 3b 173 + 3c 173 + 3d 174 } method 'test3ASwap (Ljava/lang/Object;)V' { - 0 189 - 1 189 - 2 189 - 3 189 - 4 189 - 7 189 - 8 189 - 9 189 - a 189 - b 189 - e 190 - f 190 - 10 190 - 11 190 - 12 190 - 13 191 - 14 191 - 15 191 - 16 191 - 17 191 - 18 191 - 19 191 - 1d 194 - 1e 194 - 1f 194 - 20 194 - 21 194 - 22 195 - 23 195 - 24 195 - 25 195 - 26 195 - 27 195 - 28 195 - 29 195 - 2a 195 - 2b 195 - 2c 195 - 2d 195 - 2e 195 - 2f 195 - 30 195 - 31 196 + 0 177 + 1 177 + 2 177 + 3 177 + 4 177 + 5 177 + 6 177 + 7 177 + 8 177 + 9 177 + a 177 + b 177 + c 177 + d 177 + e 178 + f 178 + 10 178 + 11 178 + 12 178 + 13 179 + 14 179 + 15 179 + 16 179 + 17 179 + 18 179 + 19 179 + 1d 182 + 1e 182 + 1f 182 + 20 182 + 21 182 + 22 183 + 23 183 + 24 183 + 25 183 + 26 183 + 27 183 + 28 183 + 29 183 + 2a 183 + 2b 183 + 2c 183 + 2d 183 + 2e 183 + 2f 183 + 30 183 + 31 184 } method 'test4ASwap (Ljava/lang/Object;)V' { - 0 199 - 1 199 - 2 199 - 3 199 - 4 199 - b 199 - f 199 - 10 199 - 11 199 - 12 199 - 13 199 - 16 200 - 17 200 - 18 200 - 19 200 - 1a 200 - 1b 201 - 1c 201 - 1d 201 - 1e 201 - 1f 201 - 20 201 - 21 201 - 25 204 - 26 204 - 27 204 - 28 204 - 29 204 - 2a 205 - 2b 205 - 2c 205 - 2d 205 - 2e 205 - 2f 205 - 30 205 - 31 205 - 32 205 - 33 205 - 34 205 - 35 205 - 36 205 - 37 205 - 38 205 - 39 206 + 0 187 + 1 187 + 2 187 + 3 187 + 4 187 + 5 187 + 6 187 + b 187 + f 187 + 10 187 + 11 187 + 12 187 + 13 187 + 14 187 + 15 187 + 16 188 + 17 188 + 18 188 + 19 188 + 1a 188 + 1b 189 + 1c 189 + 1d 189 + 1e 189 + 1f 189 + 20 189 + 21 189 + 25 192 + 26 192 + 27 192 + 28 192 + 29 192 + 2a 193 + 2b 193 + 2c 193 + 2d 193 + 2e 193 + 2f 193 + 30 193 + 31 193 + 32 193 + 33 193 + 34 193 + 35 193 + 36 193 + 37 193 + 38 193 + 39 194 } method 'test4xASwap (Ljava/lang/Object;)V' { - 0 209 - 1 209 - 2 209 - 3 209 - 4 209 - b 209 - c 209 - d 209 - e 209 - f 209 - 13 209 - 14 209 - 15 209 - 16 209 - 17 209 - 1a 210 - 1b 210 - 1c 210 - 1d 210 - 1e 210 - 1f 211 - 20 211 - 21 211 - 22 211 - 23 211 - 24 211 - 25 211 - 29 214 - 2a 214 - 2b 214 - 2c 214 - 2d 214 - 2e 215 - 2f 215 - 30 215 - 31 215 - 32 215 - 33 215 - 34 215 - 35 215 - 36 215 - 37 215 - 38 215 - 39 215 - 3a 215 - 3b 215 - 3c 215 - 3d 216 + 0 197 + 1 197 + 2 197 + 3 197 + 4 197 + 5 197 + 6 197 + b 197 + c 197 + d 197 + e 197 + f 197 + 10 197 + 11 197 + 12 197 + 13 197 + 14 197 + 15 197 + 16 197 + 17 197 + 18 197 + 19 197 + 1a 198 + 1b 198 + 1c 198 + 1d 198 + 1e 198 + 1f 199 + 20 199 + 21 199 + 22 199 + 23 199 + 24 199 + 25 199 + 29 202 + 2a 202 + 2b 202 + 2c 202 + 2d 202 + 2e 203 + 2f 203 + 30 203 + 31 203 + 32 203 + 33 203 + 34 203 + 35 203 + 36 203 + 37 203 + 38 203 + 39 203 + 3a 203 + 3b 203 + 3c 203 + 3d 204 } method 'testSetA (Ljava/lang/Object;)V' { - 0 219 - 1 219 - 2 219 - 3 221 - 4 221 - 5 221 - 6 221 - 7 221 - a 222 - b 222 - c 222 - d 222 - e 222 - 12 225 - 13 225 - 14 225 - 15 225 - 16 225 - 17 226 - 18 226 - 19 226 - 1a 226 - 1b 226 - 1c 226 - 1d 226 - 1e 226 - 1f 226 - 20 226 - 21 226 - 22 226 - 23 226 - 24 226 - 25 226 - 26 227 + 0 207 + 1 207 + 2 207 + 3 209 + 4 209 + 5 209 + 6 209 + 7 209 + 8 209 + 9 209 + a 210 + b 210 + c 210 + d 210 + e 210 + 12 213 + 13 213 + 14 213 + 15 213 + 16 213 + 17 214 + 18 214 + 19 214 + 1a 214 + 1b 214 + 1c 214 + 1d 214 + 1e 214 + 1f 214 + 20 214 + 21 214 + 22 214 + 23 214 + 24 214 + 25 214 + 26 215 } } @@ -1124,7 +1196,6 @@ Lines mapping: 12 <-> 12 13 <-> 13 14 <-> 14 -15 <-> 18 19 <-> 21 20 <-> 22 21 <-> 23 @@ -1139,107 +1210,107 @@ Lines mapping: 37 <-> 39 39 <-> 41 42 <-> 44 -43 <-> 49 -44 <-> 50 -46 <-> 52 -49 <-> 55 -50 <-> 56 -51 <-> 57 -53 <-> 60 -54 <-> 61 -57 <-> 64 -58 <-> 69 -59 <-> 70 -61 <-> 73 -62 <-> 74 -65 <-> 77 -66 <-> 78 -67 <-> 79 -69 <-> 81 -72 <-> 84 -73 <-> 85 -74 <-> 86 -77 <-> 89 -78 <-> 90 -81 <-> 93 -82 <-> 94 -83 <-> 95 -85 <-> 97 -88 <-> 100 -89 <-> 101 -90 <-> 102 -92 <-> 104 -95 <-> 107 -96 <-> 108 -97 <-> 109 -99 <-> 112 -100 <-> 113 -103 <-> 116 -104 <-> 117 -105 <-> 118 -107 <-> 121 -108 <-> 122 -112 <-> 125 -113 <-> 127 -114 <-> 128 -117 <-> 131 -118 <-> 132 -121 <-> 135 -122 <-> 136 -123 <-> 137 -125 <-> 140 -126 <-> 141 -127 <-> 142 -130 <-> 145 -131 <-> 146 -132 <-> 147 -133 <-> 151 -134 <-> 151 -135 <-> 152 -139 <-> 156 -140 <-> 157 -141 <-> 158 -144 <-> 161 -145 <-> 162 -146 <-> 163 -149 <-> 166 -150 <-> 167 -151 <-> 168 -154 <-> 171 -155 <-> 172 -156 <-> 173 -159 <-> 176 -160 <-> 181 -161 <-> 182 -164 <-> 185 -165 <-> 186 -166 <-> 187 -169 <-> 190 -170 <-> 191 -171 <-> 192 -174 <-> 195 -175 <-> 196 -176 <-> 197 -180 <-> 200 -181 <-> 201 -182 <-> 202 -185 <-> 205 -186 <-> 206 -187 <-> 207 -190 <-> 210 -191 <-> 211 -192 <-> 212 -195 <-> 215 -196 <-> 216 -197 <-> 217 -200 <-> 220 -201 <-> 222 -202 <-> 223 -205 <-> 226 -206 <-> 227 -207 <-> 228 +43 <-> 45 +44 <-> 46 +46 <-> 48 +49 <-> 51 +50 <-> 52 +51 <-> 53 +53 <-> 56 +54 <-> 57 +57 <-> 60 +58 <-> 61 +59 <-> 62 +61 <-> 65 +62 <-> 66 +65 <-> 69 +66 <-> 70 +67 <-> 71 +69 <-> 73 +72 <-> 76 +73 <-> 77 +74 <-> 78 +77 <-> 81 +78 <-> 82 +81 <-> 85 +82 <-> 86 +83 <-> 87 +85 <-> 89 +88 <-> 92 +89 <-> 93 +90 <-> 94 +92 <-> 96 +95 <-> 99 +96 <-> 100 +97 <-> 101 +99 <-> 104 +100 <-> 105 +103 <-> 108 +104 <-> 109 +105 <-> 110 +107 <-> 113 +108 <-> 114 +112 <-> 117 +113 <-> 119 +114 <-> 120 +117 <-> 123 +118 <-> 124 +121 <-> 127 +122 <-> 128 +123 <-> 129 +125 <-> 132 +126 <-> 133 +127 <-> 134 +130 <-> 137 +131 <-> 138 +132 <-> 139 +134 <-> 143 +135 <-> 144 +139 <-> 148 +140 <-> 149 +141 <-> 150 +144 <-> 153 +145 <-> 154 +146 <-> 155 +149 <-> 158 +150 <-> 159 +151 <-> 160 +154 <-> 163 +155 <-> 164 +156 <-> 165 +159 <-> 168 +160 <-> 169 +161 <-> 170 +164 <-> 173 +165 <-> 174 +166 <-> 175 +169 <-> 178 +170 <-> 179 +171 <-> 180 +174 <-> 183 +175 <-> 184 +176 <-> 185 +180 <-> 188 +181 <-> 189 +182 <-> 190 +185 <-> 193 +186 <-> 194 +187 <-> 195 +190 <-> 198 +191 <-> 199 +192 <-> 200 +195 <-> 203 +196 <-> 204 +197 <-> 205 +200 <-> 208 +201 <-> 210 +202 <-> 211 +205 <-> 214 +206 <-> 215 +207 <-> 216 Not mapped: 8 +15 16 22 29 @@ -1254,10 +1325,11 @@ Not mapped: 98 106 124 +133 136 142 152 162 172 183 -193 +193 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatching17FakeNew.dec b/testData/results/pkg/TestPatternMatching17FakeNew.dec index eee995cf2e..5af13ae78f 100644 --- a/testData/results/pkg/TestPatternMatching17FakeNew.dec +++ b/testData/results/pkg/TestPatternMatching17FakeNew.dec @@ -112,10 +112,10 @@ public class TestPatternMatching17FakeNew { public void testClash(Object obj) { if (obj instanceof String s) {// 112 - System.out.println(s.length());// 113 115 116 117 + System.out.println(s.length());// 117 } else { - int s = 0; - System.out.println(s); + int s = 0;// 113 + System.out.println(s);// 115 } }// 119 @@ -136,6 +136,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 4 3 4 4 4 + 5 4 + 6 4 b 4 c 5 d 5 @@ -145,6 +147,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 11 5 12 5 13 5 + 14 5 + 15 5 16 7 } @@ -154,6 +158,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 10 3 10 4 10 + 5 10 + 6 10 b 10 c 11 d 11 @@ -165,6 +171,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 13 12 14 12 15 12 + 16 12 + 17 12 18 14 } @@ -174,11 +182,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 17 3 17 4 17 + 5 17 + 6 17 7 17 8 17 9 17 a 17 b 17 + c 17 + d 17 e 18 f 18 10 18 @@ -189,6 +201,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 19 16 19 17 19 + 18 19 + 19 19 1a 21 } @@ -198,11 +212,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 24 3 24 4 24 + 5 24 + 6 24 7 24 8 24 9 24 a 24 b 24 + c 24 + d 24 e 25 f 25 10 25 @@ -213,6 +231,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 26 16 26 17 26 + 18 26 + 19 26 1a 29 1b 29 1c 29 @@ -230,11 +250,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 33 3 33 4 33 + 5 33 + 6 33 7 33 8 33 9 33 a 33 b 33 + c 33 + d 33 12 33 13 34 14 34 @@ -246,6 +270,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 1a 35 1b 35 1c 35 + 1d 35 + 1e 35 1f 37 } @@ -255,6 +281,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 40 3 40 4 40 + 5 40 + 6 40 7 40 8 40 9 40 @@ -265,6 +293,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 40 16 40 17 40 + 18 40 + 19 40 1a 41 1b 41 1c 41 @@ -275,6 +305,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 21 42 22 42 23 42 + 24 42 + 25 42 26 44 } @@ -284,11 +316,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 47 3 47 4 47 + 5 47 + 6 47 7 47 8 47 9 47 a 47 b 47 + c 47 + d 47 12 47 13 48 14 48 @@ -300,6 +336,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 1a 49 1b 49 1c 49 + 1d 49 + 1e 49 1f 52 20 52 21 52 @@ -317,6 +355,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 56 3 56 4 56 + 5 56 + 6 56 7 56 8 56 9 56 @@ -327,6 +367,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 56 16 56 17 56 + 18 56 + 19 56 1a 57 1b 57 1c 57 @@ -337,6 +379,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 21 58 22 58 23 58 + 24 58 + 25 58 26 61 27 61 28 61 @@ -354,11 +398,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 65 3 65 4 65 + 5 65 + 6 65 7 65 8 65 9 65 a 65 b 65 + c 65 + d 65 e 66 f 66 10 66 @@ -369,6 +417,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 67 16 67 17 67 + 18 67 + 19 67 1a 69 } @@ -378,11 +428,15 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 72 3 72 4 72 + 5 72 + 6 72 7 72 8 72 9 72 a 72 b 72 + c 72 + d 72 e 73 f 73 10 73 @@ -393,6 +447,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 15 74 16 74 17 74 + 18 74 + 19 74 1a 77 1b 77 1c 77 @@ -410,12 +466,16 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 81 3 81 4 81 + 5 81 + 6 81 b 81 f 81 10 81 11 81 12 81 13 81 + 14 81 + 15 81 16 82 17 82 18 82 @@ -426,6 +486,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 1d 83 1e 83 1f 83 + 20 83 + 21 83 22 85 } @@ -435,17 +497,23 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 88 3 88 4 88 + 5 88 + 6 88 b 88 c 88 d 88 e 88 f 88 10 88 + 11 88 + 12 88 13 88 14 88 15 88 16 88 17 88 + 18 88 + 19 88 1a 89 1b 89 1c 89 @@ -456,6 +524,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 21 90 22 90 23 90 + 24 90 + 25 90 26 92 } @@ -465,12 +535,16 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 95 3 95 4 95 + 5 95 + 6 95 b 95 f 95 10 95 11 95 12 95 13 95 + 14 95 + 15 95 16 96 17 96 18 96 @@ -481,6 +555,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 1d 97 1e 97 1f 97 + 20 97 + 21 97 22 100 23 100 24 100 @@ -498,17 +574,23 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 104 3 104 4 104 + 5 104 + 6 104 b 104 c 104 d 104 e 104 f 104 10 104 + 11 104 + 12 104 13 104 14 104 15 104 16 104 17 104 + 18 104 + 19 104 1a 105 1b 105 1c 105 @@ -519,6 +601,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 21 106 22 106 23 106 + 24 106 + 25 106 26 109 27 109 28 109 @@ -536,25 +620,22 @@ class 'pkg/TestPatternMatching17FakeNew' { 2 113 3 113 4 113 + 5 113 + 6 113 b 113 c 114 d 114 e 114 - f 114 - 10 114 - 11 114 - 12 114 - 13 114 - 14 114 - 15 114 - 16 114 - 17 114 - 18 114 - 19 114 - 1a 114 + f 116 + 10 116 + 11 117 + 12 117 + 13 117 + 14 117 + 15 117 + 16 117 + 17 117 1b 114 - 1c 114 - 1d 114 1e 114 1f 114 20 114 @@ -571,6 +652,8 @@ class 'pkg/TestPatternMatching17FakeNew' { 5 123 6 123 7 123 + 8 123 + 9 123 a 124 b 124 c 124 @@ -651,9 +734,8 @@ Lines mapping: 107 <-> 110 108 <-> 111 112 <-> 114 -113 <-> 115 -115 <-> 115 -116 <-> 115 +113 <-> 117 +115 <-> 118 117 <-> 115 119 <-> 120 122 <-> 123 @@ -661,3 +743,5 @@ Lines mapping: 124 <-> 125 127 <-> 128 128 <-> 129 +Not mapped: +116 diff --git a/testData/results/pkg/TestPatternMatchingAssign.dec b/testData/results/pkg/TestPatternMatchingAssign.dec index 0fda95ad25..6072893432 100644 --- a/testData/results/pkg/TestPatternMatchingAssign.dec +++ b/testData/results/pkg/TestPatternMatchingAssign.dec @@ -17,6 +17,8 @@ class 'pkg/TestPatternMatchingAssign' { 4 4 5 4 6 4 + 7 4 + 8 4 d 4 e 5 f 5 @@ -26,6 +28,8 @@ class 'pkg/TestPatternMatchingAssign' { 13 6 14 6 15 6 + 16 6 + 17 6 18 8 } } diff --git a/testData/results/pkg/TestPatternMatchingCompoundBool.dec b/testData/results/pkg/TestPatternMatchingCompoundBool.dec index 0721c97578..e8a9267f94 100644 --- a/testData/results/pkg/TestPatternMatchingCompoundBool.dec +++ b/testData/results/pkg/TestPatternMatchingCompoundBool.dec @@ -14,6 +14,8 @@ class 'pkg/TestPatternMatchingCompoundBool' { method 'test (ZLjava/lang/Object;)V' { 0 4 1 4 + 2 4 + 3 4 4 4 7 4 8 4 @@ -26,12 +28,16 @@ class 'pkg/TestPatternMatchingCompoundBool' { 17 4 18 4 19 4 + 1a 4 + 1b 4 1c 5 1d 5 1e 5 1f 5 20 5 21 5 + 22 5 + 23 5 24 8 25 8 26 8 diff --git a/testData/results/pkg/TestPatternMatchingFake.dec b/testData/results/pkg/TestPatternMatchingFake.dec index a5a3ea3578..47799e9d55 100644 --- a/testData/results/pkg/TestPatternMatchingFake.dec +++ b/testData/results/pkg/TestPatternMatchingFake.dec @@ -35,10 +35,10 @@ public class TestPatternMatchingFake { public void testClash(Object obj) { if (obj instanceof String s) {// 39 - System.out.println(s.length());// 40 42 43 44 + System.out.println(s.length());// 44 } else { - int s = 0; - System.out.println(s); + int s = 0;// 40 + System.out.println(s);// 42 } }// 46 @@ -64,6 +64,8 @@ class 'pkg/TestPatternMatchingFake' { 2 4 3 4 4 4 + 5 4 + 6 4 b 4 c 5 d 5 @@ -75,12 +77,16 @@ class 'pkg/TestPatternMatchingFake' { 13 5 14 5 15 5 + 16 5 + 17 5 18 8 1a 8 1b 8 1c 8 1d 8 1e 8 + 1f 8 + 20 8 25 8 26 9 27 9 @@ -92,6 +98,8 @@ class 'pkg/TestPatternMatchingFake' { 2d 9 2e 9 2f 9 + 30 9 + 31 9 32 11 } @@ -101,6 +109,8 @@ class 'pkg/TestPatternMatchingFake' { 2 14 3 14 4 14 + 5 14 + 6 14 b 14 c 15 d 15 @@ -112,6 +122,8 @@ class 'pkg/TestPatternMatchingFake' { 13 15 14 15 15 15 + 16 15 + 17 15 18 17 } @@ -122,6 +134,8 @@ class 'pkg/TestPatternMatchingFake' { 4 20 5 20 6 20 + 7 20 + 8 20 d 20 e 21 f 21 @@ -133,6 +147,8 @@ class 'pkg/TestPatternMatchingFake' { 15 21 16 21 17 21 + 18 21 + 19 21 1a 23 } @@ -142,6 +158,8 @@ class 'pkg/TestPatternMatchingFake' { 2 26 3 26 4 26 + 5 26 + 6 26 7 27 8 27 9 27 @@ -155,12 +173,16 @@ class 'pkg/TestPatternMatchingFake' { 11 27 12 27 13 27 + 14 27 + 15 27 16 30 18 30 19 30 1a 30 1b 30 1c 30 + 1d 30 + 1e 30 23 30 24 31 25 31 @@ -172,6 +194,8 @@ class 'pkg/TestPatternMatchingFake' { 2b 31 2c 31 2d 31 + 2e 31 + 2f 31 30 33 } @@ -182,25 +206,22 @@ class 'pkg/TestPatternMatchingFake' { 4 36 5 36 6 36 + 7 36 + 8 36 d 36 e 37 f 37 10 37 - 11 37 - 12 37 - 13 37 - 14 37 - 15 37 - 16 37 - 17 37 - 18 37 - 19 37 - 1a 37 - 1b 37 - 1c 37 + 11 39 + 12 39 + 13 40 + 14 40 + 15 40 + 16 40 + 17 40 + 18 40 + 19 40 1d 37 - 1e 37 - 1f 37 20 37 21 37 22 37 @@ -216,6 +237,8 @@ class 'pkg/TestPatternMatchingFake' { 4 46 5 46 6 46 + 7 46 + 8 46 9 47 a 47 b 47 @@ -227,6 +250,8 @@ class 'pkg/TestPatternMatchingFake' { 11 48 12 48 13 48 + 14 48 + 15 48 16 49 17 49 18 49 @@ -239,11 +264,15 @@ class 'pkg/TestPatternMatchingFake' { 1f 49 20 53 21 53 + 22 53 + 23 53 24 54 25 54 26 54 27 54 28 54 + 29 54 + 2a 54 2b 56 } } @@ -268,9 +297,8 @@ Lines mapping: 34 <-> 32 36 <-> 34 39 <-> 37 -40 <-> 38 -42 <-> 38 -43 <-> 38 +40 <-> 40 +42 <-> 41 44 <-> 38 46 <-> 43 49 <-> 46 @@ -281,3 +309,5 @@ Lines mapping: 58 <-> 54 59 <-> 55 61 <-> 57 +Not mapped: +43 diff --git a/testData/results/pkg/TestPatternMatchingFakeLoops.dec b/testData/results/pkg/TestPatternMatchingFakeLoops.dec index 9c69dd713a..53ca008ee6 100644 --- a/testData/results/pkg/TestPatternMatchingFakeLoops.dec +++ b/testData/results/pkg/TestPatternMatchingFakeLoops.dec @@ -40,20 +40,11 @@ public class TestPatternMatchingFakeLoops { }// 39 void test4x(Object o) { - while (true) { - label13: - if (o.hashCode() >= 0) {// 42 - if (o instanceof String x && !x.isEmpty()) { - break label13; - } - - return;// 46 - } - + while (o.hashCode() < 0 || o instanceof String x && !x.isEmpty()) {// 42 String s = (String)o;// 43 System.out.println(s);// 44 } - } + }// 46 void test4B(Object o) { while (o.hashCode() < 0 || o instanceof String var2) {// 49 @@ -65,21 +56,13 @@ public class TestPatternMatchingFakeLoops { }// 54 void test4xB(Object o) { - while (true) { - label13: - if (o.hashCode() >= 0) {// 57 - if (o instanceof String x && !x.isEmpty()) { - break label13; - } - - System.out.println("bye");// 61 - return;// 62 - } - + while (o.hashCode() < 0 || o instanceof String x && !x.isEmpty()) {// 57 String s = (String)o;// 58 System.out.println(s);// 59 } - } + + System.out.println("bye");// 61 + }// 62 void test3Swap(Object o) { while (o instanceof String || o.hashCode() < 0) {// 65 @@ -211,11 +194,15 @@ class 'pkg/TestPatternMatchingFakeLoops' { 2 19 3 19 4 19 + 5 19 + 6 19 7 19 8 19 9 19 a 19 b 19 + c 19 + d 19 e 20 f 20 10 20 @@ -237,11 +224,15 @@ class 'pkg/TestPatternMatchingFakeLoops' { 2 26 3 26 4 26 + 5 26 + 6 26 7 26 8 26 9 26 a 26 b 26 + c 26 + d 26 e 27 f 27 10 27 @@ -271,6 +262,8 @@ class 'pkg/TestPatternMatchingFakeLoops' { 2 35 3 35 4 35 + 5 35 + 6 35 7 35 9 35 a 35 @@ -293,371 +286,419 @@ class 'pkg/TestPatternMatchingFakeLoops' { } method 'test4x (Ljava/lang/Object;)V' { - 0 44 - 1 44 - 2 44 - 3 44 - 4 44 - 7 45 - 9 45 - a 45 - b 45 - c 45 - d 45 - 14 45 - 15 45 - 16 45 - 17 45 - 18 45 - 19 45 - 1c 52 - 1d 52 - 1e 52 - 1f 52 - 20 52 - 21 53 - 22 53 - 23 53 - 24 53 - 25 53 - 26 53 - 27 53 - 2b 49 + 0 42 + 1 42 + 2 42 + 3 42 + 4 42 + 5 42 + 6 42 + 7 42 + 9 42 + a 42 + b 42 + c 42 + d 42 + e 42 + f 42 + 14 42 + 15 42 + 16 42 + 17 42 + 18 42 + 19 42 + 1a 42 + 1b 42 + 1c 43 + 1d 43 + 1e 43 + 1f 43 + 20 43 + 21 44 + 22 44 + 23 44 + 24 44 + 25 44 + 26 44 + 27 44 + 2b 46 } method 'test4B (Ljava/lang/Object;)V' { + 0 49 + 1 49 + 2 49 + 3 49 + 4 49 + 5 49 + 6 49 + 7 49 + 9 49 + a 49 + b 49 + c 49 + 14 49 + 15 50 + 16 50 + 17 50 + 18 50 + 19 50 + 1a 51 + 1b 51 + 1c 51 + 1d 51 + 1e 51 + 1f 51 + 20 51 + 24 54 + 25 54 + 26 54 + 27 54 + 28 54 + 29 54 + 2a 54 + 2b 54 + 2c 55 + } + + method 'test4xB (Ljava/lang/Object;)V' { 0 58 1 58 2 58 3 58 4 58 + 5 58 + 6 58 7 58 9 58 a 58 b 58 c 58 + d 58 + e 58 + f 58 14 58 - 15 59 - 16 59 - 17 59 - 18 59 - 19 59 - 1a 60 - 1b 60 - 1c 60 - 1d 60 - 1e 60 - 1f 60 - 20 60 - 24 63 - 25 63 - 26 63 - 27 63 - 28 63 - 29 63 - 2a 63 + 15 58 + 16 58 + 17 58 + 18 58 + 19 58 + 1a 58 + 1b 58 + 1c 59 + 1d 59 + 1e 59 + 1f 59 + 20 59 + 21 60 + 22 60 + 23 60 + 24 60 + 25 60 + 26 60 + 27 60 2b 63 - 2c 64 - } - - method 'test4xB (Ljava/lang/Object;)V' { - 0 69 - 1 69 - 2 69 - 3 69 - 4 69 - 7 70 - 9 70 - a 70 - b 70 - c 70 - d 70 - 14 70 - 15 70 - 16 70 - 17 70 - 18 70 - 19 70 - 1c 78 - 1d 78 - 1e 78 - 1f 78 - 20 78 - 21 79 - 22 79 - 23 79 - 24 79 - 25 79 - 26 79 - 27 79 - 2b 74 - 2c 74 - 2d 74 - 2e 74 - 2f 74 - 30 74 - 31 74 - 32 74 - 33 75 + 2c 63 + 2d 63 + 2e 63 + 2f 63 + 30 63 + 31 63 + 32 63 + 33 64 } method 'test3Swap (Ljava/lang/Object;)V' { - 0 84 - 1 84 - 2 84 - 3 84 - 4 84 - 7 84 - 8 84 - 9 84 - a 84 - b 84 - e 85 - f 85 - 10 85 - 11 85 - 12 85 - 13 86 - 14 86 - 15 86 - 16 86 - 17 86 - 18 86 - 19 86 - 1d 88 + 0 67 + 1 67 + 2 67 + 3 67 + 4 67 + 5 67 + 6 67 + 7 67 + 8 67 + 9 67 + a 67 + b 67 + c 67 + d 67 + e 68 + f 68 + 10 68 + 11 68 + 12 68 + 13 69 + 14 69 + 15 69 + 16 69 + 17 69 + 18 69 + 19 69 + 1d 71 } method 'test3BSwap (Ljava/lang/Object;)V' { - 0 91 - 1 91 - 2 91 - 3 91 - 4 91 - 7 91 - 8 91 - 9 91 - a 91 - b 91 - e 92 - f 92 - 10 92 - 11 92 - 12 92 - 13 93 - 14 93 - 15 93 - 16 93 - 17 93 - 18 93 - 19 93 - 1d 96 - 1e 96 - 1f 96 - 20 96 - 21 96 - 22 96 - 23 96 - 24 96 - 25 97 + 0 74 + 1 74 + 2 74 + 3 74 + 4 74 + 5 74 + 6 74 + 7 74 + 8 74 + 9 74 + a 74 + b 74 + c 74 + d 74 + e 75 + f 75 + 10 75 + 11 75 + 12 75 + 13 76 + 14 76 + 15 76 + 16 76 + 17 76 + 18 76 + 19 76 + 1d 79 + 1e 79 + 1f 79 + 20 79 + 21 79 + 22 79 + 23 79 + 24 79 + 25 80 } method 'test4Swap (Ljava/lang/Object;)V' { - 0 100 - 2 100 - 3 100 - 4 100 - 5 100 - 6 100 - d 100 - 11 100 - 12 100 - 13 100 - 14 100 - 15 100 - 18 101 - 19 101 - 1a 101 - 1b 101 - 1c 101 - 1d 102 - 1e 102 - 1f 102 - 20 102 - 21 102 - 22 102 - 23 102 - 27 104 + 0 83 + 2 83 + 3 83 + 4 83 + 5 83 + 6 83 + 7 83 + 8 83 + d 83 + 11 83 + 12 83 + 13 83 + 14 83 + 15 83 + 16 83 + 17 83 + 18 84 + 19 84 + 1a 84 + 1b 84 + 1c 84 + 1d 85 + 1e 85 + 1f 85 + 20 85 + 21 85 + 22 85 + 23 85 + 27 87 } method 'test4xSwap (Ljava/lang/Object;)V' { - 0 107 - 2 107 - 3 107 - 4 107 - 5 107 - 6 107 - d 107 - e 107 - f 107 - 10 107 - 11 107 - 12 107 - 15 107 - 16 107 - 17 107 - 18 107 - 19 107 - 1c 108 - 1d 108 - 1e 108 - 1f 108 - 20 108 - 21 109 - 22 109 - 23 109 - 24 109 - 25 109 - 26 109 - 27 109 - 2b 111 + 0 90 + 2 90 + 3 90 + 4 90 + 5 90 + 6 90 + 7 90 + 8 90 + d 90 + e 90 + f 90 + 10 90 + 11 90 + 12 90 + 13 90 + 14 90 + 15 90 + 16 90 + 17 90 + 18 90 + 19 90 + 1a 90 + 1b 90 + 1c 91 + 1d 91 + 1e 91 + 1f 91 + 20 91 + 21 92 + 22 92 + 23 92 + 24 92 + 25 92 + 26 92 + 27 92 + 2b 94 } method 'test4BSwap (Ljava/lang/Object;)V' { - 0 114 - 2 114 - 3 114 - 4 114 - 5 114 - 6 114 - d 114 - 11 114 - 12 114 - 13 114 - 14 114 - 15 114 - 18 115 - 19 115 - 1a 115 - 1b 115 - 1c 115 - 1d 116 - 1e 116 - 1f 116 - 20 116 - 21 116 - 22 116 - 23 116 - 27 119 - 28 119 - 29 119 - 2a 119 - 2b 119 - 2c 119 - 2d 119 - 2e 119 - 2f 120 + 0 97 + 2 97 + 3 97 + 4 97 + 5 97 + 6 97 + 7 97 + 8 97 + d 97 + 11 97 + 12 97 + 13 97 + 14 97 + 15 97 + 16 97 + 17 97 + 18 98 + 19 98 + 1a 98 + 1b 98 + 1c 98 + 1d 99 + 1e 99 + 1f 99 + 20 99 + 21 99 + 22 99 + 23 99 + 27 102 + 28 102 + 29 102 + 2a 102 + 2b 102 + 2c 102 + 2d 102 + 2e 102 + 2f 103 } method 'test4xBSwap (Ljava/lang/Object;)V' { - 0 123 - 2 123 - 3 123 - 4 123 - 5 123 - 6 123 - d 123 - e 123 - f 123 - 10 123 - 11 123 - 12 123 - 15 123 - 16 123 - 17 123 - 18 123 - 19 123 - 1c 124 - 1d 124 - 1e 124 - 1f 124 - 20 124 - 21 125 - 22 125 - 23 125 - 24 125 - 25 125 - 26 125 - 27 125 - 2b 128 - 2c 128 - 2d 128 - 2e 128 - 2f 128 - 30 128 - 31 128 - 32 128 - 33 129 + 0 106 + 2 106 + 3 106 + 4 106 + 5 106 + 6 106 + 7 106 + 8 106 + d 106 + e 106 + f 106 + 10 106 + 11 106 + 12 106 + 13 106 + 14 106 + 15 106 + 16 106 + 17 106 + 18 106 + 19 106 + 1a 106 + 1b 106 + 1c 107 + 1d 107 + 1e 107 + 1f 107 + 20 107 + 21 108 + 22 108 + 23 108 + 24 108 + 25 108 + 26 108 + 27 108 + 2b 111 + 2c 111 + 2d 111 + 2e 111 + 2f 111 + 30 111 + 31 111 + 32 111 + 33 112 } method 'testSet (Ljava/lang/Object;)V' { - 0 132 - 1 132 - 2 132 - 3 134 - 4 134 - 5 134 - 6 134 - a 135 - b 135 - c 135 - d 135 - e 135 - 12 138 - 13 138 - 14 138 - 15 138 - 16 138 - 17 138 - 18 138 - 19 139 + 0 115 + 1 115 + 2 115 + 3 117 + 4 117 + 5 117 + 6 117 + a 118 + b 118 + c 118 + d 118 + e 118 + 12 121 + 13 121 + 14 121 + 15 121 + 16 121 + 17 121 + 18 121 + 19 122 } method 'testModifyLeak (Ljava/lang/Object;)V' { - 0 142 - 1 142 - 2 144 - 3 144 - 4 144 - 5 144 - 9 145 - a 145 - b 145 - c 145 - d 145 - e 146 - f 146 - 10 146 - 11 146 - 12 146 - 13 146 - 16 147 - 17 147 - 18 147 - 19 147 - 1a 147 - 1b 147 - 1c 147 - 1d 147 - 1e 147 - 1f 147 - 23 151 - 24 151 - 27 152 - 28 152 - 29 152 - 2a 152 - 2b 152 - 2e 154 + 0 125 + 1 125 + 2 127 + 3 127 + 4 127 + 5 127 + 9 128 + a 128 + b 128 + c 128 + d 128 + e 129 + f 129 + 10 129 + 11 129 + 12 129 + 13 129 + 14 129 + 15 129 + 16 130 + 17 130 + 18 130 + 19 130 + 1a 130 + 1b 130 + 1c 130 + 1d 130 + 1e 130 + 1f 130 + 23 134 + 24 134 + 25 134 + 26 134 + 27 135 + 28 135 + 29 135 + 2a 135 + 2b 135 + 2c 135 + 2d 135 + 2e 137 } } @@ -683,60 +724,60 @@ Lines mapping: 36 <-> 37 37 <-> 38 39 <-> 40 -42 <-> 45 -43 <-> 53 -44 <-> 54 -46 <-> 50 -49 <-> 59 -50 <-> 60 -51 <-> 61 -53 <-> 64 -54 <-> 65 -57 <-> 70 -58 <-> 79 -59 <-> 80 -61 <-> 75 -62 <-> 76 -65 <-> 85 -66 <-> 86 -67 <-> 87 -69 <-> 89 -72 <-> 92 -73 <-> 93 -74 <-> 94 -77 <-> 97 -78 <-> 98 -81 <-> 101 -82 <-> 102 -83 <-> 103 -85 <-> 105 -88 <-> 108 -89 <-> 109 -90 <-> 110 -92 <-> 112 -95 <-> 115 -96 <-> 116 -97 <-> 117 -99 <-> 120 -100 <-> 121 -103 <-> 124 -104 <-> 125 -105 <-> 126 -107 <-> 129 -108 <-> 130 -112 <-> 133 -113 <-> 135 -114 <-> 136 -117 <-> 139 -118 <-> 140 -121 <-> 143 -122 <-> 145 -123 <-> 146 -125 <-> 147 -126 <-> 148 -130 <-> 152 -131 <-> 153 -133 <-> 155 +42 <-> 43 +43 <-> 44 +44 <-> 45 +46 <-> 47 +49 <-> 50 +50 <-> 51 +51 <-> 52 +53 <-> 55 +54 <-> 56 +57 <-> 59 +58 <-> 60 +59 <-> 61 +61 <-> 64 +62 <-> 65 +65 <-> 68 +66 <-> 69 +67 <-> 70 +69 <-> 72 +72 <-> 75 +73 <-> 76 +74 <-> 77 +77 <-> 80 +78 <-> 81 +81 <-> 84 +82 <-> 85 +83 <-> 86 +85 <-> 88 +88 <-> 91 +89 <-> 92 +90 <-> 93 +92 <-> 95 +95 <-> 98 +96 <-> 99 +97 <-> 100 +99 <-> 103 +100 <-> 104 +103 <-> 107 +104 <-> 108 +105 <-> 109 +107 <-> 112 +108 <-> 113 +112 <-> 116 +113 <-> 118 +114 <-> 119 +117 <-> 122 +118 <-> 123 +121 <-> 126 +122 <-> 128 +123 <-> 129 +125 <-> 130 +126 <-> 131 +130 <-> 135 +131 <-> 136 +133 <-> 138 Not mapped: 8 15 @@ -751,4 +792,4 @@ Not mapped: 84 91 98 -106 +106 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatchingFakeLoopsInverted.dec b/testData/results/pkg/TestPatternMatchingFakeLoopsInverted.dec index 9883c28808..896a808e50 100644 --- a/testData/results/pkg/TestPatternMatchingFakeLoopsInverted.dec +++ b/testData/results/pkg/TestPatternMatchingFakeLoopsInverted.dec @@ -15,7 +15,7 @@ public class TestPatternMatchingFakeLoopsInverted { } String x = (String)o; - }// 15 + } void test3(Object o) { while (o.hashCode() >= 0 && !(o instanceof String)) {// 19 @@ -41,11 +41,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 39 void test4x(Object o) { - while (o.hashCode() >= 0) {// 42 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 42 String s = (String)o;// 43 System.out.println(s);// 44 } @@ -61,11 +57,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 54 void test4xB(Object o) { - while (o.hashCode() >= 0) {// 57 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 57 String s = (String)o;// 58 System.out.println(s);// 59 } @@ -97,7 +89,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 85 void test4xSwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 88 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 88 String s = (String)o;// 89 System.out.println(s);// 90 } @@ -113,7 +105,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 100 void test4xBSwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 103 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 103 String s = (String)o;// 104 System.out.println(s);// 105 } @@ -148,7 +140,7 @@ public class TestPatternMatchingFakeLoopsInverted { } String x = (String)o; - String var4 = (String)o;// 133 134 + String var4 = (String)o;// 134 System.out.println(var4.hashCode() + var4.length());// 135 } @@ -173,11 +165,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 156 void test4xA(Object o) { - while (o.hashCode() >= 0) {// 159 - if (o instanceof String x && !x.isEmpty()) { - break; - } - + while (o.hashCode() >= 0 && !(o instanceof String x && !x.isEmpty())) {// 159 String s = (String)o;// 160 System.out.println(s);// 161 } @@ -207,7 +195,7 @@ public class TestPatternMatchingFakeLoopsInverted { }// 187 void test4xASwap(Object o) { - while ((!(o instanceof String x) || x.isEmpty()) && o.hashCode() >= 0) {// 190 + while (!(o instanceof String x && !x.isEmpty()) && o.hashCode() >= 0) {// 190 String s = (String)o;// 191 System.out.println(s);// 192 } @@ -235,6 +223,8 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 8 5 9 5 @@ -260,14 +250,14 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 4 11 5 11 6 11 + 7 11 + 8 11 9 16 a 16 b 16 c 16 d 16 e 17 - f 17 - 10 17 11 12 12 12 13 12 @@ -280,9 +270,6 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 1a 13 1b 13 1c 13 - 1d 17 - 1e 17 - 1f 17 } method 'test3 (Ljava/lang/Object;)V' { @@ -291,11 +278,15 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 2 20 3 20 4 20 + 5 20 + 6 20 7 20 8 20 9 20 a 20 b 20 + c 20 + d 20 e 21 f 21 10 21 @@ -317,11 +308,15 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 2 27 3 27 4 27 + 5 27 + 6 27 7 27 8 27 9 27 a 27 b 27 + c 27 + d 27 e 28 f 28 10 28 @@ -351,12 +346,16 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 2 36 3 36 4 36 + 5 36 + 6 36 7 36 9 36 a 36 b 36 c 36 d 36 + e 36 + f 36 14 36 18 37 19 37 @@ -379,754 +378,827 @@ class 'pkg/TestPatternMatchingFakeLoopsInverted' { 2 43 3 43 4 43 - 7 44 - 9 44 - a 44 - b 44 - c 44 - d 44 - 14 44 - 15 44 - 16 44 - 17 44 - 18 44 - 19 44 - 1c 48 - 1d 48 - 1e 48 - 1f 48 - 20 48 - 21 49 - 22 49 - 23 49 - 24 49 - 25 49 - 26 49 - 27 49 - 2b 51 + 5 43 + 6 43 + 7 43 + 9 43 + a 43 + b 43 + c 43 + d 43 + e 43 + f 43 + 14 43 + 15 43 + 16 43 + 17 43 + 18 43 + 19 43 + 1a 43 + 1b 43 + 1c 44 + 1d 44 + 1e 44 + 1f 44 + 20 44 + 21 45 + 22 45 + 23 45 + 24 45 + 25 45 + 26 45 + 27 45 + 2b 47 } method 'test4B (Ljava/lang/Object;)V' { - 0 54 - 1 54 - 2 54 - 3 54 - 4 54 - 7 54 - 9 54 - a 54 - b 54 - c 54 - d 54 - 14 54 - 18 55 - 19 55 - 1a 55 - 1b 55 - 1c 55 - 1d 56 - 1e 56 - 1f 56 - 20 56 - 21 56 - 22 56 - 23 56 - 27 59 - 28 59 - 29 59 - 2a 59 - 2b 59 - 2c 59 - 2d 59 - 2e 59 - 2f 60 + 0 50 + 1 50 + 2 50 + 3 50 + 4 50 + 5 50 + 6 50 + 7 50 + 9 50 + a 50 + b 50 + c 50 + d 50 + e 50 + f 50 + 14 50 + 18 51 + 19 51 + 1a 51 + 1b 51 + 1c 51 + 1d 52 + 1e 52 + 1f 52 + 20 52 + 21 52 + 22 52 + 23 52 + 27 55 + 28 55 + 29 55 + 2a 55 + 2b 55 + 2c 55 + 2d 55 + 2e 55 + 2f 56 } method 'test4xB (Ljava/lang/Object;)V' { - 0 63 - 1 63 - 2 63 - 3 63 - 4 63 - 7 64 - 9 64 - a 64 - b 64 - c 64 - d 64 - 14 64 - 15 64 - 16 64 - 17 64 - 18 64 - 19 64 - 1c 68 - 1d 68 - 1e 68 - 1f 68 - 20 68 - 21 69 - 22 69 - 23 69 - 24 69 - 25 69 - 26 69 - 27 69 - 2b 72 - 2c 72 - 2d 72 - 2e 72 - 2f 72 - 30 72 - 31 72 - 32 72 - 33 73 + 0 59 + 1 59 + 2 59 + 3 59 + 4 59 + 5 59 + 6 59 + 7 59 + 9 59 + a 59 + b 59 + c 59 + d 59 + e 59 + f 59 + 14 59 + 15 59 + 16 59 + 17 59 + 18 59 + 19 59 + 1a 59 + 1b 59 + 1c 60 + 1d 60 + 1e 60 + 1f 60 + 20 60 + 21 61 + 22 61 + 23 61 + 24 61 + 25 61 + 26 61 + 27 61 + 2b 64 + 2c 64 + 2d 64 + 2e 64 + 2f 64 + 30 64 + 31 64 + 32 64 + 33 65 } method 'test3Swap (Ljava/lang/Object;)V' { - 0 76 - 1 76 - 2 76 - 3 76 - 4 76 - 7 76 - 8 76 - 9 76 - a 76 - b 76 - e 77 - f 77 - 10 77 - 11 77 - 12 77 - 13 78 - 14 78 - 15 78 - 16 78 - 17 78 - 18 78 - 19 78 - 1d 80 + 0 68 + 1 68 + 2 68 + 3 68 + 4 68 + 5 68 + 6 68 + 7 68 + 8 68 + 9 68 + a 68 + b 68 + c 68 + d 68 + e 69 + f 69 + 10 69 + 11 69 + 12 69 + 13 70 + 14 70 + 15 70 + 16 70 + 17 70 + 18 70 + 19 70 + 1d 72 } method 'test3BSwap (Ljava/lang/Object;)V' { - 0 83 - 1 83 - 2 83 - 3 83 - 4 83 - 7 83 - 8 83 - 9 83 - a 83 - b 83 - e 84 - f 84 - 10 84 + 0 75 + 1 75 + 2 75 + 3 75 + 4 75 + 5 75 + 6 75 + 7 75 + 8 75 + 9 75 + a 75 + b 75 + c 75 + d 75 + e 76 + f 76 + 10 76 + 11 76 + 12 76 + 13 77 + 14 77 + 15 77 + 16 77 + 17 77 + 18 77 + 19 77 + 1d 80 + 1e 80 + 1f 80 + 20 80 + 21 80 + 22 80 + 23 80 + 24 80 + 25 81 + } + + method 'test4Swap (Ljava/lang/Object;)V' { + 0 84 + 2 84 + 3 84 + 4 84 + 5 84 + 6 84 + 7 84 + 8 84 + d 84 11 84 12 84 - 13 85 - 14 85 - 15 85 - 16 85 - 17 85 + 13 84 + 14 84 + 15 84 + 16 84 + 17 84 18 85 19 85 - 1d 88 - 1e 88 - 1f 88 - 20 88 - 21 88 - 22 88 - 23 88 - 24 88 - 25 89 + 1a 85 + 1b 85 + 1c 85 + 1d 86 + 1e 86 + 1f 86 + 20 86 + 21 86 + 22 86 + 23 86 + 27 88 } - method 'test4Swap (Ljava/lang/Object;)V' { - 0 92 - 2 92 - 3 92 - 4 92 - 5 92 - 6 92 - d 92 - 11 92 - 12 92 - 13 92 - 14 92 - 15 92 - 18 93 - 19 93 - 1a 93 - 1b 93 - 1c 93 - 1d 94 - 1e 94 - 1f 94 - 20 94 - 21 94 - 22 94 - 23 94 - 27 96 + method 'test4xSwap (Ljava/lang/Object;)V' { + 0 91 + 2 91 + 3 91 + 4 91 + 5 91 + 6 91 + 7 91 + 8 91 + d 91 + e 91 + f 91 + 10 91 + 11 91 + 12 91 + 13 91 + 14 91 + 15 91 + 16 91 + 17 91 + 18 91 + 19 91 + 1a 91 + 1b 91 + 1c 92 + 1d 92 + 1e 92 + 1f 92 + 20 92 + 21 93 + 22 93 + 23 93 + 24 93 + 25 93 + 26 93 + 27 93 + 2b 95 } - method 'test4xSwap (Ljava/lang/Object;)V' { - 0 99 - 2 99 - 3 99 - 4 99 - 5 99 - 6 99 - d 99 - e 99 - f 99 - 10 99 - 11 99 - 15 99 - 16 99 - 17 99 + method 'test4BSwap (Ljava/lang/Object;)V' { + 0 98 + 2 98 + 3 98 + 4 98 + 5 98 + 6 98 + 7 98 + 8 98 + d 98 + 11 98 + 12 98 + 13 98 + 14 98 + 15 98 + 16 98 + 17 98 18 99 19 99 - 1c 100 + 1a 99 + 1b 99 + 1c 99 1d 100 1e 100 1f 100 20 100 - 21 101 - 22 101 - 23 101 - 24 101 - 25 101 - 26 101 - 27 101 + 21 100 + 22 100 + 23 100 + 27 103 + 28 103 + 29 103 + 2a 103 2b 103 + 2c 103 + 2d 103 + 2e 103 + 2f 104 } - method 'test4BSwap (Ljava/lang/Object;)V' { - 0 106 - 2 106 - 3 106 - 4 106 - 5 106 - 6 106 - d 106 - 11 106 - 12 106 - 13 106 - 14 106 - 15 106 + method 'test4xBSwap (Ljava/lang/Object;)V' { + 0 107 + 2 107 + 3 107 + 4 107 + 5 107 + 6 107 + 7 107 + 8 107 + d 107 + e 107 + f 107 + 10 107 + 11 107 + 12 107 + 13 107 + 14 107 + 15 107 + 16 107 + 17 107 18 107 19 107 1a 107 1b 107 - 1c 107 + 1c 108 1d 108 1e 108 1f 108 20 108 - 21 108 - 22 108 - 23 108 - 27 111 - 28 111 - 29 111 - 2a 111 - 2b 111 - 2c 111 - 2d 111 - 2e 111 + 21 109 + 22 109 + 23 109 + 24 109 + 25 109 + 26 109 + 27 109 + 2b 112 + 2c 112 + 2d 112 + 2e 112 2f 112 + 30 112 + 31 112 + 32 112 + 33 113 } - method 'test4xBSwap (Ljava/lang/Object;)V' { - 0 115 - 2 115 - 3 115 - 4 115 - 5 115 - 6 115 - d 115 - e 115 - f 115 - 10 115 - 11 115 - 15 115 - 16 115 - 17 115 - 18 115 - 19 115 - 1c 116 - 1d 116 - 1e 116 - 1f 116 - 20 116 - 21 117 - 22 117 - 23 117 - 24 117 - 25 117 - 26 117 - 27 117 - 2b 120 - 2c 120 - 2d 120 - 2e 120 - 2f 120 - 30 120 - 31 120 - 32 120 - 33 121 + method 'testSet (Ljava/lang/Object;)V' { + 0 116 + 1 116 + 2 116 + 3 118 + 4 118 + 5 118 + 6 118 + 7 118 + 8 118 + 9 118 + a 119 + b 119 + c 119 + d 119 + e 119 + 12 122 + 13 122 + 14 122 + 15 122 + 16 122 + 17 122 + 18 122 + 19 123 } - method 'testSet (Ljava/lang/Object;)V' { - 0 124 - 1 124 - 2 124 + method 'test1A (Ljava/lang/Object;)V' { + 0 126 + 1 126 + 2 126 3 126 4 126 5 126 6 126 - 7 126 + 7 127 + 8 127 + 9 127 a 127 b 127 - c 127 - d 127 - e 127 - 12 130 - 13 130 - 14 130 - 15 130 - 16 130 - 17 130 - 18 130 + c 128 + d 128 + e 128 + f 128 + 10 128 + 11 128 + 12 128 + 13 128 + 14 128 + 15 128 19 131 - } - - method 'test1A (Ljava/lang/Object;)V' { - 0 134 - 1 134 - 2 134 - 3 134 - 4 134 - 7 135 - 8 135 - 9 135 - a 135 - b 135 - c 136 - d 136 - e 136 - f 136 - 10 136 - 11 136 - 12 136 - 13 136 - 14 136 - 15 136 - 19 139 - 1a 139 - 1b 139 - 1c 139 - 1d 139 - 1e 140 - 1f 140 - 20 140 - 21 140 - 22 140 - 23 140 - 24 140 - 25 140 - 26 140 - 27 140 - 28 140 - 29 140 - 2a 140 - 2b 140 - 2c 140 - 2d 141 + 1a 131 + 1b 131 + 1c 131 + 1d 131 + 1e 132 + 1f 132 + 20 132 + 21 132 + 22 132 + 23 132 + 24 132 + 25 132 + 26 132 + 27 132 + 28 132 + 29 132 + 2a 132 + 2b 132 + 2c 132 + 2d 133 } method 'test2A (Ljava/lang/Object;)V' { - 0 144 - 2 144 - 3 144 - 4 144 - 5 144 - 6 144 - 9 149 - a 149 - b 149 - c 149 - d 149 - e 150 - f 150 - 10 150 - 11 145 - 12 145 - 13 145 - 14 145 - 15 145 - 16 146 - 17 146 - 18 146 - 19 146 - 1a 146 - 1b 146 - 1c 146 - 1d 150 - 1e 150 - 1f 150 - 20 150 - 21 150 - 22 150 - 23 150 - 24 151 - 25 151 - 26 151 - 27 151 - 28 151 - 29 151 - 2a 151 - 2b 151 - 2c 151 - 2d 151 - 2e 151 - 2f 151 - 30 151 - 31 152 - 32 152 - 33 152 + 0 136 + 2 136 + 3 136 + 4 136 + 5 136 + 6 136 + 7 136 + 8 136 + 9 141 + a 141 + b 141 + c 141 + d 141 + e 142 + 11 137 + 12 137 + 13 137 + 14 137 + 15 137 + 16 138 + 17 138 + 18 138 + 19 138 + 1a 138 + 1b 138 + 1c 138 + 20 142 + 21 142 + 22 142 + 24 143 + 25 143 + 26 143 + 28 143 + 29 143 + 2a 143 + 2c 143 + 2d 143 + 2e 143 + 30 143 + 31 143 + 32 143 } method 'test3A (Ljava/lang/Object;)V' { - 0 155 - 1 155 - 2 155 - 3 155 - 4 155 - 7 155 - 8 155 - 9 155 - a 155 - b 155 - e 156 - f 156 - 10 156 - 11 156 - 12 156 - 13 157 - 14 157 - 15 157 - 16 157 - 17 157 - 18 157 - 19 157 - 1d 160 - 1e 160 - 1f 160 - 20 160 - 21 160 - 22 161 - 23 161 - 24 161 - 25 161 - 26 161 - 27 161 - 28 161 - 29 161 - 2a 161 - 2b 161 - 2c 161 - 2d 161 - 2e 161 - 2f 161 - 30 161 - 31 162 + 0 147 + 1 147 + 2 147 + 3 147 + 4 147 + 5 147 + 6 147 + 7 147 + 8 147 + 9 147 + a 147 + b 147 + c 147 + d 147 + e 148 + f 148 + 10 148 + 11 148 + 12 148 + 13 149 + 14 149 + 15 149 + 16 149 + 17 149 + 18 149 + 19 149 + 1d 152 + 1e 152 + 1f 152 + 20 152 + 21 152 + 22 153 + 23 153 + 24 153 + 25 153 + 26 153 + 27 153 + 28 153 + 29 153 + 2a 153 + 2b 153 + 2c 153 + 2d 153 + 2e 153 + 2f 153 + 30 153 + 31 154 } method 'test4A (Ljava/lang/Object;)V' { - 0 165 - 1 165 - 2 165 - 3 165 - 4 165 - 7 165 - 9 165 - a 165 - b 165 - c 165 - d 165 - 14 165 - 18 166 - 19 166 - 1a 166 - 1b 166 - 1c 166 - 1d 167 - 1e 167 - 1f 167 - 20 167 - 21 167 - 22 167 - 23 167 - 27 170 - 28 170 - 29 170 - 2a 170 - 2b 170 - 2c 171 - 2d 171 - 2e 171 - 2f 171 - 30 171 - 31 171 - 32 171 - 33 171 - 34 171 - 35 171 - 36 171 - 37 171 - 38 171 - 39 171 - 3a 171 - 3b 172 + 0 157 + 1 157 + 2 157 + 3 157 + 4 157 + 5 157 + 6 157 + 7 157 + 9 157 + a 157 + b 157 + c 157 + d 157 + e 157 + f 157 + 14 157 + 18 158 + 19 158 + 1a 158 + 1b 158 + 1c 158 + 1d 159 + 1e 159 + 1f 159 + 20 159 + 21 159 + 22 159 + 23 159 + 27 162 + 28 162 + 29 162 + 2a 162 + 2b 162 + 2c 163 + 2d 163 + 2e 163 + 2f 163 + 30 163 + 31 163 + 32 163 + 33 163 + 34 163 + 35 163 + 36 163 + 37 163 + 38 163 + 39 163 + 3a 163 + 3b 164 } method 'test4xA (Ljava/lang/Object;)V' { - 0 175 - 1 175 - 2 175 - 3 175 - 4 175 - 7 176 - 9 176 - a 176 - b 176 - c 176 - d 176 - 14 176 - 15 176 - 16 176 - 17 176 - 18 176 - 19 176 - 1c 180 - 1d 180 - 1e 180 - 1f 180 - 20 180 - 21 181 - 22 181 - 23 181 - 24 181 - 25 181 - 26 181 - 27 181 - 2b 184 - 2c 184 - 2d 184 - 2e 184 - 2f 184 - 30 185 - 31 185 - 32 185 - 33 185 - 34 185 - 35 185 - 36 185 - 37 185 - 38 185 - 39 185 - 3a 185 - 3b 185 - 3c 185 - 3d 185 - 3e 185 - 3f 186 + 0 167 + 1 167 + 2 167 + 3 167 + 4 167 + 5 167 + 6 167 + 7 167 + 9 167 + a 167 + b 167 + c 167 + d 167 + e 167 + f 167 + 14 167 + 15 167 + 16 167 + 17 167 + 18 167 + 19 167 + 1a 167 + 1b 167 + 1c 168 + 1d 168 + 1e 168 + 1f 168 + 20 168 + 21 169 + 22 169 + 23 169 + 24 169 + 25 169 + 26 169 + 27 169 + 2b 172 + 2c 172 + 2d 172 + 2e 172 + 2f 172 + 30 173 + 31 173 + 32 173 + 33 173 + 34 173 + 35 173 + 36 173 + 37 173 + 38 173 + 39 173 + 3a 173 + 3b 173 + 3c 173 + 3d 173 + 3e 173 + 3f 174 } method 'test3ASwap (Ljava/lang/Object;)V' { - 0 189 - 1 189 - 2 189 - 3 189 - 4 189 - 7 189 - 8 189 - 9 189 - a 189 - b 189 - e 190 - f 190 - 10 190 - 11 190 - 12 190 - 13 191 - 14 191 - 15 191 - 16 191 - 17 191 - 18 191 - 19 191 - 1d 194 - 1e 194 - 1f 194 - 20 194 - 21 194 - 22 195 - 23 195 - 24 195 - 25 195 - 26 195 - 27 195 - 28 195 - 29 195 - 2a 195 - 2b 195 - 2c 195 - 2d 195 - 2e 195 - 2f 195 - 30 195 - 31 196 + 0 177 + 1 177 + 2 177 + 3 177 + 4 177 + 5 177 + 6 177 + 7 177 + 8 177 + 9 177 + a 177 + b 177 + c 177 + d 177 + e 178 + f 178 + 10 178 + 11 178 + 12 178 + 13 179 + 14 179 + 15 179 + 16 179 + 17 179 + 18 179 + 19 179 + 1d 182 + 1e 182 + 1f 182 + 20 182 + 21 182 + 22 183 + 23 183 + 24 183 + 25 183 + 26 183 + 27 183 + 28 183 + 29 183 + 2a 183 + 2b 183 + 2c 183 + 2d 183 + 2e 183 + 2f 183 + 30 183 + 31 184 } method 'test4ASwap (Ljava/lang/Object;)V' { - 0 199 - 2 199 - 3 199 - 4 199 - 5 199 - 6 199 - d 199 - 11 199 - 12 199 - 13 199 - 14 199 - 15 199 - 18 200 - 19 200 - 1a 200 - 1b 200 - 1c 200 - 1d 201 - 1e 201 - 1f 201 - 20 201 - 21 201 - 22 201 - 23 201 - 27 204 - 28 204 - 29 204 - 2a 204 - 2b 204 - 2c 205 - 2d 205 - 2e 205 - 2f 205 - 30 205 - 31 205 - 32 205 - 33 205 - 34 205 - 35 205 - 36 205 - 37 205 - 38 205 - 39 205 - 3a 205 - 3b 206 + 0 187 + 2 187 + 3 187 + 4 187 + 5 187 + 6 187 + 7 187 + 8 187 + d 187 + 11 187 + 12 187 + 13 187 + 14 187 + 15 187 + 16 187 + 17 187 + 18 188 + 19 188 + 1a 188 + 1b 188 + 1c 188 + 1d 189 + 1e 189 + 1f 189 + 20 189 + 21 189 + 22 189 + 23 189 + 27 192 + 28 192 + 29 192 + 2a 192 + 2b 192 + 2c 193 + 2d 193 + 2e 193 + 2f 193 + 30 193 + 31 193 + 32 193 + 33 193 + 34 193 + 35 193 + 36 193 + 37 193 + 38 193 + 39 193 + 3a 193 + 3b 194 } method 'test4xASwap (Ljava/lang/Object;)V' { - 0 209 - 2 209 + 0 197 + 2 197 + 3 197 + 4 197 + 5 197 + 6 197 + 7 197 + 8 197 + d 197 + e 197 + f 197 + 10 197 + 11 197 + 12 197 + 13 197 + 14 197 + 15 197 + 16 197 + 17 197 + 18 197 + 19 197 + 1a 197 + 1b 197 + 1c 198 + 1d 198 + 1e 198 + 1f 198 + 20 198 + 21 199 + 22 199 + 23 199 + 24 199 + 25 199 + 26 199 + 27 199 + 2b 202 + 2c 202 + 2d 202 + 2e 202 + 2f 202 + 30 203 + 31 203 + 32 203 + 33 203 + 34 203 + 35 203 + 36 203 + 37 203 + 38 203 + 39 203 + 3a 203 + 3b 203 + 3c 203 + 3d 203 + 3e 203 + 3f 204 + } + + method 'testSetA (Ljava/lang/Object;)V' { + 0 207 + 1 207 + 2 207 3 209 4 209 5 209 6 209 - d 209 - e 209 - f 209 - 10 209 - 11 209 - 15 209 - 16 209 - 17 209 - 18 209 - 19 209 - 1c 210 - 1d 210 - 1e 210 - 1f 210 - 20 210 - 21 211 - 22 211 - 23 211 - 24 211 - 25 211 - 26 211 - 27 211 - 2b 214 - 2c 214 - 2d 214 - 2e 214 - 2f 214 - 30 215 - 31 215 - 32 215 - 33 215 - 34 215 - 35 215 - 36 215 - 37 215 - 38 215 - 39 215 - 3a 215 - 3b 215 - 3c 215 - 3d 215 - 3e 215 - 3f 216 - } - - method 'testSetA (Ljava/lang/Object;)V' { - 0 219 - 1 219 - 2 219 - 3 221 - 4 221 - 5 221 - 6 221 - 7 221 - a 222 - b 222 - c 222 - d 222 - e 222 - 12 225 - 13 225 - 14 225 - 15 225 - 16 225 - 17 226 - 18 226 - 19 226 - 1a 226 - 1b 226 - 1c 226 - 1d 226 - 1e 226 - 1f 226 - 20 226 - 21 226 - 22 226 - 23 226 - 24 226 - 25 226 - 26 227 + 7 209 + 8 209 + 9 209 + a 210 + b 210 + c 210 + d 210 + e 210 + 12 213 + 13 213 + 14 213 + 15 213 + 16 213 + 17 214 + 18 214 + 19 214 + 1a 214 + 1b 214 + 1c 214 + 1d 214 + 1e 214 + 1f 214 + 20 214 + 21 214 + 22 214 + 23 214 + 24 214 + 25 214 + 26 215 } } @@ -1138,7 +1210,6 @@ Lines mapping: 12 <-> 12 13 <-> 13 14 <-> 14 -15 <-> 18 19 <-> 21 20 <-> 22 21 <-> 23 @@ -1153,107 +1224,107 @@ Lines mapping: 37 <-> 39 39 <-> 41 42 <-> 44 -43 <-> 49 -44 <-> 50 -46 <-> 52 -49 <-> 55 -50 <-> 56 -51 <-> 57 -53 <-> 60 -54 <-> 61 -57 <-> 64 -58 <-> 69 -59 <-> 70 -61 <-> 73 -62 <-> 74 -65 <-> 77 -66 <-> 78 -67 <-> 79 -69 <-> 81 -72 <-> 84 -73 <-> 85 -74 <-> 86 -77 <-> 89 -78 <-> 90 -81 <-> 93 -82 <-> 94 -83 <-> 95 -85 <-> 97 -88 <-> 100 -89 <-> 101 -90 <-> 102 -92 <-> 104 -95 <-> 107 -96 <-> 108 -97 <-> 109 -99 <-> 112 -100 <-> 113 -103 <-> 116 -104 <-> 117 -105 <-> 118 -107 <-> 121 -108 <-> 122 -112 <-> 125 -113 <-> 127 -114 <-> 128 -117 <-> 131 -118 <-> 132 -121 <-> 135 -122 <-> 136 -123 <-> 137 -125 <-> 140 -126 <-> 141 -127 <-> 142 -130 <-> 145 -131 <-> 146 -132 <-> 147 -133 <-> 151 -134 <-> 151 -135 <-> 152 -139 <-> 156 -140 <-> 157 -141 <-> 158 -144 <-> 161 -145 <-> 162 -146 <-> 163 -149 <-> 166 -150 <-> 167 -151 <-> 168 -154 <-> 171 -155 <-> 172 -156 <-> 173 -159 <-> 176 -160 <-> 181 -161 <-> 182 -164 <-> 185 -165 <-> 186 -166 <-> 187 -169 <-> 190 -170 <-> 191 -171 <-> 192 -174 <-> 195 -175 <-> 196 -176 <-> 197 -180 <-> 200 -181 <-> 201 -182 <-> 202 -185 <-> 205 -186 <-> 206 -187 <-> 207 -190 <-> 210 -191 <-> 211 -192 <-> 212 -195 <-> 215 -196 <-> 216 -197 <-> 217 -200 <-> 220 -201 <-> 222 -202 <-> 223 -205 <-> 226 -206 <-> 227 -207 <-> 228 +43 <-> 45 +44 <-> 46 +46 <-> 48 +49 <-> 51 +50 <-> 52 +51 <-> 53 +53 <-> 56 +54 <-> 57 +57 <-> 60 +58 <-> 61 +59 <-> 62 +61 <-> 65 +62 <-> 66 +65 <-> 69 +66 <-> 70 +67 <-> 71 +69 <-> 73 +72 <-> 76 +73 <-> 77 +74 <-> 78 +77 <-> 81 +78 <-> 82 +81 <-> 85 +82 <-> 86 +83 <-> 87 +85 <-> 89 +88 <-> 92 +89 <-> 93 +90 <-> 94 +92 <-> 96 +95 <-> 99 +96 <-> 100 +97 <-> 101 +99 <-> 104 +100 <-> 105 +103 <-> 108 +104 <-> 109 +105 <-> 110 +107 <-> 113 +108 <-> 114 +112 <-> 117 +113 <-> 119 +114 <-> 120 +117 <-> 123 +118 <-> 124 +121 <-> 127 +122 <-> 128 +123 <-> 129 +125 <-> 132 +126 <-> 133 +127 <-> 134 +130 <-> 137 +131 <-> 138 +132 <-> 139 +134 <-> 143 +135 <-> 144 +139 <-> 148 +140 <-> 149 +141 <-> 150 +144 <-> 153 +145 <-> 154 +146 <-> 155 +149 <-> 158 +150 <-> 159 +151 <-> 160 +154 <-> 163 +155 <-> 164 +156 <-> 165 +159 <-> 168 +160 <-> 169 +161 <-> 170 +164 <-> 173 +165 <-> 174 +166 <-> 175 +169 <-> 178 +170 <-> 179 +171 <-> 180 +174 <-> 183 +175 <-> 184 +176 <-> 185 +180 <-> 188 +181 <-> 189 +182 <-> 190 +185 <-> 193 +186 <-> 194 +187 <-> 195 +190 <-> 198 +191 <-> 199 +192 <-> 200 +195 <-> 203 +196 <-> 204 +197 <-> 205 +200 <-> 208 +201 <-> 210 +202 <-> 211 +205 <-> 214 +206 <-> 215 +207 <-> 216 Not mapped: 8 +15 16 22 29 @@ -1268,10 +1339,11 @@ Not mapped: 98 106 124 +133 136 142 152 162 172 183 -193 +193 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatchingFakeNew.dec b/testData/results/pkg/TestPatternMatchingFakeNew.dec index ba449a7b76..63d2e1328b 100644 --- a/testData/results/pkg/TestPatternMatchingFakeNew.dec +++ b/testData/results/pkg/TestPatternMatchingFakeNew.dec @@ -112,10 +112,10 @@ public class TestPatternMatchingFakeNew { public void testClash(Object obj) { if (obj instanceof String s) {// 112 - System.out.println(s.length());// 113 115 116 117 + System.out.println(s.length());// 117 } else { - int s = 0; - System.out.println(s); + int s = 0;// 113 + System.out.println(s);// 115 } }// 119 @@ -136,6 +136,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 4 3 4 4 4 + 5 4 + 6 4 b 4 c 5 d 5 @@ -145,6 +147,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 11 5 12 5 13 5 + 14 5 + 15 5 16 7 } @@ -155,6 +159,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 10 5 10 6 10 + 7 10 + 8 10 d 10 e 11 f 11 @@ -166,6 +172,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 15 12 16 12 17 12 + 18 12 + 19 12 1a 14 } @@ -175,11 +183,15 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 17 3 17 4 17 + 5 17 + 6 17 7 17 8 17 9 17 a 17 b 17 + c 17 + d 17 e 18 f 18 10 18 @@ -190,6 +202,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 15 19 16 19 17 19 + 18 19 + 19 19 1a 21 } @@ -199,11 +213,15 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 24 3 24 4 24 + 5 24 + 6 24 7 24 8 24 9 24 a 24 b 24 + c 24 + d 24 e 25 f 25 10 25 @@ -214,6 +232,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 15 26 16 26 17 26 + 18 26 + 19 26 1a 29 1b 29 1c 29 @@ -231,12 +251,16 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 33 3 33 4 33 + 5 33 + 6 33 7 33 9 33 a 33 b 33 c 33 d 33 + e 33 + f 33 14 33 15 34 16 34 @@ -248,6 +272,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 1c 35 1d 35 1e 35 + 1f 35 + 20 35 21 37 } @@ -257,6 +283,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 40 3 40 4 40 + 5 40 + 6 40 7 40 9 40 a 40 @@ -268,6 +296,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 17 40 18 40 19 40 + 1a 40 + 1b 40 1c 41 1d 41 1e 41 @@ -278,6 +308,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 23 42 24 42 25 42 + 26 42 + 27 42 28 44 } @@ -287,12 +319,16 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 47 3 47 4 47 + 5 47 + 6 47 7 47 9 47 a 47 b 47 c 47 d 47 + e 47 + f 47 14 47 15 48 16 48 @@ -304,6 +340,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 1c 49 1d 49 1e 49 + 1f 49 + 20 49 21 52 22 52 23 52 @@ -321,6 +359,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 56 3 56 4 56 + 5 56 + 6 56 7 56 9 56 a 56 @@ -332,6 +372,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 17 56 18 56 19 56 + 1a 56 + 1b 56 1c 57 1d 57 1e 57 @@ -342,6 +384,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 23 58 24 58 25 58 + 26 58 + 27 58 28 61 29 61 2a 61 @@ -359,11 +403,15 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 65 3 65 4 65 + 5 65 + 6 65 7 65 8 65 9 65 a 65 b 65 + c 65 + d 65 e 66 f 66 10 66 @@ -374,6 +422,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 15 67 16 67 17 67 + 18 67 + 19 67 1a 69 } @@ -383,11 +433,15 @@ class 'pkg/TestPatternMatchingFakeNew' { 2 72 3 72 4 72 + 5 72 + 6 72 7 72 8 72 9 72 a 72 b 72 + c 72 + d 72 e 73 f 73 10 73 @@ -398,6 +452,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 15 74 16 74 17 74 + 18 74 + 19 74 1a 77 1b 77 1c 77 @@ -416,12 +472,16 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 81 5 81 6 81 + 7 81 + 8 81 d 81 11 81 12 81 13 81 14 81 15 81 + 16 81 + 17 81 18 82 19 82 1a 82 @@ -432,6 +492,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 1f 83 20 83 21 83 + 22 83 + 23 83 24 85 } @@ -442,17 +504,23 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 88 5 88 6 88 + 7 88 + 8 88 d 88 e 88 f 88 10 88 11 88 12 88 + 13 88 + 14 88 15 88 16 88 17 88 18 88 19 88 + 1a 88 + 1b 88 1c 89 1d 89 1e 89 @@ -463,6 +531,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 23 90 24 90 25 90 + 26 90 + 27 90 28 92 } @@ -473,12 +543,16 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 95 5 95 6 95 + 7 95 + 8 95 d 95 11 95 12 95 13 95 14 95 15 95 + 16 95 + 17 95 18 96 19 96 1a 96 @@ -489,6 +563,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 1f 97 20 97 21 97 + 22 97 + 23 97 24 100 25 100 26 100 @@ -507,17 +583,23 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 104 5 104 6 104 + 7 104 + 8 104 d 104 e 104 f 104 10 104 11 104 12 104 + 13 104 + 14 104 15 104 16 104 17 104 18 104 19 104 + 1a 104 + 1b 104 1c 105 1d 105 1e 105 @@ -528,6 +610,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 23 106 24 106 25 106 + 26 106 + 27 106 28 109 29 109 2a 109 @@ -546,25 +630,22 @@ class 'pkg/TestPatternMatchingFakeNew' { 4 113 5 113 6 113 + 7 113 + 8 113 d 113 e 114 f 114 10 114 - 11 114 - 12 114 - 13 114 - 14 114 - 15 114 - 16 114 - 17 114 - 18 114 - 19 114 - 1a 114 - 1b 114 - 1c 114 + 11 116 + 12 116 + 13 117 + 14 117 + 15 117 + 16 117 + 17 117 + 18 117 + 19 117 1d 114 - 1e 114 - 1f 114 20 114 21 114 22 114 @@ -581,6 +662,8 @@ class 'pkg/TestPatternMatchingFakeNew' { 5 123 6 123 7 123 + 8 123 + 9 123 a 124 b 124 c 124 @@ -661,9 +744,8 @@ Lines mapping: 107 <-> 110 108 <-> 111 112 <-> 114 -113 <-> 115 -115 <-> 115 -116 <-> 115 +113 <-> 117 +115 <-> 118 117 <-> 115 119 <-> 120 122 <-> 123 @@ -671,3 +753,5 @@ Lines mapping: 124 <-> 125 127 <-> 128 128 <-> 129 +Not mapped: +116 diff --git a/testData/results/pkg/TestPatternMatchingInline.dec b/testData/results/pkg/TestPatternMatchingInline.dec index b2ed1b8d5e..28b24da712 100644 --- a/testData/results/pkg/TestPatternMatchingInline.dec +++ b/testData/results/pkg/TestPatternMatchingInline.dec @@ -2,31 +2,11 @@ package pkg; public class TestPatternMatchingInline { public void test(Object o) { - boolean var10002; - label12: { - if (o instanceof String s && s.length() > 5) { - var10002 = true; - break label12; - } - - var10002 = false; - } - - this.accept(o, var10002);// 5 + this.accept(o, o instanceof String s && s.length() > 5);// 5 }// 6 public void test2(Object o) { - boolean var10002; - label12: { - if (o instanceof Boolean b && b) { - var10002 = true; - break label12; - } - - var10002 = false; - } - - this.accept(o, var10002);// 9 + this.accept(o, o instanceof Boolean b && b);// 9 }// 10 private void accept(Object o, boolean b) { @@ -35,62 +15,64 @@ public class TestPatternMatchingInline { class 'pkg/TestPatternMatchingInline' { method 'test (Ljava/lang/Object;)V' { - 0 14 - 1 14 - 2 6 - 4 6 - 5 6 - 6 6 - 7 6 - 8 6 - f 6 - 10 6 - 11 6 - 12 6 - 13 6 - 14 6 - 15 6 - 18 7 - 19 8 - 1c 11 - 1d 14 - 1e 14 - 1f 14 - 20 15 + 0 4 + 1 4 + 2 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 1d 4 + 1e 4 + 1f 4 + 20 5 } method 'test2 (Ljava/lang/Object;)V' { - 0 28 - 1 28 - 2 20 - 4 20 - 5 20 - 6 20 - 7 20 - 8 20 - f 20 - 10 20 - 11 20 - 12 20 - 13 20 - 14 20 - 17 21 - 18 22 - 1b 25 - 1c 28 - 1d 28 - 1e 28 - 1f 29 + 0 8 + 1 8 + 2 8 + 4 8 + 5 8 + 6 8 + 7 8 + 8 8 + 9 8 + a 8 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 1c 8 + 1d 8 + 1e 8 + 1f 9 } method 'accept (Ljava/lang/Object;Z)V' { - 0 32 + 0 12 } } Lines mapping: -5 <-> 15 -6 <-> 16 -9 <-> 29 -10 <-> 30 -14 <-> 33 +5 <-> 5 +6 <-> 6 +9 <-> 9 +10 <-> 10 +14 <-> 13 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatchingInteger.dec b/testData/results/pkg/TestPatternMatchingInteger.dec index a728a5c8f2..178d9585e3 100644 --- a/testData/results/pkg/TestPatternMatchingInteger.dec +++ b/testData/results/pkg/TestPatternMatchingInteger.dec @@ -8,9 +8,7 @@ public class TestPatternMatchingInteger { public int testMulti(Object a, Object b) { if (a instanceof Integer ai && b instanceof Integer bi) {// 13 return ai + bi;// 14 - } - - if (a instanceof Integer ai) {// 15 + } else if (a instanceof Integer ai) {// 15 return ai;// 16 } else { return b instanceof Integer bi ? bi : 0;// 17 18 21 @@ -31,21 +29,16 @@ public class TestPatternMatchingInteger { } public int testMultiDifferent(Object a, Object b) { - if (a instanceof Integer i && b instanceof String s) {// 37 - return i + s.length();// 38 - } - - return 0;// 41 + return a instanceof Integer i && b instanceof String s ? i + s.length() : 0;// 37 38 41 } public void testDeMorgan(Object obj) { if (obj instanceof Integer i && i >= 1 && i >= 41) {// 45 System.out.println(i);// 48 - return;// 50 + } else { + System.out.println("i");// 46 } - - System.out.println("i");// 46 - } + }// 50 } class 'pkg/TestPatternMatchingInteger' { @@ -55,6 +48,8 @@ class 'pkg/TestPatternMatchingInteger' { 2 4 3 4 4 4 + 5 4 + 6 4 b 4 c 4 d 4 @@ -71,12 +66,16 @@ class 'pkg/TestPatternMatchingInteger' { 2 8 3 8 4 8 + 5 8 + 6 8 b 8 c 8 d 8 e 8 f 8 10 8 + 11 8 + 12 8 17 8 18 8 19 9 @@ -90,130 +89,148 @@ class 'pkg/TestPatternMatchingInteger' { 21 9 22 9 23 9 - 24 12 - 25 12 - 26 12 - 27 12 - 28 12 - 2f 12 - 30 12 - 31 13 - 32 13 - 33 13 - 34 13 - 35 13 - 36 13 - 37 15 - 38 15 - 39 15 - 3a 15 - 3b 15 - 42 15 - 43 15 - 44 15 - 45 15 - 46 15 - 47 15 - 48 15 - 4a 15 + 24 10 + 25 10 + 26 10 + 27 10 + 28 10 + 29 10 + 2a 10 + 2f 10 + 30 10 + 31 11 + 32 11 + 33 11 + 34 11 + 35 11 + 36 11 + 37 13 + 38 13 + 39 13 + 3a 13 + 3b 13 + 3c 13 + 3d 13 + 42 13 + 43 13 + 44 13 + 45 13 + 46 13 + 47 13 + 48 13 + 4a 13 } method 'testMulti2 (Ljava/lang/Object;Ljava/lang/Object;)I' { - 0 20 - 1 20 - 2 21 - 3 21 - 4 21 - 5 21 - 6 21 - d 21 - e 21 - 10 22 - 11 22 - 12 22 - 13 22 - 14 22 - 16 22 - 17 25 - 18 25 - 19 25 - 1a 25 - 1b 25 - 22 25 - 23 25 - 25 26 - 26 26 - 27 26 - 28 26 - 29 26 - 2b 26 - 2c 29 - 2d 29 + 0 18 + 1 18 + 2 19 + 3 19 + 4 19 + 5 19 + 6 19 + 7 19 + 8 19 + d 19 + e 19 + 10 20 + 11 20 + 12 20 + 13 20 + 14 20 + 16 20 + 17 23 + 18 23 + 19 23 + 1a 23 + 1b 23 + 1c 23 + 1d 23 + 22 23 + 23 23 + 25 24 + 26 24 + 27 24 + 28 24 + 29 24 + 2b 24 + 2c 27 + 2d 27 } method 'testMultiDifferent (Ljava/lang/Object;Ljava/lang/Object;)I' { - 0 33 - 1 33 - 2 33 - 3 33 - 4 33 - b 33 - c 33 - d 33 - e 33 - f 33 - 10 33 - 17 33 - 18 33 - 19 34 - 1a 34 - 1b 34 - 1c 34 - 1d 34 - 1e 34 - 1f 34 - 20 34 - 21 34 - 22 34 - 23 34 - 24 37 - 25 37 + 0 31 + 1 31 + 2 31 + 3 31 + 4 31 + 5 31 + 6 31 + b 31 + c 31 + d 31 + e 31 + f 31 + 10 31 + 11 31 + 12 31 + 17 31 + 18 31 + 19 31 + 1a 31 + 1b 31 + 1c 31 + 1d 31 + 1e 31 + 1f 31 + 20 31 + 21 31 + 22 31 + 24 31 } method 'testDeMorgan (Ljava/lang/Object;)V' { - 0 41 - 1 41 - 2 41 - 3 41 - 4 41 - b 41 - c 41 - d 41 - e 41 - f 41 - 10 41 - 11 41 - 14 41 - 15 41 - 16 41 - 17 41 - 18 41 - 19 41 - 1a 41 - 1d 46 - 1e 46 - 1f 46 - 20 46 - 21 46 - 22 46 - 23 46 - 24 46 - 28 42 - 29 42 - 2a 42 - 2b 42 - 2c 42 - 2f 43 + 0 35 + 1 35 + 2 35 + 3 35 + 4 35 + 5 35 + 6 35 + b 35 + c 35 + d 35 + e 35 + f 35 + 10 35 + 11 35 + 12 35 + 13 35 + 14 35 + 15 35 + 16 35 + 17 35 + 18 35 + 19 35 + 1a 35 + 1b 35 + 1c 35 + 1d 38 + 1e 38 + 1f 38 + 20 38 + 21 38 + 22 38 + 23 38 + 24 38 + 28 36 + 29 36 + 2a 36 + 2b 36 + 2c 36 + 2d 36 + 2e 36 + 2f 40 } } @@ -223,21 +240,21 @@ Lines mapping: 9 <-> 5 13 <-> 9 14 <-> 10 -15 <-> 13 -16 <-> 14 -17 <-> 16 -18 <-> 16 -21 <-> 16 -25 <-> 21 -26 <-> 22 -27 <-> 23 -29 <-> 26 -30 <-> 27 -33 <-> 30 -37 <-> 34 -38 <-> 35 -41 <-> 38 -45 <-> 42 -46 <-> 47 -48 <-> 43 -50 <-> 44 +15 <-> 11 +16 <-> 12 +17 <-> 14 +18 <-> 14 +21 <-> 14 +25 <-> 19 +26 <-> 20 +27 <-> 21 +29 <-> 24 +30 <-> 25 +33 <-> 28 +37 <-> 32 +38 <-> 32 +41 <-> 32 +45 <-> 36 +46 <-> 39 +48 <-> 37 +50 <-> 41 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatchingInvoke.dec b/testData/results/pkg/TestPatternMatchingInvoke.dec new file mode 100644 index 0000000000..dfd0e98581 --- /dev/null +++ b/testData/results/pkg/TestPatternMatchingInvoke.dec @@ -0,0 +1,121 @@ +package pkg; + +public class TestPatternMatchingInvoke { + public TestPatternMatchingInvoke.I get() { + return new TestPatternMatchingInvoke.A();// 17 + } + + public boolean bool() { + return true;// 21 + } + + public void test(boolean cond) { + System.out.println("Before");// 25 + if (this.bool()) {// 27 + System.out.println("Inner");// 28 + TestPatternMatchingInvoke.I i = this.get();// 29 + if (cond && i instanceof TestPatternMatchingInvoke.A) {// 30 + TestPatternMatchingInvoke.I i2 = this.get();// 31 + System.out.println(i2);// 32 + } + } + + System.out.println("After");// 36 + }// 37 + + class A implements TestPatternMatchingInvoke.I { + } + + class B implements TestPatternMatchingInvoke.I { + } + + interface I { + } +} + +class 'pkg/TestPatternMatchingInvoke' { + method 'get ()Lpkg/TestPatternMatchingInvoke$I;' { + 8 4 + } + + method 'bool ()Z' { + 0 8 + 1 8 + } + + method 'test (Z)V' { + 0 12 + 1 12 + 2 12 + 3 12 + 4 12 + 5 12 + 6 12 + 7 12 + 8 13 + 9 13 + a 13 + b 13 + c 13 + d 13 + e 13 + f 14 + 10 14 + 11 14 + 12 14 + 13 14 + 14 14 + 15 14 + 16 14 + 17 15 + 18 15 + 19 15 + 1a 15 + 1b 15 + 1c 16 + 1d 16 + 1e 16 + 1f 16 + 20 16 + 21 16 + 22 16 + 23 16 + 24 16 + 25 16 + 26 16 + 27 17 + 28 17 + 29 17 + 2a 17 + 2b 17 + 2c 18 + 2d 18 + 2e 18 + 2f 18 + 30 18 + 31 18 + 32 18 + 33 22 + 34 22 + 35 22 + 36 22 + 37 22 + 38 22 + 39 22 + 3a 22 + 3b 23 + } +} + +Lines mapping: +17 <-> 5 +21 <-> 9 +25 <-> 13 +27 <-> 14 +28 <-> 15 +29 <-> 16 +30 <-> 17 +31 <-> 18 +32 <-> 19 +36 <-> 23 +37 <-> 24 \ No newline at end of file diff --git a/testData/results/pkg/TestPatternMatchingLocalCapture.dec b/testData/results/pkg/TestPatternMatchingLocalCapture.dec index b67a5ce5ba..2dba1de9f2 100644 --- a/testData/results/pkg/TestPatternMatchingLocalCapture.dec +++ b/testData/results/pkg/TestPatternMatchingLocalCapture.dec @@ -20,6 +20,8 @@ class 'pkg/TestPatternMatchingLocalCapture' { 4 4 5 4 6 4 + 7 4 + 8 4 d 4 18 11 } diff --git a/testData/results/pkg/TestPatternMatchingMerge.dec b/testData/results/pkg/TestPatternMatchingMerge.dec index 26fdbf1a2e..632d600ca5 100644 --- a/testData/results/pkg/TestPatternMatchingMerge.dec +++ b/testData/results/pkg/TestPatternMatchingMerge.dec @@ -28,6 +28,8 @@ class 'pkg/TestPatternMatchingMerge' { 5 5 6 5 7 5 + 8 5 + 9 5 e 5 f 8 } @@ -40,6 +42,8 @@ class 'pkg/TestPatternMatchingMerge' { 4 12 5 12 6 12 + 7 12 + 8 12 9 13 a 13 b 13 diff --git a/testData/results/pkg/TestPatternMatchingStatic.dec b/testData/results/pkg/TestPatternMatchingStatic.dec index ca057fd2f1..f4260c21ca 100644 --- a/testData/results/pkg/TestPatternMatchingStatic.dec +++ b/testData/results/pkg/TestPatternMatchingStatic.dec @@ -18,7 +18,11 @@ class 'pkg/TestPatternMatchingStatic' { 2 4 3 4 4 4 + 5 4 + 6 4 c 5 + d 5 + e 5 f 7 } diff --git a/testData/results/pkg/TestPiDivision.dec b/testData/results/pkg/TestPiDivision.dec index 588a72f491..d6444249f5 100644 --- a/testData/results/pkg/TestPiDivision.dec +++ b/testData/results/pkg/TestPiDivision.dec @@ -96,6 +96,8 @@ class 'pkg/TestPiDivision' { 3 28 4 28 5 28 + 6 28 + 7 28 d 28 } } diff --git a/testData/results/pkg/TestPrimitives.dec b/testData/results/pkg/TestPrimitives.dec index c76fd0779e..3522e04306 100644 --- a/testData/results/pkg/TestPrimitives.dec +++ b/testData/results/pkg/TestPrimitives.dec @@ -1097,64 +1097,90 @@ class 'pkg/TestPrimitives' { 0 176 1 176 2 176 + 3 176 + 4 176 a 176 b 177 c 177 + d 177 + e 177 14 177 15 178 16 178 17 178 + 18 178 + 19 178 1f 178 20 179 21 179 22 179 23 179 + 24 179 + 25 179 2b 179 2c 180 2d 180 2e 180 2f 180 + 30 180 + 31 180 37 180 38 181 39 181 3a 181 3b 181 + 3c 181 + 3d 181 43 181 44 182 45 182 46 182 47 182 + 48 182 + 49 182 4f 182 50 183 51 183 52 183 53 183 + 54 183 + 55 183 5b 183 5c 184 5d 184 5e 184 5f 184 + 60 184 + 61 184 67 184 68 185 69 185 6a 185 6b 185 + 6c 185 + 6d 185 73 185 74 186 75 186 76 186 77 186 + 78 186 + 79 186 7f 186 80 187 81 187 82 187 83 187 + 84 187 + 85 187 8b 187 8c 188 8d 188 8e 188 8f 188 90 188 + 91 188 + 92 188 9a 188 } diff --git a/testData/results/pkg/TestRecordCanonicalConstructor.dec b/testData/results/pkg/TestRecordCanonicalConstructor.dec index 29ddefca22..64f0fe5730 100644 --- a/testData/results/pkg/TestRecordCanonicalConstructor.dec +++ b/testData/results/pkg/TestRecordCanonicalConstructor.dec @@ -15,6 +15,8 @@ class 'pkg/TestRecordCanonicalConstructor' { method ' (Ljava/lang/String;Ljava/lang/Object;)V' { 4 4 5 4 + 6 4 + 7 4 c 5 d 5 11 5 diff --git a/testData/results/pkg/TestRecordCanonicalConstructor2.dec b/testData/results/pkg/TestRecordCanonicalConstructor2.dec index d59fbf5ff6..5517e1dd92 100644 --- a/testData/results/pkg/TestRecordCanonicalConstructor2.dec +++ b/testData/results/pkg/TestRecordCanonicalConstructor2.dec @@ -34,6 +34,8 @@ class 'pkg/TestRecordCanonicalConstructor2' { 5 4 6 5 7 5 + 8 5 + 9 5 e 6 f 6 13 6 @@ -43,6 +45,8 @@ class 'pkg/TestRecordCanonicalConstructor2' { method ' (Ljava/lang/String;Ljava/lang/Object;)V' { 4 11 5 11 + 6 11 + 7 11 c 12 d 12 11 12 @@ -70,6 +74,8 @@ class 'pkg/TestRecordCanonicalConstructor2' { 8 20 9 21 a 21 + b 21 + c 21 11 22 12 22 16 22 diff --git a/testData/results/pkg/TestRecordGenericSuperclass.dec b/testData/results/pkg/TestRecordGenericSuperclass.dec index 98123d8cf0..d1ce7b7513 100644 --- a/testData/results/pkg/TestRecordGenericSuperclass.dec +++ b/testData/results/pkg/TestRecordGenericSuperclass.dec @@ -5,7 +5,7 @@ public class TestRecordGenericSuperclass { return null;// 5 } - public static record Rec(G num) { + public record Rec(G num) { public G getNum() { return this.num;// 10 } @@ -31,4 +31,4 @@ class 'pkg/TestRecordGenericSuperclass$Rec' { Lines mapping: 5 <-> 5 -10 <-> 10 +10 <-> 10 \ No newline at end of file diff --git a/testData/results/pkg/TestRecordInner.dec b/testData/results/pkg/TestRecordInner.dec index 49489b8733..0abd6ecea3 100644 --- a/testData/results/pkg/TestRecordInner.dec +++ b/testData/results/pkg/TestRecordInner.dec @@ -5,7 +5,7 @@ public class TestRecordInner { return new TestRecordInner.Rec(x);// 7 } - private static record Rec(int x) { + private record Rec(int x) { } } @@ -17,4 +17,4 @@ class 'pkg/TestRecordInner' { } Lines mapping: -7 <-> 5 +7 <-> 5 \ No newline at end of file diff --git a/testData/results/pkg/TestRecordLocal.dec b/testData/results/pkg/TestRecordLocal.dec new file mode 100644 index 0000000000..ead34e0590 --- /dev/null +++ b/testData/results/pkg/TestRecordLocal.dec @@ -0,0 +1,23 @@ +package pkg; + +import java.util.List; + +public class TestRecordLocal { + public Object test(List list) { + record Rec(TestRecordLocal a, List b) { + } + + return new Rec(this, list);// 9 + } +} + +class 'pkg/TestRecordLocal' { + method 'test (Ljava/util/List;)Ljava/lang/Object;' { + 4 9 + 5 9 + 9 9 + } +} + +Lines mapping: +9 <-> 10 diff --git a/testData/results/pkg/TestRecordPattern1.dec b/testData/results/pkg/TestRecordPattern1.dec deleted file mode 100644 index 9040dfe877..0000000000 --- a/testData/results/pkg/TestRecordPattern1.dec +++ /dev/null @@ -1,294 +0,0 @@ -package pkg; - -import java.lang.runtime.SwitchBootstraps; - -public class TestRecordPattern1 { - void test(Object o) { - if (o instanceof TestRecordPattern1.Point) { - int var4 = $proxy$a((TestRecordPattern1.Point)o);// 1 - int a = Integer.valueOf(var4);// 8 - var4 = $proxy$b((TestRecordPattern1.Point)o); - int b = Integer.valueOf(var4); - System.out.println(a + b);// 9 - } - }// 11 - - void test2(Object o) { - switch (o) {// 14 - case null: - System.out.println("null");// 16 - break; - case TestRecordPattern1.Point var8: - int obj = $proxy$a((TestRecordPattern1.Point)o); - int a = Integer.valueOf(obj);// 15 - obj = $proxy$b((TestRecordPattern1.Point)o); - int b = Integer.valueOf(obj); - System.out.println(a + b); - break; - default: - System.out.println("everything else");// 17 - } - }// 19 - - int test3(Object o) { - Object var2 = o; - byte var3 = 0; - - while (true) { - int var10000; - switch (SwitchBootstraps.typeSwitch<"typeSwitch",TestRecordPattern1.Point,TestRecordPattern1.Point,Object>(var2, var3)) { - case -1: - var10000 = -1;// 23 - break; - case 0: - int var8 = $proxy$a((TestRecordPattern1.Point)var2); - int a = Integer.valueOf(var8);// 24 - var8 = $proxy$b((TestRecordPattern1.Point)var2); - int b = Integer.valueOf(var8); - if (a <= 0 || b <= 0) { - var3 = 1; - continue; - } - - var10000 = a + b;// 26 - break; - case 1: - TestRecordPattern1.Point p = (TestRecordPattern1.Point)var2;// 27 - throw new IllegalArgumentException("Negative point not allowed"); - default: - throw new IllegalArgumentException("Only points or null allowed");// 28 - } - - return var10000;// 22 - } - } - - static record Point(int a, int b) { - } -} - -class 'pkg/TestRecordPattern1' { - method 'test (Ljava/lang/Object;)V' { - 0 6 - 1 6 - 2 6 - 3 6 - 4 6 - 7 7 - 8 7 - 9 7 - a 7 - b 7 - c 7 - d 7 - e 7 - f 7 - 10 8 - 11 8 - 12 8 - 13 8 - 14 8 - 15 8 - 16 8 - 17 8 - 18 8 - 19 9 - 1a 9 - 1b 9 - 1c 9 - 1d 9 - 1e 9 - 1f 9 - 20 9 - 21 9 - 22 10 - 23 10 - 24 10 - 25 10 - 26 10 - 27 10 - 28 10 - 29 10 - 2a 10 - 2b 11 - 2c 11 - 2d 11 - 2e 11 - 2f 11 - 30 11 - 31 11 - 34 13 - } - - method 'test2 (Ljava/lang/Object;)V' { - 0 16 - 4 16 - b 16 - 24 21 - 25 21 - 26 21 - 27 21 - 28 21 - 29 21 - 2a 21 - 2b 21 - 2c 21 - 2d 22 - 2e 22 - 2f 22 - 30 22 - 31 22 - 32 22 - 33 22 - 34 22 - 35 22 - 36 22 - 37 23 - 38 23 - 39 23 - 3a 23 - 3b 23 - 3c 23 - 3d 23 - 3e 23 - 3f 23 - 40 24 - 41 24 - 42 24 - 43 24 - 44 24 - 45 24 - 46 24 - 47 24 - 48 24 - 49 24 - 4a 25 - 4b 25 - 4c 25 - 4d 25 - 4e 25 - 4f 25 - 50 25 - 51 25 - 52 25 - 53 25 - 54 25 - 55 26 - 58 18 - 59 18 - 5a 18 - 5b 18 - 5c 18 - 5d 18 - 5e 18 - 5f 18 - 60 19 - 66 28 - 67 28 - 68 28 - 69 28 - 6a 28 - 6b 28 - 6e 30 - } - - method 'test3 (Ljava/lang/Object;)I' { - 0 33 - 1 33 - 2 34 - 3 34 - 4 38 - 5 38 - 6 38 - 7 38 - 8 38 - 9 38 - a 38 - b 38 - 24 40 - 25 41 - 28 43 - 29 43 - 2a 43 - 2b 43 - 2c 43 - 2d 43 - 2e 43 - 2f 43 - 30 43 - 31 44 - 32 44 - 33 44 - 34 44 - 35 44 - 36 44 - 37 44 - 38 44 - 39 44 - 3a 44 - 3b 45 - 3c 45 - 3d 45 - 3e 45 - 3f 45 - 40 45 - 41 45 - 42 45 - 43 45 - 44 46 - 45 46 - 46 46 - 47 46 - 48 46 - 49 46 - 4a 46 - 4b 46 - 4c 46 - 4d 46 - 4e 47 - 4f 47 - 50 47 - 53 47 - 54 47 - 55 47 - 58 48 - 59 48 - 5a 49 - 5d 52 - 5e 52 - 5f 52 - 60 52 - 61 52 - 62 53 - 65 55 - 66 55 - 67 55 - 68 55 - 69 55 - 6a 55 - 6f 56 - 70 56 - 74 56 - 7c 58 - 7d 58 - 81 58 - 82 61 - } -} - -Lines mapping: -1 <-> 8 -8 <-> 9 -9 <-> 12 -11 <-> 14 -14 <-> 17 -15 <-> 23 -16 <-> 19 -17 <-> 29 -19 <-> 31 -22 <-> 62 -23 <-> 41 -24 <-> 45 -26 <-> 53 -27 <-> 56 -28 <-> 59 diff --git a/testData/results/pkg/TestRecordPattern2.dec b/testData/results/pkg/TestRecordPattern2.dec deleted file mode 100644 index 42f2291cfe..0000000000 --- a/testData/results/pkg/TestRecordPattern2.dec +++ /dev/null @@ -1,494 +0,0 @@ -package pkg; - -import java.lang.runtime.SwitchBootstraps; - -public class TestRecordPattern2 { - void test(TestRecordPattern2.Pair p) { - if (p instanceof TestRecordPattern2.Pair && $proxy$a(p) instanceof String s && $proxy$b(p) instanceof Long l) {// 1 - System.out.println("String-Long pair of \"" + s + "\" and " + l); - } else if (p instanceof TestRecordPattern2.Pair && $proxy$a(p) instanceof Long l) {// 9 10 - Object var9 = $proxy$b(p); - System.out.println("Long-Object pair");// 11 - } else { - System.out.println("Other pair");// 13 - } - }// 15 - - void test2(TestRecordPattern2.Pair p) { - if (p instanceof TestRecordPattern2.Pair && $proxy$a(p) instanceof String s && $proxy$b(p) instanceof Long l) {// 8 18 - System.out.println("String-Long pair of \"" + s + "\" and " + l); - } else if (p instanceof TestRecordPattern2.Pair && $proxy$a(p) instanceof Long l) {// 19 20 - Object var9 = $proxy$b(p); - System.out.println("Long-Object pair");// 21 - } else { - System.out.println("Other pair");// 23 - } - - System.out.println("Unconditional");// 25 - }// 26 - - Object test3(TestRecordPattern2.Pair p) { - TestRecordPattern2.Pair var2 = p; - byte var3 = 0; - - while (true) { - Object var10000; - switch (SwitchBootstraps.typeSwitch<"typeSwitch",TestRecordPattern2.Pair,TestRecordPattern2.Pair,TestRecordPattern2.Pair,TestRecordPattern2.Pair,TestRecordPattern2.Pair>( - var2, var3 - )) { - case -1: - var10000 = -1;// 30 - break; - case 0: - if ($proxy$a(var2) instanceof Long l && $proxy$b(var2) instanceof Long r) {// 31 - var10000 = l + r; - break; - } - - var3 = 1; - continue; - case 1: - if ($proxy$a(var2) instanceof Integer l && $proxy$b(var2) instanceof Integer r) {// 32 - var10000 = (l << r) * var2.hashCode(); - break; - } - - var3 = 2; - continue; - case 2: - Object var21 = $proxy$a(var2); - if ($proxy$b(var2) instanceof Void r) {// 33 - throw new IllegalArgumentException("how"); - } - - var3 = 3; - continue; - case 3: - if ($proxy$a(var2) instanceof String l && $proxy$b(var2) instanceof String r && l.length() > 3 && r.length() > 3 && l.length() + r.length() < 23// 35 - ) - { - var10000 = l.length() + r.length();// 36 - break; - } - - var3 = 4;// 34 - continue; - case 4: - Object var17 = $proxy$a(var2); - var17 = $proxy$b(var2);// 37 - var10000 = -2; - break; - default: - throw new MatchException(null, null); - } - - return var10000;// 29 - } - } - - static record Pair(A a, B b) { - } -} - -class 'pkg/TestRecordPattern2' { - method 'test (Lpkg/TestRecordPattern2$Pair;)V' { - 0 6 - 1 6 - 2 6 - 3 6 - 4 6 - 7 6 - 8 6 - 9 6 - a 6 - f 6 - 10 6 - 11 6 - 12 6 - 1a 6 - 1b 6 - 1c 6 - 1d 6 - 1e 6 - 23 6 - 24 6 - 25 6 - 26 6 - 2e 6 - 2f 7 - 30 7 - 31 7 - 32 7 - 33 7 - 34 7 - 35 7 - 36 7 - 37 7 - 38 7 - 39 7 - 3a 7 - 3b 7 - 3f 8 - 40 8 - 41 8 - 42 8 - 43 8 - 46 8 - 47 8 - 48 8 - 49 8 - 4e 8 - 4f 8 - 50 8 - 51 8 - 59 8 - 5a 8 - 5b 9 - 5c 9 - 5d 9 - 5e 9 - 5f 9 - 60 9 - 65 10 - 66 10 - 67 10 - 68 10 - 69 10 - 6a 10 - 6b 10 - 6c 10 - 70 12 - 71 12 - 72 12 - 73 12 - 74 12 - 75 12 - 78 14 - } - - method 'test2 (Lpkg/TestRecordPattern2$Pair;)V' { - 0 17 - 1 17 - 2 17 - 3 17 - 4 17 - 7 17 - 8 17 - 9 17 - a 17 - f 17 - 10 17 - 11 17 - 12 17 - 1a 17 - 1b 17 - 1c 17 - 1d 17 - 1e 17 - 23 17 - 24 17 - 25 17 - 26 17 - 2e 17 - 2f 18 - 30 18 - 31 18 - 32 18 - 33 18 - 34 18 - 35 18 - 36 18 - 37 18 - 38 18 - 39 18 - 3a 18 - 3b 18 - 3f 19 - 40 19 - 41 19 - 42 19 - 43 19 - 46 19 - 47 19 - 48 19 - 49 19 - 4e 19 - 4f 19 - 50 19 - 51 19 - 59 19 - 5a 19 - 5b 20 - 5c 20 - 5d 20 - 5e 20 - 5f 20 - 60 20 - 65 21 - 66 21 - 67 21 - 68 21 - 69 21 - 6a 21 - 6b 21 - 6c 21 - 70 23 - 71 23 - 72 23 - 73 23 - 74 23 - 75 23 - 78 26 - 79 26 - 7a 26 - 7b 26 - 7c 26 - 7d 26 - 7e 26 - 7f 26 - 80 27 - } - - method 'test3 (Lpkg/TestRecordPattern2$Pair;)Ljava/lang/Object;' { - 0 30 - 1 30 - 2 31 - 3 31 - 4 36 - 5 36 - 6 35 - 7 35 - 8 35 - 9 35 - a 35 - b 35 - 34 81 - 35 81 - 39 81 - 3a 39 - 3b 39 - 3c 39 - 3d 39 - 3e 40 - 41 42 - 42 42 - 43 42 - 44 42 - 49 42 - 4a 42 - 4b 42 - 4c 42 - 54 42 - 55 42 - 56 42 - 57 42 - 58 42 - 59 42 - 5e 42 - 5f 42 - 60 42 - 61 42 - 69 42 - 6a 42 - 6e 43 - 6f 43 - 70 43 - 71 43 - 72 43 - 73 43 - 74 43 - 75 43 - 76 43 - 77 43 - 78 43 - 79 43 - 7a 43 - 7b 43 - 7c 43 - 7d 43 - 7e 43 - 7f 43 - 80 43 - 84 44 - 87 50 - 88 50 - 89 50 - 8a 50 - 8f 50 - 90 50 - 91 50 - 92 50 - 9a 50 - 9b 50 - 9c 50 - 9d 50 - 9e 50 - 9f 50 - a4 50 - a5 50 - a6 50 - a7 50 - af 50 - b0 50 - b1 51 - b4 51 - b5 51 - b6 51 - b7 51 - b8 51 - b9 51 - ba 51 - bb 51 - bc 51 - bd 51 - be 51 - bf 51 - c0 51 - c1 51 - c2 51 - c3 51 - c4 51 - c5 51 - c6 51 - c7 51 - c8 51 - c9 51 - ca 51 - cb 51 - cc 51 - d0 52 - d3 58 - d4 58 - d5 58 - d6 58 - d7 58 - d8 58 - dd 59 - de 59 - df 59 - e0 59 - e5 59 - e6 59 - e7 59 - e8 59 - f0 59 - f1 59 - f5 63 - f6 63 - f7 64 - fd 60 - 100 60 - 101 60 - 102 60 - 104 66 - 105 66 - 106 66 - 107 66 - 10c 66 - 10d 66 - 10e 66 - 10f 66 - 117 66 - 118 66 - 119 66 - 11a 66 - 11b 66 - 11c 66 - 121 66 - 122 66 - 123 66 - 124 66 - 12c 66 - 12d 66 - 12e 66 - 12f 66 - 130 66 - 131 66 - 132 66 - 133 66 - 134 66 - 137 66 - 138 66 - 139 66 - 13a 66 - 13b 66 - 13c 66 - 13d 66 - 140 66 - 141 66 - 142 66 - 143 66 - 144 66 - 145 66 - 146 66 - 147 66 - 148 66 - 149 66 - 14a 66 - 14b 66 - 14c 66 - 14d 66 - 150 73 - 151 73 - 152 74 - 155 69 - 156 69 - 157 69 - 158 69 - 159 69 - 15a 69 - 15b 69 - 15c 69 - 15d 69 - 15e 69 - 15f 69 - 160 69 - 161 69 - 162 69 - 163 70 - 166 76 - 167 76 - 168 76 - 169 76 - 16a 76 - 16b 76 - 170 77 - 171 77 - 172 77 - 173 77 - 174 77 - 175 77 - 17d 78 - 17e 78 - 17f 78 - 180 78 - 181 78 - 182 79 - 185 84 - } -} - -Lines mapping: -1 <-> 7 -8 <-> 18 -9 <-> 9 -10 <-> 9 -11 <-> 11 -13 <-> 13 -15 <-> 15 -18 <-> 18 -19 <-> 20 -20 <-> 20 -21 <-> 22 -23 <-> 24 -25 <-> 27 -26 <-> 28 -29 <-> 85 -30 <-> 40 -31 <-> 43 -32 <-> 51 -33 <-> 60 -34 <-> 74 -35 <-> 67 -36 <-> 70 -37 <-> 78 diff --git a/testData/results/pkg/TestRecordPattern3.dec b/testData/results/pkg/TestRecordPattern3.dec deleted file mode 100644 index 529e04b395..0000000000 --- a/testData/results/pkg/TestRecordPattern3.dec +++ /dev/null @@ -1,304 +0,0 @@ -package pkg; - -public class TestRecordPattern3 { - void test(TestRecordPattern3.Bundle bundle) { - if (bundle instanceof TestRecordPattern3.Bundle && $proxy$a(bundle) instanceof String a) {// 1 8 9 - String var21 = $proxy$b(bundle); - String var22 = $proxy$c(bundle); - int var23 = $proxy$i1(bundle); - int i1 = Integer.valueOf(var23); - int var24 = $proxy$i2(bundle); - int i2 = Integer.valueOf(var24); - int var25 = $proxy$i3(bundle); - int i3 = Integer.valueOf(var25); - int var26 = $proxy$i4(bundle); - int i4 = Integer.valueOf(var26); - long var27 = $proxy$l1(bundle); - long l1 = Long.valueOf(var27); - long var28 = $proxy$l2(bundle); - long l2 = Long.valueOf(var28); - char var29 = $proxy$c1(bundle); - char c1 = Character.valueOf(var29); - char var30 = $proxy$c2(bundle); - char c2 = Character.valueOf(var30); - byte var31 = $proxy$bb(bundle); - byte bb = Byte.valueOf(var31); - double var32 = $proxy$dd(bundle); - double dd = Double.valueOf(var32); - boolean var33 = $proxy$bool(bundle); - boolean bool = Boolean.valueOf(var33); - System.out.println(a + var21 + var22 + ((double)((long)(i1 + i2 + i3 + i4) + l1 + l2 + (long)c1 + (long)c2 + (long)bb) + dd) + bool);// 11 - } - }// 13 - - static record Bundle(A a, String b, String c, int i1, int i2, int i3, int i4, long l1, long l2, char c1, char c2, byte bb, double dd, boolean bool) { - } -} - -class 'pkg/TestRecordPattern3' { - method 'test (Lpkg/TestRecordPattern3$Bundle;)V' { - 0 4 - 1 4 - 2 4 - 3 4 - 4 4 - 7 4 - 8 4 - 9 4 - a 4 - f 4 - 10 4 - 11 4 - 12 4 - 1a 4 - 1b 5 - 1c 5 - 1d 5 - 1e 5 - 1f 5 - 20 5 - 21 29 - 22 29 - 24 6 - 25 6 - 26 6 - 27 6 - 28 6 - 29 6 - 2a 29 - 2b 29 - 2e 7 - 2f 7 - 30 7 - 31 7 - 32 7 - 33 7 - 34 8 - 35 8 - 36 8 - 37 8 - 38 8 - 39 8 - 3a 8 - 3b 8 - 3c 8 - 3d 8 - 3e 9 - 3f 9 - 40 9 - 41 9 - 42 9 - 43 9 - 44 10 - 45 10 - 46 10 - 47 10 - 48 10 - 49 10 - 4a 10 - 4b 10 - 4c 10 - 4d 10 - 4e 11 - 4f 11 - 50 11 - 51 11 - 52 11 - 53 11 - 54 12 - 55 12 - 56 12 - 57 12 - 58 12 - 59 12 - 5a 12 - 5b 12 - 5c 12 - 5d 12 - 5e 13 - 5f 13 - 60 13 - 61 13 - 62 13 - 63 13 - 64 14 - 65 14 - 66 14 - 67 14 - 68 14 - 69 14 - 6a 14 - 6b 14 - 6c 14 - 6d 14 - 6e 15 - 6f 15 - 70 15 - 71 15 - 72 15 - 73 15 - 74 16 - 75 16 - 76 16 - 77 16 - 78 16 - 79 16 - 7a 16 - 7b 16 - 7c 16 - 7d 16 - 7e 17 - 7f 17 - 80 17 - 81 17 - 82 17 - 83 17 - 84 18 - 85 18 - 86 18 - 87 18 - 88 18 - 89 18 - 8a 18 - 8b 18 - 8c 18 - 8d 18 - 8e 19 - 8f 19 - 90 19 - 91 19 - 92 19 - 93 19 - 94 20 - 95 20 - 96 20 - 97 20 - 98 20 - 99 20 - 9a 20 - 9b 20 - 9c 20 - 9d 20 - 9e 21 - 9f 21 - a0 21 - a1 21 - a2 21 - a3 21 - a4 22 - a5 22 - a6 22 - a7 22 - a8 22 - a9 22 - aa 22 - ab 22 - ac 22 - ad 22 - ae 23 - af 23 - b0 23 - b1 23 - b2 23 - b3 23 - b4 24 - b5 24 - b6 24 - b7 24 - b8 24 - b9 24 - ba 24 - bb 24 - bc 24 - bd 24 - be 25 - bf 25 - c0 25 - c1 25 - c2 25 - c3 25 - c4 26 - c5 26 - c6 26 - c7 26 - c8 26 - c9 26 - ca 26 - cb 26 - cc 26 - cd 26 - ce 27 - cf 27 - d0 27 - d1 27 - d2 27 - d3 27 - d4 28 - d5 28 - d6 28 - d7 28 - d8 28 - d9 28 - da 28 - db 28 - dc 28 - dd 28 - de 29 - df 29 - e0 29 - e1 29 - e2 29 - e3 29 - e4 29 - e5 29 - e6 29 - e7 29 - e8 29 - e9 29 - ea 29 - eb 29 - ec 29 - ed 29 - ee 29 - ef 29 - f0 29 - f1 29 - f2 29 - f3 29 - f4 29 - f5 29 - f6 29 - f7 29 - f8 29 - f9 29 - fa 29 - fb 29 - fc 29 - fd 29 - fe 29 - ff 29 - 100 29 - 101 29 - 102 29 - 103 29 - 104 29 - 105 29 - 106 29 - 107 29 - 108 29 - 109 29 - 10a 29 - 10b 29 - 10c 29 - 10d 29 - 10e 29 - 111 31 - } -} - -Lines mapping: -1 <-> 5 -8 <-> 5 -9 <-> 5 -11 <-> 30 -13 <-> 32 diff --git a/testData/results/pkg/TestRecordPattern4.dec b/testData/results/pkg/TestRecordPattern4.dec deleted file mode 100644 index b617b05ac6..0000000000 --- a/testData/results/pkg/TestRecordPattern4.dec +++ /dev/null @@ -1,478 +0,0 @@ -package pkg; - -public class TestRecordPattern4 { - void test(Object m) { - if (m instanceof TestRecordPattern4.Many - && $proxy$a((TestRecordPattern4.Many)m) instanceof String a// 1 9 - && $proxy$b((TestRecordPattern4.Many)m) instanceof String b - && $proxy$c((TestRecordPattern4.Many)m) instanceof String c - && $proxy$d((TestRecordPattern4.Many)m) instanceof String d - && $proxy$e((TestRecordPattern4.Many)m) instanceof String e - && $proxy$f((TestRecordPattern4.Many)m) instanceof String f - && $proxy$g((TestRecordPattern4.Many)m) instanceof String g - && $proxy$h((TestRecordPattern4.Many)m) instanceof String h - && $proxy$i((TestRecordPattern4.Many)m) instanceof String i) { - TestRecordPattern4.Many mm = (TestRecordPattern4.Many)m; - System.out.println(a + b + c + d + e + f + g + h + i + mm.hashCode());// 11 - } - }// 13 - - void test2(Object m) { - if (m instanceof TestRecordPattern4.Many) { - Object var21 = $proxy$a((TestRecordPattern4.Many)m);// 8 - if ($proxy$b((TestRecordPattern4.Many)m) instanceof String b) { - var21 = $proxy$c((TestRecordPattern4.Many)m); - var21 = $proxy$d((TestRecordPattern4.Many)m); - if ($proxy$e((TestRecordPattern4.Many)m) instanceof String e) { - var21 = $proxy$f((TestRecordPattern4.Many)m); - var21 = $proxy$g((TestRecordPattern4.Many)m); - if ($proxy$h((TestRecordPattern4.Many)m) instanceof String h) { - var21 = $proxy$i((TestRecordPattern4.Many)m); - if (var21 instanceof TestRecordPattern4.Many) { - Object var22 = $proxy$a((TestRecordPattern4.Many)var21); - var22 = $proxy$b((TestRecordPattern4.Many)var21);// 18 - var22 = $proxy$c((TestRecordPattern4.Many)var21); - var22 = $proxy$d((TestRecordPattern4.Many)var21); - var22 = $proxy$e((TestRecordPattern4.Many)var21); - var22 = $proxy$f((TestRecordPattern4.Many)var21); - var22 = $proxy$g((TestRecordPattern4.Many)var21); - if ($proxy$h((TestRecordPattern4.Many)var21) instanceof String h2 - && $proxy$i((TestRecordPattern4.Many)var21) instanceof TestRecordPattern4.Many i2) { - TestRecordPattern4.Many i = (TestRecordPattern4.Many)var21;// 17 - TestRecordPattern4.Many mm = (TestRecordPattern4.Many)m;// 16 - System.out.println(b + var21 + e + h + h2 + i2 + i.hashCode() + mm.hashCode());// 20 - } - } - } - } - } - } - }// 22 - - static record Many(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i) { - } -} - -class 'pkg/TestRecordPattern4' { - method 'test (Ljava/lang/Object;)V' { - 0 4 - 1 4 - 2 4 - 3 4 - 4 4 - 7 5 - 8 5 - 9 5 - a 5 - b 5 - c 5 - d 5 - 12 5 - 13 5 - 14 5 - 15 5 - 1d 5 - 1e 6 - 1f 6 - 20 6 - 21 6 - 22 6 - 23 6 - 24 6 - 29 6 - 2a 6 - 2b 6 - 2c 6 - 34 6 - 35 7 - 36 7 - 37 7 - 38 7 - 39 7 - 3a 7 - 3b 7 - 40 7 - 41 7 - 42 7 - 43 7 - 4b 7 - 4c 7 - 4d 8 - 4e 8 - 4f 8 - 50 8 - 51 8 - 52 8 - 53 8 - 58 8 - 59 8 - 5a 8 - 5b 8 - 63 8 - 64 8 - 65 9 - 66 9 - 67 9 - 68 9 - 69 9 - 6a 9 - 6b 9 - 70 9 - 71 9 - 72 9 - 73 9 - 7b 9 - 7c 9 - 7d 10 - 7e 10 - 7f 10 - 80 10 - 81 10 - 82 10 - 83 10 - 88 10 - 89 10 - 8a 10 - 8b 10 - 93 10 - 94 10 - 95 11 - 96 11 - 97 11 - 98 11 - 99 11 - 9a 11 - 9b 11 - a0 11 - a1 11 - a2 11 - a3 11 - ab 11 - ac 11 - ad 12 - ae 12 - af 12 - b0 12 - b1 12 - b2 12 - b3 12 - b8 12 - b9 12 - ba 12 - bb 12 - c3 12 - c4 12 - c5 13 - c6 13 - c7 13 - c8 13 - c9 13 - ca 13 - cb 13 - d0 13 - d1 13 - d2 13 - d3 13 - db 13 - dc 13 - dd 14 - de 14 - df 14 - e0 14 - e1 14 - e2 14 - e3 15 - e4 15 - e5 15 - e6 15 - e7 15 - e8 15 - e9 15 - ea 15 - eb 15 - ec 15 - ed 15 - ee 15 - ef 15 - f0 15 - f1 15 - f2 15 - f3 15 - f4 15 - f5 15 - f6 15 - f7 15 - f8 15 - f9 15 - fa 15 - fb 15 - fc 15 - fd 15 - fe 15 - ff 15 - 100 15 - 103 17 - } - - method 'test2 (Ljava/lang/Object;)V' { - 0 20 - 1 20 - 2 20 - 3 20 - 4 20 - 7 21 - 8 21 - 9 21 - a 21 - b 21 - c 21 - d 21 - e 21 - f 21 - 13 22 - 14 22 - 15 22 - 16 22 - 17 22 - 18 22 - 19 22 - 1e 22 - 1f 22 - 20 22 - 21 22 - 29 22 - 2a 23 - 2b 23 - 2c 23 - 2d 23 - 2e 23 - 2f 23 - 30 23 - 31 23 - 32 23 - 33 42 - 34 42 - 37 24 - 38 24 - 39 24 - 3a 24 - 3b 24 - 3c 24 - 3d 24 - 3e 24 - 3f 24 - 44 25 - 45 25 - 46 25 - 47 25 - 48 25 - 49 25 - 4a 25 - 4f 25 - 50 25 - 51 25 - 52 25 - 5a 25 - 5b 25 - 5c 26 - 5d 26 - 5e 26 - 5f 26 - 60 26 - 61 26 - 62 26 - 63 26 - 64 26 - 69 27 - 6a 27 - 6b 27 - 6c 27 - 6d 27 - 6e 27 - 6f 27 - 70 27 - 71 27 - 76 28 - 77 28 - 78 28 - 79 28 - 7a 28 - 7b 28 - 7c 28 - 81 28 - 82 28 - 83 28 - 84 28 - 8c 28 - 8d 28 - 8e 29 - 8f 29 - 90 29 - 91 29 - 92 29 - 93 29 - 94 29 - 95 29 - 96 29 - 97 30 - 98 30 - 99 30 - 9a 30 - 9b 30 - 9c 30 - 9f 31 - a0 31 - a1 31 - a2 31 - a3 31 - a4 31 - a5 31 - a6 31 - a7 31 - a8 31 - ad 32 - ae 32 - af 32 - b0 32 - b1 32 - b2 32 - b3 32 - b4 32 - b5 32 - b6 32 - bb 33 - bc 33 - bd 33 - be 33 - bf 33 - c0 33 - c1 33 - c2 33 - c3 33 - c4 33 - c9 34 - ca 34 - cb 34 - cc 34 - cd 34 - ce 34 - cf 34 - d0 34 - d1 34 - d2 34 - d7 35 - d8 35 - d9 35 - da 35 - db 35 - dc 35 - dd 35 - de 35 - df 35 - e0 35 - e5 36 - e6 36 - e7 36 - e8 36 - e9 36 - ea 36 - eb 36 - ec 36 - ed 36 - ee 36 - f3 37 - f4 37 - f5 37 - f6 37 - f7 37 - f8 37 - f9 37 - fa 37 - fb 37 - fc 37 - 101 38 - 102 38 - 103 38 - 104 38 - 105 38 - 106 38 - 107 38 - 108 38 - 10d 38 - 10e 38 - 10f 38 - 110 38 - 118 38 - 119 38 - 11a 39 - 11b 39 - 11c 39 - 11d 39 - 11e 39 - 11f 39 - 120 39 - 121 39 - 126 39 - 127 39 - 128 39 - 129 39 - 131 39 - 132 39 - 133 40 - 134 40 - 135 40 - 136 40 - 137 40 - 138 40 - 139 40 - 13a 41 - 13b 41 - 13c 41 - 13d 41 - 13e 41 - 13f 41 - 140 42 - 141 42 - 142 42 - 143 42 - 144 42 - 145 42 - 149 42 - 14a 42 - 14b 42 - 14c 42 - 14d 42 - 14e 42 - 14f 42 - 150 42 - 154 42 - 155 42 - 156 42 - 157 42 - 158 42 - 159 42 - 15a 42 - 15b 42 - 15c 42 - 15d 42 - 15e 42 - 15f 42 - 160 42 - 161 42 - 162 42 - 163 42 - 166 49 - } -} - -Lines mapping: -1 <-> 6 -8 <-> 22 -9 <-> 6 -11 <-> 16 -13 <-> 18 -16 <-> 42 -17 <-> 41 -18 <-> 33 -20 <-> 43 -22 <-> 50 diff --git a/testData/results/pkg/TestRecordPatterns1.dec b/testData/results/pkg/TestRecordPatterns1.dec index 8e804c25a7..94bb5b0009 100644 --- a/testData/results/pkg/TestRecordPatterns1.dec +++ b/testData/results/pkg/TestRecordPatterns1.dec @@ -1,360 +1,196 @@ package pkg; public class TestRecordPatterns1 { - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test1(TestRecordPatterns1.R r) { - if (r instanceof TestRecordPatterns1.R) { - TestRecordPatterns1.R var10000 = r; - - int var5; - label29: { - label34: { - try { - var10 = var10000.i(); - } catch (Throwable var7) { - var9 = var7; - boolean var10001 = false; - break label34; - } - - var5 = var10; - var10000 = r; - - try { - var12 = var10000.o(); - break label29; - } catch (Throwable var6) { - var9 = var6; - boolean var13 = false; - } - } - - Throwable var2 = var9;// 7 - throw new MatchException(var2.toString(), var2); - } - - Object var8 = var12; + if (r instanceof TestRecordPatterns1.R(int var5, Object var8)) {// 7 System.out.println(var5);// 8 System.out.println(var8);// 9 } }// 11 - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test2(TestRecordPatterns1.R r) { - if (r instanceof TestRecordPatterns1.R) { - TestRecordPatterns1.R var10000 = r; - - int var5; - label31: { - label36: { - try { - var10 = var10000.i(); - } catch (Throwable var7) { - var9 = var7; - boolean var10001 = false; - break label36; - } - - var5 = var10; - var10000 = r; - - try { - var12 = var10000.o(); - break label31; - } catch (Throwable var6) { - var9 = var6; - boolean var13 = false; - } - } - - Throwable var2 = var9;// 14 - throw new MatchException(var2.toString(), var2); - } - - if (var12 instanceof String s) { - System.out.println(var5);// 15 - System.out.println(s);// 16 - } + if (r instanceof TestRecordPatterns1.R(int var5, String s)) {// 14 + System.out.println(var5);// 15 + System.out.println(s);// 16 } }// 18 - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test3(TestRecordPatterns1.R r) { - if (r instanceof TestRecordPatterns1.R) { - TestRecordPatterns1.R var10000 = r; - - int var5; - label33: { - label38: { - try { - var10 = var10000.i(); - } catch (Throwable var7) { - var9 = var7; - boolean var10001 = false; - break label38; - } - - var5 = var10; - var10000 = r; - - try { - var12 = var10000.o(); - break label33; - } catch (Throwable var6) { - var9 = var6; - boolean var13 = false; - } - } - - Throwable var2 = var9;// 21 - throw new MatchException(var2.toString(), var2); - } - - if (var12 instanceof String s && s.length() > 10) { - System.out.println(var5);// 22 - System.out.println(s);// 23 - } + if (r instanceof TestRecordPatterns1.R(int var5, String s) && s.length() > 10) {// 21 + System.out.println(var5);// 22 + System.out.println(s);// 23 } }// 25 - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test4(TestRecordPatterns1.R r) { - if (r instanceof TestRecordPatterns1.R) { - TestRecordPatterns1.R var10000 = r; - - int var5; - label29: { - label34: { - try { - var10 = var10000.i(); - } catch (Throwable var7) { - var9 = var7; - boolean var10001 = false; - break label34; - } - - var5 = var10; - var10000 = r; - - try { - var12 = var10000.o(); - break label29; - } catch (Throwable var6) { - var9 = var6; - boolean var13 = false; - } - } - - Throwable var2 = var9;// 28 - throw new MatchException(var2.toString(), var2); - } - - Object var8 = var12; + if (r instanceof TestRecordPatterns1.R(int var5, Object var8)) {// 28 System.out.println(var5);// 29 System.out.println(var8);// 30 } }// 32 - static record R(int i, Object o) { + record R(int i, Object o) { } } class 'pkg/TestRecordPatterns1' { method 'test1 (Lpkg/TestRecordPatterns1$R;)V' { - 0 5 - 1 5 - 2 5 - 3 5 - 4 5 - 7 6 - 9 6 - a 12 - d 19 - e 19 - f 36 - 10 36 - 12 20 - 13 23 - 16 35 - 17 35 - 18 37 - 19 37 - 1c 36 - 1d 36 - 1e 36 - 1f 36 - 20 36 - 21 36 - 22 36 - 23 37 - 24 37 - 25 37 - 26 37 - 27 37 - 28 37 - 2e 31 - 33 32 - 34 32 - 35 32 - 36 32 - 37 32 - 3b 32 - 3c 39 + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + d 4 + e 4 + f 5 + 10 5 + 16 4 + 17 4 + 18 6 + 19 6 + 1c 5 + 1d 5 + 1e 5 + 1f 5 + 20 5 + 21 5 + 22 5 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 3c 8 } method 'test2 (Lpkg/TestRecordPatterns1$R;)V' { - 0 43 - 1 43 - 2 43 - 3 43 - 4 43 - 7 44 - 9 44 - a 50 - d 57 - e 57 - f 74 - 10 74 - 12 58 - 13 61 - 1a 73 - 1b 73 - 1c 73 - 1d 73 - 25 73 - 26 73 - 27 74 - 28 74 - 29 74 - 2a 74 - 2b 74 - 2c 74 - 2d 74 - 2e 75 - 2f 75 - 30 75 - 31 75 - 32 75 - 33 75 - 39 69 - 3e 70 - 3f 70 - 40 70 - 41 70 - 42 70 - 46 70 - 47 78 + 0 11 + 1 11 + 2 11 + 3 11 + 4 11 + 5 11 + 6 11 + d 11 + e 11 + f 12 + 10 12 + 25 11 + 26 11 + 27 12 + 28 12 + 29 12 + 2a 12 + 2b 12 + 2c 12 + 2d 12 + 2e 13 + 2f 13 + 30 13 + 31 13 + 32 13 + 33 13 + 34 13 + 35 13 + 47 15 } method 'test3 (Lpkg/TestRecordPatterns1$R;)V' { - 0 82 - 1 82 - 2 82 - 3 82 - 4 82 - 7 83 - 9 83 - a 89 - d 96 - e 96 - f 113 - 10 113 - 12 97 - 13 100 - 1a 112 - 1b 112 - 1c 112 - 1d 112 - 25 112 - 26 112 - 27 112 - 28 112 - 29 112 - 2a 112 - 2b 112 - 2c 112 - 2d 112 - 2e 112 - 31 113 - 32 113 - 33 113 - 34 113 - 35 113 - 36 113 - 37 113 - 38 114 - 39 114 - 3a 114 - 3b 114 - 3c 114 - 3d 114 - 43 108 - 48 109 - 49 109 - 4a 109 - 4b 109 - 4c 109 - 50 109 - 51 117 + 0 18 + 1 18 + 2 18 + 3 18 + 4 18 + 5 18 + 6 18 + d 18 + e 18 + f 19 + 10 19 + 25 18 + 26 18 + 27 18 + 28 18 + 29 18 + 2a 18 + 2b 18 + 2c 18 + 2d 18 + 2e 18 + 2f 18 + 30 18 + 31 19 + 32 19 + 33 19 + 34 19 + 35 19 + 36 19 + 37 19 + 38 20 + 39 20 + 3a 20 + 3b 20 + 3c 20 + 3d 20 + 3e 20 + 3f 20 + 51 22 } method 'test4 (Lpkg/TestRecordPatterns1$R;)V' { - 0 121 - 1 121 - 2 121 - 3 121 - 4 121 - 7 122 - 9 122 - a 128 - d 135 - e 135 - f 152 - 10 152 - 12 136 - 13 139 - 16 151 - 17 151 - 18 153 - 19 153 - 1c 152 - 1d 152 - 1e 152 - 1f 152 - 20 152 - 21 152 - 22 152 - 23 153 - 24 153 - 25 153 - 26 153 - 27 153 - 28 153 - 2e 147 - 33 148 - 34 148 - 35 148 - 36 148 - 37 148 - 3b 148 - 3c 155 + 0 25 + 1 25 + 2 25 + 3 25 + 4 25 + 5 25 + 6 25 + d 25 + e 25 + f 26 + 10 26 + 16 25 + 17 25 + 18 27 + 19 27 + 1c 26 + 1d 26 + 1e 26 + 1f 26 + 20 26 + 21 26 + 22 26 + 23 27 + 24 27 + 25 27 + 26 27 + 27 27 + 28 27 + 29 27 + 2a 27 + 3c 29 } } Lines mapping: -7 <-> 32 -8 <-> 37 -9 <-> 38 -11 <-> 40 -14 <-> 70 -15 <-> 75 -16 <-> 76 -18 <-> 79 -21 <-> 109 -22 <-> 114 -23 <-> 115 -25 <-> 118 -28 <-> 148 -29 <-> 153 -30 <-> 154 -32 <-> 156 \ No newline at end of file +7 <-> 5 +8 <-> 6 +9 <-> 7 +11 <-> 9 +14 <-> 12 +15 <-> 13 +16 <-> 14 +18 <-> 16 +21 <-> 19 +22 <-> 20 +23 <-> 21 +25 <-> 23 +28 <-> 26 +29 <-> 27 +30 <-> 28 +32 <-> 30 diff --git a/testData/results/pkg/TestRecordPatterns2.dec b/testData/results/pkg/TestRecordPatterns2.dec index cba11be4ce..262026f934 100644 --- a/testData/results/pkg/TestRecordPatterns2.dec +++ b/testData/results/pkg/TestRecordPatterns2.dec @@ -2,21 +2,12 @@ package pkg; public class TestRecordPatterns2 { public void test1(TestRecordPatterns2.R r) { - if (r instanceof TestRecordPatterns2.R) { - TestRecordPatterns2.R var10000 = r; - - try { - var6 = var10000.x(); - } catch (Throwable var5) {// 9 - throw new MatchException(var5.toString(), var5); - } - - int var4 = var6; + if (r instanceof TestRecordPatterns2.R(int var4)) {// 9 System.out.println(var4);// 10 } }// 12 - static record R(int x) { + record R(int x) { } } @@ -27,30 +18,24 @@ class 'pkg/TestRecordPatterns2' { 2 4 3 4 4 4 - 7 5 - 9 5 - a 8 - d 13 - e 13 - f 14 - 10 14 - 12 14 - 13 14 - 14 14 - 15 14 - 16 14 - 1c 9 - 21 10 - 22 10 - 23 10 - 24 10 - 25 10 - 29 10 - 2a 16 + 5 4 + 6 4 + d 4 + e 4 + f 5 + 10 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 2a 7 } } Lines mapping: -9 <-> 10 -10 <-> 15 -12 <-> 17 +9 <-> 5 +10 <-> 6 +12 <-> 8 diff --git a/testData/results/pkg/TestRecordPatterns3.dec b/testData/results/pkg/TestRecordPatterns3.dec new file mode 100644 index 0000000000..a19c98db2f --- /dev/null +++ b/testData/results/pkg/TestRecordPatterns3.dec @@ -0,0 +1,175 @@ +package pkg; + +public class TestRecordPatterns3 { + public void test1(TestRecordPatterns3.R r) { + if (r instanceof TestRecordPatterns3.R) {// 9 + System.out.println(r);// 10 + } + }// 12 + + public void test2(TestRecordPatterns3.R r) { + if (r instanceof TestRecordPatterns3.R) {// 15 + System.out.println(r);// 16 + } + }// 18 + + public void test3(TestRecordPatterns3.R r) { + if (r instanceof TestRecordPatterns3.R) {// 21 + System.out.println(r);// 22 + } + }// 24 + + public void test4(Object r) { + if (r instanceof TestRecordPatterns3.R var2) {// 27 + System.out.println(r);// 28 + } + }// 30 + + public void test5(Object r) { + if (r instanceof TestRecordPatterns3.R) {// 33 + System.out.println(r);// 34 + } + }// 36 + + public void test6(Object r) { + if (r instanceof TestRecordPatterns3.R x) {// 39 + System.out.println(x);// 40 + } + }// 42 + + record R() { + } +} + +class 'pkg/TestRecordPatterns3' { + method 'test1 (Lpkg/TestRecordPatterns3$R;)V' { + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 7 + } + + method 'test2 (Lpkg/TestRecordPatterns3$R;)V' { + 0 10 + 1 10 + 2 10 + 3 10 + 4 10 + 5 10 + 6 10 + 7 11 + 8 11 + 9 11 + a 11 + b 11 + c 11 + d 11 + e 13 + } + + method 'test3 (Lpkg/TestRecordPatterns3$R;)V' { + 0 16 + 1 16 + 2 16 + 3 16 + 4 16 + 5 16 + 6 16 + 7 17 + 9 17 + a 17 + b 17 + c 17 + d 17 + e 17 + f 17 + 10 19 + } + + method 'test4 (Ljava/lang/Object;)V' { + 0 22 + 1 22 + 2 22 + 3 22 + 4 22 + 5 22 + 6 22 + b 22 + c 23 + d 23 + e 23 + f 23 + 10 23 + 11 23 + 12 23 + 13 25 + } + + method 'test5 (Ljava/lang/Object;)V' { + 0 28 + 1 28 + 2 28 + 3 28 + 4 28 + 5 28 + 6 28 + 7 29 + 8 29 + 9 29 + a 29 + b 29 + c 29 + d 29 + e 31 + } + + method 'test6 (Ljava/lang/Object;)V' { + 0 34 + 1 34 + 2 34 + 3 34 + 4 34 + 5 34 + 6 34 + b 34 + c 35 + d 35 + e 35 + f 35 + 10 35 + 11 35 + 12 35 + 13 37 + } +} + +Lines mapping: +9 <-> 5 +10 <-> 6 +12 <-> 8 +15 <-> 11 +16 <-> 12 +18 <-> 14 +21 <-> 17 +22 <-> 18 +24 <-> 20 +27 <-> 23 +28 <-> 24 +30 <-> 26 +33 <-> 29 +34 <-> 30 +36 <-> 32 +39 <-> 35 +40 <-> 36 +42 <-> 38 diff --git a/testData/results/pkg/TestRecordPatterns4.dec b/testData/results/pkg/TestRecordPatterns4.dec new file mode 100644 index 0000000000..7e77f2cae3 --- /dev/null +++ b/testData/results/pkg/TestRecordPatterns4.dec @@ -0,0 +1,158 @@ +package pkg; + +public class TestRecordPatterns4 { + public void test1(TestRecordPatterns4.R r) { + if (r instanceof TestRecordPatterns4.R(Number x, String s)) {// 7 + System.out.println(x);// 8 + System.out.println(s);// 9 + } + }// 11 + + public void test2(TestRecordPatterns4.R r) { + if (r instanceof TestRecordPatterns4.R(Number x, String s) && s.length() > 10) {// 14 + System.out.println(x);// 15 + System.out.println(s);// 16 + } + }// 18 + + public void test3(TestRecordPatterns4.R r) { + if (r instanceof TestRecordPatterns4.R(Number x, String s) && s.length() > 10 && x.intValue() == 3) {// 21 + System.out.println(x);// 22 + System.out.println(s);// 23 + } + }// 25 + + record R(Object a, Object b) { + } +} + +class 'pkg/TestRecordPatterns4' { + method 'test1 (Lpkg/TestRecordPatterns4$R;)V' { + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 1c 4 + 30 4 + 31 4 + 32 5 + 33 5 + 34 5 + 35 5 + 36 5 + 37 5 + 38 5 + 39 6 + 3a 6 + 3b 6 + 3c 6 + 3d 6 + 3e 6 + 3f 6 + 40 6 + 52 8 + } + + method 'test2 (Lpkg/TestRecordPatterns4$R;)V' { + 0 11 + 1 11 + 2 11 + 3 11 + 4 11 + 5 11 + 6 11 + 1c 11 + 30 11 + 31 11 + 32 11 + 33 11 + 34 11 + 35 11 + 36 11 + 37 11 + 38 11 + 39 11 + 3a 11 + 3b 11 + 3c 12 + 3d 12 + 3e 12 + 3f 12 + 40 12 + 41 12 + 42 12 + 43 13 + 44 13 + 45 13 + 46 13 + 47 13 + 48 13 + 49 13 + 4a 13 + 5c 15 + } + + method 'test3 (Lpkg/TestRecordPatterns4$R;)V' { + 0 18 + 1 18 + 2 18 + 3 18 + 4 18 + 5 18 + 6 18 + 1c 18 + 30 18 + 31 18 + 32 18 + 33 18 + 34 18 + 35 18 + 36 18 + 37 18 + 38 18 + 39 18 + 3a 18 + 3b 18 + 3c 18 + 3d 18 + 3e 18 + 3f 18 + 40 18 + 41 18 + 42 18 + 43 18 + 44 19 + 45 19 + 46 19 + 47 19 + 48 19 + 49 19 + 4a 19 + 4b 20 + 4c 20 + 4d 20 + 4e 20 + 4f 20 + 50 20 + 51 20 + 52 20 + 64 22 + } +} + +Lines mapping: +7 <-> 5 +8 <-> 6 +9 <-> 7 +11 <-> 9 +14 <-> 12 +15 <-> 13 +16 <-> 14 +18 <-> 16 +21 <-> 19 +22 <-> 20 +23 <-> 21 +25 <-> 23 diff --git a/testData/results/pkg/TestRecordPatterns5.dec b/testData/results/pkg/TestRecordPatterns5.dec new file mode 100644 index 0000000000..f43ea9049e --- /dev/null +++ b/testData/results/pkg/TestRecordPatterns5.dec @@ -0,0 +1,170 @@ +package pkg; + +public class TestRecordPatterns5 { + public void test1(TestRecordPatterns5.R r) { + if (r instanceof TestRecordPatterns5.R(Integer x, String var8)) {// 7 + System.out.println(x);// 8 + System.out.println(var8);// 9 + } + }// 11 + + public void test2(TestRecordPatterns5.R r) { + if (r instanceof TestRecordPatterns5.R(Integer x, String var11)) {// 14 + String var8 = var11; + if (var8.length() > 10) { + System.out.println(x);// 15 + System.out.println(var8);// 16 + } + } + }// 18 + + public void test3(TestRecordPatterns5.R r) { + if (r instanceof TestRecordPatterns5.R(Integer x, String var11)) {// 21 + String var8 = var11; + if (var8.length() > 10 && x == 3) { + System.out.println(x);// 22 + System.out.println(var8);// 23 + } + } + }// 25 + + record R(Number a, String b) { + } +} + +class 'pkg/TestRecordPatterns5' { + method 'test1 (Lpkg/TestRecordPatterns5$R;)V' { + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 1c 4 + 21 4 + 22 4 + 23 6 + 24 6 + 27 5 + 28 5 + 29 5 + 2a 5 + 2b 5 + 2c 5 + 2d 5 + 2e 6 + 2f 6 + 30 6 + 31 6 + 32 6 + 33 6 + 34 6 + 35 6 + 47 8 + } + + method 'test2 (Lpkg/TestRecordPatterns5$R;)V' { + 0 11 + 1 11 + 2 11 + 3 11 + 4 11 + 5 11 + 6 11 + 1c 11 + 21 12 + 22 12 + 23 13 + 24 13 + 27 13 + 28 13 + 29 13 + 2a 13 + 2b 13 + 2c 13 + 2d 13 + 2e 13 + 2f 13 + 30 13 + 31 14 + 32 14 + 33 14 + 34 14 + 35 14 + 36 14 + 37 14 + 38 15 + 39 15 + 3a 15 + 3b 15 + 3c 15 + 3d 15 + 3e 15 + 3f 15 + 51 18 + } + + method 'test3 (Lpkg/TestRecordPatterns5$R;)V' { + 0 21 + 1 21 + 2 21 + 3 21 + 4 21 + 5 21 + 6 21 + 1c 21 + 21 22 + 22 22 + 23 23 + 24 23 + 27 23 + 28 23 + 29 23 + 2a 23 + 2b 23 + 2c 23 + 2d 23 + 2e 23 + 2f 23 + 30 23 + 31 23 + 32 23 + 33 23 + 34 23 + 35 23 + 36 23 + 37 23 + 38 23 + 39 24 + 3a 24 + 3b 24 + 3c 24 + 3d 24 + 3e 24 + 3f 24 + 40 25 + 41 25 + 42 25 + 43 25 + 44 25 + 45 25 + 46 25 + 47 25 + 59 28 + } +} + +Lines mapping: +7 <-> 5 +8 <-> 6 +9 <-> 7 +11 <-> 9 +14 <-> 12 +15 <-> 15 +16 <-> 16 +18 <-> 19 +21 <-> 22 +22 <-> 25 +23 <-> 26 +25 <-> 29 diff --git a/testData/results/pkg/TestRecordPatterns6.dec b/testData/results/pkg/TestRecordPatterns6.dec new file mode 100644 index 0000000000..4447f14220 --- /dev/null +++ b/testData/results/pkg/TestRecordPatterns6.dec @@ -0,0 +1,155 @@ +package pkg; + +import java.util.Objects; + +public class TestRecordPatterns6 { + public Object test1(TestRecordPatterns6.I in) { + return switch (in) {// 11 + case TestRecordPatterns6.I.R1(Object var14) -> var14;// 12 + case TestRecordPatterns6.I.R2(int var15) -> var15;// 13 + case TestRecordPatterns6.I.R3(String var10) -> var10;// 14 + default -> throw new MatchException(null, null); + }; + } + + public String test2(TestRecordPatterns6.I in) { + Objects.requireNonNull(in); + + while (true) { + return (String)(switch (in) {// 19 + case TestRecordPatterns6.I.R1(String s) -> s;// 20 + case TestRecordPatterns6.I.R3(String var8) -> var8;// 21 + default -> throw new IllegalStateException();// 22 + }); + } + } + + sealed interface I permits TestRecordPatterns6.I.R1, TestRecordPatterns6.I.R2, TestRecordPatterns6.I.R3 { + public record R1(Object o) implements TestRecordPatterns6.I { + } + + public record R2(int i) implements TestRecordPatterns6.I { + } + + public record R3(String s) implements TestRecordPatterns6.I { + } + } +} + +class 'pkg/TestRecordPatterns6' { + method 'test1 (Lpkg/TestRecordPatterns6$I;)Ljava/lang/Object;' { + 0 6 + 9 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 30 10 + 31 10 + 35 10 + 41 7 + 42 7 + 43 7 + 44 7 + 47 7 + 48 7 + 57 8 + 58 8 + 59 8 + 5a 8 + 5d 8 + 5e 8 + 5f 8 + 60 8 + 61 8 + 70 9 + 71 9 + 72 9 + 73 9 + 76 9 + 77 9 + 78 6 + } + + method 'test2 (Lpkg/TestRecordPatterns6$I;)Ljava/lang/String;' { + 0 15 + 2 15 + 3 15 + 4 15 + 9 18 + 10 18 + 11 18 + 12 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 19 18 + 1a 18 + 1b 18 + 1c 18 + 1d 18 + 1e 18 + 1f 18 + 20 18 + 21 18 + 22 18 + 23 18 + 24 18 + 25 18 + 26 18 + 27 18 + 28 18 + 29 18 + 2a 18 + 2b 18 + 46 19 + 47 19 + 48 19 + 49 19 + 60 20 + 61 20 + 62 20 + 63 20 + 66 20 + 67 20 + 72 21 + 73 18 + } +} + +Lines mapping: +11 <-> 7 +12 <-> 8 +13 <-> 9 +14 <-> 10 +19 <-> 19 +20 <-> 20 +21 <-> 21 +22 <-> 22 diff --git a/testData/results/pkg/TestRecordPatterns7.dec b/testData/results/pkg/TestRecordPatterns7.dec new file mode 100644 index 0000000000..896fead84f --- /dev/null +++ b/testData/results/pkg/TestRecordPatterns7.dec @@ -0,0 +1,179 @@ +package pkg; + +import java.util.Objects; + +public class TestRecordPatterns7 { + public void test(Object o) { + if (o instanceof TestRecordPatterns7.A(TestRecordPatterns7.C(TestRecordPatterns7.B(int var26, int var27), int var25), int var22, TestRecordPatterns7.B(int var28, int var29))// 5 + ) + { + System.out.println(var26 + var27 + var25 + var22 + var28 + var29);// 6 + } + }// 8 + + public void test2(Object o) { + Objects.requireNonNull(o); + + System.out + .println(// 11 + switch (o) { + case TestRecordPatterns7.A(TestRecordPatterns7.C(TestRecordPatterns7.B(int var28, int var29), int var27), int var24, TestRecordPatterns7.B(int var30, int var31)) -> var28// 12 + + var29 + + var27 + + var24 + + var30 + + var31; + default -> 0;// 13 + } + ); + } + + record A(TestRecordPatterns7.C c, int i, TestRecordPatterns7.B b2) { + } + + record B(int i1, int i2) { + } + + record C(TestRecordPatterns7.B b, int i) { + } +} + +class 'pkg/TestRecordPatterns7' { + method 'test (Ljava/lang/Object;)V' { + 0 6 + 1 6 + 2 6 + 3 6 + 4 6 + 5 6 + 6 6 + 21 6 + 22 6 + 23 9 + 24 9 + 4f 6 + 50 6 + 51 9 + 52 9 + 5a 6 + 5b 6 + 5c 9 + 5d 9 + 65 6 + 66 6 + 67 9 + 68 9 + 70 6 + 71 6 + 72 9 + 73 9 + 7b 6 + 7c 6 + 7d 9 + 7e 9 + 81 9 + 82 9 + 83 9 + 84 9 + 85 9 + 86 9 + 87 9 + 88 9 + 89 9 + 8a 9 + 8b 9 + 8c 9 + 8d 9 + 8e 9 + 8f 9 + 90 9 + 91 9 + 92 9 + 93 9 + 94 9 + 95 9 + 96 9 + 97 9 + a9 11 + } + + method 'test2 (Ljava/lang/Object;)V' { + 0 16 + 1 16 + 2 16 + 3 14 + 5 14 + 6 14 + 7 14 + c 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 19 18 + 1a 18 + 1b 18 + 1c 18 + 1d 18 + 1e 18 + 1f 18 + 20 18 + 21 18 + 22 18 + 23 18 + 42 19 + 43 19 + 44 22 + 45 22 + 73 19 + 74 19 + 75 21 + 76 21 + 7e 19 + 7f 19 + 80 19 + 81 19 + 89 19 + 8a 19 + 8b 20 + 8c 20 + 94 19 + 95 19 + 96 23 + 97 23 + 9f 19 + a0 19 + a1 24 + a2 24 + a5 19 + a6 19 + ad 20 + ae 20 + af 19 + b1 21 + b2 19 + b4 22 + b5 19 + b7 23 + b8 19 + ba 24 + bb 19 + c1 25 + c5 17 + c6 17 + c7 17 + c8 28 + } +} + +Lines mapping: +5 <-> 7 +6 <-> 10 +8 <-> 12 +11 <-> 18 +12 <-> 20 +13 <-> 26 +Not mapped: +15 diff --git a/testData/results/pkg/TestReturnIf.dec b/testData/results/pkg/TestReturnIf.dec index 6de31e35f2..7dfdb8541f 100644 --- a/testData/results/pkg/TestReturnIf.dec +++ b/testData/results/pkg/TestReturnIf.dec @@ -31,6 +31,8 @@ class 'pkg/TestReturnIf' { 0 4 1 4 2 4 + 3 4 + 4 4 a 4 } @@ -38,6 +40,8 @@ class 'pkg/TestReturnIf' { 0 8 1 8 2 8 + 3 8 + 4 8 a 8 } @@ -45,6 +49,8 @@ class 'pkg/TestReturnIf' { 0 12 1 12 2 12 + 3 12 + 4 12 a 12 } @@ -52,6 +58,8 @@ class 'pkg/TestReturnIf' { 0 16 1 16 2 16 + 3 16 + 4 16 a 16 } @@ -59,6 +67,8 @@ class 'pkg/TestReturnIf' { 0 20 1 20 2 20 + 3 20 + 4 20 a 20 } @@ -66,6 +76,8 @@ class 'pkg/TestReturnIf' { 0 24 1 24 2 24 + 3 24 + 4 24 a 24 } } diff --git a/testData/results/pkg/TestReturnSwitchExpression1.dec b/testData/results/pkg/TestReturnSwitchExpression1.dec index 06e010be72..74e22e8bd2 100644 --- a/testData/results/pkg/TestReturnSwitchExpression1.dec +++ b/testData/results/pkg/TestReturnSwitchExpression1.dec @@ -14,11 +14,38 @@ class 'pkg/TestReturnSwitchExpression1' { method 'test (I)Ljava/lang/String;' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 5 1d 5 21 6 22 6 26 7 + 27 7 28 4 } } diff --git a/testData/results/pkg/TestReturnSwitchExpression2.dec b/testData/results/pkg/TestReturnSwitchExpression2.dec index 4fb339e597..4ef3d86637 100644 --- a/testData/results/pkg/TestReturnSwitchExpression2.dec +++ b/testData/results/pkg/TestReturnSwitchExpression2.dec @@ -18,15 +18,68 @@ class 'pkg/TestReturnSwitchExpression2' { method 'test (I)Ljava/lang/String;' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 5 20 6 24 7 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 2c 4 + 2d 4 + 2e 4 + 2f 4 + 30 4 + 31 4 + 32 4 + 33 4 + 34 4 + 35 4 + 36 4 + 37 4 + 38 4 + 39 4 + 3a 4 + 3b 4 + 3c 4 + 3d 4 + 3e 4 + 3f 4 40 9 41 9 45 10 46 10 4a 11 + 4b 11 4c 4 } } diff --git a/testData/results/pkg/TestReturnSwitchExpression3.dec b/testData/results/pkg/TestReturnSwitchExpression3.dec index 3050159131..22f002d2a1 100644 --- a/testData/results/pkg/TestReturnSwitchExpression3.dec +++ b/testData/results/pkg/TestReturnSwitchExpression3.dec @@ -23,11 +23,39 @@ class 'pkg/TestReturnSwitchExpression3' { 6 4 7 6 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 24 7 25 7 29 8 2a 8 2e 9 + 2f 9 30 6 } } diff --git a/testData/results/pkg/TestReturnSwitchExpression4.dec b/testData/results/pkg/TestReturnSwitchExpression4.dec index 45d786616b..64a41c3c7b 100644 --- a/testData/results/pkg/TestReturnSwitchExpression4.dec +++ b/testData/results/pkg/TestReturnSwitchExpression4.dec @@ -21,12 +21,40 @@ class 'pkg/TestReturnSwitchExpression4' { method 'test (I)Ljava/lang/String;' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 5 1d 5 21 6 22 6 26 8 27 8 + 28 8 + 29 8 2a 9 2b 9 2f 11 @@ -38,6 +66,7 @@ class 'pkg/TestReturnSwitchExpression4' { 35 11 36 11 37 12 + 38 12 39 4 } } diff --git a/testData/results/pkg/TestReturnSwitchExpression5.dec b/testData/results/pkg/TestReturnSwitchExpression5.dec new file mode 100644 index 0000000000..bb55d55c6b --- /dev/null +++ b/testData/results/pkg/TestReturnSwitchExpression5.dec @@ -0,0 +1,62 @@ +package pkg; + +public class TestReturnSwitchExpression5 { + public String test(int i) { + return switch (i) {// 6 + case 1 -> "1";// 7 + case 2 -> "2";// 8 + default -> { + int a = 0;// 10 + throw new RuntimeException();// 11 + } + }; + } +} + +class 'pkg/TestReturnSwitchExpression5' { + method 'test (I)Ljava/lang/String;' { + 0 4 + 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 5 + 1d 5 + 21 6 + 22 6 + 26 8 + 27 8 + 2f 9 + 30 4 + } +} + +Lines mapping: +6 <-> 5 +7 <-> 6 +8 <-> 7 +10 <-> 9 +11 <-> 10 diff --git a/testData/results/pkg/TestReturnTernaryChar.dec b/testData/results/pkg/TestReturnTernaryChar.dec index 1bbe97d104..ab8046ae75 100644 --- a/testData/results/pkg/TestReturnTernaryChar.dec +++ b/testData/results/pkg/TestReturnTernaryChar.dec @@ -23,9 +23,12 @@ class 'pkg/TestReturnTernaryChar' { 4 4 5 4 6 4 + 7 4 + 8 4 9 4 a 4 e 4 + f 4 10 4 } @@ -37,10 +40,14 @@ class 'pkg/TestReturnTernaryChar' { 4 8 5 8 6 8 + 7 8 + 8 8 9 8 a 8 b 8 f 8 + 10 8 + 11 8 12 8 } @@ -52,9 +59,12 @@ class 'pkg/TestReturnTernaryChar' { 4 12 5 12 6 12 + 7 12 + 8 12 9 12 a 12 e 12 + f 12 10 12 } } diff --git a/testData/results/pkg/TestReturnTernaryConstantSimplification.dec b/testData/results/pkg/TestReturnTernaryConstantSimplification.dec index 626649d39f..bfd4daf8c4 100644 --- a/testData/results/pkg/TestReturnTernaryConstantSimplification.dec +++ b/testData/results/pkg/TestReturnTernaryConstantSimplification.dec @@ -42,6 +42,8 @@ class 'pkg/TestReturnTernaryConstantSimplification' { method 'ternaryNotAnd (ZZ)Z' { 0 4 1 4 + 2 4 + 3 4 8 4 9 4 } @@ -49,12 +51,16 @@ class 'pkg/TestReturnTernaryConstantSimplification' { method 'ifOr (ZZ)Z' { 0 8 1 8 + 2 8 + 3 8 6 8 } method 'ternaryNotOr (ZZ)Z' { 0 12 1 12 + 2 12 + 3 12 4 12 9 12 } @@ -62,6 +68,8 @@ class 'pkg/TestReturnTernaryConstantSimplification' { method 'ternaryAnd (ZZ)Z' { 0 16 1 16 + 2 16 + 3 16 4 16 9 16 } @@ -69,38 +77,56 @@ class 'pkg/TestReturnTernaryConstantSimplification' { method 'redundantIf (Z)Z' { 0 20 1 20 + 2 20 + 3 20 } method 'redundantTernary (Z)Z' { 0 24 1 24 + 2 24 + 3 24 9 24 } method 'nestedIf (ZZ)Z' { 0 28 1 28 + 2 28 + 3 28 4 28 5 28 + 6 28 + 7 28 a 28 } method 'nestedTernary (ZZ)Z' { 0 32 1 32 + 2 32 + 3 32 4 32 5 32 + 6 32 + 7 32 11 32 } method 'nestedIfs (ZZZ)Z' { 0 36 1 36 + 2 36 + 3 36 4 36 5 36 + 6 36 + 7 36 a 36 c 36 d 36 + e 36 + f 36 12 36 } } diff --git a/testData/results/pkg/TestRunSuspend.dec b/testData/results/pkg/TestRunSuspend.dec index 90f42eaf7d..a60959e9dc 100644 --- a/testData/results/pkg/TestRunSuspend.dec +++ b/testData/results/pkg/TestRunSuspend.dec @@ -4,14 +4,15 @@ import kotlin.Metadata; import kotlin.Result; import kotlin.ResultKt; import kotlin.Unit; +import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.Nullable; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 1, xi = 48, - d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0006\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\n\u001a\u00020\u0005R+\u0010\u0003\u001a\n\u0012\u0004\u0012\u00020\u0005\u0018\u00010\u0004X\u0086\u000eø\u0001\u0000ø\u0001\u0001ø\u0001\u0002¢\u0006\u000e\n\u0000\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\t\u0082\u0002\u000f\n\u0002\b\u0019\n\u0005\b¡\u001e0\u0001\n\u0002\b!¨\u0006\u000b"}, - d2 = {"Lpkg/TestRunSuspend;", "", "()V", "result", "Lkotlin/Result;", "", "getResult-xLWZpok", "()Lkotlin/Result;", "setResult", "(Lkotlin/Result;)V", "await", "vineflower_testDataKotlin"} + d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0006\b\u0002\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0006\u0010\u000b\u001a\u00020\u0006R\"\u0010\u0004\u001a\n\u0012\u0004\u0012\u00020\u0006\u0018\u00010\u0005X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\n¨\u0006\f"}, + d2 = {"Lpkg/TestRunSuspend;", "", "", "()V", "result", "Lkotlin/Result;", "", "getResult-xLWZpok", "()Lkotlin/Result;", "setResult", "(Lkotlin/Result;)V", "await", "vineflower_testDataKotlin"} ) final class TestRunSuspend { @Nullable @@ -42,6 +43,7 @@ final class TestRunSuspend { return; } + Intrinsics.checkNotNull(this, "null cannot be cast to non-null type java.lang.Object"); this.wait(); } } @@ -50,68 +52,76 @@ final class TestRunSuspend { class 'pkg/TestRunSuspend' { method ' ()V' { - 4 20 + 4 21 } method 'getResult-xLWZpok ()Lkotlin/Result;' { - 0 24 - 1 24 - 2 24 - 3 24 - 4 24 + 0 25 + 1 25 + 2 25 + 3 25 + 4 25 } method 'setResult (Lkotlin/Result;)V' { - 0 28 - 1 28 - 2 28 - 3 28 - 4 28 - 5 29 + 0 29 + 1 29 + 2 29 + 3 29 + 4 29 + 5 30 } method 'await ()V' { - 0 33 - 2 33 - 3 33 - 5 34 - 6 34 - 8 37 - 9 37 - a 37 - b 37 - c 37 - d 38 - e 38 - 11 44 - 12 44 - 13 44 - 14 44 - 15 44 - 16 44 - 17 44 - 1b 39 - 1c 39 - 1d 39 - 1e 39 - 1f 39 - 20 39 + 0 34 + 2 34 + 3 34 + 5 35 + 6 35 + 8 38 + 9 38 + a 38 + b 38 + c 38 + d 39 + e 39 + f 39 + 10 39 + 11 45 + 12 45 + 13 45 + 14 45 + 15 45 + 16 45 + 17 46 + 18 46 + 19 46 + 1a 46 + 1b 46 + 1c 46 + 1d 46 21 40 22 40 23 40 24 40 25 40 + 26 40 + 27 41 + 28 41 29 41 + 2a 41 + 2b 41 + 2f 42 } } Lines mapping: -4 <-> 21 -5 <-> 29 -7 <-> 34 -9 <-> 38 -10 <-> 39 -12 <-> 40 +4 <-> 22 +5 <-> 30 +7 <-> 35 +9 <-> 39 +10 <-> 40 +12 <-> 41 Not mapped: 8 13 diff --git a/testData/results/pkg/TestSelfIterableLoop.dec b/testData/results/pkg/TestSelfIterableLoop.dec index 4cd25667ad..8072c7085b 100644 --- a/testData/results/pkg/TestSelfIterableLoop.dec +++ b/testData/results/pkg/TestSelfIterableLoop.dec @@ -37,6 +37,8 @@ class 'pkg/TestSelfIterableLoop' { 19 7 1a 7 1b 7 + 1c 7 + 1d 7 1e 8 1f 8 20 8 diff --git a/testData/results/pkg/TestShiftLoop.dec b/testData/results/pkg/TestShiftLoop.dec index 972046ffc6..6abecdc49d 100644 --- a/testData/results/pkg/TestShiftLoop.dec +++ b/testData/results/pkg/TestShiftLoop.dec @@ -23,6 +23,8 @@ class 'pkg/TestShiftLoop' { 6 6 7 6 8 6 + 9 6 + a 6 c 7 e 7 f 6 diff --git a/testData/results/pkg/TestSimpleIf.dec b/testData/results/pkg/TestSimpleIf.dec index 29891baff0..8d19f1512a 100644 --- a/testData/results/pkg/TestSimpleIf.dec +++ b/testData/results/pkg/TestSimpleIf.dec @@ -20,18 +20,24 @@ class 'pkg/TestSimpleIf' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 6 5 7 5 8 5 9 5 + a 5 + b 5 c 7 } method 'test2 (I)V' { 0 10 1 10 + 2 10 + 3 10 4 11 5 11 6 11 @@ -46,6 +52,8 @@ class 'pkg/TestSimpleIf' { 12 13 13 13 14 13 + 15 13 + 16 13 17 15 } } diff --git a/testData/results/pkg/TestSimpleWhile.dec b/testData/results/pkg/TestSimpleWhile.dec index bf148c9e99..5892ea2d64 100644 --- a/testData/results/pkg/TestSimpleWhile.dec +++ b/testData/results/pkg/TestSimpleWhile.dec @@ -15,6 +15,8 @@ class 'pkg/TestSimpleWhile' { 1 4 2 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 diff --git a/testData/results/pkg/TestSingleCaseStrSwitch.dec b/testData/results/pkg/TestSingleCaseStrSwitch.dec index 93a4455962..35176833a3 100644 --- a/testData/results/pkg/TestSingleCaseStrSwitch.dec +++ b/testData/results/pkg/TestSingleCaseStrSwitch.dec @@ -27,6 +27,25 @@ class 'pkg/TestSingleCaseStrSwitch' { 6 5 7 5 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 1c 7 1d 7 1e 7 @@ -34,10 +53,31 @@ class 'pkg/TestSingleCaseStrSwitch' { 20 7 21 7 22 7 + 23 7 + 24 7 25 8 26 8 27 11 28 11 + 29 11 + 2a 11 + 2b 11 + 2c 11 + 2d 11 + 2e 11 + 2f 11 + 30 11 + 31 11 + 32 11 + 33 11 + 34 11 + 35 11 + 36 11 + 37 11 + 38 11 + 39 11 + 3a 11 + 3b 11 3c 12 3d 12 41 13 diff --git a/testData/results/pkg/TestSplitColorComponents.dec b/testData/results/pkg/TestSplitColorComponents.dec index 4523d57fcd..816907b461 100644 --- a/testData/results/pkg/TestSplitColorComponents.dec +++ b/testData/results/pkg/TestSplitColorComponents.dec @@ -21,6 +21,8 @@ class 'pkg/TestSplitColorComponents' { 3 4 4 4 5 4 + 6 4 + 7 4 8 5 9 5 a 5 diff --git a/testData/results/pkg/TestStackCastParam.dec b/testData/results/pkg/TestStackCastParam.dec index cad0c3f392..2d76de1e67 100644 --- a/testData/results/pkg/TestStackCastParam.dec +++ b/testData/results/pkg/TestStackCastParam.dec @@ -5,8 +5,8 @@ public class TestStackCastParam { public int y; public void test(String s) { - float var10002 = (float)this.x; - get().b.accept(s, var10002, (float)this.y);// 8 + float var10002 = this.x; + get().b.accept(s, var10002, this.y);// 8 }// 9 public static TestStackCastParam.A get() { diff --git a/testData/results/pkg/TestStaticBlockFinalField.dec b/testData/results/pkg/TestStaticBlockFinalField.dec index 9c766c78ab..f909fd65eb 100644 --- a/testData/results/pkg/TestStaticBlockFinalField.dec +++ b/testData/results/pkg/TestStaticBlockFinalField.dec @@ -48,4 +48,4 @@ Lines mapping: 9 <-> 8 10 <-> 9 11 <-> 10 -12 <-> 11 \ No newline at end of file +12 <-> 11 diff --git a/testData/results/pkg/TestStringConcat.dec b/testData/results/pkg/TestStringConcat.dec index 8d508d3ea6..33fb9eea04 100644 --- a/testData/results/pkg/TestStringConcat.dec +++ b/testData/results/pkg/TestStringConcat.dec @@ -183,4 +183,4 @@ Lines mapping: 42 <-> 27 43 <-> 28 46 <-> 31 -47 <-> 32 \ No newline at end of file +47 <-> 32 diff --git a/testData/results/pkg/TestStringLiteral.dec b/testData/results/pkg/TestStringLiteral.dec index 337ef27d03..a579cfedeb 100644 --- a/testData/results/pkg/TestStringLiteral.dec +++ b/testData/results/pkg/TestStringLiteral.dec @@ -47,12 +47,16 @@ class 'pkg/TestStringLiteral' { 5 9 6 9 7 9 + 8 9 + 9 9 a 10 b 10 c 10 d 10 e 10 f 10 + 10 10 + 11 10 12 12 } diff --git a/testData/results/pkg/TestSuspendLambdaKt.dec b/testData/results/pkg/TestSuspendLambdaKt.dec index c37bc7901f..f7e560b7f6 100644 --- a/testData/results/pkg/TestSuspendLambdaKt.dec +++ b/testData/results/pkg/TestSuspendLambdaKt.dec @@ -9,13 +9,12 @@ import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 2, xi = 48, - d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\",\u0010\u0000\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u00040\u0001ø\u0001\u0000¢\u0006\n\n\u0002\u0010\u0007\u001a\u0004\b\u0005\u0010\u0006\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\b"}, + d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\")\u0010\u0000\u001a\u0018\b\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u00040\u0001¢\u0006\n\n\u0002\u0010\u0007\u001a\u0004\b\u0005\u0010\u0006¨\u0006\b"}, d2 = {"sl1", "Lkotlin/Function1;", "Lkotlin/coroutines/Continuation;", "", "", "getSl1", "()Lkotlin/jvm/functions/Function1;", "Lkotlin/jvm/functions/Function1;", "vineflower_testDataKotlin"} ) public final class TestSuspendLambdaKt { @@ -38,10 +37,10 @@ public final class TestSuspendLambdaKt { c = "pkg.TestSuspendLambdaKt$sl1$1" ) @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 3, xi = 48, - d1 = {"\u0000\u0006\n\u0000\n\u0002\u0010\u0002\u0010\u0000\u001a\u00020\u0001H\u008a@"}, + d1 = {"\u0000\u0006\n\u0000\n\u0002\u0010\u0002\u0010\u0000\u001a\u00020\u0001H\n"}, d2 = {"", ""} ) final class NamelessClass_1 extends SuspendLambda implements Function1, Object> { @@ -51,8 +50,7 @@ public final class TestSuspendLambdaKt { super(1, $completion); } - @Nullable - public final Object invokeSuspend(@NotNull Object $result) { + public final Object invokeSuspend(Object $result) { IntrinsicsKt.getCOROUTINE_SUSPENDED(); switch (this.label) { case 0: @@ -64,13 +62,11 @@ public final class TestSuspendLambdaKt { } } - @NotNull - public final Continuation create(@NotNull Continuation $completion) { + public final Continuation create(Continuation $completion) { return (Continuation)(new NamelessClass_1($completion)); } - @Nullable - public final Object invoke(@Nullable Continuation p1) { + public final Object invoke(Continuation p1) { return ((NamelessClass_1)this.create(p1)).invokeSuspend(Unit.INSTANCE); } } @@ -80,85 +76,104 @@ public final class TestSuspendLambdaKt { class 'pkg/TestSuspendLambdaKt' { method 'getSl1 ()Lkotlin/jvm/functions/Function1;' { - 0 26 - 1 26 - 2 26 - 3 26 + 0 25 + 1 25 + 2 25 + 3 25 } method ' ()V' { - e 77 + e 73 } } class 'pkg/TestSuspendLambdaKt$sl1$1' { method ' (Lkotlin/coroutines/Continuation;)V' { - 1 50 - 2 50 - 3 50 - 4 50 - 5 50 - 6 51 + 1 49 + 2 49 + 3 49 + 4 49 + 5 49 + 6 50 } method 'invokeSuspend (Ljava/lang/Object;)Ljava/lang/Object;' { - 0 55 - 1 55 - 2 55 - 4 56 - 5 56 - 6 56 - 7 56 - 8 56 - 1c 58 - 1d 58 - 1e 58 - 1f 58 - 20 59 - 21 59 - 22 59 - 23 59 - 24 59 - 26 59 - 27 59 - 28 59 - 29 60 - 2a 60 - 2b 60 - 2c 60 - 31 62 - 32 62 - 36 62 + 0 53 + 1 53 + 2 53 + 4 54 + 5 54 + 6 54 + 7 54 + 8 54 + 9 54 + a 54 + b 54 + c 54 + d 54 + e 54 + f 54 + 10 54 + 11 54 + 12 54 + 13 54 + 14 54 + 15 54 + 16 54 + 17 54 + 18 54 + 19 54 + 1a 54 + 1b 54 + 1c 56 + 1d 56 + 1e 56 + 1f 56 + 20 57 + 21 57 + 22 57 + 23 57 + 24 57 + 26 57 + 27 57 + 28 57 + 29 58 + 2a 58 + 2b 58 + 2c 58 + 31 60 + 32 60 + 36 60 } method 'create (Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;' { - 4 68 - 8 68 - 9 68 - a 68 - b 68 + 4 65 + 8 65 + 9 65 + a 65 + b 65 } method 'invoke (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;' { - 0 73 - 1 73 - 2 73 - 3 73 - 4 73 - 5 73 - 6 73 - 7 73 - 8 73 - 9 73 - a 73 - b 73 - c 73 - d 73 - e 73 + 0 69 + 1 69 + 2 69 + 3 69 + 4 69 + 5 69 + 6 69 + 7 69 + 8 69 + 9 69 + a 69 + b 69 + c 69 + d 69 + e 69 } } Lines mapping: -3 <-> 78 -4 <-> 60 -5 <-> 61 +3 <-> 74 +4 <-> 58 +5 <-> 59 diff --git a/testData/results/pkg/TestSwitchAssign.dec b/testData/results/pkg/TestSwitchAssign.dec index 29a62d9ab7..06c1c3bf6c 100644 --- a/testData/results/pkg/TestSwitchAssign.dec +++ b/testData/results/pkg/TestSwitchAssign.dec @@ -42,6 +42,42 @@ class 'pkg/TestSwitchAssign' { 1 4 2 5 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 + 1c 5 + 1d 5 + 1e 5 + 1f 5 + 20 5 + 21 5 + 22 5 + 23 5 + 24 5 + 25 5 + 26 5 + 27 5 28 9 29 9 2a 10 @@ -67,6 +103,37 @@ class 'pkg/TestSwitchAssign' { 4b 30 4c 30 58 22 + 59 22 + 5a 22 + 5b 22 + 5c 22 + 5d 22 + 5e 22 + 5f 22 + 60 22 + 61 22 + 62 22 + 63 22 + 64 22 + 65 22 + 66 22 + 67 22 + 68 22 + 69 22 + 6a 22 + 6b 22 + 6c 22 + 6d 22 + 6e 22 + 6f 22 + 70 22 + 71 22 + 72 22 + 73 22 + 74 22 + 75 22 + 76 22 + 77 22 78 25 79 25 7a 26 diff --git a/testData/results/pkg/TestSwitchDefaultBefore.dec b/testData/results/pkg/TestSwitchDefaultBefore.dec index f324be0ce0..4f9c1e3d19 100644 --- a/testData/results/pkg/TestSwitchDefaultBefore.dec +++ b/testData/results/pkg/TestSwitchDefaultBefore.dec @@ -41,6 +41,37 @@ class 'pkg/TestSwitchDefaultBefore' { 41 11 42 11 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 + 5c 4 + 5d 4 + 5e 4 + 5f 4 + 60 4 + 61 4 + 62 4 + 63 4 + 64 4 + 65 4 + 66 4 + 67 4 + 68 4 + 69 4 + 6a 4 + 6b 4 6c 6 6d 6 6e 6 @@ -62,12 +93,40 @@ class 'pkg/TestSwitchDefaultBefore' { 82 13 83 13 84 13 + 85 13 + 86 13 87 15 } method 'test2 (I)V' { 0 18 1 18 + 2 18 + 3 18 + 4 18 + 5 18 + 6 18 + 7 18 + 8 18 + 9 18 + a 18 + b 18 + c 18 + d 18 + e 18 + f 18 + 10 18 + 11 18 + 12 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 19 18 + 1a 18 + 1b 18 1c 20 1d 20 1e 20 @@ -89,6 +148,8 @@ class 'pkg/TestSwitchDefaultBefore' { 32 27 33 27 34 27 + 35 27 + 36 27 37 29 } } diff --git a/testData/results/pkg/TestSwitchDefaultCaseReturn.dec b/testData/results/pkg/TestSwitchDefaultCaseReturn.dec index 43ba6b4177..049736ddf0 100644 --- a/testData/results/pkg/TestSwitchDefaultCaseReturn.dec +++ b/testData/results/pkg/TestSwitchDefaultCaseReturn.dec @@ -41,6 +41,8 @@ class 'pkg/TestSwitchDefaultCaseReturn' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 b 5 29 6 @@ -48,6 +50,31 @@ class 'pkg/TestSwitchDefaultCaseReturn' { 37 6 38 6 42 5 + 43 5 + 44 5 + 45 5 + 46 5 + 47 5 + 48 5 + 49 5 + 4a 5 + 4b 5 + 4c 5 + 4d 5 + 4e 5 + 4f 5 + 50 5 + 51 5 + 52 5 + 53 5 + 54 5 + 55 5 + 56 5 + 57 5 + 58 5 + 59 5 + 5a 5 + 5b 5 5c 6 5d 6 61 7 @@ -68,18 +95,50 @@ class 'pkg/TestSwitchDefaultCaseReturn' { a0 16 a1 16 ad 14 + ae 14 + af 14 + b0 14 + b1 14 + b2 14 + b3 14 + b4 14 + b5 14 + b6 14 + b7 14 + b8 14 + b9 14 + ba 14 + bb 14 + bc 14 + bd 14 + be 14 + bf 14 + c0 14 + c1 14 + c2 14 + c3 14 + c4 14 + c5 14 + c6 14 + c7 14 c8 17 c9 17 ca 17 cb 20 cc 20 + cd 20 + ce 20 cf 20 d0 20 + d1 20 + d2 20 d3 21 d4 21 d5 21 d6 24 d7 24 + d8 24 + d9 24 da 25 db 25 dc 25 @@ -93,6 +152,8 @@ class 'pkg/TestSwitchDefaultCaseReturn' { e4 28 e5 28 e6 28 + e7 28 + e8 28 e9 29 ea 29 } diff --git a/testData/results/pkg/TestSwitchExprInvoc.dec b/testData/results/pkg/TestSwitchExprInvoc.dec index 349179c91a..ca5c15edc9 100644 --- a/testData/results/pkg/TestSwitchExprInvoc.dec +++ b/testData/results/pkg/TestSwitchExprInvoc.dec @@ -14,11 +14,38 @@ class 'pkg/TestSwitchExprInvoc' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 5 1d 5 21 6 22 6 26 7 + 27 7 28 8 29 8 2a 8 diff --git a/testData/results/pkg/TestSwitchExprString1.dec b/testData/results/pkg/TestSwitchExprString1.dec index 905adb2f1b..d5728aeb50 100644 --- a/testData/results/pkg/TestSwitchExprString1.dec +++ b/testData/results/pkg/TestSwitchExprString1.dec @@ -30,6 +30,8 @@ class 'pkg/TestSwitchExprString1' { method 'get (Ljava/lang/String;)Lpkg/TestSwitchExprString1$Type;' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 6 5 @@ -42,6 +44,25 @@ class 'pkg/TestSwitchExprString1' { e 8 f 8 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 24 10 25 10 26 10 @@ -49,14 +70,37 @@ class 'pkg/TestSwitchExprString1' { 28 10 29 10 2a 10 + 2b 10 + 2c 10 2d 11 2e 11 2f 14 30 14 + 31 14 + 32 14 + 33 14 + 34 14 + 35 14 + 36 14 + 37 14 + 38 14 + 39 14 + 3a 14 + 3b 14 + 3c 14 + 3d 14 + 3e 14 + 3f 14 + 40 14 + 41 14 + 42 14 + 43 14 44 15 45 15 46 15 4a 16 + 4b 16 + 4c 16 4d 14 } } diff --git a/testData/results/pkg/TestSwitchExpressionFallthrough1.dec b/testData/results/pkg/TestSwitchExpressionFallthrough1.dec index d118675c8c..cc2d388087 100644 --- a/testData/results/pkg/TestSwitchExpressionFallthrough1.dec +++ b/testData/results/pkg/TestSwitchExpressionFallthrough1.dec @@ -24,11 +24,43 @@ class 'pkg/TestSwitchExpressionFallthrough1' { method 'test (I)V' { 0 5 1 5 + 2 5 + 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 8 5 + 9 5 + a 5 + b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 + 1c 5 + 1d 5 + 1e 5 + 1f 5 20 7 21 7 22 7 23 7 24 7 + 25 7 + 26 7 27 11 28 12 2b 14 diff --git a/testData/results/pkg/TestSwitchExpressionNested1.dec b/testData/results/pkg/TestSwitchExpressionNested1.dec index 8bb79101d9..05ba13f466 100644 --- a/testData/results/pkg/TestSwitchExpressionNested1.dec +++ b/testData/results/pkg/TestSwitchExpressionNested1.dec @@ -29,11 +29,65 @@ class 'pkg/TestSwitchExpressionNested1' { 3 6 7 6 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 24 7 28 8 2f 10 33 10 34 10 + 35 10 + 36 10 + 37 10 + 38 10 + 39 10 + 3a 10 + 3b 10 + 3c 10 + 3d 10 + 3e 10 + 3f 10 + 40 10 + 41 10 + 42 10 + 43 10 + 44 10 + 45 10 + 46 10 + 47 10 + 48 10 + 49 10 + 4a 10 + 4b 10 + 4c 10 + 4d 10 + 4e 10 + 4f 10 50 12 54 14 58 16 diff --git a/testData/results/pkg/TestSwitchExpressionPPMM.dec b/testData/results/pkg/TestSwitchExpressionPPMM.dec index af6105ecec..81e72d9322 100644 --- a/testData/results/pkg/TestSwitchExpressionPPMM.dec +++ b/testData/results/pkg/TestSwitchExpressionPPMM.dec @@ -28,6 +28,36 @@ class 'pkg/TestSwitchExpressionPPMM' { 7 6 8 6 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 29 7 2a 7 2b 7 diff --git a/testData/results/pkg/TestSwitchFinally.dec b/testData/results/pkg/TestSwitchFinally.dec index dc75183c2b..668465ae88 100644 --- a/testData/results/pkg/TestSwitchFinally.dec +++ b/testData/results/pkg/TestSwitchFinally.dec @@ -49,24 +49,24 @@ public class TestSwitchFinally { try { System.out.println(1);// 57 } finally { - System.out.println("finally"); + System.out.println("finally");// 59 switch (i) {// 61 case 0: System.out.println("0");// 63 break;// 64 case 1: System.out.println("1");// 66 - System.out.println("c");// 67 69 72 74 76 77 80 + System.out.println("c");// 67 80 return 0;// 81 default: - System.out.println("Default"); + System.out.println("Default");// 69 } - System.out.println("b"); + System.out.println("b");// 72 } - System.out.println("d");// 59 - return 1; + System.out.println("d");// 74 76 + return 1;// 77 } } @@ -77,6 +77,8 @@ class 'pkg/TestSwitchFinally' { 2 5 3 5 4 5 + 5 5 + 6 5 34 15 38 7 39 7 @@ -88,18 +90,40 @@ class 'pkg/TestSwitchFinally' { 3f 7 40 8 41 8 + 42 8 + 43 8 + 44 8 + 45 8 + 46 8 + 47 8 + 48 8 + 49 8 + 4a 8 + 4b 8 + 4c 8 + 4d 8 + 4e 8 + 4f 8 + 50 8 + 51 8 + 52 8 + 53 8 54 10 55 10 56 10 57 10 58 10 59 10 + 5a 10 + 5b 10 5c 13 5d 13 5e 13 5f 13 60 13 61 13 + 62 13 + 63 13 } method 'test1 (I)V' { @@ -108,6 +132,8 @@ class 'pkg/TestSwitchFinally' { 2 19 3 19 4 19 + 5 19 + 6 19 47 32 4b 21 4c 21 @@ -119,6 +145,33 @@ class 'pkg/TestSwitchFinally' { 52 21 53 22 54 22 + 55 22 + 56 22 + 57 22 + 58 22 + 59 22 + 5a 22 + 5b 22 + 5c 22 + 5d 22 + 5e 22 + 5f 22 + 60 22 + 61 22 + 62 22 + 63 22 + 64 22 + 65 22 + 66 22 + 67 22 + 68 22 + 69 22 + 6a 22 + 6b 22 + 6c 22 + 6d 22 + 6e 22 + 6f 22 70 24 71 24 72 24 @@ -134,12 +187,16 @@ class 'pkg/TestSwitchFinally' { 7e 27 7f 27 80 27 + 81 27 + 82 27 83 30 84 30 85 30 86 30 87 30 88 30 + 89 30 + 8a 30 } method 'test2 (I)V' { @@ -148,6 +205,8 @@ class 'pkg/TestSwitchFinally' { 2 36 3 36 4 36 + 5 36 + 6 36 2c 45 30 38 31 38 @@ -159,6 +218,16 @@ class 'pkg/TestSwitchFinally' { 37 38 38 39 39 39 + 3a 39 + 3b 39 + 3c 39 + 3d 39 + 3e 39 + 3f 39 + 40 39 + 41 39 + 42 39 + 43 39 44 41 45 41 46 41 @@ -173,6 +242,8 @@ class 'pkg/TestSwitchFinally' { 4f 42 50 42 51 42 + 52 42 + 53 42 } method 'test3 (I)I' { @@ -181,10 +252,11 @@ class 'pkg/TestSwitchFinally' { 2 49 3 49 4 49 + 5 49 + 6 49 52 67 53 67 54 67 - 55 67 56 51 57 51 58 51 @@ -195,30 +267,30 @@ class 'pkg/TestSwitchFinally' { 5d 51 5e 52 5f 52 - 60 67 - 61 67 - 62 67 - 63 67 - 64 67 - 65 67 - 66 67 - 67 67 - 68 67 - 69 67 - 6a 67 - 6b 67 - 6c 67 - 6d 67 - 6e 67 - 6f 67 - 70 67 - 71 67 - 72 67 - 73 67 - 74 67 - 75 67 - 76 67 - 77 67 + 60 52 + 61 52 + 62 52 + 63 52 + 64 52 + 65 52 + 66 52 + 67 52 + 68 52 + 69 52 + 6a 52 + 6b 52 + 6c 52 + 6d 52 + 6e 52 + 6f 52 + 70 52 + 71 52 + 72 52 + 73 52 + 74 52 + 75 52 + 76 52 + 77 52 78 54 79 54 7a 54 @@ -228,8 +300,6 @@ class 'pkg/TestSwitchFinally' { 7e 54 7f 54 80 55 - 81 67 - 82 67 83 57 84 57 85 57 @@ -241,42 +311,33 @@ class 'pkg/TestSwitchFinally' { 8b 58 8c 58 8d 58 - 8e 58 - 8f 58 - 90 58 - 91 58 - 92 58 - 93 58 - 94 58 - 95 58 - 96 58 - 97 58 - 98 58 - 99 58 - 9a 58 - 9b 58 - 9c 58 - 9d 58 - 9e 58 - 9f 58 - a0 58 - a1 58 - a2 58 - a3 58 - a4 58 - a5 58 - a6 58 - a7 58 - a8 58 - a9 58 + 8e 61 + 8f 61 + 90 61 + 91 61 + 92 61 + 93 61 + 94 61 + 95 61 + 96 64 + 97 64 + 98 64 + 99 64 + 9a 64 + 9b 64 + 9c 64 + 9d 64 + a0 67 + a1 67 + a3 67 + a4 67 + a5 67 + a8 68 aa 58 ab 58 - ac 58 ad 58 ae 58 - af 59 - b0 59 - b1 59 + af 58 b2 59 } } @@ -303,17 +364,17 @@ Lines mapping: 50 <-> 43 51 <-> 46 57 <-> 50 -59 <-> 68 +59 <-> 52 61 <-> 53 63 <-> 55 64 <-> 56 66 <-> 58 67 <-> 59 -69 <-> 59 -72 <-> 59 -74 <-> 59 -76 <-> 59 -77 <-> 59 +69 <-> 62 +72 <-> 65 +74 <-> 68 +76 <-> 68 +77 <-> 69 80 <-> 59 81 <-> 60 Not mapped: diff --git a/testData/results/pkg/TestSwitchInTry.dec b/testData/results/pkg/TestSwitchInTry.dec new file mode 100644 index 0000000000..347e59dc17 --- /dev/null +++ b/testData/results/pkg/TestSwitchInTry.dec @@ -0,0 +1,130 @@ +package pkg; + +import java.util.Arrays; +import java.util.List; + +public class TestSwitchInTry { + public static List method(String[] args) { + String ret = "";// 13 + + for (String arg : args) {// 14 + try { + byte var7 = -1; + switch (arg.hashCode()) {// 16 + case 97: + if (arg.equals("a")) { + var7 = 0; + } + default: + switch (var7) { + case 0: + ret = "a";// 18 + return Arrays.asList(ret);// 24 + default: + return Arrays.asList(ret); + } + } + } catch (Exception var8) {// 21 + } + } + + return Arrays.asList(ret); + } +} + +class 'pkg/TestSwitchInTry' { + method 'method ([Ljava/lang/String;)Ljava/util/List;' { + 0 7 + 1 7 + 2 7 + 3 9 + 4 9 + 5 9 + 7 9 + 9 9 + a 9 + 15 9 + 16 9 + 17 12 + 18 12 + 1b 11 + 1c 11 + 1d 11 + 1e 12 + 1f 12 + 20 12 + 21 12 + 22 12 + 23 12 + 24 12 + 25 12 + 26 12 + 27 12 + 28 12 + 29 12 + 2a 12 + 2b 12 + 2c 12 + 2d 12 + 2e 12 + 2f 12 + 30 12 + 31 12 + 32 12 + 33 12 + 34 14 + 35 14 + 36 14 + 37 14 + 38 14 + 39 14 + 3a 14 + 3b 14 + 3c 14 + 3d 14 + 3e 15 + 3f 15 + 40 15 + 41 18 + 42 18 + 43 18 + 44 18 + 45 18 + 46 18 + 47 18 + 48 18 + 49 18 + 4a 18 + 4b 18 + 4c 18 + 4d 18 + 4e 18 + 4f 18 + 50 18 + 51 18 + 52 18 + 53 18 + 54 20 + 55 20 + 56 20 + 5a 26 + 5c 9 + 5d 9 + 5e 9 + 68 21 + 6a 21 + 6b 21 + 6c 21 + 6d 21 + } +} + +Lines mapping: +13 <-> 8 +14 <-> 10 +16 <-> 13 +18 <-> 21 +21 <-> 27 +24 <-> 22 +Not mapped: +20 diff --git a/testData/results/pkg/TestSwitchLoop.dec b/testData/results/pkg/TestSwitchLoop.dec index f886572272..ed8fc9c1aa 100644 --- a/testData/results/pkg/TestSwitchLoop.dec +++ b/testData/results/pkg/TestSwitchLoop.dec @@ -327,11 +327,40 @@ class 'pkg/TestSwitchLoop' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 4 5 5 5 6 5 7 6 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 24 8 25 8 26 8 @@ -370,6 +399,8 @@ class 'pkg/TestSwitchLoop' { 4d 18 4e 18 4f 18 + 50 18 + 51 18 55 19 } @@ -379,11 +410,45 @@ class 'pkg/TestSwitchLoop' { 2 26 3 26 4 26 + 5 26 + 6 26 7 27 8 27 9 27 a 28 b 28 + c 28 + d 28 + e 28 + f 28 + 10 28 + 11 28 + 12 28 + 13 28 + 14 28 + 15 28 + 16 28 + 17 28 + 18 28 + 19 28 + 1a 28 + 1b 28 + 1c 28 + 1d 28 + 1e 28 + 1f 28 + 20 28 + 21 28 + 22 28 + 23 28 + 24 28 + 25 28 + 26 28 + 27 28 + 28 28 + 29 28 + 2a 28 + 2b 28 2c 30 2d 30 2e 30 @@ -450,11 +515,45 @@ class 'pkg/TestSwitchLoop' { 2 54 3 54 4 54 + 5 54 + 6 54 7 55 8 55 9 55 a 56 b 56 + c 56 + d 56 + e 56 + f 56 + 10 56 + 11 56 + 12 56 + 13 56 + 14 56 + 15 56 + 16 56 + 17 56 + 18 56 + 19 56 + 1a 56 + 1b 56 + 1c 56 + 1d 56 + 1e 56 + 1f 56 + 20 56 + 21 56 + 22 56 + 23 56 + 24 56 + 25 56 + 26 56 + 27 56 + 28 56 + 29 56 + 2a 56 + 2b 56 2c 58 2d 58 2e 58 @@ -531,11 +630,37 @@ class 'pkg/TestSwitchLoop' { 2 82 3 82 4 82 + 5 82 + 6 82 7 83 8 83 9 83 a 84 b 84 + c 84 + d 84 + e 84 + f 84 + 10 84 + 11 84 + 12 84 + 13 84 + 14 84 + 15 84 + 16 84 + 17 84 + 18 84 + 19 84 + 1a 84 + 1b 84 + 1c 84 + 1d 84 + 1e 84 + 1f 84 + 20 84 + 21 84 + 22 84 + 23 84 24 86 25 86 26 86 @@ -546,18 +671,24 @@ class 'pkg/TestSwitchLoop' { 2b 86 2c 87 2d 87 + 2e 87 + 2f 87 33 92 34 92 35 92 36 92 37 92 38 92 + 39 92 + 3a 92 3b 95 3c 95 3d 95 3e 95 3f 95 40 95 + 41 95 + 42 95 43 82 44 82 45 82 @@ -578,11 +709,37 @@ class 'pkg/TestSwitchLoop' { 2 106 3 106 4 106 + 5 106 + 6 106 7 107 8 107 9 107 a 109 b 109 + c 109 + d 109 + e 109 + f 109 + 10 109 + 11 109 + 12 109 + 13 109 + 14 109 + 15 109 + 16 109 + 17 109 + 18 109 + 19 109 + 1a 109 + 1b 109 + 1c 109 + 1d 109 + 1e 109 + 1f 109 + 20 109 + 21 109 + 22 109 + 23 109 24 111 25 111 26 111 @@ -596,8 +753,37 @@ class 'pkg/TestSwitchLoop' { 2e 115 2f 115 30 115 + 31 115 + 32 115 33 119 34 119 + 35 119 + 36 119 + 37 119 + 38 119 + 39 119 + 3a 119 + 3b 119 + 3c 119 + 3d 119 + 3e 119 + 3f 119 + 40 119 + 41 119 + 42 119 + 43 119 + 44 119 + 45 119 + 46 119 + 47 119 + 48 119 + 49 119 + 4a 119 + 4b 119 + 4c 119 + 4d 119 + 4e 119 + 4f 119 50 121 51 121 52 121 @@ -624,6 +810,8 @@ class 'pkg/TestSwitchLoop' { 71 133 72 133 73 133 + 74 133 + 75 133 76 143 77 143 78 143 @@ -653,8 +841,28 @@ class 'pkg/TestSwitchLoop' { 3 152 4 152 5 152 + 6 152 + 7 152 8 153 9 153 + a 153 + b 153 + c 153 + d 153 + e 153 + f 153 + 10 153 + 11 153 + 12 153 + 13 153 + 14 153 + 15 153 + 16 153 + 17 153 + 18 153 + 19 153 + 1a 153 + 1b 153 1c 155 1d 155 1e 155 @@ -668,8 +876,29 @@ class 'pkg/TestSwitchLoop' { 26 157 27 157 28 157 + 29 157 + 2a 157 2b 158 2c 158 + 2d 158 + 2e 158 + 2f 158 + 30 158 + 31 158 + 32 158 + 33 158 + 34 158 + 35 158 + 36 158 + 37 158 + 38 158 + 39 158 + 3a 158 + 3b 158 + 3c 158 + 3d 158 + 3e 158 + 3f 158 40 160 41 160 42 160 @@ -710,13 +939,36 @@ class 'pkg/TestSwitchLoop' { 3 175 4 175 5 175 + 6 175 + 7 175 8 176 9 176 a 176 b 176 c 176 + d 176 + e 176 f 177 10 177 + 11 177 + 12 177 + 13 177 + 14 177 + 15 177 + 16 177 + 17 177 + 18 177 + 19 177 + 1a 177 + 1b 177 + 1c 177 + 1d 177 + 1e 177 + 1f 177 + 20 177 + 21 177 + 22 177 + 23 177 24 179 25 179 26 179 @@ -753,15 +1005,45 @@ class 'pkg/TestSwitchLoop' { method 'test8 (I)V' { 0 191 1 191 + 2 191 + 3 191 + 4 191 + 5 191 + 6 191 + 7 191 + 8 191 + 9 191 + a 191 + b 191 + c 191 + d 191 + e 191 + f 191 + 10 191 + 11 191 + 12 191 + 13 191 + 14 191 + 15 191 + 16 191 + 17 191 + 18 191 + 19 191 + 1a 191 + 1b 191 1c 193 1d 193 1e 196 1f 196 20 196 21 196 + 22 196 + 23 196 24 201 25 201 26 201 + 27 201 + 28 201 2c 205 2d 205 2e 205 @@ -770,17 +1052,23 @@ class 'pkg/TestSwitchLoop' { 34 197 35 197 36 197 + 37 197 + 38 197 39 208 3a 208 3b 208 3c 208 3d 208 3e 208 + 3f 208 + 40 208 41 210 42 210 43 210 44 210 45 210 + 46 210 + 47 210 48 213 49 213 4a 213 @@ -795,15 +1083,45 @@ class 'pkg/TestSwitchLoop' { method 'test9 (I)V' { 0 218 1 218 + 2 218 + 3 218 + 4 218 + 5 218 + 6 218 + 7 218 + 8 218 + 9 218 + a 218 + b 218 + c 218 + d 218 + e 218 + f 218 + 10 218 + 11 218 + 12 218 + 13 218 + 14 218 + 15 218 + 16 218 + 17 218 + 18 218 + 19 218 + 1a 218 + 1b 218 1c 220 1d 220 1e 223 1f 223 20 223 21 223 + 22 223 + 23 223 24 228 25 228 26 228 + 27 228 + 28 228 2c 233 2d 233 2e 233 @@ -821,11 +1139,15 @@ class 'pkg/TestSwitchLoop' { 3f 229 40 229 41 229 + 42 229 + 43 229 44 236 45 236 46 236 47 236 48 236 + 49 236 + 4a 236 4b 239 4c 239 4d 239 @@ -840,19 +1162,51 @@ class 'pkg/TestSwitchLoop' { method 'test10 (I)V' { 0 245 1 245 + 2 245 + 3 245 + 4 245 + 5 245 + 6 245 + 7 245 + 8 245 + 9 245 + a 245 + b 245 + c 245 + d 245 + e 245 + f 245 + 10 245 + 11 245 + 12 245 + 13 245 + 14 245 + 15 245 + 16 245 + 17 245 + 18 245 + 19 245 + 1a 245 + 1b 245 1c 247 1d 247 1e 250 1f 250 20 250 21 250 + 22 250 + 23 250 24 254 25 254 26 254 + 27 254 + 28 254 2c 259 2d 259 2e 259 2f 259 + 30 259 + 31 259 35 263 36 263 37 263 @@ -869,11 +1223,15 @@ class 'pkg/TestSwitchLoop' { 48 255 49 255 4a 255 + 4b 255 + 4c 255 4d 271 4e 271 4f 271 50 271 51 271 + 52 271 + 53 271 54 278 55 278 56 278 @@ -888,19 +1246,51 @@ class 'pkg/TestSwitchLoop' { method 'test10b (I)V' { 0 285 1 285 + 2 285 + 3 285 + 4 285 + 5 285 + 6 285 + 7 285 + 8 285 + 9 285 + a 285 + b 285 + c 285 + d 285 + e 285 + f 285 + 10 285 + 11 285 + 12 285 + 13 285 + 14 285 + 15 285 + 16 285 + 17 285 + 18 285 + 19 285 + 1a 285 + 1b 285 1c 287 1d 287 1e 290 1f 290 20 290 21 290 + 22 290 + 23 290 24 294 25 294 26 294 + 27 294 + 28 294 2c 299 2d 299 2e 299 2f 299 + 30 299 + 31 299 35 303 36 303 37 303 @@ -917,6 +1307,8 @@ class 'pkg/TestSwitchLoop' { 48 295 49 295 4a 295 + 4b 295 + 4c 295 4d 314 4e 314 4f 314 @@ -930,6 +1322,8 @@ class 'pkg/TestSwitchLoop' { 59 306 5a 306 5b 306 + 5c 306 + 5d 306 5e 321 5f 321 60 321 diff --git a/testData/results/pkg/TestSwitchOnEnum.dec b/testData/results/pkg/TestSwitchOnEnum.dec index a0a8742010..95658ed8f2 100644 --- a/testData/results/pkg/TestSwitchOnEnum.dec +++ b/testData/results/pkg/TestSwitchOnEnum.dec @@ -52,6 +52,33 @@ class 'pkg/TestSwitchOnEnum' { 3 8 7 8 8 8 + 9 8 + a 8 + b 8 + c 8 + d 8 + e 8 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 24 10 25 10 26 12 @@ -66,6 +93,33 @@ class 'pkg/TestSwitchOnEnum$Example' { 3 20 7 20 8 20 + 9 20 + a 20 + b 20 + c 20 + d 20 + e 20 + f 20 + 10 20 + 11 20 + 12 20 + 13 20 + 14 20 + 15 20 + 16 20 + 17 20 + 18 20 + 19 20 + 1a 20 + 1b 20 + 1c 20 + 1d 20 + 1e 20 + 1f 20 + 20 20 + 21 20 + 22 20 + 23 20 24 22 25 22 26 22 @@ -81,9 +135,35 @@ class 'pkg/TestSwitchOnEnum$Example' { 32 25 33 25 34 25 + 35 25 + 36 25 3a 28 3e 28 3f 28 + 40 28 + 41 28 + 42 28 + 43 28 + 44 28 + 45 28 + 46 28 + 47 28 + 48 28 + 49 28 + 4a 28 + 4b 28 + 4c 28 + 4d 28 + 4e 28 + 4f 28 + 50 28 + 51 28 + 52 28 + 53 28 + 54 28 + 55 28 + 56 28 + 57 28 58 30 59 30 5a 30 @@ -99,6 +179,8 @@ class 'pkg/TestSwitchOnEnum$Example' { 66 33 67 33 68 33 + 69 33 + 6a 33 6b 35 } } diff --git a/testData/results/pkg/TestSwitchOnEnumJ21.dec b/testData/results/pkg/TestSwitchOnEnumJ21.dec index cff9f9f8cf..5660d78ce2 100644 --- a/testData/results/pkg/TestSwitchOnEnumJ21.dec +++ b/testData/results/pkg/TestSwitchOnEnumJ21.dec @@ -1,43 +1,94 @@ package pkg; +import ext.TestEnum2; + public class TestSwitchOnEnumJ21 { public int test1(TestSwitchOnEnumJ21.TestEnum a) { - return switch (a) {// 5 - case A -> 1;// 6 - case B -> 2;// 7 - case C -> 3;// 8 + return switch (a) {// 7 + case A -> 1;// 8 + case B -> 2;// 9 + case C -> 3;// 10 + }; + } + + public int test2(TestEnum2 a) { + return switch (a) {// 15 + case A -> 1;// 16 + case B -> 2;// 17 + case C -> 3;// 18 + }; + } + + public int test3(TestSwitchOnEnumJ21.TestEnum a) { + return switch (a) {// 23 + case null -> 4;// 27 + case A -> 1;// 24 + case B -> 2;// 25 + case C -> 3;// 26 + }; + } + + public int test4(TestEnum2 a) { + return switch (a) {// 32 + case null -> 4;// 36 + case A -> 1;// 33 + case B -> 2;// 34 + case C -> 3;// 35 + }; + } + + public int test5(TestSwitchOnEnumJ21.TestEnum a, boolean b) { + return switch (a) {// 41 + case A -> 1;// 42 + case B -> 2;// 43 + case C -> { + if (b) {// 45 + boolean c = true;// 46 + yield 3;// 47 + } else { + boolean d = true;// 49 + yield 4;// 50 + } + } }; } public int testDefault(TestSwitchOnEnumJ21.TestEnum a) { - return switch (a) {// 13 - case A -> 1;// 14 - default -> 5;// 15 + return switch (a) {// 57 + case A -> 1;// 58 + default -> 5;// 59 + }; + } + + public int testDefault2(TestEnum2 a) { + return switch (a) {// 64 + case A -> 1;// 65 + default -> 5;// 66 }; } public void testStatement(TestSwitchOnEnumJ21.TestEnum a) { - switch (a) {// 20 + switch (a) {// 71 case A: - System.out.println("A");// 22 - break;// 23 + System.out.println("A");// 73 + break;// 74 case B: - System.out.println("B");// 25 - break;// 26 + System.out.println("B");// 76 + break;// 77 case C: - System.out.println("C");// 28 + System.out.println("C");// 79 } - }// 30 + }// 81 public void testStatementDefault(TestSwitchOnEnumJ21.TestEnum a) { - switch (a) {// 33 + switch (a) {// 84 case A: - System.out.println("A");// 35 - break;// 36 + System.out.println("A");// 86 + break;// 87 default: - System.out.println("C");// 38 + System.out.println("C");// 89 } - }// 40 + }// 91 static enum TestEnum { A, @@ -48,91 +99,400 @@ public class TestSwitchOnEnumJ21 { class 'pkg/TestSwitchOnEnumJ21' { method 'test1 (Lpkg/TestSwitchOnEnumJ21$TestEnum;)I' { - 0 4 - 4 4 - 2a 5 - 2e 6 - 32 7 - 33 4 + 0 6 + 4 6 + 5 6 + 6 6 + 7 6 + 8 6 + 9 6 + a 6 + b 6 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 2a 7 + 2e 8 + 32 9 + 33 6 } - method 'testDefault (Lpkg/TestSwitchOnEnumJ21$TestEnum;)I' { - 0 12 - 4 12 - 18 13 + method 'test2 (Lext/TestEnum2;)I' { + 3 14 + 7 14 + 8 14 + 9 14 + a 14 + b 14 + c 14 + d 14 + e 14 + f 14 + 10 14 + 11 14 + 12 14 + 13 14 + 14 14 + 15 14 + 16 14 + 17 14 + 18 14 + 19 14 + 1a 14 + 1b 14 1c 14 - 1d 12 + 1d 14 + 1e 14 + 1f 14 + 20 14 + 21 14 + 22 14 + 23 14 + 2e 15 + 32 16 + 36 17 + 37 14 } - method 'testStatement (Lpkg/TestSwitchOnEnumJ21$TestEnum;)V' { - 0 19 - 4 19 - 20 21 - 21 21 - 22 21 - 23 21 - 24 21 - 25 21 - 26 21 - 27 21 - 28 22 - 2b 24 - 2c 24 - 2d 24 - 2e 24 - 2f 24 - 30 24 - 31 24 + method 'test3 (Lpkg/TestSwitchOnEnumJ21$TestEnum;)I' { + 0 22 + 4 22 + b 22 + c 22 + d 22 + e 22 + f 22 + 10 22 + 11 22 + 12 22 + 13 22 + 14 22 + 15 22 + 16 22 + 17 22 + 18 22 + 19 22 + 1a 22 + 1b 22 + 1c 22 + 1d 22 + 1e 22 + 1f 22 + 20 22 + 21 22 + 22 22 + 23 22 + 24 22 + 25 22 + 26 22 + 27 22 32 24 - 33 25 - 36 27 - 37 27 - 38 27 - 39 27 - 3a 27 - 3b 27 - 3e 29 + 36 25 + 3a 26 + 3e 23 + 3f 22 + } + + method 'test4 (Lext/TestEnum2;)I' { + 0 31 + 4 31 + b 31 + c 31 + d 31 + e 31 + f 31 + 10 31 + 11 31 + 12 31 + 13 31 + 14 31 + 15 31 + 16 31 + 17 31 + 18 31 + 19 31 + 1a 31 + 1b 31 + 1c 31 + 1d 31 + 1e 31 + 1f 31 + 20 31 + 21 31 + 22 31 + 23 31 + 24 31 + 25 31 + 26 31 + 27 31 + 32 33 + 36 34 + 3a 35 + 3e 32 + 3f 31 + } + + method 'test5 (Lpkg/TestSwitchOnEnumJ21$TestEnum;Z)I' { + 0 40 + 4 40 + 5 40 + 6 40 + 7 40 + 8 40 + 9 40 + a 40 + b 40 + c 40 + d 40 + e 40 + f 40 + 10 40 + 11 40 + 12 40 + 13 40 + 14 40 + 15 40 + 16 40 + 17 40 + 18 40 + 19 40 + 1a 40 + 1b 40 + 1c 40 + 1d 40 + 1e 40 + 1f 40 + 2a 41 + 2e 42 + 32 44 + 33 44 + 34 44 + 35 44 + 36 45 + 37 45 + 38 46 + 3c 48 + 3d 48 + 3e 49 + 42 40 + } + + method 'testDefault (Lpkg/TestSwitchOnEnumJ21$TestEnum;)I' { + 0 56 + 4 56 + 5 56 + 6 56 + 7 56 + 8 56 + 9 56 + a 56 + b 56 + c 56 + d 56 + e 56 + f 56 + 10 56 + 11 56 + 12 56 + 13 56 + 14 56 + 15 56 + 16 56 + 17 56 + 18 57 + 1c 58 + 1d 56 + } + + method 'testDefault2 (Lext/TestEnum2;)I' { + 3 63 + 7 63 + 8 63 + 9 63 + a 63 + b 63 + c 63 + d 63 + e 63 + f 63 + 10 63 + 11 63 + 12 63 + 13 63 + 14 63 + 15 63 + 16 63 + 17 63 + 18 63 + 19 63 + 1a 63 + 1b 63 + 1c 64 + 20 65 + 21 63 + } + + method 'testStatement (Lpkg/TestSwitchOnEnumJ21$TestEnum;)V' { + 0 70 + 4 70 + 5 70 + 6 70 + 7 70 + 8 70 + 9 70 + a 70 + b 70 + c 70 + d 70 + e 70 + f 70 + 10 70 + 11 70 + 12 70 + 13 70 + 14 70 + 15 70 + 16 70 + 17 70 + 18 70 + 19 70 + 1a 70 + 1b 70 + 1c 70 + 1d 70 + 1e 70 + 1f 70 + 20 72 + 21 72 + 22 72 + 23 72 + 24 72 + 25 72 + 26 72 + 27 72 + 28 73 + 2b 75 + 2c 75 + 2d 75 + 2e 75 + 2f 75 + 30 75 + 31 75 + 32 75 + 33 76 + 36 78 + 37 78 + 38 78 + 39 78 + 3a 78 + 3b 78 + 3c 78 + 3d 78 + 3e 80 } method 'testStatementDefault (Lpkg/TestSwitchOnEnumJ21$TestEnum;)V' { - 0 32 - 4 32 - 18 34 - 19 34 - 1a 34 - 1b 34 - 1c 34 - 1d 34 - 1e 34 - 1f 34 - 20 35 - 23 37 - 24 37 - 25 37 - 26 37 - 27 37 - 28 37 - 2b 39 + 0 83 + 4 83 + 5 83 + 6 83 + 7 83 + 8 83 + 9 83 + a 83 + b 83 + c 83 + d 83 + e 83 + f 83 + 10 83 + 11 83 + 12 83 + 13 83 + 14 83 + 15 83 + 16 83 + 17 83 + 18 85 + 19 85 + 1a 85 + 1b 85 + 1c 85 + 1d 85 + 1e 85 + 1f 85 + 20 86 + 23 88 + 24 88 + 25 88 + 26 88 + 27 88 + 28 88 + 29 88 + 2a 88 + 2b 90 } } Lines mapping: -5 <-> 5 -6 <-> 6 7 <-> 7 8 <-> 8 -13 <-> 13 -14 <-> 14 +9 <-> 9 +10 <-> 10 15 <-> 15 -20 <-> 20 -22 <-> 22 +16 <-> 16 +17 <-> 17 +18 <-> 18 23 <-> 23 -25 <-> 25 -26 <-> 26 -28 <-> 28 -30 <-> 30 -33 <-> 33 -35 <-> 35 -36 <-> 36 -38 <-> 38 -40 <-> 40 \ No newline at end of file +24 <-> 25 +25 <-> 26 +26 <-> 27 +27 <-> 24 +32 <-> 32 +33 <-> 34 +34 <-> 35 +35 <-> 36 +36 <-> 33 +41 <-> 41 +42 <-> 42 +43 <-> 43 +45 <-> 45 +46 <-> 46 +47 <-> 47 +49 <-> 49 +50 <-> 50 +57 <-> 57 +58 <-> 58 +59 <-> 59 +64 <-> 64 +65 <-> 65 +66 <-> 66 +71 <-> 71 +73 <-> 73 +74 <-> 74 +76 <-> 76 +77 <-> 77 +79 <-> 79 +81 <-> 81 +84 <-> 84 +86 <-> 86 +87 <-> 87 +89 <-> 89 +91 <-> 91 diff --git a/testData/results/pkg/TestSwitchOnStrings.dec b/testData/results/pkg/TestSwitchOnStrings.dec index da052f9679..92c703c399 100644 --- a/testData/results/pkg/TestSwitchOnStrings.dec +++ b/testData/results/pkg/TestSwitchOnStrings.dec @@ -54,6 +54,31 @@ class 'pkg/TestSwitchOnStrings' { 33 7 34 7 3e 4 + 3f 4 + 40 4 + 41 4 + 42 4 + 43 4 + 44 4 + 45 4 + 46 4 + 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 58 6 59 6 5a 8 @@ -76,6 +101,41 @@ class 'pkg/TestSwitchOnStrings' { 65 20 66 20 70 15 + 71 15 + 72 15 + 73 15 + 74 15 + 75 15 + 76 15 + 77 15 + 78 15 + 79 15 + 7a 15 + 7b 15 + 7c 15 + 7d 15 + 7e 15 + 7f 15 + 80 15 + 81 15 + 82 15 + 83 15 + 84 15 + 85 15 + 86 15 + 87 15 + 88 15 + 89 15 + 8a 15 + 8b 15 + 8c 15 + 8d 15 + 8e 15 + 8f 15 + 90 15 + 91 15 + 92 15 + 93 15 94 17 95 17 96 19 @@ -104,6 +164,41 @@ class 'pkg/TestSwitchOnStrings' { 65 37 66 37 70 32 + 71 32 + 72 32 + 73 32 + 74 32 + 75 32 + 76 32 + 77 32 + 78 32 + 79 32 + 7a 32 + 7b 32 + 7c 32 + 7d 32 + 7e 32 + 7f 32 + 80 32 + 81 32 + 82 32 + 83 32 + 84 32 + 85 32 + 86 32 + 87 32 + 88 32 + 89 32 + 8a 32 + 8b 32 + 8c 32 + 8d 32 + 8e 32 + 8f 32 + 90 32 + 91 32 + 92 32 + 93 32 94 34 95 34 96 36 diff --git a/testData/results/pkg/TestSwitchOnlyDefault.dec b/testData/results/pkg/TestSwitchOnlyDefault.dec index bebe3df299..84c9cd4493 100644 --- a/testData/results/pkg/TestSwitchOnlyDefault.dec +++ b/testData/results/pkg/TestSwitchOnlyDefault.dec @@ -18,6 +18,16 @@ class 'pkg/TestSwitchOnlyDefault' { method 'test (I)V' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 c 6 d 6 e 6 @@ -32,6 +42,16 @@ class 'pkg/TestSwitchOnlyDefault' { method 'test2 (I)V' { 0 11 1 11 + 2 11 + 3 11 + 4 11 + 5 11 + 6 11 + 7 11 + 8 11 + 9 11 + a 11 + b 11 c 13 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching1.dec b/testData/results/pkg/TestSwitchPatternMatching1.dec index cfb82d736d..418cdc1c46 100644 --- a/testData/results/pkg/TestSwitchPatternMatching1.dec +++ b/testData/results/pkg/TestSwitchPatternMatching1.dec @@ -1,11 +1,8 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatching1 { public void test(Object o) { - Objects.requireNonNull(o);// 5 - switch (o) { + switch (o) {// 5 case Integer i:// 6 System.out.println(i); break; @@ -20,47 +17,73 @@ public class TestSwitchPatternMatching1 { class 'pkg/TestSwitchPatternMatching1' { method 'test (Ljava/lang/Object;)V' { - 0 6 - 2 6 - 3 6 - 4 6 - 9 7 - 10 7 - 30 8 - 31 8 - 32 9 - 33 9 - 34 9 - 35 9 - 36 9 - 37 9 - 38 9 - 39 9 - 3a 10 - 41 11 - 42 11 - 43 12 - 44 12 - 45 12 - 46 12 - 47 12 - 48 12 - 49 12 - 4a 12 - 4b 13 - 4e 15 - 4f 15 - 50 15 - 51 15 - 52 15 - 53 15 - 56 17 + 0 4 + 9 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 30 5 + 31 5 + 32 6 + 33 6 + 34 6 + 35 6 + 36 6 + 37 6 + 38 6 + 39 6 + 3a 7 + 41 8 + 42 8 + 43 9 + 44 9 + 45 9 + 46 9 + 47 9 + 48 9 + 49 9 + 4a 9 + 4b 10 + 4e 12 + 4f 12 + 50 12 + 51 12 + 52 12 + 53 12 + 54 12 + 55 12 + 56 14 } } Lines mapping: -5 <-> 7 -6 <-> 9 -7 <-> 12 -8 <-> 16 -10 <-> 18 +5 <-> 5 +6 <-> 6 +7 <-> 9 +8 <-> 13 +10 <-> 15 diff --git a/testData/results/pkg/TestSwitchPatternMatching10.dec b/testData/results/pkg/TestSwitchPatternMatching10.dec index 1dda92424c..2383d74e85 100644 --- a/testData/results/pkg/TestSwitchPatternMatching10.dec +++ b/testData/results/pkg/TestSwitchPatternMatching10.dec @@ -25,6 +25,30 @@ class 'pkg/TestSwitchPatternMatching10' { 37 8 38 8 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 + 5c 4 + 5d 4 + 5e 4 + 5f 4 60 6 61 6 62 6 @@ -49,6 +73,8 @@ class 'pkg/TestSwitchPatternMatching10' { 79 13 7a 13 7b 13 + 7c 13 + 7d 13 7e 15 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching11.dec b/testData/results/pkg/TestSwitchPatternMatching11.dec index 85091cccaa..14440177d4 100644 --- a/testData/results/pkg/TestSwitchPatternMatching11.dec +++ b/testData/results/pkg/TestSwitchPatternMatching11.dec @@ -20,12 +20,37 @@ class 'pkg/TestSwitchPatternMatching11' { 37 6 38 6 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 + 5c 4 + 5d 4 + 5e 4 + 5f 4 60 5 61 5 65 6 66 6 6a 7 6e 8 + 6f 8 70 4 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching12.dec b/testData/results/pkg/TestSwitchPatternMatching12.dec index e92a706a4a..ad73f01381 100644 --- a/testData/results/pkg/TestSwitchPatternMatching12.dec +++ b/testData/results/pkg/TestSwitchPatternMatching12.dec @@ -18,12 +18,61 @@ class 'pkg/TestSwitchPatternMatching12' { method 'testTriangle (ZLext/Direction;Lext/Direction;)I' { 0 6 1 6 + 2 6 + 3 6 4 6 8 6 9 6 b 8 + c 8 + d 8 11 8 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 + 24 8 + 25 8 + 26 8 + 27 8 + 28 8 + 29 8 + 2a 8 + 2b 8 + 2c 8 + 2d 8 + 2e 8 + 2f 8 + 30 8 + 31 8 + 32 8 + 33 8 + 34 8 + 35 8 + 36 8 + 37 8 + 38 8 + 39 8 + 3a 8 + 3b 8 + 3c 8 + 3d 8 + 3e 8 + 3f 8 + 40 8 + 41 8 + 42 8 + 43 8 + 44 8 + 45 8 + 46 8 + 47 8 48 10 4c 11 50 9 diff --git a/testData/results/pkg/TestSwitchPatternMatching13.dec b/testData/results/pkg/TestSwitchPatternMatching13.dec index f27170645d..20d07fc533 100644 --- a/testData/results/pkg/TestSwitchPatternMatching13.dec +++ b/testData/results/pkg/TestSwitchPatternMatching13.dec @@ -54,6 +54,38 @@ class 'pkg/TestSwitchPatternMatching13' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 30 10 31 10 32 10 @@ -68,12 +100,16 @@ class 'pkg/TestSwitchPatternMatching13' { 43 11 44 11 45 11 + 46 11 + 47 11 48 12 49 12 4a 12 4b 12 4c 12 4d 12 + 4e 12 + 4f 12 50 15 51 15 52 15 @@ -124,6 +160,8 @@ class 'pkg/TestSwitchPatternMatching13' { 9b 21 9c 21 9d 21 + 9e 21 + 9f 21 a0 23 a1 23 a2 23 @@ -147,12 +185,16 @@ class 'pkg/TestSwitchPatternMatching13' { be 28 bf 28 c0 28 + c1 28 + c2 28 c3 29 c4 29 c5 29 c6 29 c7 29 c8 29 + c9 29 + ca 29 cb 32 cc 32 cd 32 @@ -168,6 +210,8 @@ class 'pkg/TestSwitchPatternMatching13' { d9 6 da 6 db 6 + dc 6 + dd 6 de 7 df 7 e0 7 diff --git a/testData/results/pkg/TestSwitchPatternMatching14.dec b/testData/results/pkg/TestSwitchPatternMatching14.dec index 81c1e66849..122b4c2783 100644 --- a/testData/results/pkg/TestSwitchPatternMatching14.dec +++ b/testData/results/pkg/TestSwitchPatternMatching14.dec @@ -37,18 +37,46 @@ class 'pkg/TestSwitchPatternMatching14' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 28 10 29 11 2a 11 2b 11 2c 11 2d 11 + 2e 11 + 2f 11 30 12 31 12 32 12 33 12 34 12 35 12 + 36 12 + 37 12 38 15 39 15 3a 15 @@ -68,6 +96,8 @@ class 'pkg/TestSwitchPatternMatching14' { 4a 6 4b 6 4c 6 + 4d 6 + 4e 6 4f 7 50 7 51 7 @@ -82,6 +112,8 @@ class 'pkg/TestSwitchPatternMatching14' { 5d 18 5e 18 5f 18 + 60 18 + 61 18 62 20 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching15.dec b/testData/results/pkg/TestSwitchPatternMatching15.dec index 41379f8783..233d6e7c5f 100644 --- a/testData/results/pkg/TestSwitchPatternMatching15.dec +++ b/testData/results/pkg/TestSwitchPatternMatching15.dec @@ -30,12 +30,45 @@ class 'pkg/TestSwitchPatternMatching15' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 + 2c 7 + 2d 7 + 2e 7 + 2f 7 34 8 35 8 36 8 37 8 38 8 39 8 + 3a 8 + 3b 8 41 9 42 9 43 9 @@ -57,6 +90,8 @@ class 'pkg/TestSwitchPatternMatching15' { 59 11 5a 11 5b 11 + 5c 11 + 5d 11 63 12 64 12 65 12 diff --git a/testData/results/pkg/TestSwitchPatternMatching16.dec b/testData/results/pkg/TestSwitchPatternMatching16.dec index 8cdfb6b85d..ac90bca278 100644 --- a/testData/results/pkg/TestSwitchPatternMatching16.dec +++ b/testData/results/pkg/TestSwitchPatternMatching16.dec @@ -13,18 +13,18 @@ public class TestSwitchPatternMatching16 { System.out.println("Normal number: " + n);// 15 break;// 16 case Integer ix:// 18 - if (Math.random() < 0.5) {// 21 22 23 26 27 31 + if (Math.random() < 0.5) {// 31 int oh = 0;// 32 int hello = 3;// 33 } else { System.out.println("hello");// 36 } break; - case Number nx: - System.out.println("Number: " + nx); - break; + case Number nx:// 21 + System.out.println("Number: " + nx);// 22 + break;// 23 default: - System.out.println("default"); + System.out.println("default");// 26 } }// 38 } @@ -37,12 +37,45 @@ class 'pkg/TestSwitchPatternMatching16' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 + 2c 7 + 2d 7 + 2e 7 + 2f 7 34 8 35 8 36 8 37 8 38 8 39 8 + 3a 8 + 3b 8 41 9 42 9 43 9 @@ -64,6 +97,8 @@ class 'pkg/TestSwitchPatternMatching16' { 59 11 5a 11 5b 11 + 5c 11 + 5d 11 63 12 64 12 65 12 @@ -83,46 +118,37 @@ class 'pkg/TestSwitchPatternMatching16' { 79 15 7a 15 7b 15 - 7c 15 - 7d 15 - 7e 15 - 7f 15 - 80 15 - 81 15 - 82 15 - 83 15 - 84 15 - 85 15 - 86 15 - 87 15 - 88 15 - 89 15 - 8a 15 - 8b 15 - 8c 15 - 8d 15 - 8e 15 - 8f 15 - 90 15 - 91 15 - 92 15 - 93 15 - 94 15 - 95 15 - 96 15 - 97 15 - 98 15 - 99 15 - 9a 15 - 9b 15 - 9c 15 + 80 22 + 81 22 + 82 23 + 83 23 + 84 23 + 85 23 + 86 23 + 87 23 + 88 23 + 89 23 + 8a 23 + 8b 23 + 8c 23 + 8d 23 + 8e 23 + 8f 24 + 92 26 + 93 26 + 94 26 + 95 26 + 96 26 + 97 26 + 98 26 + 99 26 9d 15 9e 15 9f 15 a0 15 - a1 15 - a2 15 a3 15 + a4 15 + a5 15 a7 16 a8 16 a9 17 @@ -133,6 +159,8 @@ class 'pkg/TestSwitchPatternMatching16' { b1 19 b2 19 b3 19 + b4 19 + b5 19 b6 28 } } @@ -146,15 +174,15 @@ Lines mapping: 15 <-> 13 16 <-> 14 18 <-> 15 -21 <-> 16 -22 <-> 16 -23 <-> 16 -26 <-> 16 -27 <-> 16 +21 <-> 23 +22 <-> 24 +23 <-> 25 +26 <-> 27 31 <-> 16 32 <-> 17 33 <-> 18 36 <-> 20 38 <-> 29 Not mapped: +27 34 diff --git a/testData/results/pkg/TestSwitchPatternMatching17.dec b/testData/results/pkg/TestSwitchPatternMatching17.dec index 8862dfa336..b94d52b1e6 100644 --- a/testData/results/pkg/TestSwitchPatternMatching17.dec +++ b/testData/results/pkg/TestSwitchPatternMatching17.dec @@ -49,6 +49,25 @@ class 'pkg/TestSwitchPatternMatching17' { e 12 f 12 10 12 + 11 12 + 12 12 + 13 12 + 14 12 + 15 12 + 16 12 + 17 12 + 18 12 + 19 12 + 1a 12 + 1b 12 + 1c 12 + 1d 12 + 1e 12 + 1f 12 + 20 12 + 21 12 + 22 12 + 23 12 24 14 25 14 26 14 @@ -60,12 +79,39 @@ class 'pkg/TestSwitchPatternMatching17' { 2c 15 2d 15 2e 15 + 2f 15 + 30 15 + 31 15 + 32 15 + 33 15 + 34 15 + 35 15 + 36 15 + 37 15 + 38 15 + 39 15 + 3a 15 + 3b 15 + 3c 15 + 3d 15 + 3e 15 + 3f 15 + 40 15 + 41 15 + 42 15 + 43 15 + 44 15 + 45 15 + 46 15 + 47 15 4b 17 4c 17 4d 17 4e 17 4f 17 50 17 + 51 17 + 52 17 56 25 57 25 58 26 @@ -74,6 +120,8 @@ class 'pkg/TestSwitchPatternMatching17' { 5d 21 5e 21 5f 21 + 60 21 + 61 21 66 22 67 22 6b 22 diff --git a/testData/results/pkg/TestSwitchPatternMatching18.dec b/testData/results/pkg/TestSwitchPatternMatching18.dec index 3e07377c9a..a913ecdb44 100644 --- a/testData/results/pkg/TestSwitchPatternMatching18.dec +++ b/testData/results/pkg/TestSwitchPatternMatching18.dec @@ -69,6 +69,33 @@ class 'pkg/TestSwitchPatternMatching18' { 4 7 9 9 10 9 + 11 9 + 12 9 + 13 9 + 14 9 + 15 9 + 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 + 24 9 + 25 9 + 26 9 + 27 9 + 28 9 + 29 9 + 2a 9 + 2b 9 2c 11 2d 11 2e 11 @@ -86,6 +113,8 @@ class 'pkg/TestSwitchPatternMatching18' { 3d 13 3e 13 3f 13 + 40 13 + 41 13 47 14 48 14 49 14 @@ -109,6 +138,8 @@ class 'pkg/TestSwitchPatternMatching18' { 5f 16 60 16 61 16 + 62 16 + 63 16 69 17 6a 17 6b 17 @@ -133,6 +164,34 @@ class 'pkg/TestSwitchPatternMatching18' { 0 27 4 27 b 27 + c 27 + d 27 + e 27 + f 27 + 10 27 + 11 27 + 12 27 + 13 27 + 14 27 + 15 27 + 16 27 + 17 27 + 18 27 + 19 27 + 1a 27 + 1b 27 + 1c 27 + 1d 27 + 1e 27 + 1f 27 + 20 27 + 21 27 + 22 27 + 23 27 + 24 27 + 25 27 + 26 27 + 27 27 28 33 29 33 2a 33 @@ -159,6 +218,8 @@ class 'pkg/TestSwitchPatternMatching18' { 44 35 45 35 46 35 + 47 35 + 48 35 4e 36 4f 36 50 36 @@ -183,6 +244,34 @@ class 'pkg/TestSwitchPatternMatching18' { 0 46 4 46 b 46 + c 46 + d 46 + e 46 + f 46 + 10 46 + 11 46 + 12 46 + 13 46 + 14 46 + 15 46 + 16 46 + 17 46 + 18 46 + 19 46 + 1a 46 + 1b 46 + 1c 46 + 1d 46 + 1e 46 + 1f 46 + 20 46 + 21 46 + 22 46 + 23 46 + 24 46 + 25 46 + 26 46 + 27 46 28 52 29 52 2a 52 @@ -200,6 +289,8 @@ class 'pkg/TestSwitchPatternMatching18' { 39 54 3a 54 3b 54 + 3c 54 + 3d 54 43 55 44 55 45 55 diff --git a/testData/results/pkg/TestSwitchPatternMatching19.dec b/testData/results/pkg/TestSwitchPatternMatching19.dec index 2b790b95fc..76a5a64f11 100644 --- a/testData/results/pkg/TestSwitchPatternMatching19.dec +++ b/testData/results/pkg/TestSwitchPatternMatching19.dec @@ -5,10 +5,6 @@ public class TestSwitchPatternMatching19 { static void test(TestSwitchPatternMatching19.XXX s) { var1; switch (s) {// 5 - case null: - default: - System.out.println("f");// 11 - break; case X1: System.out.println("x1");// 6 break; @@ -22,6 +18,10 @@ public class TestSwitchPatternMatching19 { System.out.println("d"); break; case TestSwitchPatternMatching19.XXX var11 when false: + break; + case null: + default: + System.out.println("f");// 11 } }// 13 @@ -78,69 +78,108 @@ class 'pkg/TestSwitchPatternMatching19' { 0 6 4 6 b 6 - 30 12 - 31 12 - 32 12 - 33 12 - 34 12 - 35 12 - 36 12 - 37 12 - 38 13 - 3b 14 - 3d 14 - 3e 14 - 3f 14 - 40 14 - 41 14 - 49 15 - 4a 15 - 4b 15 - 4c 15 - 4d 15 - 4e 15 - 4f 15 - 50 15 - 51 16 - 54 17 - 57 17 - 58 17 - 59 17 - 5a 17 - 5b 17 - 64 18 - 65 18 - 66 18 - 67 18 - 68 18 - 69 18 - 6a 18 - 6b 18 - 6c 19 - 6f 20 - 72 20 - 73 20 - 74 20 - 75 20 - 76 20 - 7e 21 - 7f 21 - 80 21 - 81 21 - 82 21 - 83 21 - 84 21 - 85 21 - 86 22 - 94 9 - 95 9 - 96 9 - 97 9 - 98 9 - 99 9 - 9a 9 - 9b 9 - 9c 10 + c 6 + d 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 2c 6 + 2d 6 + 2e 6 + 2f 6 + 30 8 + 31 8 + 32 8 + 33 8 + 34 8 + 35 8 + 36 8 + 37 8 + 38 9 + 3b 10 + 3d 10 + 3e 10 + 3f 10 + 40 10 + 41 10 + 42 10 + 43 10 + 49 11 + 4a 11 + 4b 11 + 4c 11 + 4d 11 + 4e 11 + 4f 11 + 50 11 + 51 12 + 54 13 + 57 13 + 58 13 + 59 13 + 5a 13 + 5b 13 + 64 14 + 65 14 + 66 14 + 67 14 + 68 14 + 69 14 + 6a 14 + 6b 14 + 6c 15 + 6f 16 + 72 16 + 73 16 + 74 16 + 75 16 + 76 16 + 77 16 + 78 16 + 7e 17 + 7f 17 + 80 17 + 81 17 + 82 17 + 83 17 + 84 17 + 85 17 + 86 18 + 94 23 + 95 23 + 96 23 + 97 23 + 98 23 + 99 23 + 9a 23 + 9b 23 9f 25 } @@ -148,6 +187,34 @@ class 'pkg/TestSwitchPatternMatching19' { 0 28 4 28 b 28 + c 28 + d 28 + e 28 + f 28 + 10 28 + 11 28 + 12 28 + 13 28 + 14 28 + 15 28 + 16 28 + 17 28 + 18 28 + 19 28 + 1a 28 + 1b 28 + 1c 28 + 1d 28 + 1e 28 + 1f 28 + 20 28 + 21 28 + 22 28 + 23 28 + 24 28 + 25 28 + 26 28 + 27 28 28 34 29 34 2a 34 @@ -194,11 +261,11 @@ class 'pkg/TestSwitchPatternMatching19' { Lines mapping: 5 <-> 7 -6 <-> 13 -7 <-> 15 -8 <-> 18 -9 <-> 21 -11 <-> 10 +6 <-> 9 +7 <-> 11 +8 <-> 14 +9 <-> 17 +11 <-> 24 13 <-> 26 16 <-> 29 17 <-> 35 diff --git a/testData/results/pkg/TestSwitchPatternMatching2.dec b/testData/results/pkg/TestSwitchPatternMatching2.dec index 8b74613ff9..b4ed6adec6 100644 --- a/testData/results/pkg/TestSwitchPatternMatching2.dec +++ b/testData/results/pkg/TestSwitchPatternMatching2.dec @@ -34,6 +34,30 @@ class 'pkg/TestSwitchPatternMatching2' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 28 8 29 8 2a 8 diff --git a/testData/results/pkg/TestSwitchPatternMatching20.dec b/testData/results/pkg/TestSwitchPatternMatching20.dec index f303aa7bdd..aa7178ff41 100644 --- a/testData/results/pkg/TestSwitchPatternMatching20.dec +++ b/testData/results/pkg/TestSwitchPatternMatching20.dec @@ -8,8 +8,8 @@ public class TestSwitchPatternMatching20 { switch (o) { case Integer var6 when false: break; - case String s: - System.out.println(s);// 7 + case String s:// 7 + System.out.println(s); break; default: System.out.println("Default");// 8 @@ -25,6 +25,33 @@ class 'pkg/TestSwitchPatternMatching20' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 3b 10 3c 10 3d 11 @@ -50,7 +77,7 @@ class 'pkg/TestSwitchPatternMatching20' { Lines mapping: 5 <-> 7 -7 <-> 12 +7 <-> 11 8 <-> 15 10 <-> 17 Not mapped: diff --git a/testData/results/pkg/TestSwitchPatternMatching21.dec b/testData/results/pkg/TestSwitchPatternMatching21.dec index c3d5d1d28c..2e99a40bd6 100644 --- a/testData/results/pkg/TestSwitchPatternMatching21.dec +++ b/testData/results/pkg/TestSwitchPatternMatching21.dec @@ -30,10 +30,6 @@ public class TestSwitchPatternMatching21 { public void test2(String it) { switch (it) {// 19 - case null: - default: - System.out.println(it + "?");// 26 27 - break; case "": System.out.println("nothing");// 20 break; @@ -45,6 +41,10 @@ public class TestSwitchPatternMatching21 { break; case String var8 when Math.random() > 0.0: System.out.println(it + "!!");// 24 25 + break; + case null: + default: + System.out.println(it + "?");// 26 27 } }// 29 @@ -74,6 +74,41 @@ class 'pkg/TestSwitchPatternMatching21' { 4 7 9 9 10 9 + 11 9 + 12 9 + 13 9 + 14 9 + 15 9 + 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 + 24 9 + 25 9 + 26 9 + 27 9 + 28 9 + 29 9 + 2a 9 + 2b 9 + 2c 9 + 2d 9 + 2e 9 + 2f 9 + 30 9 + 31 9 + 32 9 + 33 9 34 11 35 11 36 11 @@ -169,79 +204,113 @@ class 'pkg/TestSwitchPatternMatching21' { 0 31 4 31 b 31 - 2c 37 - 2d 37 - 2e 37 - 2f 37 - 30 37 - 31 37 - 32 37 - 33 37 - 34 38 - 37 40 - 38 40 - 39 40 - 3a 40 - 3b 40 - 3c 40 - 3d 40 - 3e 40 - 3f 41 - 42 43 - 45 42 - 46 42 - 47 42 - 48 42 - 49 42 - 52 43 - 53 43 - 54 43 - 55 43 - 56 43 - 57 43 - 58 43 - 59 43 - 5a 43 - 5b 43 - 5c 43 - 5d 43 - 5e 43 - 5f 44 - 62 46 - 65 45 - 66 45 - 67 45 - 68 45 - 69 45 - 6a 45 - 72 46 - 73 46 - 74 46 - 75 46 - 76 46 - 77 46 - 78 46 - 79 46 - 7a 46 - 7b 46 - 7c 46 - 7d 46 - 7e 46 - 82 34 - 85 34 - 86 34 - 87 34 - 88 34 - 89 34 - 8a 34 - 8b 34 - 8c 34 - 8d 34 - 8e 34 - 8f 34 - 90 34 - 91 34 - 92 35 + c 31 + d 31 + e 31 + f 31 + 10 31 + 11 31 + 12 31 + 13 31 + 14 31 + 15 31 + 16 31 + 17 31 + 18 31 + 19 31 + 1a 31 + 1b 31 + 1c 31 + 1d 31 + 1e 31 + 1f 31 + 20 31 + 21 31 + 22 31 + 23 31 + 24 31 + 25 31 + 26 31 + 27 31 + 28 31 + 29 31 + 2a 31 + 2b 31 + 2c 33 + 2d 33 + 2e 33 + 2f 33 + 30 33 + 31 33 + 32 33 + 33 33 + 34 34 + 37 36 + 38 36 + 39 36 + 3a 36 + 3b 36 + 3c 36 + 3d 36 + 3e 36 + 3f 37 + 42 39 + 45 38 + 46 38 + 47 38 + 48 38 + 49 38 + 52 39 + 53 39 + 54 39 + 55 39 + 56 39 + 57 39 + 58 39 + 59 39 + 5a 39 + 5b 39 + 5c 39 + 5d 39 + 5e 39 + 5f 40 + 62 42 + 65 41 + 66 41 + 67 41 + 68 41 + 69 41 + 6a 41 + 6b 41 + 6c 41 + 72 42 + 73 42 + 74 42 + 75 42 + 76 42 + 77 42 + 78 42 + 79 42 + 7a 42 + 7b 42 + 7c 42 + 7d 42 + 7e 42 + 7f 43 + 82 46 + 85 46 + 86 46 + 87 46 + 88 46 + 89 46 + 8a 46 + 8b 46 + 8c 46 + 8d 46 + 8e 46 + 8f 46 + 90 46 + 91 46 95 48 } @@ -249,6 +318,34 @@ class 'pkg/TestSwitchPatternMatching21' { 0 51 4 51 b 51 + c 51 + d 51 + e 51 + f 51 + 10 51 + 11 51 + 12 51 + 13 51 + 14 51 + 15 51 + 16 51 + 17 51 + 18 51 + 19 51 + 1a 51 + 1b 51 + 1c 51 + 1d 51 + 1e 51 + 1f 51 + 20 51 + 21 51 + 22 51 + 23 51 + 24 51 + 25 51 + 26 51 + 27 51 28 54 29 54 2a 54 @@ -312,14 +409,14 @@ Lines mapping: 14 <-> 27 16 <-> 29 19 <-> 32 -20 <-> 38 -21 <-> 41 -22 <-> 44 -23 <-> 44 -24 <-> 47 -25 <-> 47 -26 <-> 35 -27 <-> 35 +20 <-> 34 +21 <-> 37 +22 <-> 40 +23 <-> 40 +24 <-> 43 +25 <-> 43 +26 <-> 47 +27 <-> 47 29 <-> 49 32 <-> 52 33 <-> 55 diff --git a/testData/results/pkg/TestSwitchPatternMatching22.dec b/testData/results/pkg/TestSwitchPatternMatching22.dec index c6208b9d92..53a786e664 100644 --- a/testData/results/pkg/TestSwitchPatternMatching22.dec +++ b/testData/results/pkg/TestSwitchPatternMatching22.dec @@ -1,16 +1,11 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatching22 { public void test1() { try { System.out.println("hello");// 13 } catch (Exception var8) {// 14 - Object var10000 = new Object(); - Objects.requireNonNull(var10000);// 15 - Object var2 = var10000; - switch (var2) { + switch (new Object()) {// 15 case Short var4:// 19 break; default: @@ -26,10 +21,7 @@ public class TestSwitchPatternMatching22 { try { System.out.println("hello");// 28 } catch (Exception var8) {// 29 - Object var10000 = new Object(); - Objects.requireNonNull(var10000);// 30 - Object var2 = var10000; - switch (var2) { + switch (new Object()) {// 30 case Short var4:// 34 default: System.out.println("Not a short");// 32 @@ -44,8 +36,7 @@ public class TestSwitchPatternMatching22 { try { System.out.println("hello");// 43 } catch (Exception var8) {// 44 - Object var2 = new Object();// 45 - switch (var2) { + switch (new Object()) {// 45 case Short var4:// 50 case null: break; @@ -62,8 +53,7 @@ public class TestSwitchPatternMatching22 { try { System.out.println("hello");// 59 } catch (Exception var8) {// 60 - Object var2 = new Object(); - switch (var2) {// 61 + switch (new Object()) {// 61 case Short var4:// 66 case null: default: @@ -94,183 +84,292 @@ public class TestSwitchPatternMatching22 { class 'pkg/TestSwitchPatternMatching22' { method 'test1 ()V' { - 0 7 - 1 7 - 2 7 - 3 7 - 4 7 - 5 7 - 13 8 - 1c 10 - 1d 10 - 1e 10 - 20 11 - 23 12 - 2a 12 - 3c 16 - 3d 16 - 3e 16 - 3f 16 - 40 16 - 41 16 - 42 16 - 43 16 - 4b 17 - 50 13 - 51 13 - 5f 20 - 60 20 - 61 20 - 62 20 - 63 20 - 64 20 - 6a 22 + 0 5 + 1 5 + 2 5 + 3 5 + 4 5 + 5 5 + 6 5 + 7 5 + 13 6 + 2a 7 + 2b 7 + 2c 7 + 2d 7 + 2e 7 + 2f 7 + 30 7 + 31 7 + 32 7 + 33 7 + 34 7 + 35 7 + 36 7 + 37 7 + 38 7 + 39 7 + 3a 7 + 3b 7 + 3c 11 + 3d 11 + 3e 11 + 3f 11 + 40 11 + 41 11 + 42 11 + 43 11 + 4b 12 + 50 8 + 51 8 + 5f 15 + 60 15 + 61 15 + 62 15 + 63 15 + 64 15 + 65 15 + 66 15 + 6a 17 } method 'test2 ()V' { - 0 26 - 1 26 - 2 26 - 3 26 - 4 26 - 5 26 - 10 27 - 19 29 - 1a 29 - 1b 29 - 1d 30 - 20 31 - 27 31 - 38 34 - 39 34 - 3a 34 - 3b 34 - 3c 34 - 3d 34 - 3e 34 - 3f 34 - 47 35 - 4c 32 - 4d 32 - 5f 38 + 0 21 + 1 21 + 2 21 + 3 21 + 4 21 + 5 21 + 6 21 + 7 21 + 10 22 + 27 23 + 28 23 + 29 23 + 2a 23 + 2b 23 + 2c 23 + 2d 23 + 2e 23 + 2f 23 + 30 23 + 31 23 + 32 23 + 33 23 + 34 23 + 35 23 + 36 23 + 37 23 + 38 26 + 39 26 + 3a 26 + 3b 26 + 3c 26 + 3d 26 + 3e 26 + 3f 26 + 47 27 + 4c 24 + 4d 24 + 5f 30 } method 'test1Null ()V' { - 0 44 - 1 44 - 2 44 - 3 44 - 4 44 - 5 44 - 13 45 - 1b 46 - 1e 47 - 25 47 - 40 52 - 41 52 - 42 52 - 43 52 - 44 52 - 45 52 - 46 52 - 47 52 - 4f 53 - 54 48 - 55 48 - 63 56 - 64 56 - 65 56 - 66 56 - 67 56 - 68 56 - 6e 58 + 0 36 + 1 36 + 2 36 + 3 36 + 4 36 + 5 36 + 6 36 + 7 36 + 13 37 + 25 38 + 26 38 + 27 38 + 28 38 + 29 38 + 2a 38 + 2b 38 + 2c 38 + 2d 38 + 2e 38 + 2f 38 + 30 38 + 31 38 + 32 38 + 33 38 + 34 38 + 35 38 + 36 38 + 37 38 + 38 38 + 39 38 + 3a 38 + 3b 38 + 3c 38 + 3d 38 + 3e 38 + 3f 38 + 40 43 + 41 43 + 42 43 + 43 43 + 44 43 + 45 43 + 46 43 + 47 43 + 4f 44 + 54 39 + 55 39 + 63 47 + 64 47 + 65 47 + 66 47 + 67 47 + 68 47 + 69 47 + 6a 47 + 6e 49 } method 'test2Null ()V' { - 0 62 - 1 62 - 2 62 - 3 62 - 4 62 - 5 62 - 10 63 - 18 64 - 1b 65 - 22 65 - 3c 69 - 3d 69 - 3e 69 - 3f 69 - 40 69 - 41 69 - 42 69 - 43 69 - 4b 70 - 50 66 - 51 66 - 63 73 + 0 53 + 1 53 + 2 53 + 3 53 + 4 53 + 5 53 + 6 53 + 7 53 + 10 54 + 22 55 + 23 55 + 24 55 + 25 55 + 26 55 + 27 55 + 28 55 + 29 55 + 2a 55 + 2b 55 + 2c 55 + 2d 55 + 2e 55 + 2f 55 + 30 55 + 31 55 + 32 55 + 33 55 + 34 55 + 35 55 + 36 55 + 37 55 + 38 55 + 39 55 + 3a 55 + 3b 55 + 3c 59 + 3d 59 + 3e 59 + 3f 59 + 40 59 + 41 59 + 42 59 + 43 59 + 4b 60 + 50 56 + 51 56 + 63 63 } method 'testNonPattern ()V' { - 0 79 - 1 79 - 2 79 - 3 79 - 4 79 - 5 79 - 10 80 - 11 81 - 12 81 - 2c 85 - 2d 85 - 2e 85 - 2f 85 - 30 85 - 31 85 - 32 85 - 33 85 - 3b 86 - 4c 89 + 0 69 + 1 69 + 2 69 + 3 69 + 4 69 + 5 69 + 6 69 + 7 69 + 10 70 + 11 71 + 12 71 + 13 71 + 14 71 + 15 71 + 16 71 + 17 71 + 18 71 + 19 71 + 1a 71 + 1b 71 + 1c 71 + 1d 71 + 1e 71 + 1f 71 + 20 71 + 21 71 + 22 71 + 23 71 + 24 71 + 25 71 + 26 71 + 27 71 + 28 71 + 29 71 + 2a 71 + 2b 71 + 2c 75 + 2d 75 + 2e 75 + 2f 75 + 30 75 + 31 75 + 32 75 + 33 75 + 3b 76 + 4c 79 } } Lines mapping: -13 <-> 8 -14 <-> 9 -15 <-> 11 -17 <-> 17 -18 <-> 18 -19 <-> 14 -22 <-> 21 -24 <-> 23 -28 <-> 27 -29 <-> 28 -30 <-> 30 -32 <-> 35 -33 <-> 36 -34 <-> 33 -37 <-> 39 -43 <-> 45 -44 <-> 46 -45 <-> 47 -47 <-> 53 -48 <-> 54 -50 <-> 49 -53 <-> 57 -55 <-> 59 -59 <-> 63 -60 <-> 64 -61 <-> 66 -63 <-> 70 -64 <-> 71 -66 <-> 67 -69 <-> 74 -75 <-> 80 -76 <-> 81 -77 <-> 82 -79 <-> 86 -80 <-> 87 -85 <-> 90 +13 <-> 6 +14 <-> 7 +15 <-> 8 +17 <-> 12 +18 <-> 13 +19 <-> 9 +22 <-> 16 +24 <-> 18 +28 <-> 22 +29 <-> 23 +30 <-> 24 +32 <-> 27 +33 <-> 28 +34 <-> 25 +37 <-> 31 +43 <-> 37 +44 <-> 38 +45 <-> 39 +47 <-> 44 +48 <-> 45 +50 <-> 40 +53 <-> 48 +55 <-> 50 +59 <-> 54 +60 <-> 55 +61 <-> 56 +63 <-> 60 +64 <-> 61 +66 <-> 57 +69 <-> 64 +75 <-> 70 +76 <-> 71 +77 <-> 72 +79 <-> 76 +80 <-> 77 +85 <-> 80 Not mapped: 23 54 diff --git a/testData/results/pkg/TestSwitchPatternMatching3.dec b/testData/results/pkg/TestSwitchPatternMatching3.dec index f7897b96ed..8b90bea7b2 100644 --- a/testData/results/pkg/TestSwitchPatternMatching3.dec +++ b/testData/results/pkg/TestSwitchPatternMatching3.dec @@ -17,6 +17,22 @@ class 'pkg/TestSwitchPatternMatching3' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 6 1d 6 1e 6 @@ -32,6 +48,8 @@ class 'pkg/TestSwitchPatternMatching3' { 2a 9 2b 9 2c 9 + 2d 9 + 2e 9 2f 11 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching4.dec b/testData/results/pkg/TestSwitchPatternMatching4.dec index b0511c17f4..7b82360cfb 100644 --- a/testData/results/pkg/TestSwitchPatternMatching4.dec +++ b/testData/results/pkg/TestSwitchPatternMatching4.dec @@ -1,11 +1,8 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatching4 { static void test(Object s) { - Objects.requireNonNull(s);// 5 - switch (s) { + switch (s) {// 5 default: System.out.println("default");// 7 } @@ -14,25 +11,33 @@ public class TestSwitchPatternMatching4 { class 'pkg/TestSwitchPatternMatching4' { method 'test (Ljava/lang/Object;)V' { - 0 6 - 2 6 - 3 6 - 4 6 - 9 7 - 10 7 - 1c 9 - 1d 9 - 1e 9 - 1f 9 - 20 9 - 21 9 - 22 9 - 23 9 - 24 11 + 0 4 + 9 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 8 } } Lines mapping: -5 <-> 7 -7 <-> 10 -9 <-> 12 +5 <-> 5 +7 <-> 7 +9 <-> 9 diff --git a/testData/results/pkg/TestSwitchPatternMatching5.dec b/testData/results/pkg/TestSwitchPatternMatching5.dec index 665cca4729..5c3b0633af 100644 --- a/testData/results/pkg/TestSwitchPatternMatching5.dec +++ b/testData/results/pkg/TestSwitchPatternMatching5.dec @@ -40,6 +40,38 @@ class 'pkg/TestSwitchPatternMatching5' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 30 8 31 8 32 8 diff --git a/testData/results/pkg/TestSwitchPatternMatching6.dec b/testData/results/pkg/TestSwitchPatternMatching6.dec index e9c6eae9a0..b01ef8397b 100644 --- a/testData/results/pkg/TestSwitchPatternMatching6.dec +++ b/testData/results/pkg/TestSwitchPatternMatching6.dec @@ -16,8 +16,55 @@ class 'pkg/TestSwitchPatternMatching6' { method 'testTriangle (Lext/Direction;)I' { 0 6 3 6 + 4 6 + 5 6 9 6 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 28 6 + 29 6 + 2a 6 + 2b 6 + 2c 6 + 2d 6 + 2e 6 + 2f 6 + 30 6 + 31 6 + 32 6 + 33 6 + 34 6 + 35 6 + 36 6 + 37 6 + 38 6 + 39 6 + 3a 6 + 3b 6 + 3c 6 + 3d 6 + 3e 6 + 3f 6 40 8 44 9 48 7 diff --git a/testData/results/pkg/TestSwitchPatternMatching7.dec b/testData/results/pkg/TestSwitchPatternMatching7.dec index 4c575e37b8..f5b53b9d24 100644 --- a/testData/results/pkg/TestSwitchPatternMatching7.dec +++ b/testData/results/pkg/TestSwitchPatternMatching7.dec @@ -15,6 +15,22 @@ class 'pkg/TestSwitchPatternMatching7' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 1c 7 1d 7 1e 7 diff --git a/testData/results/pkg/TestSwitchPatternMatching8.dec b/testData/results/pkg/TestSwitchPatternMatching8.dec index 5e2d1424c6..27c1c9f42a 100644 --- a/testData/results/pkg/TestSwitchPatternMatching8.dec +++ b/testData/results/pkg/TestSwitchPatternMatching8.dec @@ -19,11 +19,36 @@ class 'pkg/TestSwitchPatternMatching8' { 37 6 38 6 47 4 + 48 4 + 49 4 + 4a 4 + 4b 4 + 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 + 5c 4 + 5d 4 + 5e 4 + 5f 4 60 5 61 5 65 6 66 6 6a 7 + 6b 7 6c 4 } } diff --git a/testData/results/pkg/TestSwitchPatternMatching9.dec b/testData/results/pkg/TestSwitchPatternMatching9.dec index 220d587459..b6ce00a86a 100644 --- a/testData/results/pkg/TestSwitchPatternMatching9.dec +++ b/testData/results/pkg/TestSwitchPatternMatching9.dec @@ -22,6 +22,36 @@ class 'pkg/TestSwitchPatternMatching9' { 4d 7 4e 7 5d 4 + 5e 4 + 5f 4 + 60 4 + 61 4 + 62 4 + 63 4 + 64 4 + 65 4 + 66 4 + 67 4 + 68 4 + 69 4 + 6a 4 + 6b 4 + 6c 4 + 6d 4 + 6e 4 + 6f 4 + 70 4 + 71 4 + 72 4 + 73 4 + 74 4 + 75 4 + 76 4 + 77 4 + 78 4 + 79 4 + 7a 4 + 7b 4 7c 5 7d 5 81 6 @@ -29,6 +59,7 @@ class 'pkg/TestSwitchPatternMatching9' { 86 7 87 7 8b 8 + 8c 8 8d 4 } } diff --git a/testData/results/pkg/TestSwitchPatternMatchingConstructor1.dec b/testData/results/pkg/TestSwitchPatternMatchingConstructor1.dec index 79b7a70994..44699cc3eb 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingConstructor1.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingConstructor1.dec @@ -42,6 +42,33 @@ class 'pkg/TestSwitchPatternMatchingConstructor1' { 1 8 5 8 c 8 + d 8 + e 8 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 + 24 8 + 25 8 + 26 8 + 27 8 2c 10 2d 10 2e 10 diff --git a/testData/results/pkg/TestSwitchPatternMatchingConstructor2.dec b/testData/results/pkg/TestSwitchPatternMatchingConstructor2.dec index 7bd20af9d5..a5721628e9 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingConstructor2.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingConstructor2.dec @@ -1,7 +1,5 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatchingConstructor2 { private TestSwitchPatternMatchingConstructor2(String s) { System.out.println(s);// 5 @@ -15,7 +13,6 @@ public class TestSwitchPatternMatchingConstructor2 { }// 13 private TestSwitchPatternMatchingConstructor2(Object s, boolean unused) { - Objects.requireNonNull(s); switch (s) { default: this("Non-triangle");// 16 17 @@ -25,54 +22,79 @@ public class TestSwitchPatternMatchingConstructor2 { class 'pkg/TestSwitchPatternMatchingConstructor2' { method ' (Ljava/lang/String;)V' { - 4 6 - 5 6 - 6 6 - 7 6 - 8 6 - 9 6 - a 6 - b 7 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 5 } method ' (Ljava/lang/Object;)V' { - 1 10 - 5 10 - c 10 - 20 11 - 21 11 - 25 12 - 27 10 - 28 10 - 29 10 - 2a 14 + 1 8 + 5 8 + c 8 + d 8 + e 8 + f 8 + 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 9 + 21 9 + 25 10 + 26 10 + 27 8 + 28 8 + 29 8 + 2a 12 } method ' (Ljava/lang/Object;Z)V' { - 1 17 - 3 17 - 4 17 - 5 17 - b 18 - 13 18 - 1c 20 - 1d 20 - 1e 20 - 1f 20 - 20 20 - 21 22 + 1 15 + b 15 + 13 15 + 14 15 + 15 15 + 16 15 + 17 15 + 18 15 + 19 15 + 1a 15 + 1b 15 + 1c 17 + 1d 17 + 1e 17 + 1f 17 + 20 17 + 21 19 } } Lines mapping: -5 <-> 7 -6 <-> 8 -9 <-> 11 -10 <-> 12 -11 <-> 13 -13 <-> 15 -16 <-> 21 -17 <-> 21 -19 <-> 23 +5 <-> 5 +6 <-> 6 +9 <-> 9 +10 <-> 10 +11 <-> 11 +13 <-> 13 +16 <-> 18 +17 <-> 18 +19 <-> 20 Not mapped: 4 diff --git a/testData/results/pkg/TestSwitchPatternMatchingFuzz1.dec b/testData/results/pkg/TestSwitchPatternMatchingFuzz1.dec index 7b3a89ce63..81ffe8b1ab 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingFuzz1.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingFuzz1.dec @@ -41,6 +41,23 @@ class 'pkg/TestSwitchPatternMatchingFuzz1' { c 8 f 9 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 + 24 9 + 25 9 + 26 9 + 27 9 2f 30 30 11 31 11 @@ -63,6 +80,8 @@ class 'pkg/TestSwitchPatternMatchingFuzz1' { 44 15 45 15 46 15 + 47 15 + 48 15 49 16 4a 16 4b 16 diff --git a/testData/results/pkg/TestSwitchPatternMatchingInstanceof1.dec b/testData/results/pkg/TestSwitchPatternMatchingInstanceof1.dec index 067a747473..8ab527681a 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingInstanceof1.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingInstanceof1.dec @@ -29,6 +29,33 @@ class 'pkg/TestSwitchPatternMatchingInstanceof1' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 30 8 31 8 32 8 @@ -36,21 +63,18 @@ class 'pkg/TestSwitchPatternMatchingInstanceof1' { 34 8 35 8 36 8 + 37 8 + 38 8 3d 8 3e 8 3f 9 40 9 41 9 - 42 9 - 43 9 - 44 9 - 45 9 - 46 9 47 9 48 9 - 49 9 4a 9 4b 9 + 4c 9 4f 10 56 11 57 11 diff --git a/testData/results/pkg/TestSwitchPatternMatchingInstanceof2.dec b/testData/results/pkg/TestSwitchPatternMatchingInstanceof2.dec index 43e9ce8cd4..5e91307acd 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingInstanceof2.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingInstanceof2.dec @@ -29,6 +29,33 @@ class 'pkg/TestSwitchPatternMatchingInstanceof2' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 30 8 31 8 32 8 @@ -37,21 +64,18 @@ class 'pkg/TestSwitchPatternMatchingInstanceof2' { 35 8 36 8 37 8 + 38 8 + 39 8 3f 8 40 8 41 9 42 9 43 9 - 44 9 - 45 9 - 46 9 - 47 9 - 48 9 49 9 4a 9 - 4b 9 4c 9 4d 9 + 4e 9 51 10 58 11 59 11 diff --git a/testData/results/pkg/TestSwitchPatternMatchingInstanceof3.dec b/testData/results/pkg/TestSwitchPatternMatchingInstanceof3.dec index f205d70f71..ba5defe6c2 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingInstanceof3.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingInstanceof3.dec @@ -29,6 +29,33 @@ class 'pkg/TestSwitchPatternMatchingInstanceof3' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 + 24 7 + 25 7 + 26 7 + 27 7 + 28 7 + 29 7 + 2a 7 + 2b 7 30 8 31 8 32 8 @@ -37,6 +64,8 @@ class 'pkg/TestSwitchPatternMatchingInstanceof3' { 35 8 36 8 37 8 + 38 8 + 39 8 3f 8 40 8 41 8 @@ -45,6 +74,8 @@ class 'pkg/TestSwitchPatternMatchingInstanceof3' { 44 8 45 8 46 8 + 47 8 + 48 8 4e 9 4f 9 50 9 diff --git a/testData/results/pkg/TestSwitchPatternMatchingInstanceof4.dec b/testData/results/pkg/TestSwitchPatternMatchingInstanceof4.dec index 529ece6b54..b8eb47d23b 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingInstanceof4.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingInstanceof4.dec @@ -23,6 +23,25 @@ class 'pkg/TestSwitchPatternMatchingInstanceof4' { 4 6 9 7 10 7 + 11 7 + 12 7 + 13 7 + 14 7 + 15 7 + 16 7 + 17 7 + 18 7 + 19 7 + 1a 7 + 1b 7 + 1c 7 + 1d 7 + 1e 7 + 1f 7 + 20 7 + 21 7 + 22 7 + 23 7 28 8 29 8 2a 8 @@ -30,6 +49,8 @@ class 'pkg/TestSwitchPatternMatchingInstanceof4' { 2c 8 2d 8 2e 8 + 2f 8 + 30 8 35 8 36 8 37 8 @@ -43,19 +64,15 @@ class 'pkg/TestSwitchPatternMatchingInstanceof4' { 43 8 44 8 45 8 + 46 8 + 47 8 4d 8 4e 8 4f 9 50 9 51 9 - 52 9 - 53 9 - 54 9 - 55 9 - 56 9 57 9 58 9 - 59 9 5a 9 5b 9 5c 9 @@ -63,8 +80,6 @@ class 'pkg/TestSwitchPatternMatchingInstanceof4' { 5e 9 5f 9 60 9 - 61 9 - 62 9 66 10 69 12 6a 12 diff --git a/testData/results/pkg/TestSwitchPatternMatchingJ21.dec b/testData/results/pkg/TestSwitchPatternMatchingJ21.dec new file mode 100644 index 0000000000..b72e28ef3b --- /dev/null +++ b/testData/results/pkg/TestSwitchPatternMatchingJ21.dec @@ -0,0 +1,197 @@ +package pkg; + +import java.util.function.Supplier; + +public class TestSwitchPatternMatchingJ21 { + public void test1(Object o) { + System.out.println(switch (o) {// 7 + case Integer i -> Integer.toString(i);// 8 + case null, default -> "null";// 9 + }); + }// 11 + + public String test2(Object o) { + return switch (o) {// 14 + case Integer i -> Integer.toString(i);// 15 + case String s -> s;// 16 + default -> "null";// 17 + }; + } + + public String test3(Supplier o) { + return switch (o.get()) {// 22 + case Integer i -> Integer.toString(i);// 23 + case String s -> s;// 24 + default -> "null";// 25 + }; + } +} + +class 'pkg/TestSwitchPatternMatchingJ21' { + method 'test1 (Ljava/lang/Object;)V' { + 0 6 + 1 6 + 2 6 + 3 6 + 7 6 + e 6 + f 6 + 10 6 + 11 6 + 12 6 + 13 6 + 14 6 + 15 6 + 16 6 + 17 6 + 18 6 + 19 6 + 1a 6 + 1b 6 + 1c 6 + 1d 6 + 1e 6 + 1f 6 + 20 6 + 21 6 + 22 6 + 23 6 + 24 6 + 25 6 + 26 6 + 27 6 + 2c 7 + 2d 7 + 2e 7 + 2f 7 + 30 7 + 31 7 + 32 7 + 33 7 + 34 7 + 35 7 + 39 8 + 3a 8 + 3b 6 + 3c 6 + 3d 6 + 3e 10 + } + + method 'test2 (Ljava/lang/Object;)Ljava/lang/String;' { + 0 13 + 9 13 + 10 13 + 11 13 + 12 13 + 13 13 + 14 13 + 15 13 + 16 13 + 17 13 + 18 13 + 19 13 + 1a 13 + 1b 13 + 1c 13 + 1d 13 + 1e 13 + 1f 13 + 20 13 + 21 13 + 22 13 + 23 13 + 24 13 + 25 13 + 26 13 + 27 13 + 28 13 + 29 13 + 2a 13 + 2b 13 + 30 14 + 31 14 + 32 14 + 33 14 + 34 14 + 35 14 + 36 14 + 37 14 + 38 14 + 39 14 + 41 15 + 42 15 + 43 15 + 44 15 + 48 16 + 49 16 + 4a 13 + } + + method 'test3 (Ljava/util/function/Supplier;)Ljava/lang/String;' { + 0 21 + 1 21 + 2 21 + 3 21 + 4 21 + 5 21 + 15 21 + 16 21 + 17 21 + 18 21 + 19 21 + 1a 21 + 1b 21 + 1c 21 + 1d 21 + 1e 21 + 1f 21 + 20 21 + 21 21 + 22 21 + 23 21 + 24 21 + 25 21 + 26 21 + 27 21 + 28 21 + 29 21 + 2a 21 + 2b 21 + 2c 21 + 2d 21 + 2e 21 + 2f 21 + 34 22 + 35 22 + 36 22 + 37 22 + 38 22 + 39 22 + 3a 22 + 3b 22 + 3c 22 + 3d 22 + 45 23 + 46 23 + 47 23 + 48 23 + 4c 24 + 4d 24 + 4e 21 + } +} + +Lines mapping: +7 <-> 7 +8 <-> 8 +9 <-> 9 +11 <-> 11 +14 <-> 14 +15 <-> 15 +16 <-> 16 +17 <-> 17 +22 <-> 22 +23 <-> 23 +24 <-> 24 +25 <-> 25 diff --git a/testData/results/pkg/TestSwitchPatternMatchingLoop.dec b/testData/results/pkg/TestSwitchPatternMatchingLoop.dec index e833beb523..eb324d4021 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingLoop.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingLoop.dec @@ -1,12 +1,9 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatchingLoop { public void test(Object o) { while (true) { - Objects.requireNonNull(o);// 6 - switch (o) { + switch (o) {// 6 case Integer i:// 7 System.out.println(i); break; @@ -22,45 +19,71 @@ public class TestSwitchPatternMatchingLoop { class 'pkg/TestSwitchPatternMatchingLoop' { method 'test (Ljava/lang/Object;)V' { - 0 7 - 2 7 - 3 7 - 4 7 - 9 8 - 10 8 - 30 9 - 31 9 - 32 10 - 33 10 - 34 10 - 35 10 - 36 10 - 37 10 - 38 10 - 39 10 - 3a 11 - 41 12 - 42 12 - 43 13 - 44 13 - 45 13 - 46 13 - 47 13 - 48 13 - 49 13 - 4a 13 - 4b 14 - 4e 16 - 4f 16 - 50 16 - 51 16 - 52 16 - 53 16 + 0 5 + 9 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 + 1c 5 + 1d 5 + 1e 5 + 1f 5 + 20 5 + 21 5 + 22 5 + 23 5 + 24 5 + 25 5 + 26 5 + 27 5 + 28 5 + 29 5 + 2a 5 + 2b 5 + 30 6 + 31 6 + 32 7 + 33 7 + 34 7 + 35 7 + 36 7 + 37 7 + 38 7 + 39 7 + 3a 8 + 41 9 + 42 9 + 43 10 + 44 10 + 45 10 + 46 10 + 47 10 + 48 10 + 49 10 + 4a 10 + 4b 11 + 4e 13 + 4f 13 + 50 13 + 51 13 + 52 13 + 53 13 + 54 13 + 55 13 } } Lines mapping: -6 <-> 8 -7 <-> 10 -8 <-> 13 -9 <-> 17 +6 <-> 6 +7 <-> 7 +8 <-> 10 +9 <-> 14 diff --git a/testData/results/pkg/TestSwitchPatternMatchingReturn1.dec b/testData/results/pkg/TestSwitchPatternMatchingReturn1.dec index 284d225ff7..7187717195 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingReturn1.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingReturn1.dec @@ -1,11 +1,7 @@ package pkg; -import java.util.Objects; - public class TestSwitchPatternMatchingReturn1 { public int test(Object o) { - Objects.requireNonNull(o); - return switch (o) {// 5 case Integer i -> i;// 6 case String s -> s.length();// 7 @@ -16,33 +12,57 @@ public class TestSwitchPatternMatchingReturn1 { class 'pkg/TestSwitchPatternMatchingReturn1' { method 'test (Ljava/lang/Object;)I' { - 0 6 - 2 6 - 3 6 - 4 6 - 9 8 - 10 8 - 30 9 - 31 9 - 32 9 - 33 9 - 34 9 - 35 9 - 36 9 - 3e 10 - 3f 10 - 40 10 - 41 10 - 42 10 - 43 10 - 44 10 - 48 11 - 49 8 + 0 4 + 9 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 30 5 + 31 5 + 32 5 + 33 5 + 34 5 + 35 5 + 36 5 + 3e 6 + 3f 6 + 40 6 + 41 6 + 42 6 + 43 6 + 44 6 + 48 7 + 49 4 } } Lines mapping: -5 <-> 9 -6 <-> 10 -7 <-> 11 -8 <-> 12 +5 <-> 5 +6 <-> 6 +7 <-> 7 +8 <-> 8 diff --git a/testData/results/pkg/TestSwitchPatternMatchingReturn2.dec b/testData/results/pkg/TestSwitchPatternMatchingReturn2.dec index 4a41d9a716..558c9c2bb1 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingReturn2.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingReturn2.dec @@ -23,6 +23,33 @@ class 'pkg/TestSwitchPatternMatchingReturn2' { 4 6 9 8 10 8 + 11 8 + 12 8 + 13 8 + 14 8 + 15 8 + 16 8 + 17 8 + 18 8 + 19 8 + 1a 8 + 1b 8 + 1c 8 + 1d 8 + 1e 8 + 1f 8 + 20 8 + 21 8 + 22 8 + 23 8 + 24 8 + 25 8 + 26 8 + 27 8 + 28 8 + 29 8 + 2a 8 + 2b 8 30 9 31 9 32 9 @@ -33,6 +60,8 @@ class 'pkg/TestSwitchPatternMatchingReturn2' { 37 9 38 9 39 9 + 3a 9 + 3b 9 41 9 42 9 43 9 diff --git a/testData/results/pkg/TestSwitchPatternMatchingWithNull.dec b/testData/results/pkg/TestSwitchPatternMatchingWithNull.dec index 8bbaf5d867..b9f52968ff 100644 --- a/testData/results/pkg/TestSwitchPatternMatchingWithNull.dec +++ b/testData/results/pkg/TestSwitchPatternMatchingWithNull.dec @@ -7,8 +7,8 @@ public class TestSwitchPatternMatchingWithNull { case null: System.out.println(i); break; - case String s: - System.out.println(s);// 7 + case String s:// 7 + System.out.println(s); break; default: System.out.println("Default");// 8 @@ -21,8 +21,8 @@ public class TestSwitchPatternMatchingWithNull { case null: System.out.println(i); break; - case String s: - System.out.println(s);// 15 + case String s:// 15 + System.out.println(s); break; default: System.out.println("Default");// 16 @@ -35,6 +35,30 @@ class 'pkg/TestSwitchPatternMatchingWithNull' { 0 4 4 4 b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 28 5 29 5 2a 7 @@ -63,6 +87,8 @@ class 'pkg/TestSwitchPatternMatchingWithNull' { 49 13 4a 13 4b 13 + 4c 13 + 4d 13 4e 15 } @@ -70,6 +96,30 @@ class 'pkg/TestSwitchPatternMatchingWithNull' { 0 18 4 18 b 18 + c 18 + d 18 + e 18 + f 18 + 10 18 + 11 18 + 12 18 + 13 18 + 14 18 + 15 18 + 16 18 + 17 18 + 18 18 + 19 18 + 1a 18 + 1b 18 + 1c 18 + 1d 18 + 1e 18 + 1f 18 + 20 18 + 21 18 + 22 18 + 23 18 28 19 29 19 2a 21 @@ -98,6 +148,8 @@ class 'pkg/TestSwitchPatternMatchingWithNull' { 49 27 4a 27 4b 27 + 4c 27 + 4d 27 4e 29 } } @@ -105,11 +157,11 @@ class 'pkg/TestSwitchPatternMatchingWithNull' { Lines mapping: 5 <-> 5 6 <-> 6 -7 <-> 11 +7 <-> 10 8 <-> 14 10 <-> 16 13 <-> 19 14 <-> 20 -15 <-> 25 +15 <-> 24 16 <-> 28 18 <-> 30 diff --git a/testData/results/pkg/TestSwitchReturn.dec b/testData/results/pkg/TestSwitchReturn.dec index f874e9b8fa..10aaa431f2 100644 --- a/testData/results/pkg/TestSwitchReturn.dec +++ b/testData/results/pkg/TestSwitchReturn.dec @@ -21,6 +21,64 @@ class 'pkg/TestSwitchReturn' { method 'test (I)I' { 0 4 1 4 + 2 4 + 3 4 + 4 4 + 5 4 + 6 4 + 7 4 + 8 4 + 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 + 24 4 + 25 4 + 26 4 + 27 4 + 28 4 + 29 4 + 2a 4 + 2b 4 + 2c 4 + 2d 4 + 2e 4 + 2f 4 + 30 4 + 31 4 + 32 4 + 33 4 + 34 4 + 35 4 + 36 4 + 37 4 + 38 4 + 39 4 + 3a 4 + 3b 4 3c 8 3d 8 3e 12 diff --git a/testData/results/pkg/TestSwitchSimpleMultiLine.dec b/testData/results/pkg/TestSwitchSimpleMultiLine.dec new file mode 100644 index 0000000000..db49f53fcc --- /dev/null +++ b/testData/results/pkg/TestSwitchSimpleMultiLine.dec @@ -0,0 +1,105 @@ +package pkg; + +import java.util.Random; +import java.util.function.Predicate; + +public class TestSwitchSimpleMultiLine { + public static Predicate predicates() { + int i = new Random().nextInt();// 8 + + return switch (i) {// 9 + case 0 -> object -> true;// 10 + case 1 -> object -> false;// 11 + default -> object -> { + boolean r1 = new Random().nextBoolean();// 13 + boolean r2 = new Random().nextBoolean();// 14 + return r1 && r2 ? true : new Random().nextBoolean();// 15 16 18 + }; + }; + } +} + +class 'pkg/TestSwitchSimpleMultiLine' { + method 'predicates ()Ljava/util/function/Predicate;' { + 7 7 + 8 7 + 9 7 + a 7 + b 9 + c 9 + d 9 + e 9 + f 9 + 10 9 + 11 9 + 12 9 + 13 9 + 14 9 + 15 9 + 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 + 24 9 + 25 9 + 26 9 + 27 9 + 3d 9 + } + + method 'lambda$predicates$0 (Ljava/lang/Object;)Z' { + 0 10 + 1 10 + } + + method 'lambda$predicates$1 (Ljava/lang/Object;)Z' { + 0 11 + 1 11 + } + + method 'lambda$predicates$2 (Ljava/lang/Object;)Z' { + 7 13 + 8 13 + 9 13 + a 13 + 12 14 + 13 14 + 14 14 + 15 14 + 16 15 + 17 15 + 18 15 + 19 15 + 1a 15 + 1b 15 + 1c 15 + 1d 15 + 1e 15 + 27 15 + 28 15 + 29 15 + } +} + +Lines mapping: +8 <-> 8 +9 <-> 10 +10 <-> 11 +11 <-> 12 +13 <-> 14 +14 <-> 15 +15 <-> 16 +16 <-> 16 +18 <-> 16 +Not mapped: +12 diff --git a/testData/results/pkg/TestSwitchStringHashcodeCollision.dec b/testData/results/pkg/TestSwitchStringHashcodeCollision.dec index b923886ca6..218b4d63a4 100644 --- a/testData/results/pkg/TestSwitchStringHashcodeCollision.dec +++ b/testData/results/pkg/TestSwitchStringHashcodeCollision.dec @@ -26,6 +26,33 @@ class 'pkg/TestSwitchStringHashcodeCollision' { 41 8 42 8 4c 4 + 4d 4 + 4e 4 + 4f 4 + 50 4 + 51 4 + 52 4 + 53 4 + 54 4 + 55 4 + 56 4 + 57 4 + 58 4 + 59 4 + 5a 4 + 5b 4 + 5c 4 + 5d 4 + 5e 4 + 5f 4 + 60 4 + 61 4 + 62 4 + 63 4 + 64 4 + 65 4 + 66 4 + 67 4 68 11 69 11 6a 11 @@ -35,8 +62,6 @@ class 'pkg/TestSwitchStringHashcodeCollision' { 6e 11 6f 11 70 12 - 71 12 - 72 12 73 6 74 6 75 9 diff --git a/testData/results/pkg/TestSwitchTernary.dec b/testData/results/pkg/TestSwitchTernary.dec index 0808a1c03a..8a9c4667f4 100644 --- a/testData/results/pkg/TestSwitchTernary.dec +++ b/testData/results/pkg/TestSwitchTernary.dec @@ -49,9 +49,37 @@ class 'pkg/TestSwitchTernary' { method 'test (IIZ)V' { 0 4 1 4 + 2 4 + 3 4 4 4 8 4 9 4 + a 4 + b 4 + c 4 + d 4 + e 4 + f 4 + 10 4 + 11 4 + 12 4 + 13 4 + 14 4 + 15 4 + 16 4 + 17 4 + 18 4 + 19 4 + 1a 4 + 1b 4 + 1c 4 + 1d 4 + 1e 4 + 1f 4 + 20 4 + 21 4 + 22 4 + 23 4 24 6 25 6 26 6 @@ -67,18 +95,24 @@ class 'pkg/TestSwitchTernary' { 32 9 33 9 34 9 + 35 9 + 36 9 37 11 38 11 39 11 3a 11 3b 11 3c 11 + 3d 11 + 3e 11 3f 13 } method 'testString (Ljava/lang/String;Ljava/lang/String;Z)V' { 0 16 1 16 + 2 16 + 3 16 4 16 8 16 9 16 @@ -90,6 +124,30 @@ class 'pkg/TestSwitchTernary' { 3e 21 3f 21 4b 17 + 4c 17 + 4d 17 + 4e 17 + 4f 17 + 50 17 + 51 17 + 52 17 + 53 17 + 54 17 + 55 17 + 56 17 + 57 17 + 58 17 + 59 17 + 5a 17 + 5b 17 + 5c 17 + 5d 17 + 5e 17 + 5f 17 + 60 17 + 61 17 + 62 17 + 63 17 64 19 65 19 66 19 @@ -105,22 +163,55 @@ class 'pkg/TestSwitchTernary' { 72 22 73 22 74 22 + 75 22 + 76 22 77 24 78 24 79 24 7a 24 7b 24 7c 24 + 7d 24 + 7e 24 7f 26 } method 'testEnum (Lpkg/TestSwitchTernary$TestEnum;Lpkg/TestSwitchTernary$TestEnum;Z)V' { 3 29 4 29 + 5 29 + 6 29 7 29 b 29 f 29 10 29 + 11 29 + 12 29 + 13 29 + 14 29 + 15 29 + 16 29 + 17 29 + 18 29 + 19 29 + 1a 29 + 1b 29 + 1c 29 + 1d 29 + 1e 29 + 1f 29 + 20 29 + 21 29 + 22 29 + 23 29 + 24 29 + 25 29 + 26 29 + 27 29 + 28 29 + 29 29 + 2a 29 + 2b 29 2c 31 2d 31 2e 31 @@ -136,12 +227,16 @@ class 'pkg/TestSwitchTernary' { 3a 34 3b 34 3c 34 + 3d 34 + 3e 34 3f 36 40 36 41 36 42 36 43 36 44 36 + 45 36 + 46 36 47 38 } } diff --git a/testData/results/pkg/TestSynchronized.dec b/testData/results/pkg/TestSynchronized.dec index ea0028a258..871263d40a 100644 --- a/testData/results/pkg/TestSynchronized.dec +++ b/testData/results/pkg/TestSynchronized.dec @@ -358,6 +358,32 @@ class 'pkg/TestSynchronized' { method 'test11 (I)V' { 0 85 1 85 + 2 85 + 3 85 + 4 85 + 5 85 + 6 85 + 7 85 + 8 85 + 9 85 + a 85 + b 85 + c 85 + d 85 + e 85 + f 85 + 10 85 + 11 85 + 12 85 + 13 85 + 14 85 + 15 85 + 16 85 + 17 85 + 18 85 + 19 85 + 1a 85 + 1b 85 1c 87 1f 87 21 89 @@ -386,6 +412,8 @@ class 'pkg/TestSynchronized' { 5a 101 5b 101 5c 101 + 5d 101 + 5e 101 5f 103 } diff --git a/testData/results/pkg/TestSynchronizedLoop.dec b/testData/results/pkg/TestSynchronizedLoop.dec index 7749a5a12c..c874aedaa6 100644 --- a/testData/results/pkg/TestSynchronizedLoop.dec +++ b/testData/results/pkg/TestSynchronizedLoop.dec @@ -97,6 +97,8 @@ class 'pkg/TestSynchronizedLoop' { 4 7 5 7 6 7 + 7 7 + 8 7 9 8 a 8 b 8 @@ -124,6 +126,8 @@ class 'pkg/TestSynchronizedLoop' { 3 30 4 31 5 31 + 6 31 + 7 31 8 32 9 32 a 32 @@ -144,8 +148,12 @@ class 'pkg/TestSynchronizedLoop' { 6 39 7 39 8 39 + 9 39 + a 39 b 42 c 42 + d 42 + e 42 f 50 10 50 11 50 @@ -156,6 +164,8 @@ class 'pkg/TestSynchronizedLoop' { 16 51 17 51 18 51 + 19 51 + 1a 51 1b 54 1c 54 1d 54 @@ -163,6 +173,8 @@ class 'pkg/TestSynchronizedLoop' { 1f 54 20 54 21 54 + 22 54 + 23 54 38 56 39 56 3a 56 @@ -175,6 +187,8 @@ class 'pkg/TestSynchronizedLoop' { 41 57 42 57 43 57 + 44 57 + 45 57 50 43 51 43 52 43 @@ -186,20 +200,28 @@ class 'pkg/TestSynchronizedLoop' { 58 44 59 44 5a 44 + 5b 44 + 5c 44 5d 45 5e 45 5f 45 60 45 61 45 + 62 45 + 63 45 70 64 71 64 72 64 + 73 64 + 74 64 75 65 76 65 77 65 78 65 79 65 7a 65 + 7b 65 + 7c 65 7d 67 } @@ -210,6 +232,8 @@ class 'pkg/TestSynchronizedLoop' { 3 70 4 70 5 70 + 6 70 + 7 70 8 71 b 71 c 73 @@ -298,4 +322,4 @@ Not mapped: 53 60 76 -79 \ No newline at end of file +79 diff --git a/testData/results/pkg/TestSynchronizedTernary.dec b/testData/results/pkg/TestSynchronizedTernary.dec index cecb47bb8f..874b0ef4c8 100644 --- a/testData/results/pkg/TestSynchronizedTernary.dec +++ b/testData/results/pkg/TestSynchronizedTernary.dec @@ -12,6 +12,8 @@ class 'pkg/TestSynchronizedTernary' { method 'test (ZLjava/lang/Object;Ljava/lang/Object;)V' { 0 4 1 4 + 2 4 + 3 4 4 4 8 4 a 4 diff --git a/testData/results/pkg/TestSynchronizedThrow.dec b/testData/results/pkg/TestSynchronizedThrow.dec index 1d7f4b3b19..1f1bc11c97 100644 --- a/testData/results/pkg/TestSynchronizedThrow.dec +++ b/testData/results/pkg/TestSynchronizedThrow.dec @@ -94,6 +94,8 @@ class 'pkg/TestSynchronizedThrow' { 3 18 4 19 5 19 + 6 19 + 7 19 f 20 1a 23 } @@ -119,6 +121,8 @@ class 'pkg/TestSynchronizedThrow' { 13 28 14 29 15 29 + 16 29 + 17 29 1f 30 20 33 21 33 @@ -159,6 +163,8 @@ class 'pkg/TestSynchronizedThrow' { 3 50 4 51 5 51 + 6 51 + 7 51 8 53 9 53 a 53 diff --git a/testData/results/pkg/TestSynchronizedTry.dec b/testData/results/pkg/TestSynchronizedTry.dec index c05ccd1a21..48c5314126 100644 --- a/testData/results/pkg/TestSynchronizedTry.dec +++ b/testData/results/pkg/TestSynchronizedTry.dec @@ -122,6 +122,8 @@ class 'pkg/TestSynchronizedTry' { 11 20 12 21 13 21 + 14 21 + 15 21 1b 25 1c 25 1d 25 @@ -134,18 +136,26 @@ class 'pkg/TestSynchronizedTry' { 2e 28 2f 28 30 28 + 31 28 + 32 28 36 30 37 31 38 31 + 39 31 + 3a 31 3b 34 3c 34 3d 34 + 3e 34 + 3f 34 40 35 41 35 42 35 43 35 44 35 45 35 + 46 35 + 47 35 48 37 } @@ -168,6 +178,8 @@ class 'pkg/TestSynchronizedTry' { 11 44 12 45 13 45 + 14 45 + 15 45 1b 49 1c 49 1d 49 @@ -180,18 +192,26 @@ class 'pkg/TestSynchronizedTry' { 2e 52 2f 52 30 52 + 31 52 + 32 52 36 54 37 55 38 55 + 39 55 + 3a 55 3b 58 3c 58 3d 58 + 3e 58 + 3f 58 40 59 41 59 42 59 43 59 44 59 45 59 + 46 59 + 47 59 48 61 } @@ -209,6 +229,8 @@ class 'pkg/TestSynchronizedTry' { c 68 d 71 e 71 + f 71 + 10 71 13 72 16 78 17 74 diff --git a/testData/results/pkg/TestSynchronizedTryReturn.dec b/testData/results/pkg/TestSynchronizedTryReturn.dec index 6b82cad2ac..b93817657a 100644 --- a/testData/results/pkg/TestSynchronizedTryReturn.dec +++ b/testData/results/pkg/TestSynchronizedTryReturn.dec @@ -29,6 +29,8 @@ class 'pkg/TestSynchronizedTryReturn' { 3 4 4 7 5 7 + 6 7 + 7 7 a 12 b 8 10 9 diff --git a/testData/results/pkg/TestSynchronizedTrySharing.dec b/testData/results/pkg/TestSynchronizedTrySharing.dec index 910a049a6d..7e57a56c45 100644 --- a/testData/results/pkg/TestSynchronizedTrySharing.dec +++ b/testData/results/pkg/TestSynchronizedTrySharing.dec @@ -64,6 +64,8 @@ class 'pkg/TestSynchronizedTrySharing' { 2a 16 2b 17 2c 17 + 2d 17 + 2e 17 2f 19 } @@ -102,6 +104,8 @@ class 'pkg/TestSynchronizedTrySharing' { 41 34 42 35 43 35 + 44 35 + 45 35 46 37 } } diff --git a/testData/results/pkg/TestSynchronizedUnprotected.dec b/testData/results/pkg/TestSynchronizedUnprotected.dec index 0f2ef725f5..afb3bac560 100644 --- a/testData/results/pkg/TestSynchronizedUnprotected.dec +++ b/testData/results/pkg/TestSynchronizedUnprotected.dec @@ -4,11 +4,11 @@ import kotlin.Metadata; import kotlin.Unit; @Metadata( - mv = {1, 6, 0}, + mv = {2, 0, 0}, k = 1, xi = 48, - d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0003\u001a\u00020\u0004¨\u0006\u0005"}, - d2 = {"Lpkg/TestSynchronizedUnprotected;", "", "()V", "test", "", "vineflower_testDataKotlin"} + d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u0006\u0010\u0004\u001a\u00020\u0005¨\u0006\u0006"}, + d2 = {"Lpkg/TestSynchronizedUnprotected;", "", "", "()V", "test", "", "vineflower_testDataKotlin"} ) public final class TestSynchronizedUnprotected { // $VF: Extended synchronized range to monitorexit @@ -41,13 +41,6 @@ class 'pkg/TestSynchronizedUnprotected' { 13 18 14 18 17 20 - 18 20 - 19 20 - 1a 20 - 1b 20 - 1c 20 - 1d 20 - 1e 20 } } diff --git a/testData/results/pkg/TestTempAssign.dec b/testData/results/pkg/TestTempAssign.dec index ea65e15f73..4e50c47b1b 100644 --- a/testData/results/pkg/TestTempAssign.dec +++ b/testData/results/pkg/TestTempAssign.dec @@ -54,6 +54,8 @@ class 'pkg/TestTempAssign' { 1 9 2 9 3 9 + 4 9 + 5 9 6 10 7 10 8 10 diff --git a/testData/results/pkg/TestTernaryAssign.dec b/testData/results/pkg/TestTernaryAssign.dec index d39b44b381..fadeaccfda 100644 --- a/testData/results/pkg/TestTernaryAssign.dec +++ b/testData/results/pkg/TestTernaryAssign.dec @@ -18,6 +18,8 @@ class 'pkg/TestTernaryAssign' { 2 5 3 5 4 5 + 5 5 + 6 5 7 5 b 5 c 5 diff --git a/testData/results/pkg/TestTernaryCall.dec b/testData/results/pkg/TestTernaryCall.dec index 0677a583a5..4b0ed7a605 100644 --- a/testData/results/pkg/TestTernaryCall.dec +++ b/testData/results/pkg/TestTernaryCall.dec @@ -19,10 +19,14 @@ class 'pkg/TestTernaryCall' { 2 4 3 4 4 4 + 5 4 + 6 4 7 4 e 4 12 4 13 4 + 14 4 + 15 4 16 4 1d 4 26 4 @@ -34,15 +38,23 @@ class 'pkg/TestTernaryCall' { method 'test2 (ZZZ)V' { 0 8 1 8 + 2 8 + 3 8 4 8 5 8 + 6 8 + 7 8 b 8 c 8 + d 8 + e 8 f 9 10 9 11 9 12 9 13 9 + 14 9 + 15 9 16 11 } } diff --git a/testData/results/pkg/TestTernaryReturn.dec b/testData/results/pkg/TestTernaryReturn.dec index 793f2b3c9e..4d1d4da501 100644 --- a/testData/results/pkg/TestTernaryReturn.dec +++ b/testData/results/pkg/TestTernaryReturn.dec @@ -21,6 +21,8 @@ class 'pkg/TestTernaryReturn' { 2 7 3 7 4 7 + 5 7 + 6 7 7 8 8 8 9 10 @@ -33,11 +35,15 @@ class 'pkg/TestTernaryReturn' { 10 11 11 11 12 11 + 13 11 + 14 11 15 11 16 11 17 11 18 11 19 11 + 1a 11 + 1b 11 1f 11 20 11 21 11 @@ -54,11 +60,15 @@ class 'pkg/TestTernaryReturn' { 2f 11 30 11 31 11 + 32 11 + 33 11 34 11 35 11 36 11 37 11 38 11 + 39 11 + 3a 11 3e 11 3f 11 40 11 diff --git a/testData/results/pkg/TestTernaryReturn2.dec b/testData/results/pkg/TestTernaryReturn2.dec index 5b189fa8e7..bc699a0a9c 100644 --- a/testData/results/pkg/TestTernaryReturn2.dec +++ b/testData/results/pkg/TestTernaryReturn2.dec @@ -47,11 +47,14 @@ class 'pkg/TestTernaryReturn2' { 19 4 1a 4 1b 4 + 1c 4 + 1d 4 1e 4 1f 4 20 4 21 4 25 4 + 26 4 27 4 28 4 29 4 @@ -66,6 +69,8 @@ class 'pkg/TestTernaryReturn2' { method 'b (Lpkg/TestTernaryReturn2$T;)Z' { 0 8 1 8 + 2 8 + 3 8 9 8 } diff --git a/testData/results/pkg/TestTextTokens3.dec b/testData/results/pkg/TestTextTokens3.dec index 684260fdf8..e9bbd157c3 100644 --- a/testData/results/pkg/TestTextTokens3.dec +++ b/testData/results/pkg/TestTextTokens3.dec @@ -31,6 +31,30 @@ class 'pkg/TestTextTokens3' { 6 5 a 5 b 5 + c 5 + d 5 + e 5 + f 5 + 10 5 + 11 5 + 12 5 + 13 5 + 14 5 + 15 5 + 16 5 + 17 5 + 18 5 + 19 5 + 1a 5 + 1b 5 + 1c 5 + 1d 5 + 1e 5 + 1f 5 + 20 5 + 21 5 + 22 5 + 23 5 24 7 25 7 26 7 diff --git a/testData/results/pkg/TestThrowException.dec b/testData/results/pkg/TestThrowException.dec index b4ca681aaf..69c480adbb 100644 --- a/testData/results/pkg/TestThrowException.dec +++ b/testData/results/pkg/TestThrowException.dec @@ -10,7 +10,7 @@ public class TestThrowException { this.r = new Runnable() {// 12 @Override public void run() { - int a = 5;// 15 + int ax = 5;// 15 }// 16 }; } @@ -21,6 +21,8 @@ class 'pkg/TestThrowException' { method ' (I)V' { 4 6 5 6 + 6 6 + 7 6 c 7 d 7 11 7 diff --git a/testData/results/pkg/TestThrowLoop.dec b/testData/results/pkg/TestThrowLoop.dec index b0d4269f54..1aa0492d4d 100644 --- a/testData/results/pkg/TestThrowLoop.dec +++ b/testData/results/pkg/TestThrowLoop.dec @@ -32,9 +32,13 @@ class 'pkg/TestThrowLoop' { 7 7 8 7 9 7 + a 7 + b 7 c 7 d 7 e 7 + f 7 + 10 7 11 8 12 8 13 8 @@ -43,10 +47,14 @@ class 'pkg/TestThrowLoop' { 16 8 17 9 18 9 + 19 9 + 1a 9 1b 9 1c 9 1d 9 1e 9 + 1f 9 + 20 9 28 10 29 7 2a 7 @@ -56,13 +64,19 @@ class 'pkg/TestThrowLoop' { 31 14 32 14 33 14 + 34 14 + 35 14 36 15 37 15 + 38 15 + 39 15 3a 15 3b 15 3c 15 3d 15 3e 15 + 3f 15 + 40 15 48 16 49 14 4a 14 diff --git a/testData/results/pkg/TestTryCatchFinally.dec b/testData/results/pkg/TestTryCatchFinally.dec index 07e8bb2a6b..65bb97a308 100644 --- a/testData/results/pkg/TestTryCatchFinally.dec +++ b/testData/results/pkg/TestTryCatchFinally.dec @@ -30,10 +30,10 @@ public class TestTryCatchFinally { } catch (Exception var6) {// 52 System.out.println("Error" + var6);// 53 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 55 } - return -1;// 55 56 57 + return -1;// 56 57 } } @@ -45,12 +45,16 @@ class 'pkg/TestTryCatchFinally' { 3 5 4 5 5 5 + 6 5 + 7 5 14 8 15 8 16 8 17 8 18 8 19 8 + 1a 8 + 1b 8 1f 9 2d 12 2e 12 @@ -58,6 +62,8 @@ class 'pkg/TestTryCatchFinally' { 30 12 31 12 32 12 + 33 12 + 34 12 38 14 } @@ -65,10 +71,14 @@ class 'pkg/TestTryCatchFinally' { 0 17 1 17 2 17 + 3 17 + 4 17 c 18 d 19 e 19 f 19 + 10 19 + 11 19 12 20 13 20 1b 22 @@ -91,20 +101,17 @@ class 'pkg/TestTryCatchFinally' { 24 30 25 30 26 30 + 27 30 + 28 30 31 35 - 32 35 - 33 35 - 34 35 35 32 36 32 37 32 38 32 39 32 3a 32 - 3b 35 - 3c 35 - 3d 35 - 3e 35 + 3b 32 + 3c 32 3f 35 } } @@ -123,7 +130,7 @@ Lines mapping: 51 <-> 29 52 <-> 30 53 <-> 31 -55 <-> 36 +55 <-> 33 56 <-> 36 57 <-> 36 Not mapped: diff --git a/testData/results/pkg/TestTryCatchNested.dec b/testData/results/pkg/TestTryCatchNested.dec index 9285fa4963..541be5438e 100644 --- a/testData/results/pkg/TestTryCatchNested.dec +++ b/testData/results/pkg/TestTryCatchNested.dec @@ -34,6 +34,8 @@ class 'pkg/TestTryCatchNested' { 12 11 13 11 14 11 + 15 11 + 16 11 17 13 } } diff --git a/testData/results/pkg/TestTryFinally.dec b/testData/results/pkg/TestTryFinally.dec index a3c18f4f1f..d224d33d14 100644 --- a/testData/results/pkg/TestTryFinally.dec +++ b/testData/results/pkg/TestTryFinally.dec @@ -13,10 +13,10 @@ public class TestTryFinally { try { System.out.println("Hello");// 14 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 16 } - System.out.println("Bye");// 16 17 19 + System.out.println("Bye");// 17 19 } public void test2(int i) { @@ -42,6 +42,8 @@ class 'pkg/TestTryFinally' { 3 5 4 5 5 5 + 6 5 + 7 5 c 9 10 7 11 7 @@ -57,26 +59,24 @@ class 'pkg/TestTryFinally' { 3 13 4 13 5 13 + 6 13 + 7 13 10 18 11 18 12 18 - 13 18 14 15 15 15 16 15 17 15 18 15 19 15 - 1a 18 - 1b 18 - 1c 18 - 1d 18 + 1a 15 + 1b 15 1e 18 1f 18 - 20 18 21 18 22 18 - 23 19 + 23 18 } method 'test2 (I)V' { @@ -86,6 +86,8 @@ class 'pkg/TestTryFinally' { 3 23 4 23 5 23 + 6 23 + 7 23 1d 25 1e 25 1f 25 @@ -96,6 +98,8 @@ class 'pkg/TestTryFinally' { 24 25 25 26 26 26 + 27 26 + 28 26 29 27 2a 27 2b 27 @@ -121,7 +125,7 @@ Lines mapping: 8 <-> 8 9 <-> 10 14 <-> 14 -16 <-> 19 +16 <-> 16 17 <-> 19 19 <-> 19 25 <-> 24 diff --git a/testData/results/pkg/TestTryLoop.dec b/testData/results/pkg/TestTryLoop.dec index 0b355ae40e..7f141998f2 100644 --- a/testData/results/pkg/TestTryLoop.dec +++ b/testData/results/pkg/TestTryLoop.dec @@ -50,6 +50,8 @@ class 'pkg/TestTryLoop' { 16 19 17 20 18 20 + 19 20 + 1a 20 1b 22 } @@ -60,6 +62,8 @@ class 'pkg/TestTryLoop' { 6 27 7 27 8 27 + 9 27 + a 27 b 28 c 28 d 28 diff --git a/testData/results/pkg/TestTryLoop2.dec b/testData/results/pkg/TestTryLoop2.dec index 5badc65877..6c9cf925c4 100644 --- a/testData/results/pkg/TestTryLoop2.dec +++ b/testData/results/pkg/TestTryLoop2.dec @@ -29,6 +29,8 @@ class 'pkg/TestTryLoop2' { 2 12 3 12 4 12 + 5 12 + 6 12 b 16 16 17 17 18 diff --git a/testData/results/pkg/TestTryLoopNoCatch.dec b/testData/results/pkg/TestTryLoopNoCatch.dec index eee77992a6..ce23c0ab1a 100644 --- a/testData/results/pkg/TestTryLoopNoCatch.dec +++ b/testData/results/pkg/TestTryLoopNoCatch.dec @@ -34,6 +34,8 @@ class 'pkg/TestTryLoopNoCatch' { 5 6 6 6 7 6 + 8 6 + 9 6 a 8 b 8 c 8 @@ -64,6 +66,8 @@ class 'pkg/TestTryLoopNoCatch' { 4 18 5 18 6 18 + 7 18 + 8 18 10 19 11 21 12 21 @@ -72,6 +76,8 @@ class 'pkg/TestTryLoopNoCatch' { 15 21 16 21 17 21 + 18 21 + 19 21 1f 21 } } diff --git a/testData/results/pkg/TestTryLoopRecompile.dec b/testData/results/pkg/TestTryLoopRecompile.dec index 7fb43de408..24e65b936e 100644 --- a/testData/results/pkg/TestTryLoopRecompile.dec +++ b/testData/results/pkg/TestTryLoopRecompile.dec @@ -30,10 +30,14 @@ class 'pkg/TestTryLoopRecompile' { 2 12 3 12 4 12 + 5 12 + 6 12 b 13 16 16 17 17 18 17 + 19 17 + 1a 17 1b 20 } } diff --git a/testData/results/pkg/TestTryLoopReturnFinally.dec b/testData/results/pkg/TestTryLoopReturnFinally.dec index 0b53f10ca5..c2a842e58a 100644 --- a/testData/results/pkg/TestTryLoopReturnFinally.dec +++ b/testData/results/pkg/TestTryLoopReturnFinally.dec @@ -32,16 +32,22 @@ class 'pkg/TestTryLoopReturnFinally' { 3 11 7 12 8 12 + 9 12 + a 12 13 13 18 16 2c 19 2d 19 + 2e 19 + 2f 19 3c 21 3d 21 3e 21 3f 21 40 21 41 21 + 42 21 + 43 21 46 23 } } diff --git a/testData/results/pkg/TestTryLoopSimpleFinally.dec b/testData/results/pkg/TestTryLoopSimpleFinally.dec index 59126197d4..fa6e8de806 100644 --- a/testData/results/pkg/TestTryLoopSimpleFinally.dec +++ b/testData/results/pkg/TestTryLoopSimpleFinally.dec @@ -48,18 +48,24 @@ class 'pkg/TestTryLoopSimpleFinally' { 1e 16 1f 17 20 17 + 21 17 + 22 17 2f 19 30 19 31 19 32 19 33 19 34 19 + 35 19 + 36 19 39 21 } method 'test2 (ILjava/nio/file/Path;)V' { 0 25 1 25 + 2 25 + 3 25 8 26 c 26 d 27 @@ -67,12 +73,16 @@ class 'pkg/TestTryLoopSimpleFinally' { f 27 10 27 11 27 + 12 27 + 13 27 14 28 15 28 16 28 17 28 18 28 19 28 + 1a 28 + 1b 28 24 29 26 32 27 32 @@ -86,6 +96,8 @@ class 'pkg/TestTryLoopSimpleFinally' { 3f 35 40 35 41 35 + 42 35 + 43 35 } } @@ -108,4 +120,4 @@ Not mapped: 17 22 36 -40 \ No newline at end of file +40 diff --git a/testData/results/pkg/TestTryReturn.dec b/testData/results/pkg/TestTryReturn.dec index 6df5be330d..b78cc23df7 100644 --- a/testData/results/pkg/TestTryReturn.dec +++ b/testData/results/pkg/TestTryReturn.dec @@ -32,13 +32,13 @@ public class TestTryReturn { break label27; } } finally { - System.out.println("Finally"); + System.out.println("Finally");// 31 } return;// 28 } - System.out.println("suc");// 31 32 34 + System.out.println("suc");// 32 34 } public boolean testFinally2(Supplier supplier) { @@ -46,10 +46,10 @@ public class TestTryReturn { try { b = supplier.get();// 40 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 42 } - return b;// 42 43 45 + return b;// 43 45 } public boolean testFinally3(boolean b, boolean c, int a, Supplier supplier) { @@ -77,10 +77,10 @@ public class TestTryReturn { try { b = supplier.get();// 67 } finally { - System.out.println("Finally"); + System.out.println("Finally");// 69 } - return b;// 69 70 72 + return b;// 70 72 } public boolean testFinally5(Supplier supplier) { @@ -262,6 +262,8 @@ class 'pkg/TestTryReturn' { 1b 19 1c 19 1d 19 + 1e 19 + 1f 19 } method 'testFinally1 (Ljava/util/function/Supplier;)V' { @@ -271,6 +273,8 @@ class 'pkg/TestTryReturn' { 3 26 4 26 5 26 + 6 26 + 7 26 8 30 9 30 a 30 @@ -281,27 +285,25 @@ class 'pkg/TestTryReturn' { 12 30 13 30 14 30 + 15 30 + 16 30 1f 37 28 40 29 40 2a 40 - 2b 40 2c 34 2d 34 2e 34 2f 34 30 34 31 34 - 32 40 - 33 40 - 34 40 - 35 40 + 32 34 + 33 34 36 40 37 40 - 38 40 39 40 3a 40 - 3b 41 + 3b 40 } method 'testFinally2 (Ljava/util/function/Supplier;)Z' { @@ -316,27 +318,26 @@ class 'pkg/TestTryReturn' { b 46 c 46 15 51 - 16 51 - 17 51 - 18 51 19 48 1a 48 1b 48 1c 48 1d 48 1e 48 - 1f 51 - 20 51 - 21 51 - 22 51 + 1f 48 + 20 48 23 51 } method 'testFinally3 (ZZILjava/util/function/Supplier;)Z' { 0 57 1 57 + 2 57 + 3 57 4 65 5 65 + 6 65 + 7 65 8 65 9 65 a 65 @@ -348,6 +349,8 @@ class 'pkg/TestTryReturn' { 13 65 14 65 15 65 + 16 65 + 17 65 1d 65 1e 65 27 70 @@ -355,9 +358,13 @@ class 'pkg/TestTryReturn' { 29 70 2a 58 2b 58 + 2c 58 + 2d 58 2e 59 2f 59 30 59 + 31 59 + 32 59 44 59 45 62 46 62 @@ -376,6 +383,8 @@ class 'pkg/TestTryReturn' { 64 67 65 67 66 67 + 67 67 + 68 67 } method 'testFinally4 (Ljava/util/function/Supplier;)Z' { @@ -392,19 +401,14 @@ class 'pkg/TestTryReturn' { d 77 e 77 17 82 - 18 82 - 19 82 - 1a 82 1b 79 1c 79 1d 79 1e 79 1f 79 20 79 - 21 82 - 22 82 - 23 82 - 24 82 + 21 79 + 22 79 25 82 } @@ -446,6 +450,8 @@ class 'pkg/TestTryReturn' { 40 94 41 94 42 94 + 43 94 + 44 94 48 97 49 97 } @@ -455,6 +461,8 @@ class 'pkg/TestTryReturn' { 1 101 2 104 3 104 + 4 104 + 5 104 6 105 7 105 8 106 @@ -463,6 +471,8 @@ class 'pkg/TestTryReturn' { b 106 c 106 d 106 + e 106 + f 106 10 109 11 109 12 109 @@ -498,6 +508,8 @@ class 'pkg/TestTryReturn' { 4f 114 50 114 51 114 + 52 114 + 53 114 57 117 58 117 } @@ -507,6 +519,8 @@ class 'pkg/TestTryReturn' { 1 121 2 125 3 125 + 4 125 + 5 125 e 126 1b 129 1c 129 @@ -514,6 +528,8 @@ class 'pkg/TestTryReturn' { 1e 129 1f 129 20 129 + 21 129 + 22 129 } method 'testPostdomFailure ()V' { @@ -522,6 +538,8 @@ class 'pkg/TestTryReturn' { 2 171 3 171 4 171 + 5 171 + 6 171 e 173 f 173 10 173 @@ -530,12 +548,16 @@ class 'pkg/TestTryReturn' { 16 176 17 176 18 176 + 19 176 + 1a 176 21 177 22 178 23 178 24 178 25 178 26 178 + 27 178 + 28 178 3a 183 3b 183 3c 183 @@ -550,16 +572,22 @@ class 'pkg/TestTryReturn' { 3 190 4 190 5 190 + 6 190 + 7 190 b 191 e 192 f 193 10 193 + 11 193 + 12 193 16 200 17 194 18 194 19 194 1a 194 1b 194 + 1c 194 + 1d 194 21 195 24 198 25 198 @@ -578,6 +606,8 @@ class 'pkg/TestTryReturn' { 7 209 8 209 9 209 + a 209 + b 209 13 210 14 211 15 216 @@ -585,6 +615,8 @@ class 'pkg/TestTryReturn' { 17 216 18 216 19 216 + 1a 216 + 1b 216 26 218 36 225 39 220 @@ -592,12 +624,16 @@ class 'pkg/TestTryReturn' { 3b 220 3c 220 3d 220 + 3e 220 + 3f 220 4a 217 4f 223 50 223 51 223 52 223 53 223 + 54 223 + 55 223 } } @@ -610,11 +646,11 @@ Lines mapping: 24 <-> 27 27 <-> 31 28 <-> 38 -31 <-> 41 +31 <-> 35 32 <-> 41 34 <-> 41 40 <-> 47 -42 <-> 52 +42 <-> 49 43 <-> 52 45 <-> 52 50 <-> 58 @@ -625,7 +661,7 @@ Lines mapping: 60 <-> 68 65 <-> 75 67 <-> 78 -69 <-> 83 +69 <-> 80 70 <-> 83 72 <-> 83 76 <-> 87 diff --git a/testData/results/pkg/TestTryReturnNoDebug.dec b/testData/results/pkg/TestTryReturnNoDebug.dec index b8fd38eaa9..3574ddefc8 100644 --- a/testData/results/pkg/TestTryReturnNoDebug.dec +++ b/testData/results/pkg/TestTryReturnNoDebug.dec @@ -72,6 +72,8 @@ class 'pkg/TestTryReturnNoDebug' { 1b 22 1c 22 1d 22 + 1e 22 + 1f 22 23 23 2f 24 30 24 diff --git a/testData/results/pkg/TestTrySplit.dec b/testData/results/pkg/TestTrySplit.dec index 51eb2fe90b..a39ced299e 100644 --- a/testData/results/pkg/TestTrySplit.dec +++ b/testData/results/pkg/TestTrySplit.dec @@ -32,17 +32,23 @@ class 'pkg/TestTrySplit' { 15 9 16 10 17 10 + 18 10 + 19 10 1a 11 1b 11 1c 11 1d 11 1e 11 1f 11 + 20 11 + 21 11 22 14 23 14 24 14 25 14 26 14 + 27 14 + 28 14 31 18 33 16 34 16 @@ -50,6 +56,8 @@ class 'pkg/TestTrySplit' { 36 16 37 16 38 16 + 39 16 + 3a 16 } method 'throwMyException (Ljava/lang/String;)V' { @@ -70,4 +78,4 @@ Lines mapping: 17 <-> 9 21 <-> 22 Not mapped: -18 \ No newline at end of file +18 diff --git a/testData/results/pkg/TestTrySynchronized.dec b/testData/results/pkg/TestTrySynchronized.dec index f50946cc84..cc770ca891 100644 --- a/testData/results/pkg/TestTrySynchronized.dec +++ b/testData/results/pkg/TestTrySynchronized.dec @@ -65,6 +65,8 @@ class 'pkg/TestTrySynchronized' { 27 17 28 18 29 18 + 2a 18 + 2b 18 2c 20 } @@ -104,6 +106,8 @@ class 'pkg/TestTrySynchronized' { 39 34 3a 35 3b 35 + 3c 35 + 3d 35 3e 37 } diff --git a/testData/results/pkg/TestTryVar.dec b/testData/results/pkg/TestTryVar.dec index e8dc67027d..00cd99acda 100644 --- a/testData/results/pkg/TestTryVar.dec +++ b/testData/results/pkg/TestTryVar.dec @@ -35,6 +35,8 @@ class 'pkg/TestTryVar' { 3 4 4 4 5 4 + 6 4 + 7 4 8 6 9 6 a 6 @@ -64,6 +66,8 @@ class 'pkg/TestTryVar' { 3 17 4 17 5 17 + 6 17 + 7 17 8 19 9 19 a 19 diff --git a/testData/results/pkg/TestTryVarNoDebug.dec b/testData/results/pkg/TestTryVarNoDebug.dec index 952d3d2cad..17d05639f4 100644 --- a/testData/results/pkg/TestTryVarNoDebug.dec +++ b/testData/results/pkg/TestTryVarNoDebug.dec @@ -35,6 +35,8 @@ class 'pkg/TestTryVarNoDebug' { 3 4 4 4 5 4 + 6 4 + 7 4 8 6 9 6 a 6 @@ -64,6 +66,8 @@ class 'pkg/TestTryVarNoDebug' { 3 17 4 17 5 17 + 6 17 + 7 17 8 19 9 19 a 19 diff --git a/testData/results/pkg/TestTryWithResourcesAfterSwitch.dec b/testData/results/pkg/TestTryWithResourcesAfterSwitch.dec index 139bcc11ce..7c607b2714 100644 --- a/testData/results/pkg/TestTryWithResourcesAfterSwitch.dec +++ b/testData/results/pkg/TestTryWithResourcesAfterSwitch.dec @@ -51,6 +51,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 3 7 4 8 5 8 + 6 8 + 7 8 f 9 10 11 11 11 @@ -59,6 +61,25 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 2d 13 2e 13 38 12 + 39 12 + 3a 12 + 3b 12 + 3c 12 + 3d 12 + 3e 12 + 3f 12 + 40 12 + 41 12 + 42 12 + 43 12 + 44 12 + 45 12 + 46 12 + 47 12 + 48 12 + 49 12 + 4a 12 + 4b 12 4c 15 4d 15 4e 15 @@ -73,6 +94,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 61 18 62 18 63 18 + 64 18 + 65 18 bf 24 c4 20 c5 20 @@ -80,6 +103,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { c7 20 c8 20 c9 20 + ca 20 + cb 20 } method 'test2 ()V' { @@ -89,6 +114,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 3 27 4 28 5 28 + 6 28 + 7 28 f 29 10 31 11 31 @@ -97,6 +124,25 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 2d 33 2e 33 38 32 + 39 32 + 3a 32 + 3b 32 + 3c 32 + 3d 32 + 3e 32 + 3f 32 + 40 32 + 41 32 + 42 32 + 43 32 + 44 32 + 45 32 + 46 32 + 47 32 + 48 32 + 49 32 + 4a 32 + 4b 32 50 35 51 35 52 35 @@ -107,6 +153,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { 5c 36 5d 36 5e 36 + 5f 36 + 60 36 b5 42 ba 38 bb 38 @@ -114,6 +162,8 @@ class 'pkg/TestTryWithResourcesAfterSwitch' { bd 38 be 38 bf 38 + c0 38 + c1 38 } } diff --git a/testData/results/pkg/TestTryWithResourcesCatchFinallyJ16.dec b/testData/results/pkg/TestTryWithResourcesCatchFinallyJ16.dec index bd6ed208b9..4c112900a6 100644 --- a/testData/results/pkg/TestTryWithResourcesCatchFinallyJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesCatchFinallyJ16.dec @@ -41,12 +41,16 @@ class 'pkg/TestTryWithResourcesCatchFinallyJ16' { 32 10 33 11 34 11 + 35 11 + 36 11 44 13 45 13 46 13 47 13 48 13 49 13 + 4a 13 + 4b 13 4f 15 } @@ -64,12 +68,16 @@ class 'pkg/TestTryWithResourcesCatchFinallyJ16' { 37 20 38 21 39 21 + 3a 21 + 3b 21 49 23 4a 23 4b 23 4c 23 4d 23 4e 23 + 4f 23 + 50 23 54 25 } diff --git a/testData/results/pkg/TestTryWithResourcesCatchJ16.dec b/testData/results/pkg/TestTryWithResourcesCatchJ16.dec index fa7f365e19..3448352b1b 100644 --- a/testData/results/pkg/TestTryWithResourcesCatchJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesCatchJ16.dec @@ -63,6 +63,8 @@ class 'pkg/TestTryWithResourcesCatchJ16' { 2a 10 2b 11 2c 11 + 2d 11 + 2e 11 2f 13 } @@ -80,6 +82,8 @@ class 'pkg/TestTryWithResourcesCatchJ16' { 2f 18 30 19 31 19 + 32 19 + 33 19 34 21 } @@ -111,14 +115,20 @@ class 'pkg/TestTryWithResourcesCatchJ16' { 18 33 19 33 1b 34 + 1c 34 + 1d 34 6d 36 6e 37 6f 37 70 37 71 37 72 37 + 73 37 + 74 37 75 40 76 40 + 77 40 + 78 40 79 41 7a 41 7b 41 @@ -131,6 +141,8 @@ class 'pkg/TestTryWithResourcesCatchJ16' { 85 43 86 43 87 43 + 88 43 + 89 43 8a 46 8b 46 } diff --git a/testData/results/pkg/TestTryWithResourcesFake.dec b/testData/results/pkg/TestTryWithResourcesFake.dec index 29f08bc9f1..fce47998ad 100644 --- a/testData/results/pkg/TestTryWithResourcesFake.dec +++ b/testData/results/pkg/TestTryWithResourcesFake.dec @@ -52,6 +52,8 @@ class 'pkg/TestTryWithResourcesFake' { 7 15 8 15 9 15 + a 15 + b 15 c 16 d 16 e 16 @@ -61,6 +63,8 @@ class 'pkg/TestTryWithResourcesFake' { 15 18 16 18 17 18 + 18 18 + 19 18 1a 22 1b 22 1c 22 @@ -76,10 +80,14 @@ class 'pkg/TestTryWithResourcesFake' { 30 26 36 29 37 29 + 38 29 + 39 29 3d 30 3e 31 3f 31 40 31 + 41 31 + 42 31 43 34 44 34 4b 37 diff --git a/testData/results/pkg/TestTryWithResourcesFakeTrigger.dec b/testData/results/pkg/TestTryWithResourcesFakeTrigger.dec index d40a7d24f0..334cd494d2 100644 --- a/testData/results/pkg/TestTryWithResourcesFakeTrigger.dec +++ b/testData/results/pkg/TestTryWithResourcesFakeTrigger.dec @@ -82,6 +82,8 @@ class 'pkg/TestTryWithResourcesFakeTrigger' { 6 13 7 13 8 13 + 9 13 + a 13 e 14 f 22 16 19 @@ -93,15 +95,21 @@ class 'pkg/TestTryWithResourcesFakeTrigger' { 1 25 2 27 3 27 + 4 27 + 5 27 6 29 7 29 8 29 9 29 a 29 b 29 + c 29 + d 29 11 30 12 31 13 31 + 14 31 + 15 31 19 35 1a 35 1b 35 @@ -121,11 +129,15 @@ class 'pkg/TestTryWithResourcesFakeTrigger' { c 44 12 47 13 47 + 14 47 + 15 47 19 48 1b 49 1c 49 1d 49 1e 49 + 1f 49 + 20 49 21 52 22 52 23 54 @@ -140,11 +152,15 @@ class 'pkg/TestTryWithResourcesFakeTrigger' { c 60 12 63 13 63 + 14 63 + 15 63 19 64 1b 65 1c 65 1d 65 1e 65 + 1f 65 + 20 65 21 68 22 68 23 70 diff --git a/testData/results/pkg/TestTryWithResourcesFinallyJ16.dec b/testData/results/pkg/TestTryWithResourcesFinallyJ16.dec index 5f1f03eacc..02601177c3 100644 --- a/testData/results/pkg/TestTryWithResourcesFinallyJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesFinallyJ16.dec @@ -41,6 +41,8 @@ class 'pkg/TestTryWithResourcesFinallyJ16' { 37 11 38 11 39 11 + 3a 11 + 3b 11 } method 'testFunc (Ljava/io/File;)V' { @@ -61,6 +63,8 @@ class 'pkg/TestTryWithResourcesFinallyJ16' { 3c 19 3d 19 3e 19 + 3f 19 + 40 19 } method 'create (Ljava/io/File;)Ljava/util/Scanner;' { diff --git a/testData/results/pkg/TestTryWithResourcesJ16.dec b/testData/results/pkg/TestTryWithResourcesJ16.dec index e7e0ed69d9..acdbbbebe4 100644 --- a/testData/results/pkg/TestTryWithResourcesJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesJ16.dec @@ -6,10 +6,10 @@ import java.util.Scanner; public class TestTryWithResourcesJ16 { public void test(File file) throws FileNotFoundException { - try (Scanner scanner = new Scanner(file)) { + try (Scanner scanner = new Scanner(file)) {// 11 scanner.next();// 12 } - }// 11 13 + }// 13 public void testFunc(File file) throws FileNotFoundException { try (Scanner scanner = this.create(file)) {// 17 @@ -31,26 +31,6 @@ class 'pkg/TestTryWithResourcesJ16' { b 9 c 9 12 11 - 13 11 - 14 11 - 15 11 - 16 11 - 17 11 - 18 11 - 19 11 - 1a 11 - 1b 11 - 1c 11 - 1d 11 - 1e 11 - 1f 11 - 20 11 - 21 11 - 22 11 - 23 11 - 24 11 - 25 11 - 26 11 } method 'testFunc (Ljava/io/File;)V' { @@ -74,7 +54,7 @@ class 'pkg/TestTryWithResourcesJ16' { } Lines mapping: -11 <-> 12 +11 <-> 9 12 <-> 10 13 <-> 12 17 <-> 15 diff --git a/testData/results/pkg/TestTryWithResourcesLoopJ16.dec b/testData/results/pkg/TestTryWithResourcesLoopJ16.dec index 6fb74aec21..902bd97a34 100644 --- a/testData/results/pkg/TestTryWithResourcesLoopJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesLoopJ16.dec @@ -96,6 +96,8 @@ class 'pkg/TestTryWithResourcesLoopJ16' { 8 10 9 10 a 10 + b 10 + c 10 18 11 19 11 1a 11 @@ -119,6 +121,8 @@ class 'pkg/TestTryWithResourcesLoopJ16' { f 23 10 23 11 23 + 12 23 + 13 23 1f 24 20 24 21 24 @@ -148,6 +152,8 @@ class 'pkg/TestTryWithResourcesLoopJ16' { 15 38 16 38 17 38 + 18 38 + 19 38 2d 42 2e 42 2f 42 @@ -177,11 +183,15 @@ class 'pkg/TestTryWithResourcesLoopJ16' { 15 53 16 53 17 53 + 18 53 + 19 53 2d 57 2e 57 2f 57 30 57 31 57 + 32 57 + 33 57 44 63 45 58 46 58 @@ -212,6 +222,8 @@ class 'pkg/TestTryWithResourcesLoopJ16' { 15 73 16 73 17 73 + 18 73 + 19 73 2d 74 2e 74 2f 74 diff --git a/testData/results/pkg/TestTryWithResourcesManyJ16.dec b/testData/results/pkg/TestTryWithResourcesManyJ16.dec index b9c75a8897..56b5698eb4 100644 --- a/testData/results/pkg/TestTryWithResourcesManyJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesManyJ16.dec @@ -19,7 +19,7 @@ public class TestTryWithResourcesManyJ16 { System.out.println(s4.nextLine());// 19 System.out.println(s5.nextLine());// 20 } - }// 9 21 + }// 21 } class 'pkg/TestTryWithResourcesManyJ16' { @@ -88,32 +88,13 @@ class 'pkg/TestTryWithResourcesManyJ16' { 60 19 61 19 62 19 + 63 19 + 64 19 df 21 - e0 21 - e1 21 - e2 21 - e3 21 - e4 21 - e5 21 - e6 21 - e7 21 - e8 21 - e9 21 - ea 21 - eb 21 - ec 21 - ed 21 - ee 21 - ef 21 - f0 21 - f1 21 - f2 21 - f3 21 } } Lines mapping: -9 <-> 22 10 <-> 10 11 <-> 11 12 <-> 12 @@ -126,4 +107,5 @@ Lines mapping: 20 <-> 20 21 <-> 22 Not mapped: +9 22 diff --git a/testData/results/pkg/TestTryWithResourcesMultiJ16.dec b/testData/results/pkg/TestTryWithResourcesMultiJ16.dec index 6430ae2817..e91ffeacc2 100644 --- a/testData/results/pkg/TestTryWithResourcesMultiJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesMultiJ16.dec @@ -8,13 +8,13 @@ import java.util.Scanner; public class TestTryWithResourcesMultiJ16 { public void testMulti(File file) throws IOException { try ( - Scanner scanner = new Scanner(file); + Scanner scanner = new Scanner(file);// 10 FileWriter writer = new FileWriter(file); ) { scanner.next();// 11 writer.write("hello");// 12 } - }// 10 13 + }// 13 } class 'pkg/TestTryWithResourcesMultiJ16' { @@ -31,32 +31,14 @@ class 'pkg/TestTryWithResourcesMultiJ16' { 18 14 19 14 1a 14 + 1b 14 + 1c 14 3d 16 - 3e 16 - 3f 16 - 40 16 - 41 16 - 42 16 - 43 16 - 44 16 - 45 16 - 46 16 - 47 16 - 48 16 - 49 16 - 4a 16 - 4b 16 - 4c 16 - 4d 16 - 4e 16 - 4f 16 - 50 16 - 51 16 } } Lines mapping: -10 <-> 17 +10 <-> 11 11 <-> 14 12 <-> 15 13 <-> 17 diff --git a/testData/results/pkg/TestTryWithResourcesNestedJ16.dec b/testData/results/pkg/TestTryWithResourcesNestedJ16.dec index 9d2de4e9cc..1cbbf63be5 100644 --- a/testData/results/pkg/TestTryWithResourcesNestedJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesNestedJ16.dec @@ -7,14 +7,14 @@ import java.util.Scanner; public class TestTryWithResourcesNestedJ16 { public void testNested(File file) throws IOException { try ( - Scanner scanner = new Scanner(file); + Scanner scanner = new Scanner(file);// 10 Scanner scanner1 = new Scanner(file);// 11 Scanner scanner2 = new Scanner(file);// 12 Scanner scanner3 = new Scanner(file);// 13 ) { scanner.next();// 14 } - }// 10 18 + }// 18 public void testNestedFinally(File file) throws IOException { try (Scanner scanner = new Scanner(file)) {// 22 @@ -54,26 +54,6 @@ class 'pkg/TestTryWithResourcesNestedJ16' { 28 14 29 14 87 16 - 88 16 - 89 16 - 8a 16 - 8b 16 - 8c 16 - 8d 16 - 8e 16 - 8f 16 - 90 16 - 91 16 - 92 16 - 93 16 - 94 16 - 95 16 - 96 16 - 97 16 - 98 16 - 99 16 - 9a 16 - 9b 16 } method 'testNestedFinally (Ljava/io/File;)V' { @@ -96,27 +76,35 @@ class 'pkg/TestTryWithResourcesNestedJ16' { 57 25 58 25 59 25 + 5a 25 + 5b 25 89 28 8a 28 8b 28 8c 28 8d 28 + 8e 28 + 8f 28 bb 31 bc 31 bd 31 be 31 bf 31 + c0 31 + c1 31 e5 36 ea 34 eb 34 ec 34 ed 34 ee 34 + ef 34 + f0 34 } } Lines mapping: -10 <-> 17 +10 <-> 10 11 <-> 11 12 <-> 12 13 <-> 13 diff --git a/testData/results/pkg/TestTryWithResourcesNestedLoop.dec b/testData/results/pkg/TestTryWithResourcesNestedLoop.dec index 03a6f6feb4..e51c2a74f3 100644 --- a/testData/results/pkg/TestTryWithResourcesNestedLoop.dec +++ b/testData/results/pkg/TestTryWithResourcesNestedLoop.dec @@ -71,6 +71,8 @@ class 'pkg/TestTryWithResourcesNestedLoop' { 27 16 28 16 29 16 + 2a 16 + 2b 16 2c 16 2d 16 2e 16 @@ -79,6 +81,8 @@ class 'pkg/TestTryWithResourcesNestedLoop' { 31 16 32 16 33 16 + 34 16 + 35 16 3a 17 3d 17 3e 17 @@ -107,6 +111,8 @@ class 'pkg/TestTryWithResourcesNestedLoop' { 58 20 59 20 5a 20 + 5b 20 + 5c 20 5d 21 5e 21 5f 21 @@ -121,6 +127,8 @@ class 'pkg/TestTryWithResourcesNestedLoop' { 68 21 69 21 6a 21 + 6b 21 + 6c 21 6d 22 6e 22 6f 22 diff --git a/testData/results/pkg/TestTryWithResourcesOuterJ16.dec b/testData/results/pkg/TestTryWithResourcesOuterJ16.dec index 6579f98eb2..c3f1276292 100644 --- a/testData/results/pkg/TestTryWithResourcesOuterJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesOuterJ16.dec @@ -309,7 +309,7 @@ public class TestTryWithResourcesOuterJ16 { }// 93 public void testSame4(File file) throws FileNotFoundException { - try (Scanner scanner = new Scanner(file)) { + try (Scanner scanner = new Scanner(file)) {// 96 Scanner var3 = scanner; try { @@ -330,7 +330,7 @@ public class TestTryWithResourcesOuterJ16 { scanner.close(); } } - }// 96 100 + }// 100 private Scanner create(File file) throws FileNotFoundException { return new Scanner(file);// 104 @@ -349,6 +349,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { e 14 10 27 11 27 + 12 27 + 13 27 14 28 15 28 16 28 @@ -356,14 +358,20 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 1b 15 1d 16 1e 16 + 1f 16 + 20 16 21 18 22 18 + 23 18 + 24 18 28 19 2a 20 2b 20 2c 20 2d 20 2e 20 + 2f 20 + 30 20 31 24 32 24 33 24 @@ -385,6 +393,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { b 37 d 50 e 50 + f 50 + 10 50 11 51 12 51 13 51 @@ -392,14 +402,20 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 18 38 1a 39 1b 39 + 1c 39 + 1d 39 1e 41 1f 41 + 20 41 + 21 41 25 42 27 43 28 43 29 43 2a 43 2b 43 + 2c 43 + 2d 43 2e 47 2f 47 30 47 @@ -425,9 +441,13 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 1e 65 1f 65 20 65 + 21 65 + 22 65 23 78 24 78 25 78 + 26 78 + 27 78 28 79 29 79 2a 79 @@ -437,21 +457,29 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 32 67 33 67 34 67 + 35 67 + 36 67 37 69 38 69 39 69 + 3a 69 + 3b 69 3f 70 41 71 42 71 43 71 44 71 45 71 + 46 71 + 47 71 48 75 49 75 4a 75 4b 93 4c 93 4d 93 + 4e 93 + 4f 93 50 94 51 94 52 94 @@ -461,15 +489,21 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 5a 82 5b 82 5c 82 + 5d 82 + 5e 82 5f 84 60 84 61 84 + 62 84 + 63 84 67 85 69 86 6a 86 6b 86 6c 86 6d 86 + 6e 86 + 6f 86 70 90 71 90 72 90 @@ -495,9 +529,13 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 1e 108 1f 108 20 108 + 21 108 + 22 108 23 121 24 121 25 121 + 26 121 + 27 121 28 122 29 122 2a 122 @@ -507,21 +545,29 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 32 110 33 110 34 110 + 35 110 + 36 110 37 112 38 112 39 112 + 3a 112 + 3b 112 3f 113 41 114 42 114 43 114 44 114 45 114 + 46 114 + 47 114 48 118 49 118 4a 118 4b 136 4c 136 4d 136 + 4e 136 + 4f 136 50 137 51 137 52 137 @@ -531,15 +577,21 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 5a 125 5b 125 5c 125 + 5d 125 + 5e 125 5f 127 60 127 61 127 + 62 127 + 63 127 67 128 69 129 6a 129 6b 129 6c 129 6d 129 + 6e 129 + 6f 129 70 133 71 133 72 133 @@ -565,9 +617,13 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 1e 151 1f 151 20 151 + 21 151 + 22 151 23 164 24 164 25 164 + 26 164 + 27 164 28 165 29 165 2a 165 @@ -577,21 +633,29 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 32 153 33 153 34 153 + 35 153 + 36 153 37 155 38 155 39 155 + 3a 155 + 3b 155 3f 156 41 157 42 157 43 157 44 157 45 157 + 46 157 + 47 157 48 161 49 161 4a 161 4b 179 4c 179 4d 179 + 4e 179 + 4f 179 50 180 51 180 52 180 @@ -601,15 +665,21 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 5a 168 5b 168 5c 168 + 5d 168 + 5e 168 5f 170 60 170 61 170 + 62 170 + 63 170 67 171 69 172 6a 172 6b 172 6c 172 6d 172 + 6e 172 + 6f 172 70 176 71 176 72 176 @@ -635,6 +705,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 18 206 19 206 1a 206 + 1b 206 + 1c 206 1d 207 1e 207 1f 207 @@ -644,20 +716,28 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 27 195 28 195 29 195 + 2a 195 + 2b 195 2c 197 2d 197 2e 197 + 2f 197 + 30 197 34 198 36 199 37 199 38 199 39 199 3a 199 + 3b 199 + 3c 199 3d 203 3e 203 3f 203 40 221 41 221 + 42 221 + 43 221 44 222 45 222 46 222 @@ -665,14 +745,20 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 4b 209 4d 210 4e 210 + 4f 210 + 50 210 51 212 52 212 + 53 212 + 54 212 58 213 5a 214 5b 214 5c 214 5d 214 5e 214 + 5f 214 + 60 214 61 218 62 218 63 218 @@ -694,6 +780,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 13 247 14 247 15 247 + 16 247 + 17 247 18 248 19 248 1a 248 @@ -703,20 +791,28 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 22 236 23 236 24 236 + 25 236 + 26 236 27 238 28 238 29 238 + 2a 238 + 2b 238 2f 239 31 240 32 240 33 240 34 240 35 240 + 36 240 + 37 240 38 244 39 244 3a 244 3b 262 3c 262 + 3d 262 + 3e 262 3f 263 40 263 41 263 @@ -724,14 +820,20 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 46 250 48 251 49 251 + 4a 251 + 4b 251 4c 253 4d 253 + 4e 253 + 4f 253 53 254 55 255 56 255 57 255 58 255 59 255 + 5a 255 + 5b 255 5c 259 5d 259 5e 259 @@ -753,6 +855,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 13 288 14 288 15 288 + 16 288 + 17 288 18 289 19 289 1a 289 @@ -762,15 +866,21 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 22 277 23 277 24 277 + 25 277 + 26 277 27 279 28 279 29 279 + 2a 279 + 2b 279 2f 280 31 281 32 281 33 281 34 281 35 281 + 36 281 + 37 281 38 285 39 285 3a 285 @@ -780,6 +890,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 3e 292 40 305 41 305 + 42 305 + 43 305 44 306 45 306 46 306 @@ -787,14 +899,20 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 4b 293 4d 294 4e 294 + 4f 294 + 50 294 51 296 52 296 + 53 296 + 54 296 58 297 5a 298 5b 298 5c 298 5d 298 5e 298 + 5f 298 + 60 298 61 302 62 302 63 302 @@ -812,6 +930,8 @@ class 'pkg/TestTryWithResourcesOuterJ16' { e 315 10 328 11 328 + 12 328 + 13 328 14 329 15 329 16 329 @@ -819,38 +939,24 @@ class 'pkg/TestTryWithResourcesOuterJ16' { 1b 316 1d 317 1e 317 + 1f 317 + 20 317 21 319 22 319 + 23 319 + 24 319 28 320 2a 321 2b 321 2c 321 2d 321 2e 321 + 2f 321 + 30 321 31 325 32 325 33 325 38 332 - 39 332 - 3a 332 - 3b 332 - 3c 332 - 3d 332 - 3e 332 - 3f 332 - 40 332 - 41 332 - 42 332 - 43 332 - 44 332 - 45 332 - 46 332 - 47 332 - 48 332 - 49 332 - 4a 332 - 4b 332 - 4c 332 } method 'create (Ljava/io/File;)Ljava/util/Scanner;' { @@ -918,7 +1024,7 @@ Lines mapping: 91 <-> 293 92 <-> 306 93 <-> 309 -96 <-> 333 +96 <-> 312 97 <-> 317 98 <-> 316 99 <-> 329 diff --git a/testData/results/pkg/TestTryWithResourcesReturnJ16.dec b/testData/results/pkg/TestTryWithResourcesReturnJ16.dec index d9a132f31b..2d6e7f7463 100644 --- a/testData/results/pkg/TestTryWithResourcesReturnJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesReturnJ16.dec @@ -203,12 +203,16 @@ class 'pkg/TestTryWithResourcesReturnJ16' { 17 99 18 99 19 99 + 1a 99 + 1b 99 1c 99 1d 99 1e 99 1f 99 20 99 21 99 + 22 99 + 23 99 24 111 25 111 26 111 @@ -238,6 +242,8 @@ class 'pkg/TestTryWithResourcesReturnJ16' { 53 103 54 103 55 103 + 56 103 + 57 103 58 104 59 104 5a 104 @@ -278,12 +284,16 @@ class 'pkg/TestTryWithResourcesReturnJ16' { 11 122 12 122 13 122 + 14 122 + 15 122 16 122 17 122 18 122 19 122 1a 122 1b 122 + 1c 122 + 1d 122 1e 123 1f 123 20 123 @@ -313,6 +323,8 @@ class 'pkg/TestTryWithResourcesReturnJ16' { a 134 b 134 c 134 + d 134 + e 134 f 135 10 135 11 135 diff --git a/testData/results/pkg/TestTryWithResourcesSwitchJ16.dec b/testData/results/pkg/TestTryWithResourcesSwitchJ16.dec index 6431d6f233..e9da125776 100644 --- a/testData/results/pkg/TestTryWithResourcesSwitchJ16.dec +++ b/testData/results/pkg/TestTryWithResourcesSwitchJ16.dec @@ -91,6 +91,31 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 8 9 9 9 a 9 + b 9 + c 9 + d 9 + e 9 + f 9 + 10 9 + 11 9 + 12 9 + 13 9 + 14 9 + 15 9 + 16 9 + 17 9 + 18 9 + 19 9 + 1a 9 + 1b 9 + 1c 9 + 1d 9 + 1e 9 + 1f 9 + 20 9 + 21 9 + 22 9 + 23 9 24 11 25 11 26 11 @@ -115,6 +140,8 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 3d 17 3e 17 3f 17 + 40 17 + 41 17 63 20 } @@ -130,6 +157,31 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 8 25 9 25 a 25 + b 25 + c 25 + d 25 + e 25 + f 25 + 10 25 + 11 25 + 12 25 + 13 25 + 14 25 + 15 25 + 16 25 + 17 25 + 18 25 + 19 25 + 1a 25 + 1b 25 + 1c 25 + 1d 25 + 1e 25 + 1f 25 + 20 25 + 21 25 + 22 25 + 23 25 24 27 25 27 26 27 @@ -145,18 +197,24 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 32 30 33 30 34 30 + 35 30 + 36 30 42 33 43 33 44 33 45 33 46 33 47 33 + 48 33 + 49 33 4a 36 4b 36 4c 36 4d 36 4e 36 4f 36 + 50 36 + 51 36 73 40 74 40 75 40 @@ -170,12 +228,16 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 7d 41 7e 41 7f 41 + 80 41 + 81 41 82 42 83 42 84 42 85 42 86 42 87 42 + 88 42 + 89 42 8a 44 } @@ -191,6 +253,31 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 8 49 9 49 a 49 + b 49 + c 49 + d 49 + e 49 + f 49 + 10 49 + 11 49 + 12 49 + 13 49 + 14 49 + 15 49 + 16 49 + 17 49 + 18 49 + 19 49 + 1a 49 + 1b 49 + 1c 49 + 1d 49 + 1e 49 + 1f 49 + 20 49 + 21 49 + 22 49 + 23 49 24 51 25 51 26 51 @@ -206,6 +293,8 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 32 54 33 54 34 54 + 35 54 + 36 54 42 57 43 57 44 57 @@ -222,12 +311,16 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 59 60 5a 60 5b 60 + 5c 60 + 5d 60 5e 63 5f 63 60 63 61 63 62 63 63 63 + 64 63 + 65 63 87 67 88 67 89 67 @@ -241,12 +334,16 @@ class 'pkg/TestTryWithResourcesSwitchJ16' { 91 68 92 68 93 68 + 94 68 + 95 68 96 69 97 69 98 69 99 69 9a 69 9b 69 + 9c 69 + 9d 69 9e 72 9f 72 } diff --git a/testData/results/pkg/TestUnionTypeAssign.dec b/testData/results/pkg/TestUnionTypeAssign.dec index 2ac099f85b..71337fbebc 100644 --- a/testData/results/pkg/TestUnionTypeAssign.dec +++ b/testData/results/pkg/TestUnionTypeAssign.dec @@ -132,4 +132,4 @@ Lines mapping: 23 <-> 23 24 <-> 24 27 <-> 27 -28 <-> 28 \ No newline at end of file +28 <-> 28 diff --git a/testData/results/pkg/TestUnknownCast.dec b/testData/results/pkg/TestUnknownCast.dec index 3a976f71a7..dc309b7654 100644 --- a/testData/results/pkg/TestUnknownCast.dec +++ b/testData/results/pkg/TestUnknownCast.dec @@ -31,6 +31,8 @@ class 'pkg/TestUnknownCast' { 3 5 4 8 5 8 + 6 8 + 7 8 f 9 10 12 11 12 @@ -40,6 +42,8 @@ class 'pkg/TestUnknownCast' { 1d 19 1e 19 1f 19 + 20 19 + 21 19 22 19 24 20 25 20 diff --git a/testData/results/pkg/TestUnknownCastJ17.dec b/testData/results/pkg/TestUnknownCastJ17.dec index 27deb46c4a..6397698336 100644 --- a/testData/results/pkg/TestUnknownCastJ17.dec +++ b/testData/results/pkg/TestUnknownCastJ17.dec @@ -1,21 +1,12 @@ package pkg; import java.lang.annotation.ElementType; -import java.util.Objects; public class TestUnknownCastJ17 { - // $VF: Could not properly define all variable types! public void test() { ElementType vvv1 = ElementType.METHOD;// 8 synchronized (this) {// 9 - label91: { - System.out.println(vvv1);// 10 - Object var23; - Objects.requireNonNull(var23);// 11 - Object vvv5 = var23; - - var10000_1 = ()(new Object()); - } + System.out.println(vvv1);// 10 } try { @@ -29,13 +20,8 @@ public class TestUnknownCastJ17 { synchronized (this) {// 35 System.out.println(vvv1);// 36 System.out.println(vvv1);// 37 - Object var10000; - Objects.requireNonNull(var10000);// 38 - Object vvv5 = var10000; - - new Object(); - for (int var9 = switch (vvv5) { + for (int var9 = switch (new Object()) {// 38 default -> { ElementType var5 = ElementType.METHOD;// 40 System.out.println(vvv1);// 42 @@ -56,120 +42,122 @@ public class TestUnknownCastJ17 { class 'pkg/TestUnknownCastJ17' { method 'test ()V' { - 0 8 - 1 8 - 2 8 - 3 8 - 4 9 - 7 9 - 8 11 - 9 11 - a 11 - b 11 - c 11 - d 11 - e 11 - 17 13 - 18 13 - 19 13 - 1b 14 - a8 21 - a9 22 - aa 24 + 0 6 + 1 6 + 2 6 + 3 6 + 4 7 + 7 7 + 8 8 + 9 8 + a 8 + b 8 + c 8 + d 8 + e 8 + a8 12 + a9 13 + aa 15 } method 'test2 ()V' { - 0 27 - 1 27 - 2 27 - 3 27 - 4 28 - 7 28 - 8 29 - 9 29 - a 29 - b 29 - c 29 - d 29 - e 29 - f 30 - 10 30 - 11 30 - 12 30 - 13 30 - 14 30 - 15 30 - 1e 32 - 1f 32 - 20 32 - 22 33 - 26 37 - 2e 37 - 38 39 - 39 39 - 3a 39 - 3b 39 - 3c 39 - 3d 40 - 3e 40 - 3f 40 - 40 40 - 41 40 - 42 40 - 43 40 - 44 41 - 45 41 - 46 41 - 48 43 - 49 43 - 4a 43 - 4b 43 - 4c 43 - 4d 43 - 4e 43 - 4f 43 - 52 44 - 53 44 - 54 44 - 55 44 - 56 45 - 57 45 - 58 45 - 59 45 - 5a 45 - 5b 45 - 5c 45 - 5d 43 - 5e 43 - 5f 43 - 76 50 - 77 51 - 78 53 + 0 18 + 1 18 + 2 18 + 3 18 + 4 19 + 7 19 + 8 20 + 9 20 + a 20 + b 20 + c 20 + d 20 + e 20 + f 21 + 10 21 + 11 21 + 12 21 + 13 21 + 14 21 + 15 21 + 2e 23 + 2f 23 + 30 23 + 31 23 + 32 23 + 33 23 + 34 23 + 35 23 + 36 23 + 37 23 + 38 25 + 39 25 + 3a 25 + 3b 25 + 3c 25 + 3d 26 + 3e 26 + 3f 26 + 40 26 + 41 26 + 42 26 + 43 26 + 44 27 + 45 27 + 46 27 + 48 29 + 49 29 + 4a 29 + 4b 29 + 4c 29 + 4d 29 + 4e 29 + 4f 29 + 50 29 + 51 29 + 52 30 + 53 30 + 54 30 + 55 30 + 56 31 + 57 31 + 58 31 + 59 31 + 5a 31 + 5b 31 + 5c 31 + 5d 29 + 5e 29 + 5f 29 + 76 36 + 77 37 + 78 39 } } Lines mapping: -8 <-> 9 -9 <-> 10 -10 <-> 12 -11 <-> 14 -28 <-> 22 -29 <-> 23 -31 <-> 25 -34 <-> 28 -35 <-> 29 -36 <-> 30 -37 <-> 31 -38 <-> 33 -40 <-> 40 -42 <-> 41 -43 <-> 44 -44 <-> 45 -45 <-> 46 -51 <-> 51 -52 <-> 52 -54 <-> 54 +8 <-> 7 +9 <-> 8 +10 <-> 9 +28 <-> 13 +29 <-> 14 +31 <-> 16 +34 <-> 19 +35 <-> 20 +36 <-> 21 +37 <-> 22 +38 <-> 24 +40 <-> 26 +42 <-> 27 +43 <-> 30 +44 <-> 31 +45 <-> 32 +51 <-> 37 +52 <-> 38 +54 <-> 40 Not mapped: +11 13 15 16 diff --git a/testData/results/pkg/TestUnnamedVar1.dec b/testData/results/pkg/TestUnnamedVar1.dec index 63186cd056..2699356f46 100644 --- a/testData/results/pkg/TestUnnamedVar1.dec +++ b/testData/results/pkg/TestUnnamedVar1.dec @@ -6,78 +6,32 @@ import java.util.List; import java.util.Scanner; public class TestUnnamedVar1 { - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test(Object o) { if (o instanceof TestUnnamedVar1.Point var2) { TestUnnamedVar1.Point var10000 = var2; - int var4; - label29: { - label34: { - try { - var9 = var10000.x(); - } catch (Throwable var6) { - var8 = var6; - boolean var10001 = false; - break label34; - } - - var4 = var9; - var10000 = var2; - - try { - var10000.y(); - break label29; - } catch (Throwable var5) { - var8 = var5; - boolean var11 = false; - } - } - - Throwable var7 = var8;// 12 - throw new MatchException(var7.toString(), var7); + try { + var7 = var10000.x(); + } catch (Throwable var6) {// 12 + throw new MatchException(var6.toString(), var6); + } + + int var4 = var7; + var10000 = var2; + + try { + var10000.y(); + } catch (Throwable var5) { + throw new MatchException(var5.toString(), var5); } System.out.println(var4);// 13 } }// 15 - // $VF: Inserted dummy exception handlers to handle obfuscated exceptions public void test1(Object o) { - if (o instanceof TestUnnamedVar1.Point var2) { - TestUnnamedVar1.Point var10000 = var2; - - int var5; - label31: { - label36: { - try { - var11 = var10000.x(); - } catch (Throwable var7) { - var10 = var7; - boolean var10001 = false; - break label36; - } - - var5 = var11; - var10000 = var2; - - try { - var13 = var10000.y(); - break label31; - } catch (Throwable var6) { - var10 = var6; - boolean var14 = false; - } - } - - Throwable var8 = var10;// 18 - throw new MatchException(var8.toString(), var8); - } - - Object var9 = var13; - if (var9 instanceof Integer) { - System.out.println(var5);// 19 - } + if (o instanceof TestUnnamedVar1.Point(int var5, Object var8)) {// 18 + System.out.println(var5);// 19 } }// 21 @@ -92,122 +46,116 @@ public class TestUnnamedVar1 { } }// 33 - static record Point(int x, Object y) { + record Point(int x, Object y) { } } class 'pkg/TestUnnamedVar1' { method 'test (Ljava/lang/Object;)V' { - 0 10 - 1 10 - 2 10 - 3 10 - 4 10 - b 10 - c 11 - d 17 - 10 24 - 11 24 - 12 40 - 13 40 - 15 25 - 16 28 - 1b 40 - 1c 40 - 1d 40 - 1e 40 - 1f 40 - 25 36 - 2a 37 - 2b 37 - 2c 37 - 2d 37 - 2e 37 - 32 37 - 33 42 + 0 9 + 1 9 + 2 9 + 3 9 + 4 9 + 5 9 + 6 9 + b 9 + c 10 + d 13 + e 13 + f 13 + 10 18 + 11 18 + 12 27 + 13 27 + 15 19 + 16 22 + 17 22 + 18 22 + 1b 27 + 1c 27 + 1d 27 + 1e 27 + 1f 27 + 20 27 + 21 27 + 25 14 + 2a 15 + 2b 15 + 2c 15 + 2d 15 + 2e 15 + 32 15 + 33 29 } method 'test1 (Ljava/lang/Object;)V' { - 0 46 - 1 46 - 2 46 - 3 46 - 4 46 - b 46 - c 47 - d 53 - 10 60 - 11 60 - 12 78 - 13 78 - 15 61 - 16 64 - 19 76 - 1a 76 - 1b 77 - 1c 77 - 1d 77 - 1e 77 - 1f 77 - 20 77 - 23 78 - 24 78 - 25 78 - 26 78 - 27 78 - 2d 72 - 32 73 - 33 73 - 34 73 - 35 73 - 36 73 - 3a 73 - 3b 81 + 0 32 + 1 32 + 2 32 + 3 32 + 4 32 + 5 32 + 6 32 + 10 32 + 11 32 + 12 33 + 13 33 + 1b 32 + 1c 32 + 23 33 + 24 33 + 25 33 + 26 33 + 27 33 + 28 33 + 29 33 + 3b 35 } method 'stream (Ljava/util/List;)Ljava/util/List;' { - 0 84 - 1 84 - 2 84 - 3 84 - 4 84 - 5 84 - b 84 - c 84 - d 84 - e 84 - f 84 - 10 84 - 11 84 - 12 84 - 13 84 - 14 84 - 15 84 + 0 38 + 1 38 + 2 38 + 3 38 + 4 38 + 5 38 + b 38 + c 38 + d 38 + e 38 + f 38 + 10 38 + 11 38 + 12 38 + 13 38 + 14 38 + 15 38 } method 'lambda$stream$0 (Ljava/lang/String;)Ljava/lang/String;' { - 0 84 - 1 84 - 2 84 + 0 38 + 1 38 + 2 38 } method 'trycatch (Ljava/io/File;)V' { - 4 89 - c 90 - d 92 + 4 43 + c 44 + d 46 } } Lines mapping: -12 <-> 37 -13 <-> 41 -15 <-> 43 -18 <-> 73 -19 <-> 79 -21 <-> 82 -24 <-> 85 -29 <-> 90 -30 <-> 91 -33 <-> 93 +12 <-> 15 +13 <-> 28 +15 <-> 30 +18 <-> 33 +19 <-> 34 +21 <-> 36 +24 <-> 39 +29 <-> 44 +30 <-> 45 +33 <-> 47 Not mapped: 32 \ No newline at end of file diff --git a/testData/results/pkg/TestVarRedef.dec b/testData/results/pkg/TestVarRedef.dec index 51b6265a66..e084080e9a 100644 --- a/testData/results/pkg/TestVarRedef.dec +++ b/testData/results/pkg/TestVarRedef.dec @@ -47,6 +47,8 @@ class 'pkg/TestVarRedef' { 1 13 2 17 3 17 + 4 17 + 5 17 6 24 7 24 8 25 @@ -77,12 +79,16 @@ class 'pkg/TestVarRedef' { 56 27 59 29 5a 29 + 5b 29 + 5c 29 5d 30 5e 30 5f 30 60 30 61 30 62 30 + 63 30 + 64 30 } } diff --git a/testData/results/pkg/TestWhileCondition.dec b/testData/results/pkg/TestWhileCondition.dec index 5080951453..f2450b4663 100644 --- a/testData/results/pkg/TestWhileCondition.dec +++ b/testData/results/pkg/TestWhileCondition.dec @@ -30,13 +30,19 @@ class 'pkg/TestWhileCondition' { 5 6 6 6 7 6 + 8 6 + 9 6 a 6 b 6 + c 6 + d 6 e 6 f 6 10 6 11 6 12 6 + 13 6 + 14 6 15 7 16 7 17 7 @@ -57,15 +63,23 @@ class 'pkg/TestWhileCondition' { 7 15 8 15 9 15 + a 15 + b 15 c 15 d 15 + e 15 + f 15 10 15 11 15 12 15 13 15 14 15 + 15 15 + 16 15 17 15 18 15 + 19 15 + 1a 15 1b 16 1c 16 1d 16 @@ -74,6 +88,8 @@ class 'pkg/TestWhileCondition' { 20 17 21 15 22 15 + 23 15 + 24 15 2a 15 2e 19 } diff --git a/testData/results/pkg/TestWhileConditionTernary.dec b/testData/results/pkg/TestWhileConditionTernary.dec index 0dfe5c2152..de013ba3db 100644 --- a/testData/results/pkg/TestWhileConditionTernary.dec +++ b/testData/results/pkg/TestWhileConditionTernary.dec @@ -29,16 +29,22 @@ class 'pkg/TestWhileConditionTernary' { 2 4 3 4 4 4 + 5 4 + 6 4 7 5 8 5 9 5 a 5 b 5 + c 5 + d 5 e 5 f 5 10 5 11 5 12 5 + 13 5 + 14 5 15 5 16 5 17 5 @@ -49,11 +55,15 @@ class 'pkg/TestWhileConditionTernary' { 1c 5 1d 5 1e 5 + 1f 5 + 20 5 24 5 25 5 26 5 27 5 28 5 + 29 5 + 2a 5 2b 6 2c 6 2d 6 diff --git a/testData/results/pkg/TestWhileForeach.dec b/testData/results/pkg/TestWhileForeach.dec index 7321d6b081..515cf33205 100644 --- a/testData/results/pkg/TestWhileForeach.dec +++ b/testData/results/pkg/TestWhileForeach.dec @@ -51,6 +51,8 @@ class 'pkg/TestWhileForeach' { 13 13 14 13 15 13 + 16 13 + 17 13 18 14 19 14 1a 14 @@ -72,6 +74,8 @@ class 'pkg/TestWhileForeach' { 33 15 34 15 35 15 + 36 15 + 37 15 38 16 39 16 3a 16 @@ -108,4 +112,4 @@ Lines mapping: 31 <-> 29 Not mapped: 22 -25 \ No newline at end of file +25 diff --git a/testData/results/pkg/TestWhileIterator.dec b/testData/results/pkg/TestWhileIterator.dec index e875c815d6..a4bb8288e6 100644 --- a/testData/results/pkg/TestWhileIterator.dec +++ b/testData/results/pkg/TestWhileIterator.dec @@ -47,6 +47,8 @@ class 'pkg/TestWhileIterator' { 16 12 17 12 18 12 + 19 12 + 1a 12 1b 12 1c 12 1d 12 @@ -55,6 +57,8 @@ class 'pkg/TestWhileIterator' { 20 12 21 12 22 12 + 23 12 + 24 12 25 13 26 13 27 13 @@ -72,6 +76,8 @@ class 'pkg/TestWhileIterator' { 33 13 34 13 35 13 + 36 13 + 37 13 38 14 39 14 3a 14 diff --git a/testData/results/pkg/TestWhileLambda.dec b/testData/results/pkg/TestWhileLambda.dec index 346d73e27d..b9e6638c60 100644 --- a/testData/results/pkg/TestWhileLambda.dec +++ b/testData/results/pkg/TestWhileLambda.dec @@ -18,6 +18,8 @@ class 'pkg/TestWhileLambda' { 7 6 8 8 9 8 + a 8 + b 8 13 9 1a 10 1e 12 diff --git a/testData/results/pkg/TestWhileTernary1.dec b/testData/results/pkg/TestWhileTernary1.dec index 10c03079ed..4f357caeaa 100644 --- a/testData/results/pkg/TestWhileTernary1.dec +++ b/testData/results/pkg/TestWhileTernary1.dec @@ -19,14 +19,22 @@ class 'pkg/TestWhileTernary1' { method 'test (ZII)I' { 0 4 1 4 + 2 4 + 3 4 4 7 5 7 + 6 7 + 7 7 8 7 9 7 a 7 + b 7 + c 7 10 7 11 7 12 7 + 13 7 + 14 7 15 8 16 8 17 8 diff --git a/testData/results/pkg/TestWhileTernary10.dec b/testData/results/pkg/TestWhileTernary10.dec index 5d4ec6f136..351f887047 100644 --- a/testData/results/pkg/TestWhileTernary10.dec +++ b/testData/results/pkg/TestWhileTernary10.dec @@ -4,7 +4,7 @@ import java.util.stream.Stream; public class TestWhileTernary10 { public double test(boolean condition, int n, Stream doubles) { - double[] ds = new double[]{(double)n};// 7 + double[] ds = new double[]{n};// 7 for (int i = 0; condition ? i >= n : n >= i; i++) {// 9 for (int j = 0; j < n; j++) {// 10 @@ -20,10 +20,10 @@ public class TestWhileTernary10 { } public double test1(boolean condition, int n, Stream doubles) { - double[] ds = new double[]{(double)n};// 24 + double[] ds = new double[]{n};// 24 for (int i = 0; condition ? i >= n : n >= i; i++) {// 26 - ds[0] += (double)i;// 27 + ds[0] += i;// 27 } doubles.forEach(d -> ds[0] -= d);// 30 @@ -31,7 +31,7 @@ public class TestWhileTernary10 { } public double test2(boolean condition, int n, Stream doubles) { - double[] ds = new double[]{(double)n};// 35 + double[] ds = new double[]{n};// 35 for (int i = 0; condition ? i >= n : n >= i; i++) {// 37 for (int j = 0; j < n; j++) {// 38 @@ -60,14 +60,20 @@ class 'pkg/TestWhileTernary10' { c 8 d 8 e 8 + f 8 + 10 8 11 8 12 8 13 8 14 8 + 15 8 + 16 8 1a 8 1b 8 1c 8 1d 8 + 1e 8 + 1f 8 20 9 21 9 22 9 @@ -75,6 +81,8 @@ class 'pkg/TestWhileTernary10' { 24 9 25 9 26 9 + 27 9 + 28 9 29 10 2a 10 2b 10 @@ -87,7 +95,11 @@ class 'pkg/TestWhileTernary10' { 32 11 33 11 34 11 + 35 11 + 36 11 37 12 + 38 12 + 39 12 3a 9 3b 9 3c 9 @@ -128,14 +140,20 @@ class 'pkg/TestWhileTernary10' { c 24 d 24 e 24 + f 24 + 10 24 11 24 12 24 13 24 14 24 + 15 24 + 16 24 1a 24 1b 24 1c 24 1d 24 + 1e 24 + 1f 24 20 25 21 25 22 25 @@ -180,14 +198,20 @@ class 'pkg/TestWhileTernary10' { c 35 d 35 e 35 + f 35 + 10 35 11 35 12 35 13 35 14 35 + 15 35 + 16 35 1a 35 1b 35 1c 35 1d 35 + 1e 35 + 1f 35 20 36 21 36 22 36 @@ -195,6 +219,8 @@ class 'pkg/TestWhileTernary10' { 24 36 25 36 26 36 + 27 36 + 28 36 29 37 2a 37 2b 37 @@ -203,6 +229,8 @@ class 'pkg/TestWhileTernary10' { 2e 37 2f 37 30 37 + 31 37 + 32 37 33 38 34 38 35 38 @@ -215,7 +243,11 @@ class 'pkg/TestWhileTernary10' { 3c 39 3d 39 3e 39 + 3f 39 + 40 39 41 40 + 42 40 + 43 40 44 37 45 37 46 37 diff --git a/testData/results/pkg/TestWhileTernary2.dec b/testData/results/pkg/TestWhileTernary2.dec index 745f49db13..b5dd3cf3bc 100644 --- a/testData/results/pkg/TestWhileTernary2.dec +++ b/testData/results/pkg/TestWhileTernary2.dec @@ -13,12 +13,18 @@ class 'pkg/TestWhileTernary2' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 11 5 12 5 13 5 diff --git a/testData/results/pkg/TestWhileTernary3.dec b/testData/results/pkg/TestWhileTernary3.dec index b05b60b7fd..aa4158cecf 100644 --- a/testData/results/pkg/TestWhileTernary3.dec +++ b/testData/results/pkg/TestWhileTernary3.dec @@ -15,12 +15,18 @@ class 'pkg/TestWhileTernary3' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 11 5 12 5 13 5 diff --git a/testData/results/pkg/TestWhileTernary4.dec b/testData/results/pkg/TestWhileTernary4.dec index cfce795dfe..668909c927 100644 --- a/testData/results/pkg/TestWhileTernary4.dec +++ b/testData/results/pkg/TestWhileTernary4.dec @@ -13,12 +13,18 @@ class 'pkg/TestWhileTernary4' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 14 7 15 7 16 7 diff --git a/testData/results/pkg/TestWhileTernary5.dec b/testData/results/pkg/TestWhileTernary5.dec index 5225fbd46d..ea8da41436 100644 --- a/testData/results/pkg/TestWhileTernary5.dec +++ b/testData/results/pkg/TestWhileTernary5.dec @@ -22,6 +22,8 @@ class 'pkg/TestWhileTernary5' { 1 4 2 4 3 4 + 4 4 + 5 4 6 5 7 5 8 5 @@ -30,14 +32,22 @@ class 'pkg/TestWhileTernary5' { b 6 c 6 d 6 + e 6 + f 6 10 8 11 8 + 12 8 + 13 8 14 8 15 8 16 8 + 17 8 + 18 8 1c 8 1d 8 1e 8 + 1f 8 + 20 8 21 9 22 9 23 9 diff --git a/testData/results/pkg/TestWhileTernary6.dec b/testData/results/pkg/TestWhileTernary6.dec index 6e39175f92..6e8a2c5001 100644 --- a/testData/results/pkg/TestWhileTernary6.dec +++ b/testData/results/pkg/TestWhileTernary6.dec @@ -27,15 +27,25 @@ class 'pkg/TestWhileTernary6' { a 7 b 7 c 7 + d 7 + e 7 f 8 + 10 8 + 11 8 12 10 13 10 + 14 10 + 15 10 16 10 17 10 18 10 + 19 10 + 1a 10 1e 10 1f 10 20 10 + 21 10 + 22 10 23 11 } } diff --git a/testData/results/pkg/TestWhileTernary7.dec b/testData/results/pkg/TestWhileTernary7.dec index cca8ef7edd..d32660b4e7 100644 --- a/testData/results/pkg/TestWhileTernary7.dec +++ b/testData/results/pkg/TestWhileTernary7.dec @@ -15,14 +15,20 @@ class 'pkg/TestWhileTernary7' { 2 4 3 4 4 4 + 5 4 + 6 4 7 4 8 4 9 4 a 4 + b 4 + c 4 10 4 11 4 12 4 13 4 + 14 4 + 15 4 16 5 17 5 18 5 diff --git a/testData/results/pkg/TestWhileTernary8.dec b/testData/results/pkg/TestWhileTernary8.dec index 71a55c113d..483f74338e 100644 --- a/testData/results/pkg/TestWhileTernary8.dec +++ b/testData/results/pkg/TestWhileTernary8.dec @@ -13,18 +13,28 @@ class 'pkg/TestWhileTernary8' { method 'test (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 9 4 a 4 b 4 + c 4 + d 4 11 4 12 4 13 4 + 14 4 + 15 4 19 4 1a 4 1b 4 + 1c 4 + 1d 4 1e 5 1f 5 20 5 diff --git a/testData/results/pkg/TestWhileTernary9.dec b/testData/results/pkg/TestWhileTernary9.dec index 3fcefc1190..93b2edebc5 100644 --- a/testData/results/pkg/TestWhileTernary9.dec +++ b/testData/results/pkg/TestWhileTernary9.dec @@ -45,10 +45,16 @@ class 'pkg/TestWhileTernary9' { 2 4 3 6 4 6 + 5 6 + 6 6 7 6 8 6 + 9 6 + a 6 e 6 f 6 + 10 6 + 11 6 12 7 13 7 14 7 @@ -57,6 +63,8 @@ class 'pkg/TestWhileTernary9' { 17 7 18 7 19 7 + 1a 7 + 1b 7 1f 11 } @@ -69,15 +77,23 @@ class 'pkg/TestWhileTernary9' { 5 14 6 14 7 14 + 8 14 + 9 14 a 15 b 15 c 15 d 17 e 17 + f 17 + 10 17 11 17 12 17 + 13 17 + 14 17 18 17 19 17 + 1a 17 + 1b 17 1c 18 1d 18 1e 18 @@ -86,6 +102,8 @@ class 'pkg/TestWhileTernary9' { 21 18 22 18 23 18 + 24 18 + 25 18 29 23 } @@ -98,15 +116,23 @@ class 'pkg/TestWhileTernary9' { 5 26 6 26 7 26 + 8 26 + 9 26 a 27 b 27 c 27 d 29 e 29 + f 29 + 10 29 11 29 12 29 + 13 29 + 14 29 18 29 19 29 + 1a 29 + 1b 29 1c 30 1d 30 1e 30 @@ -115,12 +141,16 @@ class 'pkg/TestWhileTernary9' { 21 30 22 30 23 30 + 24 30 + 25 30 29 35 2a 35 2b 35 2c 35 2d 35 2e 35 + 2f 35 + 30 35 31 37 } } diff --git a/testData/results/pkg/TestWhileTernaryFake.dec b/testData/results/pkg/TestWhileTernaryFake.dec index 2d7a6e6d67..e05a4409b0 100644 --- a/testData/results/pkg/TestWhileTernaryFake.dec +++ b/testData/results/pkg/TestWhileTernaryFake.dec @@ -13,12 +13,18 @@ class 'pkg/TestWhileTernaryFake' { method 'test2 (ZII)V' { 0 4 1 4 + 2 4 + 3 4 4 4 5 4 6 4 + 7 4 + 8 4 c 4 d 4 e 4 + f 4 + 10 4 14 5 15 5 16 5 diff --git a/testData/src/java16/pkg/TestInlineSwitchExpression7.java b/testData/src/java16/pkg/TestInlineSwitchExpression7.java new file mode 100644 index 0000000000..d37c1e94f4 --- /dev/null +++ b/testData/src/java16/pkg/TestInlineSwitchExpression7.java @@ -0,0 +1,28 @@ +package pkg; + +public enum TestInlineSwitchExpression7 { + A, + B, + C; + + private int get() { + return ordinal(); + } + + public int test(TestInlineSwitchExpression7 in) { + return switch (in) { + case A -> { + int a = get(); + yield a + 1; + } + case B -> { + int b = get(); + yield b + 2; + } + case C -> { + int c = get(); + yield c + 3; + } + }; + } +} diff --git a/testData/src/java16/pkg/TestPatternMatchingInvoke.java b/testData/src/java16/pkg/TestPatternMatchingInvoke.java new file mode 100644 index 0000000000..e0cd8c2c7f --- /dev/null +++ b/testData/src/java16/pkg/TestPatternMatchingInvoke.java @@ -0,0 +1,38 @@ +package pkg; + +public class TestPatternMatchingInvoke { + interface I { + + } + + class A implements I { + + } + + class B implements I { + + } + + public I get() { + return new A(); + } + + public boolean bool() { + return true; + } + + public void test(boolean cond) { + System.out.println("Before"); + + if (bool()) { + System.out.println("Inner"); + I i = get(); + if (cond && i instanceof A) { + I i2 = get(); + System.out.println(i2); + } + } + + System.out.println("After"); + } +} diff --git a/testData/src/java16/pkg/TestRecordLocal.java b/testData/src/java16/pkg/TestRecordLocal.java new file mode 100644 index 0000000000..a6c6739053 --- /dev/null +++ b/testData/src/java16/pkg/TestRecordLocal.java @@ -0,0 +1,11 @@ +package pkg; + +import java.util.List; + +public class TestRecordLocal { + public Object test(List list) { + record Rec(TestRecordLocal a, List b) {} + + return new Rec(this, list); + } +} diff --git a/testData/src/java16/pkg/TestReturnSwitchExpression5.java b/testData/src/java16/pkg/TestReturnSwitchExpression5.java new file mode 100644 index 0000000000..674f24656b --- /dev/null +++ b/testData/src/java16/pkg/TestReturnSwitchExpression5.java @@ -0,0 +1,15 @@ +package pkg; + + +public class TestReturnSwitchExpression5 { + public String test(int i) { + return switch (i) { + case 1 -> "1"; + case 2 -> "2"; + default -> { + int a = 0; + throw new RuntimeException(); + } + }; + } +} diff --git a/testData/src/java19preview/pkg/TestRecordPattern1.java b/testData/src/java19preview/pkg/TestRecordPattern1.java deleted file mode 100644 index fbc0b00199..0000000000 --- a/testData/src/java19preview/pkg/TestRecordPattern1.java +++ /dev/null @@ -1,31 +0,0 @@ -package pkg; - -public class TestRecordPattern1 { - - record Point(int a, int b) {} - - void test(Object o) { - if (o instanceof Point(int a, int b)) { - System.out.println(a + b); - } - } - - void test2(Object o) { - switch(o) { - case Point(var a, var b) -> System.out.println(a + b); - case null -> System.out.println("null"); - case Object obj -> System.out.println("everything else"); - } - } - - int test3(Object o) { - return switch(o) { - case null -> -1; - case Point(var a, var b) - when a > 0 && b > 0 - -> a + b; - case Point p -> throw new IllegalArgumentException("Negative point not allowed"); - case Object object -> throw new IllegalArgumentException("Only points or null allowed"); - }; - } -} \ No newline at end of file diff --git a/testData/src/java19preview/pkg/TestRecordPattern2.java b/testData/src/java19preview/pkg/TestRecordPattern2.java deleted file mode 100644 index fa0d9feadf..0000000000 --- a/testData/src/java19preview/pkg/TestRecordPattern2.java +++ /dev/null @@ -1,40 +0,0 @@ -package pkg; - -public class TestRecordPattern2 { - - record Pair(A a, B b) {} - - void test(Pair p) { - if (p instanceof Pair(String s, Long l)) { - System.out.println("String-Long pair of \"" + s + "\" and " + l); - } else if (p instanceof Pair(Long l, Object o)) { - System.out.println("Long-Object pair"); - } else { - System.out.println("Other pair"); - } - } - - void test2(Pair p) { - if (p instanceof Pair(String s, Long l)) { - System.out.println("String-Long pair of \"" + s + "\" and " + l); - } else if (p instanceof Pair(Long l, Object o)) { - System.out.println("Long-Object pair"); - } else { - System.out.println("Other pair"); - } - System.out.println("Unconditional"); - } - - Object test3(Pair p) { - return switch(p) { - case null -> -1; - case Pair(Long l, Long r) v -> l + r; - case Pair(Integer l, Integer r) v -> (l << r) * v.hashCode(); - case Pair(Object l, Void r) -> throw new IllegalArgumentException("how"); - case Pair(String l, String r) - when l.length() > 3 && r.length() > 3 && l.length() + r.length() < 23 - -> l.length() + r.length(); - case Pair(Object l, Object r) p2 -> -2; - }; - } -} \ No newline at end of file diff --git a/testData/src/java19preview/pkg/TestRecordPattern3.java b/testData/src/java19preview/pkg/TestRecordPattern3.java deleted file mode 100644 index 749d83a527..0000000000 --- a/testData/src/java19preview/pkg/TestRecordPattern3.java +++ /dev/null @@ -1,14 +0,0 @@ -package pkg; - -public class TestRecordPattern3 { - - record Bundle(A a, String b, String c, int i1, int i2, int i3, int i4, long l1, long l2, char c1, char c2, byte bb, double dd, boolean bool) {} - - void test(Bundle bundle){ - if (bundle instanceof Bundle( - String a, var b, var c, var i1, var i2, var i3, var i4, var l1, var l2, var c1, var c2, var bb, var dd, var bool - )){ - System.out.println(((a + b + c) + (i1 + i2 + i3 + i4 + l1 + l2 + c1 + c2 + bb + dd)) + bool); - } - } -} \ No newline at end of file diff --git a/testData/src/java19preview/pkg/TestRecordPattern4.java b/testData/src/java19preview/pkg/TestRecordPattern4.java deleted file mode 100644 index 9e72ca8555..0000000000 --- a/testData/src/java19preview/pkg/TestRecordPattern4.java +++ /dev/null @@ -1,23 +0,0 @@ -package pkg; - -public class TestRecordPattern4 { - - record Many(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i) {} - - void test(Object m){ - if (m instanceof Many( - String a, String b, String c, String d, String e, String f, String g, String h, String i - ) mm) { - System.out.println(a + b + c + d + e + f + g + h + i + mm.hashCode()); - } - } - - void test2(Object m) { - if (m instanceof Many( - var a, String b, var c, var d, String e, var f, var g, String h, Many( - var a2, var b2, var c2, var d2, var e2, var f2, var g2, String h2, Many i2 - ) i) mm) { - System.out.println(b + c + e + h + h2 + i2 + i.hashCode() + mm.hashCode()); - } - } -} \ No newline at end of file diff --git a/testData/src/java21/ext/TestEnum2.java b/testData/src/java21/ext/TestEnum2.java new file mode 100644 index 0000000000..bcc0edddad --- /dev/null +++ b/testData/src/java21/ext/TestEnum2.java @@ -0,0 +1,7 @@ +package ext; + +public enum TestEnum2 { + A, + B, + C +} diff --git a/testData/src/java21/pkg/TestCastIntersectionJ21.java b/testData/src/java21/pkg/TestCastIntersectionJ21.java new file mode 100644 index 0000000000..81f5eae5b1 --- /dev/null +++ b/testData/src/java21/pkg/TestCastIntersectionJ21.java @@ -0,0 +1,36 @@ +package pkg; + +public class TestCastIntersectionJ21 { + public void test1(I1 i1) { + method((I1 & I2) i1); + } + + public void test2(I2 i2) { + method((I1 & I2) i2); + } + + public void test3(I1 i1) { + var i = (I1 & I2) i1; + method(i); + } + + public void test4(I2 i2) { + var i = (I1 & I2) i2; + method(i); + } + + public void test5(I2 i2) { + var i = (I1 & I2) i2; + i.method(); + } + + public void method(I i) { + } + + private static class I1 { + } + + private static interface I2 { + public void method(); + } +} diff --git a/testData/src/java21/pkg/TestInnerClasses2J21.java b/testData/src/java21/pkg/TestInnerClasses2J21.java new file mode 100644 index 0000000000..d856d67cd7 --- /dev/null +++ b/testData/src/java21/pkg/TestInnerClasses2J21.java @@ -0,0 +1,15 @@ +package pkg; + +public class TestInnerClasses2J21 { + private void test() { + new Inner().new Inner2(true, true); + } + + private class Inner { + private class Inner2 { + private Inner2(boolean nonFinal, final boolean finalB) { + TestInnerClasses2J21.this.test(); + } + } + } +} diff --git a/testData/src/java21/pkg/TestInnerClasses3J21.java b/testData/src/java21/pkg/TestInnerClasses3J21.java new file mode 100644 index 0000000000..98690a3225 --- /dev/null +++ b/testData/src/java21/pkg/TestInnerClasses3J21.java @@ -0,0 +1,20 @@ +package pkg; + +public class TestInnerClasses3J21 { + private int i = 0; + + private class Inner { + private int j; + Inner() { + this(0); + } + + Inner(int i) { + this.j = i; + } + + private void setI() { + TestInnerClasses3J21.this.i = j; + } + } +} diff --git a/testData/src/java21/pkg/TestInnerClasses4J21.java b/testData/src/java21/pkg/TestInnerClasses4J21.java new file mode 100644 index 0000000000..351e19be9e --- /dev/null +++ b/testData/src/java21/pkg/TestInnerClasses4J21.java @@ -0,0 +1,12 @@ +package pkg; + +import java.util.List; + +public class TestInnerClasses4J21 { + private class Inner { + Inner(double d, List l) { + + } + } + +} diff --git a/testData/src/java21/pkg/TestRecordPatterns3.java b/testData/src/java21/pkg/TestRecordPatterns3.java new file mode 100644 index 0000000000..7698a8f280 --- /dev/null +++ b/testData/src/java21/pkg/TestRecordPatterns3.java @@ -0,0 +1,43 @@ +package pkg; + +public class TestRecordPatterns3 { + record R() { + + } + + public void test1(R r) { + if (r instanceof R()) { + System.out.println(r); + } + } + + public void test2(R r) { + if (r instanceof R) { + System.out.println(r); + } + } + + public void test3(R r) { + if (r instanceof R x) { + System.out.println(x); + } + } + + public void test4(Object r) { + if (r instanceof R()) { + System.out.println(r); + } + } + + public void test5(Object r) { + if (r instanceof R) { + System.out.println(r); + } + } + + public void test6(Object r) { + if (r instanceof R x) { + System.out.println(x); + } + } +} diff --git a/testData/src/java21/pkg/TestRecordPatterns4.java b/testData/src/java21/pkg/TestRecordPatterns4.java new file mode 100644 index 0000000000..ed7c4c52b8 --- /dev/null +++ b/testData/src/java21/pkg/TestRecordPatterns4.java @@ -0,0 +1,26 @@ +package pkg; + +public class TestRecordPatterns4 { + record R(Object a, Object b) {} + + public void test1(R r) { + if (r instanceof R(Number x, String s)) { + System.out.println(x); + System.out.println(s); + } + } + + public void test2(R r) { + if (r instanceof R(Number x, String s) && s.length() > 10) { + System.out.println(x); + System.out.println(s); + } + } + + public void test3(R r) { + if (r instanceof R(Number x, String s) && s.length() > 10 && x.intValue() == 3) { + System.out.println(x); + System.out.println(s); + } + } +} diff --git a/testData/src/java21/pkg/TestRecordPatterns5.java b/testData/src/java21/pkg/TestRecordPatterns5.java new file mode 100644 index 0000000000..e5ff6bf316 --- /dev/null +++ b/testData/src/java21/pkg/TestRecordPatterns5.java @@ -0,0 +1,26 @@ +package pkg; + +public class TestRecordPatterns5 { + record R(Number a, String b) {} + + public void test1(R r) { + if (r instanceof R(Integer x, String s)) { + System.out.println(x); + System.out.println(s); + } + } + + public void test2(R r) { + if (r instanceof R(Integer x, String s) && s.length() > 10) { + System.out.println(x); + System.out.println(s); + } + } + + public void test3(R r) { + if (r instanceof R(Integer x, String s) && s.length() > 10 && x.intValue() == 3) { + System.out.println(x); + System.out.println(s); + } + } +} diff --git a/testData/src/java21/pkg/TestRecordPatterns6.java b/testData/src/java21/pkg/TestRecordPatterns6.java new file mode 100644 index 0000000000..5cdcd31506 --- /dev/null +++ b/testData/src/java21/pkg/TestRecordPatterns6.java @@ -0,0 +1,25 @@ +package pkg; + +public class TestRecordPatterns6 { + sealed interface I { + record R1(Object o) implements I {}; + record R2(int i) implements I {}; + record R3(String s) implements I {}; + } + + public Object test1(I in) { + return switch (in) { + case I.R1(Object o) -> o; + case I.R2(int i) -> i; + case I.R3(String s) -> s; + }; + } + + public String test2(I in) { + return switch (in) { + case I.R1(String s) -> s; + case I.R3(String s) -> s; + default -> throw new IllegalStateException(); + }; + } +} diff --git a/testData/src/java21/pkg/TestRecordPatterns7.java b/testData/src/java21/pkg/TestRecordPatterns7.java new file mode 100644 index 0000000000..1b3e50a352 --- /dev/null +++ b/testData/src/java21/pkg/TestRecordPatterns7.java @@ -0,0 +1,22 @@ +package pkg; + +public class TestRecordPatterns7 { + public void test(Object o) { + if (o instanceof A(C(B(int i1, int i2), int i3), int i4, B(int i5, int i6))) { + System.out.println(i1 + i2 + i3 + i4 + i5 + i6); + } + } + + public void test2(Object o) { + System.out.println(switch (o) { + case A(C(B(int i1, int i2), int i3), int i4, B(int i5, int i6)) -> i1 + i2 + i3 + i4 + i5 + i6; + default -> 0; + }); + } + + record A(C c, int i, B b2) {} + + record B(int i1, int i2) {} + + record C(B b, int i) {} +} diff --git a/testData/src/java21/pkg/TestSwitchOnEnumJ21.java b/testData/src/java21/pkg/TestSwitchOnEnumJ21.java index f3fc6a301b..aa59f277f2 100644 --- a/testData/src/java21/pkg/TestSwitchOnEnumJ21.java +++ b/testData/src/java21/pkg/TestSwitchOnEnumJ21.java @@ -1,5 +1,7 @@ package pkg; +import ext.TestEnum2; + public class TestSwitchOnEnumJ21 { public int test1(TestEnum a) { return switch (a) { @@ -8,6 +10,48 @@ public int test1(TestEnum a) { case C -> 3; }; } + + public int test2(TestEnum2 a) { + return switch (a) { + case A -> 1; + case B -> 2; + case C -> 3; + }; + } + + public int test3(TestEnum a) { + return switch (a) { + case A -> 1; + case B -> 2; + case C -> 3; + case null -> 4; + }; + } + + public int test4(TestEnum2 a) { + return switch (a) { + case A -> 1; + case B -> 2; + case C -> 3; + case null -> 4; + }; + } + + public int test5(TestEnum a, boolean b) { + return switch (a) { + case A -> 1; + case B -> 2; + case C -> { + if (b) { + boolean c = true; + yield 3; + } else { + boolean d = true; + yield 4; + } + } + }; + } public int testDefault(TestEnum a) { return switch (a) { @@ -15,6 +59,13 @@ public int testDefault(TestEnum a) { default -> 5; }; } + + public int testDefault2(TestEnum2 a) { + return switch (a) { + case A -> 1; + default -> 5; + }; + } public void testStatement(TestEnum a) { switch (a) { diff --git a/testData/src/java21/pkg/TestSwitchPatternMatchingJ21.java b/testData/src/java21/pkg/TestSwitchPatternMatchingJ21.java new file mode 100644 index 0000000000..64e62ec2b8 --- /dev/null +++ b/testData/src/java21/pkg/TestSwitchPatternMatchingJ21.java @@ -0,0 +1,28 @@ +package pkg; + +import java.util.function.Supplier; + +public class TestSwitchPatternMatchingJ21 { + public void test1(Object o) { + System.out.println(switch (o) { + case Integer i -> Integer.toString(i); + case null, default -> "null"; + }); + } + + public String test2(Object o) { + return switch (o) { + case Integer i -> Integer.toString(i); + case String s -> s; + default -> "null"; + }; + } + + public String test3(Supplier o) { + return switch (o.get()) { + case Integer i -> Integer.toString(i); + case String s -> s; + default -> "null"; + }; + } +} diff --git a/testData/src/java21/pkg/TestSwitchSimpleMultiLine.java b/testData/src/java21/pkg/TestSwitchSimpleMultiLine.java new file mode 100644 index 0000000000..0d7bbc8d6b --- /dev/null +++ b/testData/src/java21/pkg/TestSwitchSimpleMultiLine.java @@ -0,0 +1,22 @@ +package pkg; + +import java.util.Random; +import java.util.function.Predicate; + +public class TestSwitchSimpleMultiLine { + public static Predicate predicates() { + int i = new Random().nextInt(); + return switch (i) { + case 0 -> object -> true; + case 1 -> object -> false; + default -> object -> { + final boolean r1 = new Random().nextBoolean(); + final boolean r2 = new Random().nextBoolean(); + if (r1 && r2) { + return true; + } + return new Random().nextBoolean(); + }; + }; + } +} diff --git a/testData/src/java8/pkg/TestAnonymousClassToLambda.java b/testData/src/java8/pkg/TestAnonymousClassToLambda.java new file mode 100644 index 0000000000..1297464cde --- /dev/null +++ b/testData/src/java8/pkg/TestAnonymousClassToLambda.java @@ -0,0 +1,11 @@ +package pkg; + +public class TestAnonymousClassToLambda { + public Object test1(Object o) { + return new Object() { + public Runnable getRunnable() { + return () -> System.out.println(o); + } + }; + } +} diff --git a/testData/src/java8/pkg/TestBlankLinesSpaces.java b/testData/src/java8/pkg/TestBlankLinesSpaces.java new file mode 100644 index 0000000000..efba634512 --- /dev/null +++ b/testData/src/java8/pkg/TestBlankLinesSpaces.java @@ -0,0 +1,25 @@ +package pkg; + +import java.util.Random; + +public class TestBlankLinesSpaces { + private static final String STRING = longMethodName00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000(); + + private static String longMethodName00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000() { + return null; + } + + static { + takeLambda00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000(() -> { + for (int i = 0; i < 10; i++) { + System.out.println(i); + } + if (new Random().nextBoolean()) { + System.out.println(true); + } + }); + } + + static void takeLambda00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000(Runnable r) { + } +} diff --git a/testData/src/java8/pkg/TestEmptyLambda.java b/testData/src/java8/pkg/TestEmptyLambda.java new file mode 100644 index 0000000000..ef0548592f --- /dev/null +++ b/testData/src/java8/pkg/TestEmptyLambda.java @@ -0,0 +1,5 @@ +package pkg; + +public class TestEmptyLambda { + public static final Runnable EMPTY_LAMBDA = () -> {}; +} diff --git a/testData/src/java8/pkg/TestNumberCasts.java b/testData/src/java8/pkg/TestNumberCasts.java new file mode 100644 index 0000000000..ab2e6c08cd --- /dev/null +++ b/testData/src/java8/pkg/TestNumberCasts.java @@ -0,0 +1,84 @@ +package pkg; + +public class TestNumberCasts { + private static void b(byte b) { + } + + private static void s(short s) { + } + + private static void i(int i) { + } + + private static void l(long l) { + } + + private static void f(float f) { + } + + private static void d(double d) { + } + + public void test() { + byte b = 127; + b(b); + s(b); + i(b); + l(b); + f(b); + d(b); + s((short) (b * b)); + s((short) (b + b)); + s((short) (-b - b)); + + short s = 32767; + b((byte) s); + s(s); + i(s); + l(s); + f(s); + d(s); + i((int) s * s); + i((int) s + s); + i((int) -s - s); + + int i = 2147483647; + b((byte) i); + s((short) i); + i(i); + l(i); + f(i); + d(i); + l(i * i); // not a good idea, but should test for it + l(i + b); // not a good idea, but should test for it + l((long) (i * i)); // not a good idea, but should test for it + l((long) i * i); + l((long) i + i); + l((long) -i - i); + l((long) i + b); + + long l = 9223372036854775807L; + b((byte) l); + s((short) l); + i((int) l); + l(l); + f(l); + d(l); + + float f = 3.4028235E38f; + b((byte) f); + s((short) f); + i((int) f); + l((long) f); + f(f); + d(f); + + double d = 1.7976931348623157E308; + b((byte) d); + s((short) d); + i((int) d); + l((long) d); + f((float) d); + d(d); + } +} diff --git a/testData/src/java8/pkg/TestNumberDisambiguation.java b/testData/src/java8/pkg/TestNumberDisambiguation.java new file mode 100644 index 0000000000..632432551d --- /dev/null +++ b/testData/src/java8/pkg/TestNumberDisambiguation.java @@ -0,0 +1,93 @@ +package pkg; + +public class TestNumberDisambiguation { + public void foo(byte b) { + } + + public void foo(short s) { + } + + public void foo(char c) { + } + + public void foo(int i) { + } + + public void foo(long l) { + } + + public void foo(float f) { + } + + public void foo(double d) { + } + + public void bar(byte a, byte b) { + } + + public void bar(short a, short b) { + } + + public void bar(char a, char b) { + } + + public void bar(int a, int b) { + } + + public void bar(long a, long b) { + } + + public void bar(float a, float b) { + } + + public void bar(double a, double b) { + } + + public void baz(int a, byte b, byte c) { + } + + public void baz(int a, short b, short c) { + } + + public void baz(int a, char b, char c) { + } + + public void baz(int a, int b, int c) { + } + + public void baz(int a, long b, long c) { + } + + public void baz(int a, float b, float c) { + } + + public void baz(int a, double b, double c) { + } + + public void test() { + int i = 24; + foo((byte) i); + foo((short) i); + foo((char) i); + foo(i); + foo((long) i); + foo((float) i); + foo((double) i); + + bar((byte) 0, (byte) i); + bar((short) 0, (short) i); + bar('\u0000', (char) i); + bar(0, i); + bar(0L, i); + bar(0.0F, i); + bar(0.0, i); + + baz(0, (byte) 127, (byte) i); + baz(0, (short) 32767, (short) i); + baz(0, '\uFFFF', (char) i); + baz(0, Integer.MAX_VALUE, i); + baz(0, Long.MAX_VALUE, i); + baz(0, Float.MAX_VALUE, i); + baz(0, Double.MAX_VALUE, i); + } +} diff --git a/testData/src/java8/pkg/TestSwitchInTry.java b/testData/src/java8/pkg/TestSwitchInTry.java new file mode 100644 index 0000000000..a7450667cf --- /dev/null +++ b/testData/src/java8/pkg/TestSwitchInTry.java @@ -0,0 +1,26 @@ +package pkg; + +import java.util.Arrays; +import java.util.List; + +public class TestSwitchInTry { + /** + * ISSUE 349: Infinite loop in SFormsConstructor->splitVariables + * Submitted by @mvisat + */ + + public static List method(String[] args) { + String ret = ""; + for (String arg : args) { + try { + switch (arg) { + case "a": + ret = "a"; + } + break; + } catch (Exception ex) { + } + } + return Arrays.asList(ret); + } +} diff --git a/testFixtures/org/jetbrains/java/decompiler/SingleClassesTestBase.java b/testFixtures/org/jetbrains/java/decompiler/SingleClassesTestBase.java index 59b2d8f033..59bc5cbf95 100644 --- a/testFixtures/org/jetbrains/java/decompiler/SingleClassesTestBase.java +++ b/testFixtures/org/jetbrains/java/decompiler/SingleClassesTestBase.java @@ -29,10 +29,8 @@ import java.util.regex.Pattern; import java.util.stream.Stream; -import static org.jetbrains.java.decompiler.DecompilerTestFixture.assertFilesEqual; import static org.jetbrains.java.decompiler.DecompilerTestFixture.getContent; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assumptions.assumeTrue; /* @@ -57,11 +55,11 @@ protected final void registerSet(String name, Runnable initializer, Object ...op testSets.add(currentTestSet); } - protected final void register(TestDefinition.Version version, String testClass, String... others) { - register(version, testClass, false, others); + protected final TestDefinition register(TestDefinition.Version version, String testClass, String... others) { + return register(version, testClass, false, others); } - private void register(TestDefinition.Version version, String testClass, boolean failable, String... others) { + private TestDefinition register(TestDefinition.Version version, String testClass, boolean failable, String... others) { if (classNames.contains(testClass)) { throw new AssertionFailedError("Registered same class twice! " + testClass); } @@ -69,17 +67,21 @@ private void register(TestDefinition.Version version, String testClass, boolean List othersList = new ArrayList<>(others.length); for (String other : others) othersList.add(getFullClassName(other)); - currentTestSet.testDefinitions.add(new TestDefinition(version, getFullClassName(testClass), othersList, failable)); + TestDefinition test = new TestDefinition(version, getFullClassName(testClass), othersList, failable); + currentTestSet.testDefinitions.add(test); + return test; } @Deprecated // Temporary fix for inconsistent javac code generation - protected final void registerFailable(TestDefinition.Version version, String testClass, String... others) { - register(version, testClass, true, others); + protected final TestDefinition registerFailable(TestDefinition.Version version, String testClass, String... others) { + return register(version, testClass, true, others); } - protected final void registerRaw(TestDefinition.Version version, String testClass, String ...others) { - currentTestSet.testDefinitions.add(new TestDefinition(version, testClass, Arrays.asList(others), false)); + protected final TestDefinition registerRaw(TestDefinition.Version version, String testClass, String ...others) { + TestDefinition test = new TestDefinition(version, testClass, Arrays.asList(others), false); + currentTestSet.testDefinitions.add(test); + return test; } private static String getFullClassName(String className) { @@ -181,6 +183,7 @@ public static class TestDefinition { public final List others; public final boolean failable; private final DecompilerTestFixture fixture = new DecompilerTestFixture(); + private String expectedFileName; public TestDefinition(Version version, String testClass, List others, boolean failable) { this.version = version; @@ -197,6 +200,10 @@ public Path getReferenceFile() { return SingleClassesTestBase.getReferenceFile(fixture, testClass); } + public void setExpectedFileName(String expectedFileName) { + this.expectedFileName = expectedFileName; + } + public void run(Object[] options, SingleClassesTestBase base) throws IOException { fixture.setUp(options); ConsoleDecompiler decompiler = fixture.getDecompiler(); @@ -220,8 +227,21 @@ public void run(Object[] options, SingleClassesTestBase base) throws IOException String testFileName = classFile.getFileName().toString(); String testName = testFileName.substring(0, testFileName.length() - 6); - Path decompiledFile = fixture.getTargetDir().resolve(testName + ".java"); - assertTrue(Files.isRegularFile(decompiledFile)); + + Path decompiledFile; + if (expectedFileName != null) { + decompiledFile = fixture.getTargetDir().resolve(expectedFileName); + } else { + // First try a name copying that of the original classfile along with the extension matching the compiler's language + decompiledFile = fixture.getTargetDir().resolve(testName + '.' + version.extension); + + if (!Files.isRegularFile(decompiledFile)) { + // If that fails, try with a .java extension + decompiledFile = fixture.getTargetDir().resolve(testName + ".java"); + } + } + + assertTrue(Files.isRegularFile(decompiledFile), "Decompiled file not found: " + decompiledFile); String decompiledContent = getContent(decompiledFile); @@ -229,7 +249,7 @@ public void run(Object[] options, SingleClassesTestBase base) throws IOException // scala likes to generate "unrelated" classfiles for the majority of its functionality // tack those onto the end of the decompiled files for (String companionFile : others) { - Path decompiledCompanion = fixture.getTargetDir().resolve(companionFile + ".java"); + Path decompiledCompanion = fixture.getTargetDir().resolve(companionFile + '.' + version.extension); // cut off any packages decompiledCompanion = fixture.getTargetDir().resolve(decompiledCompanion.getFileName()); assertTrue(Files.isRegularFile(decompiledCompanion)); @@ -288,7 +308,8 @@ public enum Version { JAVA_21(21), JAVA_21_PREVIEW(21, "preview", "Preview"), GROOVY("groovy", "Groovy"), - KOTLIN("kt", "Kotlin"), + KOTLIN("kt", "Kotlin", "kt"), + KOTLIN_OLD("ktold", "Kotlin (old defaults)", "kt"), SCALA("scala", "Scala"), JASM("jasm", "Custom (jasm)"), ; @@ -298,11 +319,17 @@ public enum Version { public final int runtimeVersion; public final String directory; public final String display; + public final String extension; - Version(String directory, String display) { + Version(String directory, String display, String extension) { this.runtimeVersion = UNKNOWN_RUNTIME; this.directory = directory; this.display = display; + this.extension = extension; + } + + Version(String directory, String display) { + this(directory, display, "java"); } Version(int javaVersion) { @@ -313,6 +340,7 @@ public enum Version { this.runtimeVersion = javaVersion; this.directory = "java" + javaVersion + suffix; this.display = "Java " + javaVersion + (!display.isEmpty() ? " " + display : ""); + this.extension = "java"; } @Override