Skip to content

Commit 9a896d5

Browse files
committed
Mixins were not the only bridges. Bridges must actually not be final.
1 parent c6abf3e commit 9a896d5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

compiler/src/dotty/tools/backend/jvm/BTypesFromSymbols.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,9 @@ class BTypesFromSymbols[I <: DottyBackendInterface](val int: I, val frontendAcce
298298
// without having to provide any implementations, but that is an
299299
// illegal combination of modifiers at the bytecode level so
300300
// suppress final if abstract if present.
301-
&& !sym.isOneOf(AbstractOrTrait), ACC_FINAL)
301+
&& !sym.isOneOf(AbstractOrTrait)
302+
// Bridges can be final, but final bridges confuse some frameworks
303+
&& !sym.is(Bridge), ACC_FINAL)
302304
.addFlagIf(sym.isStaticMember, ACC_STATIC)
303305
.addFlagIf(sym.is(Bridge), ACC_BRIDGE | ACC_SYNTHETIC)
304306
.addFlagIf(sym.is(Artifact), ACC_SYNTHETIC)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
trait EventLike
2+
3+
trait GrandParent:
4+
def changed: EventLike
5+
6+
trait HasChanged extends GrandParent:
7+
override def changed: EventLike
8+
9+
abstract class Parent extends GrandParent:
10+
object changed extends EventLike
11+
12+
class Child extends Parent with HasChanged
13+
14+
object Test:
15+
def main(args: Array[String]): Unit =
16+
val child = Child()
17+
println(child.changed)
18+
println((child: HasChanged).changed)
19+
end Test

0 commit comments

Comments
 (0)