j2objc: The [IOSClass getDeclaredClasses] method fails when called on a class that has prefix applied
Assume I have a Java class as follows:
package com.mycompany.mysdk;
public class SomeClass {
public class Inner {
}
}
If I translate this Java class to Objective-C without applying a prefix, then making the following call…
IOSObjectArray *declaredClasses = [ComMycompanyMysdkSomeClass_class_() getDeclaredClasses];
… succeeds and I get a sensible array for declaredClasses
.
However, if I translate the Java class to Objective-C with a prefix applied (albeit an empty prefix), then making the following call…
IOSObjectArray *declaredClasses = [SomeClass_class_() getDeclaredClasses];
… results in a JavaLangClassNotFoundException
being thrown with this message: "com.mycompany.mysdk.SomeClass$Inner"
.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (9 by maintainers)
Right, that’s why the issue is still open. 😃
Do not use the initWithClass: method, as it’s private to j2objc’s runtime. Only use methods that are part of the public java.lang.Class API https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html, which doesn’t have any public constructors.
On Wed, May 18, 2016 at 6:41 AM Adil Hussain notifications@github.com wrote: