rentzsch / mogenerator

Core Data code generation

Home Page:http://rentzsch.github.com/mogenerator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warnings for method collision

zorn opened this issue · comments

One thing that seems to burn me often is giving one of my Entities an attribute with a name that clashes with the other methods in Cocoa.

It would be cool if mogenerator gave me a warning that although I have an attribute named description the class mogenerator will create will have a method that will collide with NSObject's -description.

I've seen similar issues with -name -type -value and a few others.

This should be in the data modeler, but since mogenerator + Xmo'd is all about picking up Apple slack, I agree we should roll it in. Patches welcome and/or a comprehensive list of such troublesome names.

Looks like Xcode's gotten smarter since this feature was requested. its data model editor now won't allow attributes with the following names:

  • description
  • hash
  • superclass
  • class
  • self
  • zone
  • isProxy
  • managedObjectContext
  • entity
  • objectID
  • isInserted
  • isUpdated
  • isDeleted
  • isFault
  • retain
  • retainCount
  • release
  • autorelease
  • init
  • copy
  • mutableCopy
  • dealloc
  • and so on (didn't bother trying all the methods in NSObject)

@zorn #74 says "type" is a problem (as does chockenberry). I can't find anything that suggests "name" or "value" are problematic?

Can someone tell me how to suppress the primitive accessors? We don't use them and 1.28 appears to still be generating them.

While primitiveType and setPrimitiveType are suppressed, setPrimitiveTypeValue and primitiveTypeValue are not. Which creates code that doesn't even compile (since they reference the suppressed methods)

The bizarre thing I'm experiencing on my iOS project, is that of the 15 or so entities I have, primitiveType and setPrimitiveType are only generated for one of the classes! This on version 1.28.

@rentzsch Is there a way to suppress the primitive accessors, and possibly also some of the other generated code as well?