Rimash Mohomed
Rimash Mohomed

Reputation: 143

Why scala native method can not be private

In Scala 2.11.0,

@native private def sampleMethod(argOne: Long): Int

Above declaration gives the following compiler error

abstract member may not have private modifier @native private def sampleMethod(argOne: Long): Int

What is the proper way of declaring native private member method

Upvotes: 2

Views: 757

Answers (1)

som-snytt
som-snytt

Reputation: 39577

Ordinarily, a subclass can't supply an overriding private method, so private methods must not be abstract. Looks like a bug was introduced during a refactor that breaks the test for native methods, which get a pass. I commented on the ticket, which is fixed for 2.12.

Upvotes: 2

Related Questions