Scala Programming Language
  1. Scala Programming Language
  2. SI-5894

Macros lead to forwarders being generated for methods which do not exist

    Details

      Description

      ...and NoSuchMethodError is the outcome for anyone unlucky enough to call the forwarder. Here are the methods in scala.reflect.makro.internal.package$ .

      public <T> api.Exprs$Expr<ArrayTag<T>> materializeArrayTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public <T> api.Exprs$Expr<ErasureTag<T>> materializeErasureTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public <T> api.Exprs$Expr<ClassTag<T>> materializeClassTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public <T> api.Exprs$Expr<api.TypeTags$TypeTag<T>> materializeTypeTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public <T> api.Exprs$Expr<api.TypeTags$ConcreteTypeTag<T>> materializeConcreteTypeTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public makro.internal.Utils context2utils(makro.Context);
      

      Here are the ones in scala.reflect.makro.internal.package, which should only be forwarders to the above.

      public static makro.internal.Utils context2utils(makro.Context);
      public static <T> api.Exprs$Expr<api.TypeTags$ConcreteTypeTag<T>> materializeConcreteTypeTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public static <T> api.TypeTags$ConcreteTypeTag<T> materializeConcreteTypeTag(api.Universe);
      public static <T> api.Exprs$Expr<api.TypeTags$TypeTag<T>> materializeTypeTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public static <T> api.TypeTags$TypeTag<T> materializeTypeTag(api.Universe);
      public static <T> api.Exprs$Expr<ClassTag<T>> materializeClassTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public static <T> ClassTag<T> materializeClassTag(api.Universe);
      public static <T> api.Exprs$Expr<ErasureTag<T>> materializeErasureTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public static <T> ErasureTag<T> materializeErasureTag(api.Universe);
      public static <T> api.Exprs$Expr<ArrayTag<T>> materializeArrayTag_impl(makro.Context, api.Exprs$Expr<api.Universe>, api.TypeTags$TypeTag<T>);
      public static <T> ArrayTag<T> materializeArrayTag(api.Universe);
      

      Notice the addition of:

      public static <T> api.TypeTags$ConcreteTypeTag<T> materializeConcreteTypeTag(api.Universe);
      public static <T> api.TypeTags$TypeTag<T> materializeTypeTag(api.Universe);
      public static <T> ClassTag<T> materializeClassTag(api.Universe);
      public static <T> ErasureTag<T> materializeErasureTag(api.Universe);
      public static <T> ArrayTag<T> materializeArrayTag(api.Universe);
      

      Those methods have these implementations ("threatened implementations" I guess.)

      def materializeArrayTag[T](u: Universe): ArrayTag[T] = macro materializeArrayTag_impl[T]
      def materializeErasureTag[T](u: Universe): ErasureTag[T] = macro materializeErasureTag_impl[T]
      def materializeClassTag[T](u: Universe): ClassTag[T] = macro materializeClassTag_impl[T]
      def materializeTypeTag[T](u: Universe): u.TypeTag[T] = macro materializeTypeTag_impl[T]
      def materializeConcreteTypeTag[T](u: Universe): u.ConcreteTypeTag[T] = macro materializeConcreteTypeTag_impl[T]
      

        Activity

        Hide
        Paul Phillips added a comment -

        I sent an email to scala-internals; it appears to be enough to add MACRO to excluded forwarder flags, but since it has to be done in two places, I resist.

        Show
        Paul Phillips added a comment - I sent an email to scala-internals; it appears to be enough to add MACRO to excluded forwarder flags, but since it has to be done in two places, I resist.
        Hide
        Miguel Garcia added a comment -

        From the discussion it looks to me the only workable solution is for GenASM to deprecate GenJVM. Ideas are welcome on how to get there faster (besides SI-5836).

        Show
        Miguel Garcia added a comment - From the discussion it looks to me the only workable solution is for GenASM to deprecate GenJVM. Ideas are welcome on how to get there faster (besides SI-5836 ).
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/1713

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development