Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot reify annotations #5223

Closed
scabug opened this issue Nov 25, 2011 · 2 comments
Closed

Cannot reify annotations #5223

scabug opened this issue Nov 25, 2011 · 2 comments
Assignees

Comments

@scabug
Copy link

@scabug scabug commented Nov 25, 2011

import scala.reflect.

object Foo extends App {
  Code.lift{def printf(format: String, args: Any*): String = (null: @cloneable)}
}
error: java.lang.ClassCastException: scala.reflect.internal.AnnotationInfos$CompleteAnnotationInfo cannot be cast to scala.Product
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:522)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$scala$tools$nsc$transform$LiftCode$Reifier$$reify$1.apply(LiftCode.scala:512)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$scala$tools$nsc$transform$LiftCode$Reifier$$reify$1.apply(LiftCode.scala:512)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:77)
	at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
	at scala.collection.AbstractTraversable.map(Traversable.scala:112)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:512)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:316)
	at scala.collection.Iterator$class.foreach(Iterator.scala:690)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1115)
	at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:132)
	at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
	at scala.collection.AbstractIterator.toList(Iterator.scala:1115)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyCaseClassInstance(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyType(LiftCode.scala:455)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyTree(LiftCode.scala:482)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:506)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:316)
	at scala.collection.Iterator$class.foreach(Iterator.scala:690)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1115)
	at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:132)
	at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
	at scala.collection.AbstractIterator.toList(Iterator.scala:1115)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyCaseClassInstance(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyTree(LiftCode.scala:485)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:506)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:316)
	at scala.collection.Iterator$class.foreach(Iterator.scala:690)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1115)
	at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:132)
	at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
	at scala.collection.AbstractIterator.toList(Iterator.scala:1115)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyCaseClassInstance(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyTree(LiftCode.scala:485)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:506)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$scala$tools$nsc$transform$LiftCode$Reifier$$reify$1.apply(LiftCode.scala:512)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$scala$tools$nsc$transform$LiftCode$Reifier$$reify$1.apply(LiftCode.scala:512)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:77)
	at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
	at scala.collection.AbstractTraversable.map(Traversable.scala:112)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:512)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier$$anonfun$reifyCaseClassInstance$1.apply(LiftCode.scala:338)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:316)
	at scala.collection.Iterator$class.foreach(Iterator.scala:690)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1115)
	at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:132)
	at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
	at scala.collection.AbstractIterator.toList(Iterator.scala:1115)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyCaseClassInstance(LiftCode.scala:338)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyTree(LiftCode.scala:485)
	at scala.tools.nsc.transform.LiftCode$Reifier.scala$tools$nsc$transform$LiftCode$Reifier$$reify(LiftCode.scala:506)
	at scala.tools.nsc.transform.LiftCode$Reifier.reifyTopLevel(LiftCode.scala:290)
	at scala.tools.nsc.transform.LiftCode$Codifier.codify(LiftCode.scala:158)
	at scala.tools.nsc.transform.LiftCode$Codifier.transform(LiftCode.scala:127)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1$$anonfun$apply$2.apply(Trees.scala:1249)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1$$anonfun$apply$2.apply(Trees.scala:1249)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1257)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1249)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1248)
	at scala.collection.immutable.List.loop$1(List.scala:151)
	at scala.collection.immutable.List.mapConserve(List.scala:167)
	at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1248)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1160)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:49)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1257)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:49)
	at scala.tools.nsc.transform.LiftCode$Codifier.transform(LiftCode.scala:151)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:1234)
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 25, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5223?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 26, 2011

Commit Message Bot (anonymous) said:
(extempore in r26072) Annotations reacquainted with reification.

Had AnnotationInfo extend Product3 since it's no longer a case class.
Tried to make reflection a little more robust. Closes #5223, review by vogt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.