Closed Ingo60 closed 11 years ago
I also noticed this issue in GAE (const 3 also breaks). This is due to Eclipse Java Compiler bug in version 3.7 for a statement like below in the Frege generated Java code:
Object fooObj = 5; int foo = (int) fooObj; //error here
They have fixed it in 3.7.1 and I have upgraded our REPL library to 3.7.2 but somehow GAE still picks up old library. It is working fine in standalone REPL with the new library. I will look into it further.
I have not done it because I felt it was not necessary (yes, I took the time to study the JLS), but we could change the code gen so that in such cases it would do (int)(java.lang.Integer)fooObj. If you think that this would fix it, let me now.
If you think that this would fix it, let me now.
Thanks Ingo. (java.lang.Integer) fooObj
would fix the issue (similarly for other primitives as well) but I think that we can have that as the last option since it is a valid code according to JLS. I will give it a try to fix in GAE. If it doesn't work out, we will apply this fix.
It looks like we need to apply the above fix for all primitive conversions since the GAE is loading the Eclipse Java compiler from the server's parent class loader and it is not taking the latest version jar from our web application. I deployed tryfrege even without the Eclipse Java Compiler jar inside the web application and still it works in GAE which confirms that the jar is loaded from parent class loader and the latest jar with the fix from our web application is never read.
Ok, I'll care about it this evening.
Thanks Ingo.
On Monday, January 21, 2013, Ingo Wechsung wrote:
Ok, I'll care about it this evening.
— Reply to this email directly or view it on GitHubhttps://github.com/Frege/try-frege/issues/1#issuecomment-12487005.
Here is the commit you need: https://github.com/Frege/frege/commit/5e7b72fb9591c3d133c262f914e9141e5d8be100
This will also make arithmetic sequences available, which I implemented last week.
I am not sure if it will compile because of this, hence I also uploaded the frege3.21.33-g5e7b72f.jar to code.google.com/p/frege
I hope it will fix the bug.
Thanks. It fixed the issue. I have deployed the updated version with this jar in GAE. http://tryfrege.appspot.com/
Great! I am very glad to see that it fixed it.
Just tried the follwoing:
frege> snd (undefined, 42) 1: Cannot cast from Object to int frege> :version 3.21.9-g1b7b660
It may be that this happens in the code generation pass. For an analysis we would need the source code that is generated by the REPL.
Or maybe it doesn't happen in a more recent version, I remember I've fixed some bugs since this version.