commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Hair <kni...@gmail.com>
Subject [Javaflow] Weird ClassCastException and ClassNotFoundExceptions during build
Date Fri, 24 Jun 2011 14:53:58 GMT
Hello everyone,

I have two problems. The relevant stack traces are here:

https://gist.github.com/1044901

I started using Javaflow yesterday in order to implement coroutines into an
interpreter that I'm working on. I made a simple test case, and it worked
despite some really weird build errors. This is my first problem: when using
the ant task to enhance bytecode, javaflow spews out ClasssNotFoundException
errors for every class I'm enhancing. Despite this, the ant build completes
successfully and javaflow seems to work. These exceptions are emitted as
warnings in ant. I'm trying to figure out how to get rid of those warnings
without just suppressing build warnings in ant.

The second problem is much more important. In my (most likely naive and
misguided) implementation of coroutines, I'm getting class cast exceptions
when I attempt to resume a suspended function call. In my interpreter, every
object is an EveObject as far as Java is concerned. Functions (of type
eve.core.Function) are wrapped inside eve.core.EveObject. I implemented some
basic attempt at coroutines/continuations here:

https://github.com/ProjectMoon/eve2/blob/coroutines/src/eve/scope/ScopeManager.java#L344
https://github.com/ProjectMoon/eve2/blob/coroutines/src/eve/statements/expressions/ResumeExpression.java
https://github.com/ProjectMoon/eve2/blob/coroutines/src/eve/statements/expressions/YieldExpression.java

The ScopeManager's invokeCoroutine method is what handles the state tracking
for continuation dispatching in order to make coroutines possible.
YieldExpression (taking the form of "yield <expression>") will yield the
current function to a function returned by <expression>. The resume
statement currently just invokes a function as a coroutine. If the function
identified by the yield statement has not yet been executed as a
continuation, it works fine. But as soon as I try to resume a coroutine that
has been suspended, it craps out with a ClassCastException about trying to
cast an eve.core.Function to an eve.core.EveObject.

I find this very odd. Is it a bug in the library, or am I just doing
something wrong? If anyone would like to help with this, it would be much
appreciated. I uploaded this branch to the GitHub repository if anyone wants
to pull it down and build it. The git repository is:

git://github.com/ProjectMoon/eve2.git

To build it, make sure Ant and Ivy are installed. Run `ant dependencies` and
then `ant jar`. It will pull down the Javaflow library from SVN, build it,
put into the local MVN repo, and then use it as an Ivy dependency along with
everything else. Dependency resolution should only take about 5-6 minutes on
a good connection. After that, building takes ~5 seconds. I've only ever
built it on *nix systems, but I'd assume it will build on Windows too...

I have two particular test cases. One is a test.eve file, while the other is
a hardcoded coroutines test written in Java. Both will produce the same type
of error.

test.eve is invoked thus (assuming Java 1.6):
java -jar dist/eve.jar test.eve

The Java test invoked thus (again, assuming Java 1.6):
java -cp "dist/*:dist/lib/*" eve.core.CoroutinesTest

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message