Runtime exception: Structural identity doesn't work for method references
See original GitHub issueDescribe the bug
items.stream().map(item -> item.getId()).forEach(System.out::println)
✅
items.stream().map(Item::getId).forEach(System.out::println);
🆘
To Reproduce
Test project: https://github.com/marksto/manifold-cast-exception
mvn clean install
Expected behavior Structural identity works for method references in Java 8+.
Desktop (please complete the following information):
- OS Type & Version: “mac os x”, version: “10.14.3”, arch: “x86_64”, family: “mac”
- Java/JDK version: Java version: 1.8.0_172, vendor: Oracle Corporation
- IntelliJ IDEA version: 2018.1.2
- Manifold version: 0.59-alpha
- Manifold IntelliJ plugin version: 0.59-alpha
Stack trace
Exception in thread "main" java.lang.ClassCastException: manifold.ext.DataBindings cannot be cast to abc.schema.Item
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at abc.RunMe.loadItemsArray_PlainInterface(RunMe.java:39)
at abc.RunMe.main(RunMe.java:22)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
java - Runtime exception on method reference with bound ...
I have the following class, which represents an entity that can be identified by a String id: public abstract class IdentifiableEntity ...
Read more >Resolve "ClassNotFoundExeption" errors from Java Lambda ...
The ClassNotFoundException error occurs when a Java runtime loads a class by its fully qualified name, but doesn't locate the class.
Read more >Custom script runtime error - Forum - One Identity
I was able to import dependent libraries build in Visual studio. My script looks like below. #If Not SCRIPTDEBUGGER Then References netstandard.dll. References...
Read more >Chapter 15. Expressions
Run-time exceptions are thrown by the predefined operators as follows: A class instance creation expression (§15.9.4), array creation expression (§15.10.2), ...
Read more >How to test for reference equality (Identity) - C# guide
That is, only one instance of each unique literal string is maintained. However, the runtime does not guarantee that strings created at run...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix available in release 0.65-alpha
Ooo-key… I managed to figure out this inconsistency between debugger interpretation and the code being executed too (regardless the error in evaluator the app itself was running fine), and in the end this last ClassCastException turned out to be an invalid JSON Schema issue. 🤦♂️
Product was parsed with:
while the schema used for loading had:
I’ve covered this scenario with a separate test case in updated test project, but still was not able to reproduce the exact same exception (in tests it fails with
manifold.internal.javac.JavaCompileIssuesException: Error compiling Java class: abc.schema.java_lang_String_structuralproxy_abc_schema_Category
).