#1000895

Duplicate methods named andThen

    • Created on: Fri, Feb 03 (3 months ago)
    • Reported by: Mike Slinn
    • Assigned to: -
    • Milestone: -
    • Type: -
    • Version: 2.0.0-final-29
    • Operative System: -
    • Status: Invalid
    • Priority: Normal (3)
    • Component: Eclipse
    • Permission type: Public
    • Fixed in version: -
    • Eclipse version: Helios
    Classes that use OnComplete introduced with Akka 2.0-M4 are flagged with this error in Eclipse IDE:
    Duplicate methods named andThen with the parameters (Function1) and (Function1<BoxedUnit,C>) are defined by the type japi.CallbackBridge<Either<Throwable,Integer>>

    SBT compiles and runs the code fine, however Eclipse IDE refuses to run the code. Here is a sample class:
    import java.util.concurrent.Callable;
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    
    import akka.dispatch.ExecutionContext;
    import akka.dispatch.Future;
    import akka.dispatch.Futures;
    import akka.dispatch.OnComplete;
    import akka.japi.Procedure2;
    
    class ApplyNonBlocking {
        private final ExecutorService executorService = Executors.newFixedThreadPool(10);
    
        private final ExecutionContext context = new ExecutionContext() {
            @Override public void execute(Runnable r) { executorService.execute(r); }
        };
    
        private final OnComplete<Integer> completionFunction = new OnComplete<Integer>() {
            
            @Override public void onComplete(Throwable exception, Integer result) {
                if (result != null) {
                    System.out.println("Nonblocking Java apply result: " + result);
                } else {
                    System.out.println("Nonblocking Java apply exception: " + exception);
                }
                executorService.shutdown(); // terminates program
            }
        };
    
        private final Callable<Integer> callable = new Callable<Integer>() {
            @Override public Integer call() {
                return 2 + 3;
            }
        };
    
    
        public void doit() {
            Future<Integer> resultFuture = Futures.future(callable, context);
            resultFuture.onComplete(completionFunction);
        }
    
        public static void main(String[] args) {
            new ApplyNonBlocking().doit();
        }
    }

    Here is build.sbt:
    resolvers ++= Seq(
      "Typesafe Snapshots"    at "http://repo.typesafe.com/typesafe/snapshots",
      "Typesafe Releases"     at "http://repo.typesafe.com/typesafe/releases",
      "Scala-Tools Snapshots" at "http://scala-tools.org/repo-snapshots",
      "Scala Tools Releases"  at "http://scala-tools.org/repo-releases"
    )
    
    libraryDependencies ++= Seq(
      "org.scalatest"                 %% "scalatest"     % "1.6.1"        % "test" withSources(),
      "com.typesafe.akka"             %  "akka-actor"    % "latest.integration" withSources(),
      "org.scala-tools"               %% "scala-stm"     % "0.5-SNAPSHOT" withSources()
    )
  • Followers
     
    Ico-users Iulian Dragos , Mike Slinn 
     
    Attachments
    No attachments
    Associations
     
    # Relation Summary Status Action
    Activity
     
    User picture

          on Feb 06, 2012 @ 02:23pm UTC * By Iulian Dragos

    I get this error when compiling in sbt:

    > compile
    [info] Compiling 1 Java source to /Users/dragos/sandbox/akka-ddef/target/scala-2.9.1/classes...
    [error] /Users/dragos/sandbox/akka-ddef/src/main/java/ApplyNonBlocking.java:14: <anonymous ApplyNonBlocking$1> is not abstract and does not override abstract method reportFailure(java.lang.Throwable) in akka.dispatch.ExecutionContext
    [error]     private final ExecutionContext context = new ExecutionContext() {
    [error]                                                                     ^
    [error] 1 error
    [error] {file:/Users/dragos/sandbox/akka-ddef/}default-73da89/compile:compile: javac returned nonzero exit code
    [error] Total time: 1 s, completed Feb 6, 2012 9:12:28 PM


    But I see the problem you mentioned if I add a stub for this method.
    User picture

          on Feb 06, 2012 @ 03:05pm UTC * By Mike Slinn

    Viktor added reportFailure() over the weekend.

    Mike
    User picture

          on May 07, 2012 @ 04:47am UTC * By Mirco Dotta

    Status changed from New to Invalid
    This was a Scala library issue, and it is fixed in Scala 2.9.2.
    Time Expenditure
    Loading