Update J2ObjC runtime build targets for compatibility with explicit modules for Swift

PiperOrigin-RevId: 415614417
diff --git a/jre_emul/Classes/IOSObjectArray.h b/jre_emul/Classes/IOSObjectArray.h
index dd41014..22bdbeb 100644
--- a/jre_emul/Classes/IOSObjectArray.h
+++ b/jre_emul/Classes/IOSObjectArray.h
@@ -24,8 +24,6 @@
 
 #import "IOSArray.h"
 
-#pragma clang system_header
-
 @class IOSClass;
 @class IOSObjectArray;
 
diff --git a/jre_emul/Classes/IOSReflection.h b/jre_emul/Classes/IOSReflection.h
index 55cc05e..25e474b 100644
--- a/jre_emul/Classes/IOSReflection.h
+++ b/jre_emul/Classes/IOSReflection.h
@@ -80,7 +80,7 @@
 
 __attribute__((always_inline)) inline const char *JreMethodJavaName(
     const J2ObjcMethodInfo *metadata, const void **ptrTable) {
-  const char *javaName = JrePtrAtIndex(ptrTable, metadata->javaNameIdx);
+  const char *javaName = (const char *)JrePtrAtIndex(ptrTable, metadata->javaNameIdx);
   return javaName ? javaName : sel_getName(metadata->selector);
 }
 
diff --git a/jre_emul/Classes/J2ObjC_common.h b/jre_emul/Classes/J2ObjC_common.h
index 18f9071..fc9635b 100644
--- a/jre_emul/Classes/J2ObjC_common.h
+++ b/jre_emul/Classes/J2ObjC_common.h
@@ -15,8 +15,6 @@
 #ifndef _J2OBJC_COMMON_H_
 #define _J2OBJC_COMMON_H_
 
-#pragma clang system_header
-
 #import <CoreFoundation/CoreFoundation.h>
 #import <Foundation/Foundation.h>
 
@@ -64,7 +62,7 @@
 
 CF_EXTERN_C_BEGIN
 
-id JreThrowNullPointerException() __attribute__((noreturn));
+id JreThrowNullPointerException(void) __attribute__((noreturn));
 void JreThrowClassCastException(id p, Class cls) __attribute__((noreturn));
 void JreThrowClassCastExceptionWithIOSClass(id p, IOSClass *cls) __attribute__((noreturn));
 void JreThrowArithmeticExceptionWithNSString(NSString *msg) __attribute__((noreturn));
diff --git a/jre_emul/Classes/J2ObjC_source.h b/jre_emul/Classes/J2ObjC_source.h
index 2279b4d..8e2e15b 100644
--- a/jre_emul/Classes/J2ObjC_source.h
+++ b/jre_emul/Classes/J2ObjC_source.h
@@ -28,8 +28,6 @@
 #import "jni.h"
 #import "objc/runtime.h"
 
-#pragma clang system_header
-
 // "I" is defined in complex.h, which results in errors if that file is also
 // included.
 #pragma push_macro("I")
diff --git a/jre_emul/Classes/java_lang_Thread.h b/jre_emul/Classes/java_lang_Thread.h
index f9dd910..35de807 100644
--- a/jre_emul/Classes/java_lang_Thread.h
+++ b/jre_emul/Classes/java_lang_Thread.h
@@ -15,6 +15,7 @@
 #ifndef java_lang_Thread_H
 #define java_lang_Thread_H
 
+#import <CoreFoundation/CoreFoundation.h>
 #import <pthread.h>
 
 @class JavaLangThread;
diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util.h b/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util.h
index 31088a9..a0a0877 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util.h
+++ b/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util.h
@@ -46,13 +46,15 @@
  * IO helper functions
  */
 
-jint readSingle(JNIEnv *env, jobject this, jfieldID fid);
-jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
-               jint len, jfieldID fid);
-void writeSingle(JNIEnv *env, jobject this, jint byte, jboolean append, jfieldID fid);
-void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off,
+jint readSingle(JNIEnv *env, jobject this_, jfieldID fid);
+jint readBytes(JNIEnv *env, jobject this_, jbyteArray bytes, jint off, jint len,
+               jfieldID fid);
+void writeSingle(JNIEnv *env, jobject this_, jint byte, jboolean append,
+                 jfieldID fid);
+void writeBytes(JNIEnv *env, jobject this_, jbyteArray bytes, jint off,
                 jint len, jboolean append, jfieldID fid);
-void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
+void fileOpen(JNIEnv *env, jobject this_, jstring path, jfieldID fid,
+              int flags);
 void throwFileNotFoundException(JNIEnv *env, jstring path);
 
 
diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util_md.h b/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util_md.h
index d2ceffc..680cebf 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util_md.h
+++ b/jre_emul/android/platform/libcore/ojluni/src/main/native/io_util_md.h
@@ -86,7 +86,7 @@
 /*
  * IO helper function(s)
  */
-void fileClose(JNIEnv *env, jobject this, jfieldID fid);
+void fileClose(JNIEnv *env, jobject this_, jfieldID fid);
 
 #ifdef MACOSX
 jstring newStringPlatform(JNIEnv *env, const char* str);
diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/native/net_util_md.h b/jre_emul/android/platform/libcore/ojluni/src/main/native/net_util_md.h
index 6e9beee..f30e7f8 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/main/native/net_util_md.h
+++ b/jre_emul/android/platform/libcore/ojluni/src/main/native/net_util_md.h
@@ -36,6 +36,7 @@
 #include <sys/poll.h>
 #endif
 
+#include "jni.h"
 
 #if defined(__linux__) || defined(MACOSX)
 extern int NET_Timeout(int s, long timeout);
diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/native/zip_util.h b/jre_emul/android/platform/libcore/ojluni/src/main/native/zip_util.h
index b1f7f7b..1ea5703 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/main/native/zip_util.h
+++ b/jre_emul/android/platform/libcore/ojluni/src/main/native/zip_util.h
@@ -30,6 +30,8 @@
 #ifndef _ZIP_H_
 #define _ZIP_H_
 
+#include "jni.h"
+
 // J2ObjC: use ZIP_ prefix to avoid conflict with ZipConstants accessor
 // method names.
 
diff --git a/protobuf/runtime/src/com/google/protobuf/CodedOutputStream_PackagePrivate.h b/protobuf/runtime/src/com/google/protobuf/CodedOutputStream_PackagePrivate.h
index 12e2081..b3549ec 100644
--- a/protobuf/runtime/src/com/google/protobuf/CodedOutputStream_PackagePrivate.h
+++ b/protobuf/runtime/src/com/google/protobuf/CodedOutputStream_PackagePrivate.h
@@ -302,6 +302,10 @@
   return FlushBuffer();
 }
 
+#else
+
+typedef struct CGPCodedOutputStream CGPCodedOutputStream;
+
 #endif // __cplusplus
 
 @interface ComGoogleProtobufCodedOutputStream () {