Inside SWT

Sunday, January 07, 2007

Best compile error ever!

Here is a boring line of C code:

createJavaVM = findSymbol(jniLibrary, _T_ECLIPSE("JNI_CreateJavaVM"));

On a C compiler that shall remain nameless, forgetting to cast the result (using (JNI_createJavaVM)) gives the following:

"../eclipseJNI.c", line 193: warning: assignment type mismatch:
pointer to function(pointer to pointer to pointer to const struct JNIInvokeInterface_ {pointer to void reserved0, pointer to void reserved1, pointer to void reserved2, pointer to function(..) returning int DestroyJavaVM, pointer to function(..) returning int AttachCurrentThread, pointer to function(..) returning int DetachCurrentThread, pointer to function(..) returning int GetEnv, pointer to function(..) returning int AttachCurrentThreadAsDaemon}, pointer to pointer to pointer to const struct JNINativeInterface_ {pointer to void reserved0, pointer to void reserved1, pointer to void reserved2, pointer to void reserved3, pointer to function(..) returning int GetVersion, pointer to function(..) returning pointer to struct _jobject {..} DefineClass, pointer to function(..) returning pointer to struct _jobject {..} FindClass, pointer to function(..) returning pointer to struct _jmethodID {..} FromReflectedMethod, pointer to function(..) returning pointer to struct _jfieldID {..} FromReflectedField, pointer to function(..) returning pointer to struct _jobject {..} ToReflectedMethod, pointer to function(..) returning pointer to struct _jobject {..} GetSuperclass, pointer to function(..) returning unsigned char IsAssignableFrom, pointer to function(..) returning pointer to struct _jobject {..} ToReflectedField, pointer to function(..) returning int Throw, pointer to function(..) returning int ThrowNew, pointer to function(..) returning pointer to struct _jobject {..} ExceptionOccurred, pointer to function(..) returning void ExceptionDescribe, pointer to function(..) returning void ExceptionClear, pointer to function(..) returning void FatalError, pointer to function(..) returning int PushLocalFrame, pointer to function(..) returning pointer to struct _jobject {..} PopLocalFrame, pointer to function(..) returning pointer to struct _jobject {..} NewGlobalRef, pointer to function(..) returning void DeleteGlobalRef, pointer to function(..) returning void DeleteLocalRef, pointer to function(..) returning unsigned char IsSameObject, pointer to function(..) returning pointer to struct _jobject {..} NewLocalRef, pointer to function(..) returning int EnsureLocalCapacity, pointer to function(..) returning pointer to struct _jobject {..} AllocObject, pointer to function(..) returning pointer to struct _jobject {..} NewObject, pointer to function(..) returning pointer to struct _jobject {..} NewObjectV, pointer to function(..) returning pointer to struct _jobject {..} NewObjectA, pointer to function(..) returning pointer to struct _jobject {..} GetObjectClass, pointer to function(..) returning unsigned char IsInstanceOf, pointer to function(..) returning pointer to struct _jmethodID {..} GetMethodID, pointer to function(..) returning pointer to struct _jobject {..} CallObjectMethod, pointer to function(..) returning pointer to struct _jobject {..} CallObjectMethodV, pointer to function(..) returning pointer to struct _jobject {..} CallObjectMethodA, pointer to function(..) returning unsigned char CallBooleanMethod, pointer to function(..) returning unsigned char CallBooleanMethodV, pointer to function(..) returning unsigned char CallBooleanMethodA, pointer to function(..) returning signed char CallByteMethod, pointer to function(..) returning signed char CallByteMethodV, pointer to function(..) returning signed char CallByteMethodA, pointer to function(..) returning unsigned short CallCharMethod, pointer to function(..) returning unsigned short CallCharMethodV, pointer to function(..) returning unsigned short CallCharMethodA, pointer to function(..) returning short CallShortMethod, pointer to function(..) returning short CallShortMethodV, pointer to function(..) returning short CallShortMethodA, pointer to function(..) returning int CallIntMethod, pointer to function(..) returning int CallIntMethodV, pointer to function(..) returning int CallIntMethodA, pointer to function(..) returning long long CallLongMethod, pointer to function(..) returning long long CallLongMethodV, pointer to function(..) returning long long CallLongMethodA, pointer to function(..) returning float CallFloatMethod, pointer to function(..) returning float CallFloatMethodV, pointer to function(..) returning float CallFloatMethodA, pointer to function(..) returning double CallDoubleMethod, pointer to function(..) returning double CallDoubleMethodV, pointer to function(..) returning double CallDoubleMethodA, pointer to function(..) returning void CallVoidMethod, pointer to function(..) returning void CallVoidMethodV, pointer to function(..) returning void CallVoidMethodA, pointer to function(..) returning pointer to struct _jobject {..} CallNonvirtualObjectMethod, pointer to function(..) returning pointer to struct _jobject {..} CallNonvirtualObjectMethodV, pointer to function(..) returning pointer to struct _jobject {..} CallNonvirtualObjectMethodA, pointer to function(..) returning unsigned char CallNonvirtualBooleanMethod, pointer to function(..) returning unsigned char CallNonvirtualBooleanMethodV, pointer to function(..) returning unsigned char CallNonvirtualBooleanMethodA, pointer to function(..) returning signed char CallNonvirtualByteMethod, pointer to function(..) returning signed char CallNonvirtualByteMethodV, pointer to function(..) returning signed char CallNonvirtualByteMethodA, pointer to function(..) returning unsigned short CallNonvirtualCharMethod, pointer to function(..) returning unsigned short CallNonvirtualCharMethodV, pointer to function(..) returning unsigned short CallNonvirtualCharMethodA, pointer to function(..) returning short CallNonvirtualShortMethod, pointer to function(..) returning short CallNonvirtualShortMethodV, pointer to function(..) returning short CallNonvirtualShortMethodA, pointer to function(..) returning int CallNonvirtualIntMethod, pointer to function(..) returning int CallNonvirtualIntMethodV, pointer to function(..) returning int CallNonvirtualIntMethodA, pointer to function(..) returning long long CallNonvirtualLongMethod, pointer to function(..) returning long long CallNonvirtualLongMethodV, pointer to function(..) returning long long CallNonvirtualLongMethodA, pointer to function(..) returning float CallNonvirtualFloatMethod, pointer to function(..) returning float CallNonvirtualFloatMethodV, pointer to function(..) returning float CallNonvirtualFloatMethodA, pointer to function(..) returning double CallNonvirtualDoubleMethod, pointer to function(..) returning double CallNonvirtualDoubleMethodV, pointer to function(..) returning double CallNonvirtualDoubleMethodA, pointer to function(..) returning void CallNonvirtualVoidMethod, pointer to function(..) returning void CallNonvirtualVoidMethodV, pointer to function(..) returning void CallNonvirtualVoidMethodA, pointer to function(..) returning pointer to struct _jfieldID {..} GetFieldID, pointer to function(..) returning pointer to struct _jobject {..} GetObjectField, pointer to function(..) returning unsigned char GetBooleanField, pointer to function(..) returning signed char GetByteField, pointer to function(..) returning unsigned short GetCharField, pointer to function(..) returning short GetShortField, pointer to function(..) returning int GetIntField, pointer to function(..) returning long long GetLongField, pointer to function(..) returning float GetFloatField, pointer to function(..) returning double GetDoubleField, pointer to function(..) returning void SetObjectField, pointer to function(..) returning void SetBooleanField, pointer to function(..) returning void SetByteField, pointer to function(..) returning void SetCharField, pointer to function(..) returning void SetShortField, pointer to function(..) returning void SetIntField, pointer to function(..) returning void SetLongField, pointer to function(..) returning void SetFloatField, pointer to function(..) returning void SetDoubleField, pointer to function(..) returning pointer to struct _jmethodID {..} GetStaticMethodID, pointer to function(..) returning pointer to struct _jobject {..} CallStaticObjectMethod, pointer to function(..) returning pointer to struct _jobject {..} CallStaticObjectMethodV, pointer to function(..) returning pointer to struct _jobject {..} CallStaticObjectMethodA, pointer to function(..) returning unsigned char CallStaticBooleanMethod, pointer to function(..) returning unsigned char CallStaticBooleanMethodV, pointer to function(..) returning unsigned char CallStaticBooleanMethodA, pointer to function(..) returning signed char CallStaticByteMethod, pointer to function(..) returning signed char CallStaticByteMethodV, pointer to function(..) returning signed char CallStaticByteMethodA, pointer to function(..) returning unsigned short CallStaticCharMethod, pointer to function(..) returning unsigned short CallStaticCharMethodV, pointer to function(..) returning unsigned short CallStaticCharMethodA, pointer to function(..) returning short CallStaticShortMethod, pointer to function(..) returning short CallStaticShortMethodV, pointer to function(..) returning short CallStaticShortMethodA, pointer to function(..) returning int CallStaticIntMethod, pointer to function(..) returning int CallStaticIntMethodV, pointer to function(..) returning int CallStaticIntMethodA, pointer to function(..) returning long long CallStaticLongMethod, pointer to function(..) returning long long CallStaticLongMethodV, pointer to function(..) returning long long CallStaticLongMethodA, pointer to function(..) returning float CallStaticFloatMethod, pointer to function(..) returning float CallStaticFloatMethodV, pointer to function(..) returning float CallStaticFloatMethodA, pointer to function(..) returning double CallStaticDoubleMethod, pointer to function(..) returning double CallStaticDoubleMethodV, pointer to function(..) returning double CallStaticDoubleMethodA, pointer to function(..) returning void CallStaticVoidMethod, pointer to function(..) returning void CallStaticVoidMethodV, pointer to function(..) returning void CallStaticVoidMethodA, pointer to function(..) returning pointer to struct _jfieldID {..} GetStaticFieldID, pointer to function(..) returning pointer to struct _jobject {..} GetStaticObjectField, pointer to function(..) returning unsigned char GetStaticBooleanField, pointer to function(..) returning signed char GetStaticByteField, pointer to function(..) returning unsigned short GetStaticCharField, pointer to function(..) returning short GetStaticShortField, pointer to function(..) returning int GetStaticIntField, pointer to function(..) returning long long GetStaticLongField, pointer to function(..) returning float GetStaticFloatField, pointer to function(..) returning double GetStaticDoubleField, pointer to function(..) returning void SetStaticObjectField, pointer to function(..) returning void SetStaticBooleanField, pointer to function(..) returning void SetStaticByteField, pointer to function(..) returning void SetStaticCharField, pointer to function(..) returning void SetStaticShortField, pointer to function(..) returning void SetStaticIntField, pointer to function(..) returning void SetStaticLongField, pointer to function(..) returning void SetStaticFloatField, pointer to function(..) returning void SetStaticDoubleField, pointer to function(..) returning pointer to struct _jobject {..} NewString, pointer to function(..) returning int GetStringLength, pointer to function(..) returning pointer to const unsigned short GetStringChars, pointer to function(..) returning void ReleaseStringChars, pointer to function(..) returning pointer to struct _jobject {..} NewStringUTF, pointer to function(..) returning int GetStringUTFLength, pointer to function(..) returning pointer to const char GetStringUTFChars, pointer to function(..) returning void ReleaseStringUTFChars, pointer to function(..) returning int GetArrayLength, pointer to function(..) returning pointer to struct _jobject {..} NewObjectArray, pointer to function(..) returning pointer to struct _jobject {..} GetObjectArrayElement, pointer to function(..) returning void SetObjectArrayElement, pointer to function(..) returning pointer to struct _jobject {..} NewBooleanArray, pointer to function(..) returning pointer to struct _jobject {..} NewByteArray, pointer to function(..) returning pointer to struct _jobject {..} NewCharArray, pointer to function(..) returning pointer to struct _jobject {..} NewShortArray, pointer to function(..) returning pointer to struct _jobject {..} NewIntArray, pointer to function(..) returning pointer to struct _jobject {..} NewLongArray, pointer to function(..) returning pointer to struct _jobject {..} NewFloatArray, pointer to function(..) returning pointer to struct _jobject {..} NewDoubleArray, pointer to function(..) returning pointer to unsigned char GetBooleanArrayElements, pointer to function(..) returning pointer to signed char GetByteArrayElements, pointer to function(..) returning pointer to unsigned short GetCharArrayElements, pointer to function(..) returning pointer to short GetShortArrayElements, pointer to function(..) returning pointer to int GetIntArrayElements, pointer to function(..) returning pointer to long long GetLongArrayElements, pointer to function(..) returning pointer to float GetFloatArrayElements, pointer to function(..) returning pointer to double GetDoubleArrayElements, pointer to function(..) returning void ReleaseBooleanArrayElements, pointer to function(..) returning void ReleaseByteArrayElements, pointer to function(..) returning void ReleaseCharArrayElements, pointer to function(..) returning void ReleaseShortArrayElements, pointer to function(..) returning void ReleaseIntArrayElements, pointer to function(..) returning void ReleaseLongArrayElements, pointer to function(..) returning void ReleaseFloatArrayElements, pointer to function(..) returning void ReleaseDoubleArrayElements, pointer to function(..) returning void GetBooleanArrayRegion, pointer to function(..) returning void GetByteArrayRegion, pointer to function(..) returning void GetCharArrayRegion, pointer to function(..) returning void GetShortArrayRegion, pointer to function(..) returning void GetIntArrayRegion, pointer to function(..) returning void GetLongArrayRegion, pointer to function(..) returning void GetFloatArrayRegion, pointer to function(..) returning void GetDoubleArrayRegion, pointer to function(..) returning void SetBooleanArrayRegion, pointer to function(..) returning void SetByteArrayRegion, pointer to function(..) returning void SetCharArrayRegion, pointer to function(..) returning void SetShortArrayRegion, pointer to function(..) returning void SetIntArrayRegion, pointer to function(..) returning void SetLongArrayRegion, pointer to function(..) returning void SetFloatArrayRegion, pointer to function(..) returning void SetDoubleArrayRegion, pointer to function(..) returning int RegisterNatives, pointer to function(..) returning int UnregisterNatives, pointer to function(..) returning int MonitorEnter, pointer to function(..) returning int MonitorExit, pointer to function(..) returning int GetJavaVM, pointer to function(..) returning void GetStringRegion, pointer to function(..) returning void GetStringUTFRegion, pointer to function(..) returning pointer to void GetPrimitiveArrayCritical, pointer to function(..) returning void ReleasePrimitiveArrayCritical, pointer to function(..) returning pointer to const unsigned short GetStringCritical, pointer to function(..) returning void ReleaseStringCritical, pointer to function(..) returning pointer to struct _jobject {..} NewWeakGlobalRef, pointer to function(..) returning void DeleteWeakGlobalRef, pointer to function(..) returning unsigned char ExceptionCheck, pointer to function(..) returning pointer to struct _jobject {..} NewDirectByteBuffer, pointer to function(..) returning pointer to void GetDirectBufferAddress, pointer to function(..) returning long long GetDirectBufferCapacity}, pointer to void) returning int "=" pointer to void


That was easy to figure out, wasn't it?

Steve

9 Comments:

  • Ah, so that's why people prefer coding in Java ...

    ;-)

    By Blogger AlBlue, at 2:30 PM  

  • Steve, you should open up a contest: Top 10 things that come to your mind when you see this error. For example, "Mmmm, donuts!.." :-)

    By Anonymous Peter Nehrer, at 11:31 PM  

  • The thing that comes to my mind is late nights doing homework for CS165

    By Anonymous Anonymous, at 3:32 PM  

  • ... my lord, I'm stuck in a university time warp ...

    By Blogger Steve, at 3:38 PM  

  • That is some ugly error.
    The code is probably just missing a semicolon at the end :)

    By Anonymous MAtej, at 4:22 AM  

  • It's missing a cast.

    By Blogger Steve, at 3:38 PM  

  • This kinda error reminds me that its time to turn off the comp and go out!

    By Anonymous Artemis, at 4:51 AM  

  • It is not an error ... it is a warning.

    By Anonymous parris, at 3:25 PM  

  • "Best compiler warning ever!"

    By Blogger Steve, at 3:27 PM  

Post a Comment

<< Home