Skip to content

Commit

Permalink
SI-6978 No linting of Java parens
Browse files Browse the repository at this point in the history
Don't lint overriding of nullary by non-nullary
when non-nullary is Java-defined. They can't help it.
  • Loading branch information
som-snytt committed Oct 15, 2016
1 parent 9d3f077 commit c71dfa1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ abstract class RefChecks extends Transform {
checkOverrideTypes()
checkOverrideDeprecated()
if (settings.warnNullaryOverride) {
if (other.paramss.isEmpty && !member.paramss.isEmpty) {
if (other.paramss.isEmpty && !member.paramss.isEmpty && !member.isJavaDefined) {
reporter.warning(member.pos, "non-nullary method overrides nullary method")
}
}
Expand Down
1 change: 1 addition & 0 deletions test/files/pos/t6978.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xlint -Xfatal-warnings
5 changes: 5 additions & 0 deletions test/files/pos/t6978/J.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

public class J {
public int f() { return 42; }
}

7 changes: 7 additions & 0 deletions test/files/pos/t6978/S.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

trait X { def f: Int }

object Test extends J with X with App {
println(f)
}

0 comments on commit c71dfa1

Please sign in to comment.