You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by rodbs <gi...@git.apache.org> on 2017/03/22 11:55:55 UTC

[GitHub] zeppelin issue #780: [ZEPPELIN-658] Scala: not accepting companion objects i...

Github user rodbs commented on the issue:

    https://github.com/apache/zeppelin/pull/780
  
    As @saj1th says, I'm still getting this issue with Zeppelin 0.7 while trying to use companion object; even placing the object definition in the same line as the class definition:
    
    `
    class Account {
      val id = Account.newUniqueNumber()
      private var balance = 0.0
      def deposit(amount: Double) { balance += amount }
      def description = "Account " + id + " with balance " + balance
    };  object Account { // The companion object
      private var lastNumber = 0
      private def newUniqueNumber() = { lastNumber += 1; lastNumber }
    }
    
    
    val acct1 = new Account
    val acct2 = new Account
    acct1.deposit(1000)
    val d1 = acct1.description
    val d2 = acct2.description`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---