Comments (7)
That's surprising, as j2objc should be generating all declarations before use. The J2OBJC_CLASS_TYPE_LITERAL_SOURCE error is very strange, as it's included in every .m file, and should match a J2OBJC_TYPE_LITERAL_HEADER that is either in the same file (if the type is private) or in the associated .h file.
One possible problem is if you are using #import
with j2objc-generated headers instead of #include
. #include
is necessary when a generated header has multiple types which refer to each other (an "include cycle"). We minimize the need for this by declaring @class
and @protocol
declarations where needed, but sometimes both types need to be fully declared, so j2objc generates segmented headers. Segmented headers in a way split a single header file into multiple ones that can be separately included, so #import
can't be used since only one segment will be read.
Are you only seeing this in the Xcode UI, and not in a build log? If so, then Xcode may be confused by segmented headers.
from j2objc.
Hi Tom, thanks for the speedy response. I'll check out #include versus #import - looks like we may be doing this wrong, though a quick change to include doesn't seem to result in fewer warnings, so far.
We use j2objc to convert a java library to a static library project in xcode. The main header file for our library currently looks like this - is there some overarching import/include i should be doing?
#include <Foundation/Foundation.h>
#include "J2ObjC_header.h"
#include "java/lang/Integer.h"
#include "java/lang/Boolean.h"
#include "java/lang/Long.h"
#include "java/lang/Double.h"
#include "java/math/BigDecimal.h"
#include "java/util/Date.h"
#include "java/util/List.h"
#include "java/util/AbstractList.h"
#include "java/util/ArrayList.h"
#include "java/util/Collection.h"
#include "java/util/AbstractMap.h"
#include "java/util/Map.h"
#include "java/util/Set.h"
#include "java/io/File.h"
#include "IOSClass.h"
#include "IOSPrimitiveArray.h"
from j2objc.
Its very strange, actually, because taking another example:
ASWPresentersStep2AddYourIntroductionPresenter *new_ASWPresentersStep2AddYourIntroductionPresenter_init() {
...
}
Xcode highlights in yellow the () after 'init' with the usual warning, but I can see the header is declared with (void), which is, as far as I can gather, correct:
FOUNDATION_EXPORT ASWPresentersStep2AddYourIntroductionPresenter *new_ASWPresentersStep2AddYourIntroductionPresenter_init(void) NS_RETURNS_RETAINED;
For what its worth, I changed all imports to includes for generated code in our library project and the number of warnings did not drop.
from j2objc.
Interesting.. in this case, its offering to 'fix' the issue by injecting (void) in the .m file.
from j2objc.
My guess is that Xcode is now getting confused by how j2objc's generates declarations. If you have the time, please try applying all the Xcode fixes and then diffing the generated sources to see what it changed. If we can tweak j2objc's output to make Xcode happy (without breaking anything), we should do that. Also, what version of Xcode are you using?
from j2objc.
Thanks Tom. The Xcode version is reported as Version 14.3.1 (14E300c)
We have more than 2000 warnings currently, so i'm not sure I can set about applying all of the fixes its suggesting. From what i've seen its mostly injecting (void) in places where the .m files have (). However, the relevant generated headers have the correct form with (void) so i'm not even sure why its suggesting these changes.
Some of the other changes its suggesting are... well, odd:
from j2objc.
Closing this as I think this is due to the weird way i'm using the headers from the j2objc dist along with the JRE framework bundle.
from j2objc.
Related Issues (20)
- Encountering "multiple commands produce 'module.modulemap'" error when linking a target with any two of the J2ObjC XCFrameworks HOT 1
- When can you update the new version? HOT 3
- JAVA code is configured with JVM, how do I configure JVM into J2OBJC? HOT 1
- My
- Myself
- Files with same name HOT 3
- Size of JRE.xcframework exceeds 75MB limit of appstoreconnect HOT 2
- bitwise error ( sudo make dist command ). JDK 15 osx Sonoma 14.1.2
- The contents of JRE.xcframework (static vs dynamic lib)
- Bazel 6 example workspace
- Inquiry about Support for Apple's Privacy Manifest Files HOT 1
- Difficulty resolving missing Android SDK APIs in iOS SDK during J2objc translation HOT 1
- "JavaMathBigDecimal_initWithLong_(self, val)" declaration not available in "BigDecimal.h" causing compilation error HOT 6
- Building j2objc fails on latest master HOT 2
- make dist fails on latest master (error while building cycle_finder jar) HOT 4
- Error in upgrading J2ObjC from version 2.8 to 3.0: create_JavaLangDeprecated() too few arguments HOT 2
- Multiple commands produce JSONArray.h
- Transpiler generated header like JavaUtilMap cannot be bridged to swift HOT 3
- 0 HOT 2
- J2objc 3.0.0 and JDK 17 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from j2objc.