@@ -619,14 +619,15 @@ class ClassfileParser(
619
619
// invariant: `in` and `ctx` should not be captured inside the result function
620
620
def parseAttributes (sym : Symbol , pt : Type = WildcardType , isVarargs : Boolean = false )(using ctx : Context , in : DataReader ): AttributeCompleter = {
621
621
var typeUpdate : Option [Context ?=> Type ] = None
622
-
622
+ var delayedWork : List [ Context ?=> Unit ] = Nil
623
623
val res = new AttributeCompleter {
624
624
def complete (tp : Type )(using Context ): Type = {
625
625
val newType = if (typeUpdate.isEmpty) tp else typeUpdate.get
626
626
exceptions.foreach { ex =>
627
627
val cls = getClassSymbol(ex.name)
628
628
sym.addAnnotation(ThrowsAnnotation (cls.asClass))
629
629
}
630
+ delayedWork.foreach(_.apply)
630
631
cook.apply(newType)
631
632
}
632
633
}
@@ -680,10 +681,13 @@ class ClassfileParser(
680
681
681
682
case tpnme.CodeATTR =>
682
683
in.skip(attrLen)
683
- if (sym.owner.isAllOf(Flags .JavaInterface )) {
684
- sym.resetFlag(Flags .Deferred )
685
- sym.owner.resetFlag(Flags .PureInterface )
686
- report.log(s " $sym in ${sym.owner} is a java8+ default method. " )
684
+ // flag test will trigger completion and cycles, thus have to be lazy
685
+ delayedWork ::= { (using ctx) =>
686
+ if (sym.owner.isAllOf(Flags .JavaInterface )) {
687
+ sym.resetFlag(Flags .Deferred )
688
+ sym.owner.resetFlag(Flags .PureInterface )
689
+ report.log(s " $sym in ${sym.owner} is a java 8+ default method. " )
690
+ }
687
691
}
688
692
689
693
case _ =>
0 commit comments