Skip to content

Commit

Permalink
ISSUE-12393: Parse concrete private interface methods in Java
Browse files Browse the repository at this point in the history
  • Loading branch information
dengziming committed Sep 2, 2021
1 parent ef87850 commit 96bd9b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/javac/JavaParsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
val vparams = formalParams()
if (!isVoid) rtpt = optArrayBrackets(rtpt)
optThrows()
val isConcreteInterfaceMethod = !inInterface || (mods hasFlag Flags.JAVA_DEFAULTMETHOD) || (mods hasFlag Flags.STATIC)
val isConcreteInterfaceMethod = !inInterface || (mods hasFlag Flags.JAVA_DEFAULTMETHOD) || (mods hasFlag Flags.STATIC) || (mods hasFlag Flags.PRIVATE)
val bodyOk = !(mods1 hasFlag Flags.DEFERRED) && isConcreteInterfaceMethod
val body =
if (bodyOk && in.token == LBRACE) {
Expand Down
7 changes: 7 additions & 0 deletions test/files/pos/t12393/R1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// javaVersion: 9+
public interface IF {

private void foo() {
return;
}
}

0 comments on commit 96bd9b1

Please sign in to comment.