@@ -13,7 +13,7 @@ import ast.{untpd, tpd}
13
13
import Contexts .* , Symbols .* , Types .* , Names .* , Constants .* , Decorators .* , Annotations .* , Flags .*
14
14
import Comments .{Comment , docCtx }
15
15
import NameKinds .*
16
- import StdNames .nme
16
+ import StdNames .{ nme , tpnme }
17
17
import config .Config
18
18
import collection .mutable
19
19
import reporting .{Profile , NoProfile }
@@ -49,6 +49,9 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
49
49
50
50
private var profile : Profile = NoProfile
51
51
52
+ private val isOutlinePickle : Boolean = attributes.isOutline
53
+ private val isJavaPickle : Boolean = attributes.isJava
54
+
52
55
def treeAnnots (tree : untpd.MemberDef ): List [Tree ] =
53
56
val ts = annotTrees.lookup(tree)
54
57
if ts == null then Nil else ts.toList
@@ -188,19 +191,19 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
188
191
def pickleExternalRef (sym : Symbol ) = {
189
192
val isShadowedRef =
190
193
sym.isClass && tpe.prefix.member(sym.name).symbol != sym
191
- if ( sym.is(Flags .Private ) || isShadowedRef) {
194
+ if sym.is(Flags .Private ) || isShadowedRef then
192
195
writeByte(if (tpe.isType) TYPEREFin else TERMREFin )
193
196
withLength {
194
197
pickleNameAndSig(sym.name, sym.signature, sym.targetName)
195
198
pickleType(tpe.prefix)
196
199
pickleType(sym.owner.typeRef)
197
200
}
198
- }
199
- else {
201
+ else if isJavaPickle && sym == defn.FromJavaObjectSymbol then
202
+ pickleType(defn.ObjectType ) // when unpickling Java TASTy, replace by <FromJavaObject>
203
+ else
200
204
writeByte(if (tpe.isType) TYPEREF else TERMREF )
201
205
pickleNameAndSig(sym.name, tpe.signature, sym.targetName)
202
- pickleType(tpe.prefix)
203
- }
206
+ pickleType(tpe.prefix)
204
207
}
205
208
if (sym.is(Flags .Package )) {
206
209
writeByte(if (tpe.isType) TYPEREFpkg else TERMREFpkg )
@@ -342,7 +345,7 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
342
345
case _ : Template | _ : Hole => pickleTree(tpt)
343
346
case _ if tpt.isType => pickleTpt(tpt)
344
347
}
345
- if attributes.isOutline && sym.isTerm && attributes.isJava then
348
+ if isOutlinePickle && sym.isTerm && isJavaPickle then
346
349
// TODO: if we introduce outline typing for Scala definitions
347
350
// then we will need to update the check here
348
351
pickleElidedUnlessEmpty(rhs, tpt.tpe)
0 commit comments