Please test: issue resolved between Eclipse, Java and Akka futures

1,009 views
Skip to first unread message

rkuhn

unread,
Feb 28, 2012, 10:52:06 AM2/28/12
to akka...@googlegroups.com
Dear hAkkers,

Akka 2.0-RC3 has been compiled with an upcoming bug-fix release of Scala (2.9.1-1-RC1) in order to resolve an issue between the Java compiler employed by Eclipse and our Future Java API: previous Scala versions did not set the “synthetic” flag on some bridge methods like PartialFunction.andThen, leading to failures when building a Java project using e.g. Future.onComplete within Eclipse (plain javac did not have problems). Fixing this uncovered another problem, which had miraculously slipped under the radar until then, namely that it is impossible to express the type Function1[T, Boolean] in Java (Boolean being the primitive “boolean” in Scala), which means that it is not possible to directly use Future.filter() from Java. Hence we slightly changed the Java API for Future.filter, please have a look at akka.dispatch.Filter.filterOf().

Sorry for the techno-babble in the previous paragraph, the summary is: if you experienced any trouble building Java projects using Akka in Eclipse, please try out RC3 and report back whether it now works as expected.

In case you are developing mixed Scala/Java projects and encounter similar problems when using FunctionN-derivatives from Java, you might want to try out the latest nightly build of the Scala IDE, which incorporates this fix (and gives you nice implicits highlighting, for example; recommended to upgrade to Indigo, though).

Regards,

Roland

Michael Slinn

unread,
Feb 28, 2012, 12:17:00 PM2/28/12
to akka...@googlegroups.com
I tried out a four different configurations of Eclipse with Helium nightly-update-master-2.9.2-SNAPSHOT (updated within the last hour), after running 'sbt eclipse' with sbt 0.11.2 and sbteclipse-plugin 2.0.0. The Java code I tested with is here.

eclipse-jee-helios-SR2-win32-x86_64 with Java 1.7.0-b147 64 bit
bad option: -P:continuations:enable    AkkaFutures        Unknown    Scala Problem
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,ArrayList<String>>>

eclipse-jee-indigo-SR2-win32-x86_64 with Java 1.7.0-b147 64 bit
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,ArrayList<String>>>

eclipse-jee-indigo-SR2-win32 with jdk1.6.0_31 32 bit
Error when installing Scala IDE plugin: 
An error occurred while collecting items to be installed
session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,org.aspectj.weaver,1.6.12.20110613132200.
MD5 hash is not as expected. Expected: b908d6587f9adba4e9fc9c0d3ca037de and found 6e4d47fd80830794d68aeee4092e0541.
Tried again and it installed fine. Got the same error:
bad option: -P:continuations:enable    AkkaFutures        Unknown    Scala Problem
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,ArrayList<String>>> 
 

eclipse-jee-helios-SR2-win32 with jdk1.6.0_31 32 bit
bad option: -P:continuations:enable    AkkaFutures        Unknown    Scala Problem
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,ArrayList<String>>>


Mike

rkuhn

unread,
Feb 28, 2012, 12:22:27 PM2/28/12
to akka...@googlegroups.com
Now I remember what I forgot to mention: the continuations plugin is automatically enabled in the nightly builds now, just remove the contents of the P option field of the Scala compiler options preferences.

Regards,

Roland

PS: did you also try with a pure Java project and akka RC3?

Michael Slinn

unread,
Feb 28, 2012, 12:47:53 PM2/28/12
to akka...@googlegroups.com
Roland,

1) I made a new sbt project that did not have any Scala files, ran 'sbt eclipse' and got:

Indigo SR2 64 bit with 64 bit Java 1.7
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
at com.micronautics.akka.dispatch.ConfigJava.main(ConfigJava.java:51)
(this is line that declares main(), also onComplete invocations were highlighted as an error by the display compiler)

Indigo SR2 32 bit with 32 bit Java 1.6
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,Integer>>
The return types are incompatible for the inherited methods Function1<Either<Throwable,Integer>,BoxedUnit>.apply(Either<Throwable,Integer>), japi.CallbackBridge<Either<Throwable,Integer>>.apply(Either<Throwable,Integer>)

Helios SR2 32 bit with 32 bit Java 1.6
Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,Integer>>


2) Which of the following lines in build.sbt are no longer required for RC3?

autoCompilerPlugins := true

addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.9.1")

scalacOptions ++= Seq("-deprecation", "-P:continuations:enable")

libraryDependencies <+= scalaVersion { v => compilerPlugin("org.scala-lang.plugins" % "continuations" % v) }

Mike

Michael Slinn

unread,
Feb 28, 2012, 1:26:11 PM2/28/12
to akka...@googlegroups.com
Here is a complete project that demonstrates the problem. It has only one Java source file.


Mike

√iktor Ҡlang

unread,
Feb 28, 2012, 2:22:18 PM2/28/12
to akka...@googlegroups.com

It's probably faster if you start from 0.

Cheers,
V

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/0LrxZdZBQ_IJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Mike Slinn

unread,
Feb 28, 2012, 2:26:39 PM2/28/12
to akka...@googlegroups.com
Say what?

Mike

Roland Kuhn

unread,
Feb 28, 2012, 2:27:23 PM2/28/12
to akka...@googlegroups.com
Thanks, Michael, that will make it easier once I'm at a real computer again! What I can tell you right away, though, is that you are not actually using akka 2.0-RC3 in build.sbt, and the jar referenced in .classpath consequently is not the right one. 


Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/Fnsni-MNF4sJ.

√iktor Ҡlang

unread,
Feb 28, 2012, 2:35:17 PM2/28/12
to akka...@googlegroups.com

Why are you using "latest-integration" as akka version??

--

Mike Slinn

unread,
Feb 28, 2012, 2:43:59 PM2/28/12
to akka...@googlegroups.com
Ivy supports latest.release, latest.milestone, latest.integration and explicit versions (as per Ivy docs). latest.integration is known to sbt as latest_integration. Specifying that, and having this as the first resolver gives me the latest and hopefully greatest Akka build without having to constantly edit build.sbt:

"Akka Snapshots"        at "http://akka.io/snapshots"

Isn't this today's build? akka-actor-2.0-20120228-000701.jar

Mike

√iktor Ҡlang

unread,
Feb 28, 2012, 2:52:05 PM2/28/12
to akka...@googlegroups.com

I'd strongly recommend sticking with official releases, as I don't fancy wasting my time not knowing which artifact you're actually using.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.

Roland Kuhn

unread,
Feb 28, 2012, 2:54:08 PM2/28/12
to akka...@googlegroups.com
Hi Michael,

the build you got may be from today (just barely so), but it is not 2.0-RC3, which I kindly asked you to test. Would you please test that one and confirm that it works?

BTW: snapshots are the devil, and keep in mind that you don't know whether latest.integration actually gives you the “release-2.0” branch (it doesn't). 



Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.

Mike Slinn

unread,
Feb 28, 2012, 3:18:52 PM2/28/12
to akka...@googlegroups.com
Now using:

"com.typesafe.akka" % "akka-actor" % "2.0-RC3"
withSources(),

Problems went away. I will now go stand in the corner ;)

Mike

Roland Kuhn

unread,
Feb 28, 2012, 3:29:41 PM2/28/12
to akka...@googlegroups.com
Great to hear that it's solved, thanks for testing! Now, if anybody else finds something wrong with RC3, speak now (at least very soon) or forever hold your peace!


Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn

√iktor Ҡlang

unread,
Feb 28, 2012, 3:36:49 PM2/28/12
to akka...@googlegroups.com
On Tue, Feb 28, 2012 at 9:29 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
Great to hear that it's solved, thanks for testing!  Now, if anybody else finds something wrong with RC3, speak now (at least very soon) or forever hold your peace!

Yeah, SHIP or SKIP!
 


Regards,

Roland Kuhn
Typesafe — The software stack for applications that scale
twitter: @rolandkuhn

On 28 feb 2012, at 21:18, Mike Slinn <msl...@gmail.com> wrote:

> Now using:
>
> "com.typesafe.akka"             %  "akka-actor"    % "2.0-RC3" withSources(),
>
> Problems went away. I will now go stand in the corner ;)
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups "Akka User List" group.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Samuel Tardieu

unread,
Feb 28, 2012, 3:47:10 PM2/28/12
to akka...@googlegroups.com


2012/2/28 √iktor Ҡlang <viktor...@gmail.com>



On Tue, Feb 28, 2012 at 9:29 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
Great to hear that it's solved, thanks for testing!  Now, if anybody else finds something wrong with RC3, speak now (at least very soon) or forever hold your peace!

Yeah, SHIP or SKIP!

I've been using it since a few hours on two of the projects I'm working on, and I'm satisfied with it so far.

Mike Slinn

unread,
Feb 28, 2012, 4:18:34 PM2/28/12
to akka...@googlegroups.com
I got bored in the corner and came out to play again.
  1. My Java code with Filter is broken now because of the changes in RC3. The ScalaDoc basically says now "Don't use Filter". So why even have the Filter class? It is true that there are better ways of filtering. Please tell me that I should just delete all my filter examples and the accompanying discussion and I will be happy.
  2. Display compiler complains a lot for nothing
  3. OnComplete, OnSuccess and OnFailure no longer need @SuppressWarnings("unchecked")
  4. ExecutionContext.reportFailure() no longer needs @SuppressWarnings("unused")
  5. Still get complaints about "bad option: -P:continuations:enable��� AkkaFutures��� ��� Unknown��� Scala Problem". presumably I should remove that line from build.sbt. When I tried to remove that line from build.sbt, and compiled using sbt, I got: "this code must be compiled with the Scala continuations plugin enabled". I commented out the line in .settings/org.scala-ide.sdt.core.prefs but then my flow() test code never completed, although it compiled and ran:

deprecation=true
#P=continuations\:enable
scala.compiler.useProjectSettings=true

There are a lot of changes to examine. I'm sure more exist.

What would you do without me to tell you all these things? :)

Mike

Michael Slinn

unread,
Feb 28, 2012, 5:48:15 PM2/28/12
to akka...@googlegroups.com
I also discovered that even though I set the Eclipse encoding to UTF-8, it requires => and not ⇒ otherwise this error: "'=>' expected but '}' found".

There is also a classpath problem, or something that causes debug sessions for Java programs on my larger project to fail with: java.lang.ClassNotFoundException: (name of my class). If I copy those classes to the smaller project that I shared with you it works fine. However, the smaller project was originally copied from the larger. Do not know what causes this problem.

Mike 

Michael Slinn

unread,
Feb 28, 2012, 6:33:35 PM2/28/12
to akka...@googlegroups.com
There is some strangeness, like a ghost in the machine. I get messages like "The type scala.ScalaObject cannot be resolved. It is indirectly referenced from required .class files" on Java files. If I comment out most of the class, and clean it works. Then as I uncomment it bit by bit it might or might not run after uncommenting out the entire program. Perhaps clean does not completely reset some compiler artifact.

Statements that seem to be problematic:

    @SuppressWarnings("unchecked")
private final ArrayList<Future<String>> daemonFutures = new ArrayList<Future<String>> (/*Arrays.asList(
            Futures.future(new HttpGetter("http://akka.io/"), dispatcher),
            Futures.future(new HttpGetter("http://www.playframework.org/"), dispatcher),
            Futures.future(new HttpGetter("http://nbronson.github.com/scala-stm/"), dispatcher)
        )*/);

        final Future<ArrayList<String>> f = Futures.fold(initialValue, daemonFutures, applyFn, dispatcher);


Mike

Michael Slinn

unread,
Feb 28, 2012, 6:35:22 PM2/28/12
to akka...@googlegroups.com
Another problematic statement:

    ActorSystem system = ActorSystem.apply("actorSystem", ConfigFactory.parseString(configString));

Does not complain for this, however:

    ActorSystem system = ActorSystem.apply();

Mike

D Pars

unread,
Feb 28, 2012, 8:29:19 PM2/28/12
to Akka User List
Hi Roland,
RC3 has fixed all of the Eclipse compilation issues I had seen up to
this point - which includes using the Future.onWhatevers(s) as well as
the TestKit errors (fixed in a previous RC).

I am using the methods as documented in the Java API
http://akka.io/docs/akka/2.0-RC3/java/index.html (so.. not using
ActorSystem.apply and the like).

Thank you all very much!
D

rkuhn

unread,
Feb 29, 2012, 3:41:48 AM2/29/12
to akka...@googlegroups.com
Hi Michael,


Am Dienstag, 28. Februar 2012 22:18:34 UTC+1 schrieb Michael Slinn:
I got bored in the corner and came out to play again.
  1. My Java code with Filter is broken now because of the changes in RC3. The ScalaDoc basically says now "Don't use Filter". So why even have the Filter class? It is true that there are better ways of filtering. Please tell me that I should just delete all my filter examples and the accompanying discussion and I will be happy.

Yes, you should just delete filter() from the Java side of things, recommend map() instead.
 
  1. Display compiler complains a lot for nothing

Without more specifics I cannot say much, only that it is probably not an Akka issue; from your wording I assume that the build compiler is working fine, right? If this occurs within a project which has the Scala nature enabled, then it may well be a problem in the Scala IDE plugin, please report there (which appropriate level of detail). If this happens in a pure Java environment, i.e. Eclipse without any Scala tooling, that would be a different thing; but we’d still need much more specific failure information.
 
  1. OnComplete, OnSuccess and OnFailure no longer need @SuppressWarnings("unchecked")

I take that to be a good thing.
 
  1. ExecutionContext.reportFailure() no longer needs @SuppressWarnings("unused")

That also sounds like a good thing.
 
  1. Still get complaints about "bad option: -P:continuations:enable��� AkkaFutures��� ��� Unknown��� Scala Problem". presumably I should remove that line from build.sbt. When I tried to remove that line from build.sbt, and compiled using sbt, I got: "this code must be compiled with the Scala continuations plugin enabled". I commented out the line in .settings/org.scala-ide.sdt.core.prefs but then my flow() test code never completed, although it compiled and ran:

This has nothing to do with Java, right? (just to clear out possible misunderstandings) As I said: the current nightlies do not behave like the 2.0.0 plugin in this regard, which is why they are nightly snapshot builds and not release (candidates). To summarize: with Akka 2.0-RC3 and Scala 2.9.1-1-RC1 you need the plugin explicitly enabled for the SBT build (as was always the case); in Eclipse nightly builds (which are using a 2.9.2-SNAPSHOT scala compiler) you currently must remove the explicit settings related to the CPS plugin. Can you confirm that these instructions work?
 
Regards,

Roland

rkuhn

unread,
Feb 29, 2012, 3:45:39 AM2/29/12
to akka...@googlegroups.com

rkuhn

unread,
Feb 29, 2012, 3:47:53 AM2/29/12
to akka...@googlegroups.com
Works fine here, what kind of error are you getting? In which context does this line appear?

rkuhn

unread,
Feb 29, 2012, 3:48:33 AM2/29/12
to akka...@googlegroups.com
Thanks for the heads-up!

Regards,

Roland

Michael Slinn

unread,
Feb 29, 2012, 6:49:06 PM2/29/12
to akka...@googlegroups.com
I deleted every file and directory created by a compiler, and rebuilt.

java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more

Mike

√iktor Ҡlang

unread,
Feb 29, 2012, 6:50:49 PM2/29/12
to akka...@googlegroups.com
Spending less than a second on your stacktrace I assume that the scala standard library is not on your classpath.
What is your conclusion?


Mike

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/HSH9OxB9G2sJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Mike Slinn

unread,
Feb 29, 2012, 6:53:31 PM2/29/12
to akka...@googlegroups.com
Unfortunately it is on the path.

Mike

√iktor Ҡlang

unread,
Feb 29, 2012, 6:59:18 PM2/29/12
to akka...@googlegroups.com
Then your URLClassLoader doesn't know that.

On Thu, Mar 1, 2012 at 12:53 AM, Mike Slinn <msl...@gmail.com> wrote:
Unfortunately it is on the path.

Mike

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Mike Slinn

unread,
Feb 29, 2012, 7:00:18 PM2/29/12
to akka...@googlegroups.com
This same program runs fine under SBT and IDEA. Something about the new
Eclipse setup is still messed up.

Mike

√iktor Ҡlang

unread,
Feb 29, 2012, 7:05:31 PM2/29/12
to akka...@googlegroups.com
On Thu, Mar 1, 2012 at 1:00 AM, Mike Slinn <msl...@gmail.com> wrote:
This same program runs fine under SBT and IDEA. Something about the new Eclipse setup is still messed up.

Install Eclipse a-fresh and install the correct nightly separately and try there. If that works then you've broken your old install (I am not an Eclipse repair man so unfortunately I have no idea on how you unbreak it) if the fresh install doesn't work, then we have a problem with the scala plugin. But please do make sure that the Eclipse version you're using is supported by the Scala IDE plugin.

Cheers,
 


Mike

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Mike Slinn

unread,
Feb 29, 2012, 7:18:30 PM2/29/12
to akka...@googlegroups.com
Yesterday I installed 4 new copies of Eclipse fresh on one machine,
along with updated Java versions, which is what I reported on yesterday.
Today I worked on another machine with identical results, again with
fresh installs. Eclipse is not broken, it works fine. There are,
however, problems with the Scala plugin.

I'll use IDEA and SBT instead. I cannot afford to spend any more time on
these problems.

Mike

√iktor Ҡlang

unread,
Feb 29, 2012, 7:20:56 PM2/29/12
to akka...@googlegroups.com
On Thu, Mar 1, 2012 at 1:18 AM, Mike Slinn <msl...@gmail.com> wrote:
Yesterday I installed 4 new copies of Eclipse fresh on one machine, along with updated Java versions, which is what I reported on yesterday. Today I worked on another machine with identical results, again with fresh installs. Eclipse is not broken, it works fine. There are, however, problems with the Scala plugin.

Which one are you using with which version of Eclipse?
 

I'll use IDEA and SBT instead. I cannot afford to spend any more time on these problems.

Me neither, I've been working 16h today already.

 


Mike

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Mike Slinn

unread,
Feb 29, 2012, 7:25:07 PM2/29/12
to akka...@googlegroups.com
I reported on that extensively yesterday. I worked through a good
portion of the support matrix.

Mike

√iktor Ҡlang

unread,
Feb 29, 2012, 7:30:21 PM2/29/12
to akka...@googlegroups.com
On Thu, Mar 1, 2012 at 1:25 AM, Mike Slinn <msl...@gmail.com> wrote:
I reported on that extensively yesterday. I worked through a good portion of the support matrix.

Then I assume you've reported this to the ScalaIDE team.
 


Mike

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Mike Slinn

unread,
Feb 29, 2012, 7:32:25 PM2/29/12
to akka...@googlegroups.com
No, just here. I'm completely out of time.

Mike

Reply all
Reply to author
Forward
0 new messages