From b61e24b02ece26194117937ec367e5a1bcc4e0a8 Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Fri, 7 Aug 2020 16:13:25 +0200 Subject: [PATCH 1/2] Reproduce and minimize error --- project/scripts/bootstrapCmdTests | 2 ++ tests/pos/i9525/VolatileByteRef.java | 3 +++ tests/pos/i9525/volatile.scala | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 tests/pos/i9525/VolatileByteRef.java create mode 100644 tests/pos/i9525/volatile.scala diff --git a/project/scripts/bootstrapCmdTests b/project/scripts/bootstrapCmdTests index dec3ce8b12af..8aa518eddd7f 100755 --- a/project/scripts/bootstrapCmdTests +++ b/project/scripts/bootstrapCmdTests @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + source $(dirname $0)/cmdTestsCommon.inc.sh # check that benchmarks can run diff --git a/tests/pos/i9525/VolatileByteRef.java b/tests/pos/i9525/VolatileByteRef.java new file mode 100644 index 000000000000..c78f4a8a1287 --- /dev/null +++ b/tests/pos/i9525/VolatileByteRef.java @@ -0,0 +1,3 @@ +public final class VolatileByteRef implements java.io.Serializable { + volatile public byte elem; +} diff --git a/tests/pos/i9525/volatile.scala b/tests/pos/i9525/volatile.scala new file mode 100644 index 000000000000..a3a8dccdae5d --- /dev/null +++ b/tests/pos/i9525/volatile.scala @@ -0,0 +1,3 @@ +package scala + +final class volatile extends scala.annotation.StaticAnnotation From 71fb4605776a424e3f79441378ae1d4ef92b6bdd Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Mon, 10 Aug 2020 19:02:40 +0200 Subject: [PATCH 2/2] Fix #9525: use untyped tree to avoid double vision of symbols --- .../src/dotty/tools/dotc/parsing/JavaParsers.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala index 3c226cd5d792..55b6eb917342 100644 --- a/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -367,10 +367,10 @@ object JavaParsers { // assumed true unless we see public/private/protected var isPackageAccess = true var annots = new ListBuffer[Tree] - def addAnnot(sym: ClassSymbol) = + def addAnnot(tpt: Tree) = annots += atSpan(in.offset) { in.nextToken() - New(TypeTree(sym.typeRef)) + New(tpt) } while (true) @@ -404,11 +404,11 @@ object JavaParsers { flags |= Flags.DefaultMethod in.nextToken() case NATIVE => - addAnnot(NativeAnnot) + addAnnot(scalaDot(jtpnme.NATIVEkw)) case TRANSIENT => - addAnnot(TransientAnnot) + addAnnot(scalaDot(jtpnme.TRANSIENTkw)) case VOLATILE => - addAnnot(VolatileAnnot) + addAnnot(scalaDot(jtpnme.VOLATILEkw)) case SYNCHRONIZED | STRICTFP => in.nextToken() case _ =>