Skip to content

Result unwrap cannot find field "java.lang.NoSuchFieldError: field0" #117

Open
@jaredlll08

Description

@jaredlll08

Due to the generic bound on E (<T, E : Exception>), when the bytecode is written, it is written as:

GETFIELD stdlib/Result$Error.field0 : Ljava/lang/Exception;

Which cannot be found as it is declared as:

  // access flags 0x11
  // signature TE;
  // declaration: field0 extends E
  public final Ljava/lang/Object; field0

Repro:

import stdlib.Result;
import stdlib.Exception;

Result<string, Exception>.Error(new Exception("Errored")).unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions