Skip to content

Wrong bytecode generated for trait's method with throws clause #10192

@scabug

Description

@scabug

Compiling the following trait with 2.12.0 vs 2.12.1 produces different bytecode

trait Actor {
  @throws(classOf[Exception]) // when changing this you MUST also change ActorDocTest
  //#lifecycle-hooks
  def preStart(): Unit = ()
}

Classfile produced with 2.12.0:

Compiled from "A.scala"
public interface Actor {
  public static void preStart$(Actor) throws java.lang.Exception;
  public void preStart() throws java.lang.Exception;
  public static void $init$(Actor);
}

Classfile produced with 2.12.1:

public interface Actor {
  public static void preStart$(Actor);
  public void preStart() throws java.lang.Exception;
  public static void $init$(Actor);
}

Note how the signature of method preStart$ is different.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions