Macros lead to forwarders being generated for methods which do not exist #5894
Copy link
Copy link
Closed
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]
Reactions are currently unavailable
Activity
scabug commentedon Jun 7, 2012
Imported From: https://issues.scala-lang.org/browse/SI-5894?orig=1
Reporter: @paulp
Affected Versions: 2.10.0
scabug commentedon Jun 7, 2012
@paulp said:
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.
scabug commentedon Jun 8, 2012
@magarciaEPFL said:
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 #5836).
scabug commentedon Dec 5, 2012
@retronym said:
scala/scala#1713