참고 : 스칼라의 Class
1. age_$eq(int)
위 글에 설명되어 있듯 age_=()는 setter입니다.
즉, 실제 사용 시
outsider.age = 30
이라고 할 때 이것은 아래와 같이 호출하고 있다고 할 수 있습니다.
outsider.age_=(30)
그런데 왜 age_= 가 아니고 age_$eq 로 바뀌었냐면 JVM 에서는 ‘=’ 기호를 메서드명에 사용하는 것이 허용되지 않기 때문입니다.
2. $tag()
public int $tag() throws java.rmi.RemoteException;
뭐 하는 놈일까? … 이렇다는군요.
This(=$tag()) is a method defined within the ScalaObject trait designed to help optimize pattern matching. Unfortunately, it also means yet another abstract method which must be defined when implementing Scala traits which contain method definitions. ( via Interop Between Java and Scala )
Advertisement
Like this:
Be the first to like this post.