E066: Native Members May Not Have Implementation

This error is emitted when a method marked with @native annotation has an implementation body.

The @native annotation indicates that the method's implementation is provided by the runtime or a native library (like JNI). Native methods must be declared without a body because their implementation exists outside of Scala code.


Example

class Example:
  @native def nativeMethod(): Int = 42

Error

-- [E066] Syntax Error: example.scala:2:14 -------------------------------------
2 |  @native def nativeMethod(): Int = 42
  |              ^
  |              @native members may not have an implementation

Solution

// Remove the implementation from native methods
class Example:
  @native def nativeMethod(): Int
// Or remove @native if you want to provide an implementation
class Example:
  def normalMethod(): Int = 42