File tree 3 files changed +17
-5
lines changed
compiler/scala/tools/nsc/symtab/classfile
reflect/scala/reflect/internal
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ abstract class Pickler extends SubComponent {
251
251
252
252
putChildren(sym, children.toList sortBy (_.sealedSortName))
253
253
}
254
- for (annot <- (sym.annotations filter (ann => ann.isStatic && ! ann.isErroneous)).reverse)
254
+ for (annot <- (sym.annotations filter (ann => { ann.failIfStub; ann. isStatic && ! ann.isErroneous} )).reverse)
255
255
putAnnotation(sym, annot)
256
256
}
257
257
else if (sym != NoSymbol ) {
@@ -304,6 +304,7 @@ abstract class Pickler extends SubComponent {
304
304
putSymbols(tparams)
305
305
case AnnotatedType (_, underlying) =>
306
306
putType(underlying)
307
+ tp.annotations.foreach(_.failIfStub) // staticAnnotations skips stubs but we want a hard error
307
308
tp.staticAnnotations foreach putAnnotation
308
309
case _ =>
309
310
throw new FatalError (" bad type: " + tp + " (" + tp.getClass + " )" )
Original file line number Diff line number Diff line change @@ -296,6 +296,7 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
296
296
* metaAnnotations = List(getter).
297
297
*/
298
298
def symbol = atp.typeSymbol
299
+ final def failIfStub : Unit = symbol.info
299
300
300
301
/** These are meta-annotations attached at the use site; they
301
302
* only apply to this annotation usage. For instance, in
@@ -323,7 +324,14 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
323
324
/** Check whether the type or any of the arguments are erroneous */
324
325
def isErroneous = atp.isErroneous || args.exists(_.isErroneous)
325
326
326
- def isStatic = symbol isNonBottomSubClass StaticAnnotationClass
327
+ def isStatic = {
328
+ symbol match {
329
+ case _ : StubSymbol =>
330
+ false // See scala/bug#11679
331
+ case _ =>
332
+ symbol isNonBottomSubClass StaticAnnotationClass
333
+ }
334
+ }
327
335
328
336
/** Check whether any of the arguments mention a symbol */
329
337
def refsSymbol (sym : Symbol ) = hasArgWhich(_.symbol == sym)
Original file line number Diff line number Diff line change @@ -3461,9 +3461,12 @@ trait Types
3461
3461
object AnnotatedType extends AnnotatedTypeExtractor
3462
3462
3463
3463
object StaticallyAnnotatedType {
3464
- def unapply (tp : Type ): Option [(List [AnnotationInfo ], Type )] = tp.staticAnnotations match {
3465
- case Nil => None
3466
- case annots => Some ((annots, tp.withoutAnnotations))
3464
+ def unapply (tp : Type ): Option [(List [AnnotationInfo ], Type )] = {
3465
+ tp.annotations.foreach(_.failIfStub) // staticAnnotations skips stubs but we want a hard error
3466
+ tp.staticAnnotations match {
3467
+ case Nil => None
3468
+ case annots => Some ((annots, tp.withoutAnnotations))
3469
+ }
3467
3470
}
3468
3471
}
3469
3472
You can’t perform that action at this time.
0 commit comments