/*
 * Copyright 2015-present Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.facebook.buck.util;

import java.lang.reflect.Method;

/**
 * Fetches the user ID of the running process.
 */
public class UnixUserIdFetcher implements UserIdFetcher {
  @Override
  public long getUserId() {
    try {
      Class<?> cls = Class.forName("com.sun.security.auth.module.UnixSystem", true, null);
      Object unixSystem = cls.newInstance();
      Method getUid = cls.getDeclaredMethod("getUid");
      return (long) getUid.invoke(unixSystem);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

/*
 * Copyright 2015-present Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.facebook.buck.util;

import com.sun.security.auth.module.UnixSystem;

/**
 * Fetches the user ID of the running process.
 */
public class UnixUserIdFetcher implements UserIdFetcher {
  @Override
  public long getUserId() {
    return new UnixSystem().getUid();
  }
}

--- 
+++ 
@@ -16,7 +16,7 @@
 
 package com.facebook.buck.util;
 
-import com.sun.security.auth.module.UnixSystem;
+import java.lang.reflect.Method;
 
 /**
  * Fetches the user ID of the running process.
@@ -24,6 +24,13 @@
 public class UnixUserIdFetcher implements UserIdFetcher {
   @Override
   public long getUserId() {
-    return new UnixSystem().getUid();
+    try {
+      Class<?> cls = Class.forName("com.sun.security.auth.module.UnixSystem", true, null);
+      Object unixSystem = cls.newInstance();
+      Method getUid = cls.getDeclaredMethod("getUid");
+      return (long) getUid.invoke(unixSystem);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
   }
 }
Use reflection to access UnixSystem

Summary: This class doesn't exist on Windows and breaks compilation as a result.

Test Plan: `ant clean default` on Windows.
