@@ -224,19 +224,23 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
224
224
if (claszSymbol.isClass) // @DarkDimius is this test needed here?
225
225
for (binary <- ctx.compilationUnit.pickled.get(claszSymbol.asClass)) {
226
226
val store = if (mirrorC ne null ) mirrorC else plainC
227
- if (ctx.settings.emitTasty.value) {
228
- val outTastyFile = getFileForClassfile(outF, store.name, " .tasty" )
229
- val outstream = new DataOutputStream (outTastyFile.bufferedOutput)
230
-
231
- try outstream.write(binary)
232
- finally outstream.close()
233
- } else {
234
- val dataAttr = new CustomAttr (nme.TASTYATTR .mangledString, binary)
235
- store.visitAttribute(dataAttr)
236
- // Create an empty file to signal that a tasty section exist in the corresponding .class
237
- // This is much cheaper and simpler to check than doing classfile parsing
238
- getFileForClassfile(outF, store.name, " .hasTasty" )
239
- }
227
+ val tasty =
228
+ if (ctx.settings.emitTasty.value) {
229
+ val outTastyFile = getFileForClassfile(outF, store.name, " .tasty" )
230
+ val outstream = new DataOutputStream (outTastyFile.bufferedOutput)
231
+ try outstream.write(binary)
232
+ finally outstream.close()
233
+ // TASTY attribute is created but 0 bytes are stored in it.
234
+ // A TASTY attribute has length 0 if and only if the .tasty file exists.
235
+ Array .empty[Byte ]
236
+ } else {
237
+ // Create an empty file to signal that a tasty section exist in the corresponding .class
238
+ // This is much cheaper and simpler to check than doing classfile parsing
239
+ getFileForClassfile(outF, store.name, " .hasTasty" )
240
+ binary
241
+ }
242
+ val dataAttr = new CustomAttr (nme.TASTYATTR .mangledString, tasty)
243
+ store.visitAttribute(dataAttr)
240
244
}
241
245
242
246
// -------------- bean info class, if needed --------------
0 commit comments