Closed michael-milgrom closed 4 years ago
Thanks for your report. Can you please provide a complete example including your own source code that helps reproduce this problem?
I tried to use my own input for the Reflect.compile() but I got an error so I used your input (the one you were providing in the git) but still got the same error. I can send you my all code if needed.
Supplier<String> supplier = Reflect.compile(
"com.example.HelloWorld",
"package com.example;\n" +
"class HelloWorld implements java.util.function.Supplier<String> {\n" +
" public String get() {\n" +
" return \"Hello World!\";\n" +
" }\n" +
"}\n").create().get();
return supplier.get();
This is the import I'm using: import org.joor.Reflect; Because as I said the import static org.joor.Reflect.*; give me compilation error (Reflect cannot be resolved) and give me Import 'Reflect' (org.joor) solution.
I'm not sure if I understand it. The code example you've shown does not import Reflect.*
, nor would you need that import. Also, the stack trace you've shown shows that the compilation actually ran, but failed.
I'll try reproducing this, but I'm still curious why you'd say that this has anything to do with your static import...
I'm not sure as well whats going on. Its my first time trying to use a static import. so maybe your code actually fine and I just dont understand what I should do with that. In general I tried to follow your manual to make your code work. Im calling your code from a non- static method in a non- static class. maybe that was the reason for the code throw exception.
So, I used your import but is says I have compilation error on the Reflect, and tells me I should use another import. If I use your static import I will have a compilation error but when I use the other import I have an error (NullPointerException). Im sending in the compile method exactly what you gave in your example and I entered into your code to see maybe the example is in correct but it should work.
if you want I can send you the link to my project on git and you will take a look if it helps. and by the way thank you so much for your time working on this amazing solution!
if you want I can send you the link to my project on git and you will take a look if it helps. and by the way thank you so much for your time working on this amazing solution!
Code always beats prose, so yes please :)
Or even better, if possible, you could fork this project, add a unit test that reproduces the problem, and send a PR with the failing test.
In any case, think about it this way. If I can reproduce the problem on my machine, then I will be able to fix it right away. If I cannot reproduce this, I cannot really help you very well.
This is a different problem, but I cannot reproduce it either.
NoSuchMethodError
means that you were able to compile your code, but at runtime, the jOOR library was not found, or you had a different jOOR library version at runtime than at compile time.
I'm closing this issue as it does not seem to describe any problems in jOOR, but rather general Java classpath setup problems.
HI ,
i am facing the same issue , can you help me out for android ?
thank you
@ganatrajay Thanks for your message. Can you please open a new issue with details on how to reproduce your problem?
@ganatrajay I'm sorry, I overlooked you were using android. See my answer here: https://github.com/jOOQ/jOOR/issues/102#issuecomment-619405300
Expected behavior and actual behavior:
print hellow world to console
Steps to reproduce the problem:
I follower your instructions, added Dependency and imported static org.joor.Reflect.*, but I got a compilation error. so I used the suggestion eclipse gave me to import org.joor.Reflect. compile method didn't excised so I changed the dependency version to 0.9.12, and I run my code.
Versions:
0.9.12
Error message:
Exception in thread "Thread-1" org.joor.ReflectException: Error while compiling com.example.HelloWorld at org.joor.Compile.compile(Compile.java:156) at org.joor.Reflect.compile(Reflect.java:102) at org.joor.Reflect.compile(Reflect.java:77) at server.Server.compileFile(Server.java:397) at server.OurThreadClass.handleRequest(OurThreadClass.java:215) at server.OurThreadClass.handleConnection(OurThreadClass.java:111) at server.OurThreadClass.run(OurThreadClass.java:72) Caused by: java.lang.NullPointerException at org.joor.Compile.compile(Compile.java:64) ... 6 more