Skip to content

Cannot remap method overriding with generic parameter #8

Open
@qouteall

Description

@qouteall

Example:

//mc code
public abstract class Feature<FC extends FeatureConfig>{
    public abstract boolean generate(IWorld world, ChunkGenerator<? extends ChunkGeneratorConfig> generator, Random random, BlockPos pos, FC config);
}

//my code
public class SimpleSpawnerFeature extends Feature<DefaultFeatureConfig>{
    @Override
    public boolean generate(
        IWorld world,
        ChunkGenerator<? extends ChunkGeneratorConfig> generator,
        Random random,
        BlockPos pos,
        DefaultFeatureConfig config
    ){...}
}

In my code this "generate" cannot be remapped.
In AbstractClassMappingImpl#getMethodMapping, the input signature is MethodSignature{name=generate, descriptor=(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/DefaultFeatureConfig;)Z}

And in this.methods it has MethodSignature{name=generate, descriptor=(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/FeatureConfig;)Z}
So getMethodMapping will return null in this case.

Possible solution:
In AbstractClassMappingImpl#getMethodMapping, if it cannot find the method mapping that exactly match the signature, then find the method mapping that has the same name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions