Skip to content

Commit 3e76f3c

Browse files
Merge pull request #1594 from dotty-staging/fix-#1576
Fix #1576: Parameters of Java annotations should be public
2 parents cd23560 + f253099 commit 3e76f3c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ object JavaParsers {
131131
def makeSyntheticParam(count: Int, tpt: Tree): ValDef =
132132
makeParam(nme.syntheticParamName(count), tpt)
133133
def makeParam(name: TermName, tpt: Tree): ValDef =
134-
ValDef(name, tpt, EmptyTree).withMods(Modifiers(Flags.JavaDefined | Flags.PrivateLocalParamAccessor))
134+
ValDef(name, tpt, EmptyTree).withMods(Modifiers(Flags.JavaDefined | Flags.ParamAccessor))
135135

136136
def makeConstructor(formals: List[Tree], tparams: List[TypeDef], flags: FlagSet = Flags.JavaDefined) = {
137137
val vparams = mapWithIndex(formals)((p, i) => makeSyntheticParam(i + 1, p))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public @interface TagAnnotation {
2+
public String value();
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
val v: TagAnnotation = null
3+
println(v.value) // error: value value in class TagAnnotation cannot be accessed as a
4+
// member of TagAnnotation(Test.v) from module class Test$.
5+
}

0 commit comments

Comments
 (0)