Introduce work-around for Scala compiler crash.

Scala compiler crashes as soon as Account.Id class is being referenced from
Scala code. Thus ugly work-arounds are needed one introduced here.

Fortunately enough, the trunk version of a compiler has a fix for this
issue already incorporated so this work-arounds will be removed in a
future.

Change-Id: I9d6cc236a16cf5bf9939b4e255c856dddbedd822
Signed-off-by: Grzegorz Kossakowski <grek@google.com>
diff --git a/src/main/java/com/google/gerrit/client/reviewdb/Account.java b/src/main/java/com/google/gerrit/client/reviewdb/Account.java
index 379930e..b882fe8 100644
--- a/src/main/java/com/google/gerrit/client/reviewdb/Account.java
+++ b/src/main/java/com/google/gerrit/client/reviewdb/Account.java
@@ -144,6 +144,16 @@
     return oldAccountId;
   }
 
+  /**
+   * This method which identical to getId.get() is introduced as a temporary work-around for Scala
+   * compiler crash reported as: http://lampsvn.epfl.ch/trac/scala/ticket/1539
+   * In this compiler crashes as soon as Account.Id class is being referenced from Scala code.
+   * TODO: Remove this method as soon as Scala 2.8 is being used
+   */
+  int getRawOldAccountId() {
+    return oldAccountId.get();
+  }
+
   /** Get the full name of the user ("Given-name Surname" style). */
   public String getFullName() {
     return fullName;
@@ -198,4 +208,14 @@
   public void setContactFiled() {
     contactFiledOn = new Timestamp(System.currentTimeMillis());
   }
+
+  /**
+   * TODO: Remove this method as soon as Scala 2.8 is being used
+   * @see com.google.gerrit.client.reviewdb.Account#getRawOldAccountId()
+   */
+  static Account newInstance(int rawId) {
+    Account a = new Account();
+    a.oldAccountId = new Id(rawId);
+    return a;
+  }
 }
diff --git a/src/main/java/com/google/gerrit/client/reviewdb/AccountExternalId.java b/src/main/java/com/google/gerrit/client/reviewdb/AccountExternalId.java
index 4f5637a..2e703f4 100644
--- a/src/main/java/com/google/gerrit/client/reviewdb/AccountExternalId.java
+++ b/src/main/java/com/google/gerrit/client/reviewdb/AccountExternalId.java
@@ -156,4 +156,30 @@
   public void setTrusted(final boolean t) {
     trusted = t;
   }
+
+  /**
+   * This method which identical to getId.get() is introduced as a temporary work-around for Scala
+   * compiler crash reported as: http://lampsvn.epfl.ch/trac/scala/ticket/1539
+   * In this compiler crashes as soon as Account.Id class is being referenced from Scala code.
+   * TODO: Remove this method as soon as Scala 2.8 is being used
+   */
+  int getRawOldAccountId() {
+    return oldAccountId.get();
+  }
+
+  /**
+   * TODO: Remove this method as soon as Scala 2.8 is being used
+   * @see #getRawOldAccountId()
+   */
+  String getRawExternalId() {
+    return key.get();
+  }
+
+  /**
+   * TODO: Remove this method as soon as Scala 2.8 is being used
+   * @see #getRawOldAccountId()
+   */
+  static AccountExternalId newInstance(int rawOldAccountId, String rawExternalId) {
+    return new AccountExternalId(new Account.Id(rawOldAccountId), new Key(rawExternalId));
+  }
 }