Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Records aren't mapped properly #73

Closed
ghost opened this issue Sep 25, 2021 · 5 comments
Closed

Records aren't mapped properly #73

ghost opened this issue Sep 25, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented Sep 25, 2021

Classes that extend Record, implementing synthetic toString, hashCode, and/or equals, with the characteristic of this.method<invokedynamic>(...) under fernflower, require special mapping treatment to be used in a debug environment without remapping.

Assembly:

DEFINE PUBLIC FINAL hashCode()I
A:
LINE A 54
ALOAD this
INVOKEDYNAMIC hashCode (Lnet/minecraft/world/level/biome/BiomeSource$1FeatureData;)I handle[H_INVOKESTATIC java/lang/runtime/ObjectMethods.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/TypeDescriptor;Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;] args[Lnet/minecraft/world/level/biome/BiomeSource$1FeatureData;, "step;feature", handle[H_GETFIELD net/minecraft/world/level/biome/BiomeSource$1FeatureData.a I], handle[H_GETFIELD net/minecraft/world/level/biome/BiomeSource$1FeatureData.b Lnet/minecraft/world/level/levelgen/feature/ConfiguredFeature;]]
IRETURN
B:
C:

CFR:

package net.minecraft.world.level.biome;

import java.lang.invoke.MethodHandle;
import java.lang.runtime.ObjectMethods;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;

record BiomeSource$1FeatureData(int step, ConfiguredFeature<?, ?> feature) {
    @Override
    public final String toString() {
        return ObjectMethods.bootstrap("toString", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this);
    }

    @Override
    public final int hashCode() {
        return (int)ObjectMethods.bootstrap("hashCode", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this);
    }

    @Override
    public final boolean equals(Object object) {
        return (boolean)ObjectMethods.bootstrap("equals", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this, object);
    }
}
@ghost
Copy link
Author

ghost commented Sep 25, 2021

image
image

hm

@ghost
Copy link
Author

ghost commented Sep 25, 2021

I'm not sure how to approach pulling the old parent symbol to read the internal field cache. Duplicating put entries in the mappings loader with the alternative/new class symbol seems to work. https://pastebin.com/eqkMU6J0
image Seems to be stable

@md-5
Copy link
Owner

md-5 commented Sep 25, 2021

Pull request?

@ghost
Copy link
Author

ghost commented Sep 25, 2021

Sure, lemme just rebase to master instead of the last release and test again

@ghost ghost mentioned this issue Sep 25, 2021
md-5 pushed a commit that referenced this issue Sep 26, 2021
@md-5
Copy link
Owner

md-5 commented Sep 26, 2021

Thanks

@md-5 md-5 closed this as completed Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant