EOGenerator - Referencing Prototypes in a different EOModel


Today when I ran my eogenerator script, I got an error ... it has been over 10 days since I needed to run eogenerator on my project, so I had obviously done something. After getting over the few seconds of that uneasy feeling in your stomach at the thought of losing productivity (I was in the developer coding rapidly zone .... and now I had a derailment to deal with) fixing a problem on something that has always worked reliably up to now.......

It crashed after about a dozen java files. The error on the command line looked like this:
2006-11-21 10:08:51.131 eogenerator[694] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value
./eogenerator_the_java: line 7: 694 Trace/BPT trap /Users/kieran/Applications/EOGenerator-1.7/eogenerator -model /Users/kieran/DevProjects/Cheetah/Code/cheetah/cheetah.eomodeld -destination /Users/kieran/DevProjects/Cheetah/Code/cheetah -subclassDestination /Users/kieran/DevProjects/Cheetah/Code/cheetah -templatedir /Users/kieran/Applications/EOGenerator-1.7/MyTemplates -javaTemplate EOGJavaSourceKK032806.eotemplate -subclassJavaTemplate JavaSubclassSourceEOF5.eotemplate -verbose -java


....... and I got a system thread crash too:
Date/Time: 2006-11-21 10:08:51.196 -0500
OS Version: 10.4.8 (Build 8L2127)
Report Version: 4

Command: eogenerator
Path: /Users/kieran/Applications/EOGenerator-1.7/eogenerator
Parent: bash [693]

Version: ??? (???)

PID: 694
Thread: 0

Exception: EXC_BREAKPOINT (0x0006)
Code[0]: 0x00000002
Code[1]: 0x00000000


Thread 0 Crashed:
0 com.apple.Foundation 0x9262850b _NSRaiseError + 227
1 com.apple.Foundation 0x9264f2cb +[NSException raise:format:] + 57
2 com.apple.Foundation 0x9269a131 _NSDictionaryRaiseInsertNilValueException + 75
3 com.apple.Foundation 0x925dd5bf -[NSCFDictionary setObject:forKey:] + 146
4 eogenerator 0x00003d0a 0x1000 + 11530
5 eogenerator 0x0000337f 0x1000 + 9087
6 eogenerator 0x0000367f 0x1000 + 9855
7 com.apple.Foundation 0x92612edc -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 137
8 eogenerator 0x0000bbdb 0x1000 + 43995
9 eogenerator 0x0000c0b2 0x1000 + 45234
10 eogenerator 0x0000fb3b 0x1000 + 60219
11 eogenerator 0x0000bac8 0x1000 + 43720
12 eogenerator 0x0000b980 0x1000 + 43392
13 eogenerator 0x00005bcb 0x1000 + 19403
14 eogenerator 0x000053d2 0x1000 + 17362
15 eogenerator 0x000051c3 0x1000 + 16835
16 eogenerator 0x00006f4f 0x1000 + 24399
17 eogenerator 0x00002472 0x1000 + 5234
18 eogenerator 0x0000238d 0x1000 + 5005

What was wrong I thought ...... was my OS installation flaky after cloning it twice last week to upgrade my hard drive? .... was it an incompatibility with OS X 10.4.8 which I had just upgraded to from 10.4.7? ....... hmmmm .......... examing the few files that eogenerator has generated quickly shed light on the issue. All my method return types were missing and where there should be class casts, I only had double brackets () ....... ah yes ...... now I realize it cannot see the prototypes! And the reason is that I (yes, me, it almost ALWAYS is the operators fault!) took my prototypes out of my EOModel and put them in a framework last week!

The fix was easy. I just updated my project's eogenerator script to this, adding the refmodel option to the eogenerator command:
#!/bin/bash

# KK 10/21/2006 - updated to account for prototypes in a separate framework
/Users/kieran/Applications/EOGenerator-1.7/eogenerator -model /Users/kieran/DevProjects/Cheetah/Code/cheetah/cheetah.eomodeld -refmodel /Library/Frameworks/WKPrototypes.framework/Resources/WKPrototypes.eomodeld -destination /Users/kieran/DevProjects/Cheetah/Code/cheetah -subclassDestination /Users/kieran/DevProjects/Cheetah/Code/cheetah -templatedir /Users/kieran/Applications/EOGenerator-1.7/MyTemplates -javaTemplate EOGJavaSourceKK032806.eotemplate -subclassJavaTemplate JavaSubclassSourceEOF5.eotemplate -verbose -java

# Generate the javadoc API docs
javadoc -verbose -d /Library/WebServer/Documents/cheetah_api /Users/kieran/DevProjects/Cheetah/Code/cheetah/*.java


Posted: Tue - November 21, 2006 at 10:33 AM        


Published by