Issue in iOS after cross compile using XmlPull library

Greetings,

We’re working on an app, and the developer is including the xmlpull library to work with some XML data.

In XCode, the XmlPullParserFactory.mm class shows a pair of Semantic issues with a specific line.

In the original java it looks like this:

final String name = classNames.substring(pos, cut);

Class candidate = null;

Object instance = null;

try

{

  candidate = Class.forName(name);

  // necessary because of J2ME .class issue

  instance = candidate.newInstance();

}

When converted to Objective C, the first line in the try block looks like:

candidate = Class::forName(name);

… and I get the following 2 issues with that line:

  •   Expected a class or namespace
    
  •   Reference to ‘Class’ is ambiguous
    

I’ve done no native iOS development, so I don’t know where to start on this. Has anyone seen anything like this before, or have any insight they can share?

Dave

Ambiguity sometimes happens where ObjectiveC names clash with Java ones.

I would modify the java to have an import at the top of:

import java.lang.Class;

and then change any references to Class to be fully qualified e.g.

java.lang.Class candidate = null;

        candidate = java.lang.Class.forName(name);

etc…

That way the compiler will not have a chance to get confused.

Cheers,

Matt