WARN java.lang.class: Class.forName() failed to load 'android.util.DisplayMetrics'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>android.util.DisplayMetrics</pattern></forceLinkClasses> to your robovm.xml file to link it in.
But android.util.DisplayMetrics does not exist because I compile for iOS.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It would be nice if you could test the "java8.util.Spliterators.assume.oracle.collections.impl" property approach first.
If that works out, I can try to add RoboVM detection in a second step (I can make an interim test version for you).
If that also works, I could add that as an "off the record" feature in the next release (1.4.3). But please note, that I'll never officially support RoboVM (let alone iOS) since I can only support platforms that I can test myself regularly.
Btw., the warning regarding "android.util.DisplayMetrics" will appear in both scenarios (property and runtime detection) - just ignore it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The attached interim version attempts to do without the "assume.oracle.collections.impl" property by detecting RoboVM at runtime.
Could you please test this version? Don't forget to remove the "assume.oracle.collections.impl" property. The test would be more meaningful if you could test with parallelStream() - ArrayList is ok as a collection to test.
If the test works, I can add RoboVM detection in the 1.4.3 release if you want.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
StreamSupport.stream(list).forEach(...) is OK. But StreamSupport.parallelStream(list).forEach(...) throws an Exception.
java.lang.Error: java.lang.NoSuchFieldException: threadLocals
at java8.util.concurrent.ForkJoinWorkerThread.<clinit>(ForkJoinWorkerThread.java:256)
at java8.util.concurrent.ForkJoinPool$DefaultForkJoinWorkerThreadFactory.newThread(ForkJoinPool.java:636)
at java8.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1344)
at java8.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1368)
at java8.util.concurrent.ForkJoinPool.signalWork(ForkJoinPool.java:1494)
at java8.util.concurrent.ForkJoinPool.externalPush(ForkJoinPool.java:1968)
at java8.util.concurrent.ForkJoinTask.fork(ForkJoinTask.java:700)
at java8.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:359)
at java8.util.concurrent.CountedCompleter.exec(CountedCompleter.java:742)
at java8.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:291)
at java8.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:403)
at java8.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:732)
at java8.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:195)
at java8.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:210)
at java8.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:232)
at java8.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:459)
at java8.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:624)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi.
I'm trying to use streamsupport 1.4.2, but an error is occurred.
I use RoboVM Studio for iOS development.
Here is my code.
ArrayList<Subscription> subscriptions = new ArrayList<>();
// ...
StreamSupport.stream(subscriptions).forEach(Subscription::unsubscribe);
This causes an error.
java.lang.Error: java.lang.NoSuchFieldException: elementData
at java8.util.ArrayListSpliterator.<clinit>(ArrayListSpliterator.java:211)
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I found a warning before the error.
WARN java.lang.class: Class.forName() failed to load 'android.util.DisplayMetrics'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>android.util.DisplayMetrics</pattern></forceLinkClasses> to your robovm.xml file to link it in.
But android.util.DisplayMetrics does not exist because I compile for iOS.
iOS is not supported, I'm sorry.
I'd try the following:
This must be issued before anything from streamsupport is used / get's loaded - i.e., as early as possible (e.g., in your Main.java).
Please keep me informed whether that works in your case.
Last edit: Stefan Zobel 2016-03-17
It would be nice if you could test the "java8.util.Spliterators.assume.oracle.collections.impl" property approach first.
If that works out, I can try to add RoboVM detection in a second step (I can make an interim test version for you).
If that also works, I could add that as an "off the record" feature in the next release (1.4.3). But please note, that I'll never officially support RoboVM (let alone iOS) since I can only support platforms that I can test myself regularly.
Btw., the warning regarding "android.util.DisplayMetrics" will appear in both scenarios (property and runtime detection) - just ignore it.
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Thanks for your reply.
"java8.util.Spliterators.assume.oracle.collections.impl" property approach worked.
Of course I get it. Because RoboVM compiles Java bytecode to native binaries. I think you are enough for Java bytecode level support.
OK, fine. Then let's go for the next round.
The attached interim version attempts to do without the "assume.oracle.collections.impl" property by detecting RoboVM at runtime.
Could you please test this version? Don't forget to remove the "assume.oracle.collections.impl" property. The test would be more meaningful if you could test with parallelStream() - ArrayList is ok as a collection to test.
If the test works, I can add RoboVM detection in the 1.4.3 release if you want.
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I'm sorry for the late reply.
StreamSupport.stream(list).forEach(...) is OK. But StreamSupport.parallelStream(list).forEach(...) throws an Exception.
java.lang.Error: java.lang.NoSuchFieldException: threadLocals
at java8.util.concurrent.ForkJoinWorkerThread.<clinit>(ForkJoinWorkerThread.java:256)
at java8.util.concurrent.ForkJoinPool$DefaultForkJoinWorkerThreadFactory.newThread(ForkJoinPool.java:636)
at java8.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1344)
at java8.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1368)
at java8.util.concurrent.ForkJoinPool.signalWork(ForkJoinPool.java:1494)
at java8.util.concurrent.ForkJoinPool.externalPush(ForkJoinPool.java:1968)
at java8.util.concurrent.ForkJoinTask.fork(ForkJoinTask.java:700)
at java8.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:359)
at java8.util.concurrent.CountedCompleter.exec(CountedCompleter.java:742)
at java8.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:291)
at java8.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:403)
at java8.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:732)
at java8.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:195)
at java8.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:210)
at java8.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:232)
at java8.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:459)
at java8.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:624)
Ah, ok. Thanks for testing.
I'll fix this and come back to you with another interim version.
Thanks,
Stefan
Please find attached a fixed version. Could you please test again with this version and let me know your results?
Thanks,
Stefan
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Both stream() and parallelStream() work.
Thanks for your great job.
Good. Thanks for testing! So, I'll add this small enhancement to the 1.4.3 release.
But please keep in mind that streamsupport on RoboVM is still not officially supported.
If it works - fine, you are lucky. If not - too bad, but it's not my department :-)