Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default method in interface? #13

Closed
dchambers opened this issue Mar 27, 2014 · 6 comments
Closed

Default method in interface? #13

dchambers opened this issue Mar 27, 2014 · 6 comments

Comments

@dchambers
Copy link

Our build fails now that I've started making use of retrolambda (via the gradle plug-in), for a project that was a pure Java 7 code base, with one class (NodeCommander) converted to make use of Lambdas. The bit that sticks out to me as looking strange is this:

  bad class file: /home/dominicc/git-dev/brjs/brjs-core/build/classes/main/org/bladerunnerjs/model/BRJSNode.class
default method found in version 51.0 classfile

Since I'm not making any use of default methods in this, or any other interface. You can see the code for yourself here:

This problem happens both when I configure the JAVA_7 and JAVA_8 environment variables on my machine, and when I don't and it uses some built-in compiler. Here's the tail of the build failure log:

:brjs-core:processResources
:brjs-core:zipJsDocResources
:brjs-core:classes
:brjs-core:compileRetrolambdaMain
Retrolambda 1.1.2
Bytecode version: 51 (Java 7)
Input directory:  /home/dominicc/git-dev/brjs/brjs-core/build/retrolambda/main
Output directory: /home/dominicc/git-dev/brjs/brjs-core/build/classes/main
Classpath:        /home/dominicc/git-dev/brjs/brjs-core/build/retrolambda/main:/home/dominicc/git-dev/brjs/brjs-core/build/resources/main:/home/dominicc/git-dev/brjs/brjs-logger/build/libs/brjs-logger-v0.5-114-gabb72a7-DEV.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.3/cd8d6ffc833cc63c30d712a180f4663d8f55799b/commons-io-2.3.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.6.6/ce53b0a0e2cfbb27e8a59d38f79a18a5c6a8d2b0/slf4j-api-1.6.6.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.2.2/1f96456ca233dec780aa224bff076d8e8bca3908/gson-2.2.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/c9ad4a0850ab676c5c64461a05ca524cdfff59f1/json-simple-1.1.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.esotericsoftware.yamlbeans/yamlbeans/1.06/52bbb25465e93308038a6a7401899a06407b98cd/yamlbeans-1.06.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/javax.validation/validation-api/1.1.0.Final/8613ae82954779d518631e05daa73a6a954817d5/validation-api-1.1.0.Final.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.apache.bval/bval-jsr303/0.5/a23543b20bc2a3f932b4c80c94486e7e47e81324/bval-jsr303-0.5.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.martiansoftware/jsap/2.1/d17c260c8f5eb6e7d6bd75449a57edfeb53d2305/jsap-2.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.aggregate/jetty-all-server/7.6.4.v20120524/de1e981352b2376dda62cf8f1ee1e45c89bb0871/jetty-all-server-7.6.4.v20120524.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/javax.transaction/jta/1.1/2ca09f0b36ca7d71b762e14ea2ff09d5eac57558/jta-1.1.jar:/h                                                                       ome/dominicc/.gradle/caches/modules-2/files-2.1/com.google.javascript/closure-compiler/r2180/273b22e366ab352eeda308146d77e7da700d8701/closure-compiler-r2180.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.jamesmurty.utils/java-xmlbuilder/0.6/db049c92218c35edba0f395e38eff723b1303c02/java-xmlbuilder-0.6.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/xalan/2.7.1/75f1d83ce27bab5f29fff034fc74aa9f7266f22a/xalan-2.7.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.sun.xml.stream/sjsxp/1.0.2/348fff97c4354fd58110dd1e81ebcd48146d1da9/sjsxp-1.0.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/dom4j/dom4j/1.6.1/5d3ccc056b6f056dbf0dddfdf43894b9065a8f94/dom4j-1.6.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.ostermiller/utils/1.07.00/a8828217b2dd0507fbe9e9d0b2981acfb908b590/utils-1.07.00.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/net.htmlparser.jericho/jericho-html/3.2/b8385d9836562d75df8445db00c7e9c50459af9f/jericho-html-3.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.codehaus.woodstox/woodstox-core-asl/4.2.0/7a3784c65cfa5c0553f31d000b43346feb1f4ee3/woodstox-core-asl-4.2.0.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.codehaus.woodstox/stax2-api/3.1.1/466eab062e9d1a3ce2c4631b6d09b5e5c0cbd1b/stax2-api-3.1.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/net.java.dev.msv/msv-core/2013.2.2/5af8712dbc3b5b6dc0cc8b20da4224478fc7793/msv-core-2013.2.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.thaiopensource/trang/20091111/f66f18561a4a821910b5bd7e3af58ee187af5a00/trang-20091111.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/1.3.9/40719ea6961c0cb6afaeb6a921eaa1f6afd4cfdf/jsr305-1.3.9.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/junit/junit/4.10/e4f1766ce7404a08f45d859fb9c226fc9e41a861/junit-4.10.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.apache.bval/bval-core/0.5/db676f443722a1412ca61b55d4b3b9c2ac96d548/bval-core-0.5.jar:/home/dominicc/.gradle/caches/modules-2/                                                                files-2.1/org.eclipse.jetty.orbit/javax.servlet/2.5.0.v201103041518/9c16011c06bc6fe5e9dba080fcb40ddb4b75dc85/javax.servlet-2.5.0.v201103041518.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.orbit/javax.security.auth.message/1.0.0.v201108011116/864ac89e01622b020fa2104bfda379692146b3b6/javax.security.auth.message-1.0.0.v201108011116.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.orbit/javax.mail.glassfish/1.4.1.v201005082020/b707c39fc080529c4a9ffc1df4eac58421133aaf/javax.mail.glassfish-1.4.1.v201005082020.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.orbit/javax.activation/1.1.0.v201105071233/b394a9fbf664ca835452b3ced452710bcf79fd81/javax.activation-1.1.0.v201105071233.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.orbit/javax.annotation/1.1.0.v201108011116/964b4bd5e4f40d6497fd302e2e66c4a4257138b3/javax.annotation-1.1.0.v201108011116.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/args4j/args4j/2.0.16/9f00fb12820743b9e05c686eba543d64dd43f2b1/args4j-2.0.16.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/2.4.1/c589509ec6fd86d5d2fda37e07c08538235d3b9/protobuf-java-2.4.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.json/json/20090211/c183aa3a2a6250293808bba12262c8920ce5a51c/json-20090211.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.8.2/fc33bf7cd8c5309dd7b81228e8626515ee42efd9/ant-1.8.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.googlecode.jarjar/jarjar/1.1/88085e95e0c9cf49e29116bd467a5dccd07d40a0/jarjar-1.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/net.iharder/base64/2.3.8/7d2e2cea90cc51169fd02a35888820ab07f6d02f/base64-2.3.8.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/serializer/2.7.1/4b4b18df434451249bb65a63f2fb69e215a6a020/serializer-2.7.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/net.java.dev.msv/xsdlib/2013.2.2/78f6ac3ac8c076f10120ca5e2813f46e59290bc2/xsdlib-2013.2.2.jar:/h                                                                ome/dominicc/.gradle/caches/modules-2/files-2.1/net.java.dev.msv/msv-testharness/2013.2.2/c2bdb0fcee4b8551d336a10dd6d2c76fc87d670c/msv-testharness-2013.2.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/xml-resolver/xml-resolver/1.2/3d0f97750b3a03e0971831566067754ba4bfd68c/xml-resolver-1.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/xerces/xercesImpl/2.9.1/7bc7e49ddfe4fb5f193ed37ecc96c12292c8ceb6/xercesImpl-2.9.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/isorelax/isorelax/20030108/b21859c352bd959ea22d06b2fe8c93b2e24531b9/isorelax-20030108.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/relaxngDatatype/relaxngDatatype/20020414/de7952cecd05b65e0e4370cc93fc03035175eef5/relaxngDatatype-20020414.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/net.sf.saxon/saxon/8.7/68f963a06e2c384ab8d60aaa89ed0363928f6e84/saxon-8.7.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/860340562250678d1a344907ac75754e259cdb14/hamcrest-core-1.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/commons-beanutils/commons-beanutils-core/1.8.3/75812698e5e859f2cb587c622c4cdfcd61676426/commons-beanutils-core-1.8.3.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant-launcher/1.8.2/6a5466384e7e2086b13d3d281dadaa059b0d0923/ant-launcher-1.8.2.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/13.0.1/d6f22b1e60a2f1ef99e22c9f5fde270b2088365/guava-13.0.1.jar:/home/dominicc/.gradle/caches/modules-2/files-2.1/javax.xml.stream/stax-api/1.0-2/d6337b0de8b25e53e81b922352fbea9f9f57ba0b/stax-api-1.0-2.jar
Saving lambda class: org/bladerunnerjs/testing/specutility/engine/NodeCommander$$Lambda$1
Saving lambda class: org/bladerunnerjs/testing/specutility/engine/NodeCommander$$Lambda$2
Saving lambda class: org/bladerunnerjs/testing/specutility/engine/NodeCommander$$Lambda$3
Saving lambda class: org/bladerunnerjs/testing/specutility/engine/NodeCommander$$Lambda$4
:brjs-core:compileTestJava
warning: [path] bad path element "/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/xalan/2.7.1/75f1d83ce27bab5f29fff034fc74aa9f7266f22a/xercesImpl.jar": no such file or directory
warning: [path] bad path element "/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/xalan/2.7.1/75f1d83ce27bab5f29fff034fc74aa9f7266f22a/xml-apis.jar": no such file or directory
warning: [path] bad path element "/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/xalan/2.7.1/75f1d83ce27bab5f29fff034fc74aa9f7266f22a/serializer.jar": no such file or directory
warning: [path] bad path element "/home/dominicc/.gradle/caches/modules-2/files-2.1/com.thaiopensource/trang/20091111/f66f18561a4a821910b5bd7e3af58ee187af5a00/resolver.jar": no such file or directory
warning: [path] bad path element "/home/dominicc/.gradle/caches/modules-2/files-2.1/xalan/serializer/2.7.1/4b4b18df434451249bb65a63f2fb69e215a6a020/xml-apis.jar": no such file or directory
/home/dominicc/git-dev/brjs/brjs-core/src/test/java/org/bladerunnerjs/model/NodeTesterFactory.java:3: error: cannot access BRJSNode
import org.bladerunnerjs.model.BRJSNode;
                          ^
  bad class file: /home/dominicc/git-dev/brjs/brjs-core/build/classes/main/org/bladerunnerjs/model/BRJSNode.class
    default method found in version 51.0 classfile
    Please remove or make sure it appears in the correct subdirectory of the classpath.
:brjs-core:compileTestJava FAILED
:brjs-core:processTestResources
:cutlass-common:processResources
:bladerunner-common-servlets:processResources UP-TO-DATE
:bladerunner-common-servlets:processTestResources
:brjs-logger-binding:compileJava
:brjs-logger-binding:processResources UP-TO-DATE
:brjs-logger-binding:classes
:brjs-logger-binding:jar
:bundlers:processResources
:bladerunner-dev-servlets:processResources UP-TO-DATE
:bladerunner-dev-servlets:processTestResources
:bladerunner-prod-servlets:processResources UP-TO-DATE
:bladerunner-prod-servlets:processTestResources
:brjs-logger:compileTestJava UP-TO-DATE
:brjs-logger:processTestResources UP-TO-DATE
:brjs-logger:testClasses UP-TO-DATE
:brjs-logger:test UP-TO-DATE
:brjs-logger-binding:compileTestJava UP-TO-DATE
:brjs-logger-binding:processTestResources UP-TO-DATE
:brjs-logger-binding:testClasses UP-TO-DATE
:brjs-logger-binding:test UP-TO-DATE
:cutlass-tasks:processResources UP-TO-DATE
:brjs-runner:processResources UP-TO-DATE
:brjs-runner:processTestResources
:bundlers:processTestResources
:cutlass-common:processTestResources
:cutlass-tasks:processTestResources
:js-test-driver-bundler-plugin:processResources UP-TO-DATE
:js-test-driver-bundler-plugin:processTestResources
:old-bladerunner-tests:compileJava UP-TO-DATE
:old-bladerunner-tests:processResources UP-TO-DATE
:old-bladerunner-tests:classes UP-TO-DATE
:old-bladerunner-tests:processTestResources
:system-app-servlets:processResources
:system-app-servlets:processTestResources

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':brjs-core:compileTestJava'.
> Compilation failed with exit code 1; see the compiler error output for details.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':brjs-core:compileTestJava'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed with exit code 1; see the compiler error output for details.
    at org.gradle.api.internal.tasks.compile.CommandLineJavaCompiler.executeCompiler(CommandLineJavaCompiler.java:68)
    at org.gradle.api.internal.tasks.compile.CommandLineJavaCompiler.execute(CommandLineJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.CommandLineJavaCompiler.execute(CommandLineJavaCompiler.java:34)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:96)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:49)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:35)
    at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)
    at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)
    at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)
    at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:24)
    at org.gradle.api.tasks.compile.Compile.compile(Compile.java:67)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 66 more


BUILD FAILED

Total time: 19.654 secs

Any help or pointers for further investigation would be much appreciated.

@dchambers
Copy link
Author

I noticed earlier today when trying to switch from Java 8 to Java 7 in Eclipse that it got in a weird state, where it started moaning about default methods in anonymous Comparator implementations, and I wondered if this was related to the problem I'm having here.

So I created an empty project with just one test containing a lambda and 'retrolambda' was able to convert it to Java 7, but the moment I tried to implement Comparator, whether using lambdas or not, it caused the exact problem I've been seeing. I tried creating an abstract class called BaseComparator that provides concrete implementations for all the new default methods in the Compatator interface except compareTo() itself, thinking this would solve the problem, but it didn't. So it looks like the only way to use 'retrolambda' is to avoid implementing any interface with default methods, full stop.

This is very limiting, and in our case means we would have to write our own bubble sort implementation, so we could avoid the Comparator interface completely.

@luontola
Copy link
Owner

I found the cause (JDK 8 generates bridge methods to interfaces when overriding a method to refine its return type) and released Retrolambda 1.1.4 which includes a fix for it. Please try it to see if it helps (and whether there are still other issues).

I couldn't figure out how to make Gradle use the new Retrolambda version, so I could not test it on your project, but that's probably just because I don't know Gradle.

@dchambers
Copy link
Author

Excellent work!

I too was also unable to get the Gradle plug-in to use the latest version of retrolambda, so have raised an issue (evant/gradle-retrolambda#20) to help improve the documentation in this area. Will let you know how this fix works out for me once I'm able to test it.

@dchambers
Copy link
Author

It sounds like you've already seen this for yourself, but our complete build is now passing. Thanks so much for the rapid turn around on this.

@luontola luontola added enhancement and removed bug labels Mar 31, 2014
Arneball added a commit to Arneball/retrolambda that referenced this issue Aug 11, 2014
public interface MyInterface {
    default String def() {
        return "[" + toString() + ", " + "def]";
    }

    default String join(MyInterface other) {
        return def() + other.def();
    }
}

class C implements MyInterface{}  compiles to:

public class testpackage.MyClass implements testpackage.MyInterface {
  public testpackage.MyClass();
    Code:
       0: aload_0
       1: invokespecial luontola#16                 // Method java/lang/Object."<init>":()V
       4: return

  public java.lang.String join(testpackage.MyInterface);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  luontola#46                 // Method testpackage/MyInterfacehelper.join:(Ltestpackage/MyInterface;Ltestpackage/MyInterface;)Ljava/lang/String;
       5: areturn

  public java.lang.String def();
    Code:
       0: aload_0
       1: invokestatic  luontola#49                 // Method testpackage/MyInterfacehelper.def:(Ltestpackage/MyInterface;)Ljava/lang/String;
       4: areturn
}

Where testpackage.MyInterfacehelper is compiled to
public class testpackage.MyInterfacehelper {
  private testpackage.MyInterfacehelper();
    Code:
       0: aload_0
       1: invokespecial luontola#9                  // Method java/lang/Object."<init>":()V
       4: return

  public static java.lang.String def(testpackage.MyInterface);
    Code:
       0: new           luontola#13                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial luontola#14                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           luontola#16                 // String [
       9: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: invokevirtual luontola#24                 // Method java/lang/Object.toString:()Ljava/lang/String;
      16: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           luontola#26                 // String ,
      21: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: ldc           luontola#28                 // String def]
      26: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      29: invokevirtual luontola#29                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      32: areturn

  public static java.lang.String join(testpackage.MyInterface, testpackage.MyInterface);
    Code:
       0: new           luontola#13                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial luontola#14                 // Method java/lang/StringBuilder."<init>":()V
       7: aload_0
       8: invokeinterface luontola#35,  1           // InterfaceMethod testpackage/MyInterface.def:()Ljava/lang/String;
      13: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      16: aload_1
      17: invokeinterface luontola#35,  1           // InterfaceMethod testpackage/MyInterface.def:()Ljava/lang/String;
      22: invokevirtual luontola#20                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      25: invokevirtual luontola#29                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      28: areturn
}

==============
interface StaticTest {
    static <T> T staticMethod(T t) {
        return t;
    }
}
compiles to
public class testpackage.StaticTesthelper {
  private testpackage.StaticTesthelper();
    Code:
       0: aload_0
       1: invokespecial luontola#9                  // Method java/lang/Object."<init>":()V
       4: return

  public static <T> T staticMethod$static(T);
    Code:
       0: aload_0
       1: areturn
}

========

Brigde methods are generated properly in example:
public interface BridgeParent<T> {
    T get();
}
public interface StringBridges extends BridgeParent<String> {
    @OverRide
    default String get() {
        return "default method";
    }

    default String concrete() {
        return "concrete";
    }
}
public class testpackage.StringBridgeshelper
  SourceFile: "testpackage/StringBridges.java"
  minor version: 0
  major version: 50
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   luontola#1 = Utf8               testpackage/StringBridgeshelper
   luontola#2 = Class              luontola#1             //  testpackage/StringBridgeshelper
   luontola#3 = Utf8               java/lang/Object
   luontola#4 = Class              luontola#3             //  java/lang/Object
   luontola#5 = Utf8               testpackage/StringBridges.java
   luontola#6 = Utf8               <init>
   luontola#7 = Utf8               ()V
   luontola#8 = NameAndType        luontola#6:luontola#7          //  "<init>":()V
   luontola#9 = Methodref          luontola#4.luontola#8          //  java/lang/Object."<init>":()V
  luontola#10 = Utf8               get
  luontola#11 = Utf8               (Ltestpackage/StringBridges;)Ljava/lang/String;
  luontola#12 = Utf8               default method
  luontola#13 = String             luontola#12            //  default method
  luontola#14 = Utf8               concrete
  luontola#15 = String             luontola#14            //  concrete
  luontola#16 = Utf8               (Ltestpackage/StringBridges;)Ljava/lang/Object;
  luontola#17 = Utf8               testpackage/StringBridges
  luontola#18 = Class              luontola#17            //  testpackage/StringBridges
  luontola#19 = Utf8               ()Ljava/lang/String;
  luontola#20 = NameAndType        luontola#10:luontola#19        //  get:()Ljava/lang/String;
  luontola#21 = InterfaceMethodref luontola#18.luontola#20        //  testpackage/StringBridges.get:()Ljava/lang/String;
  luontola#22 = Utf8               Code
  luontola#23 = Utf8               LineNumberTable
  luontola#24 = Utf8               SourceFile
{
  private testpackage.StringBridgeshelper();
    descriptor: ()V
    flags: ACC_PRIVATE
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial luontola#9                  // Method java/lang/Object."<init>":()V
         4: return

  public static java.lang.String get(testpackage.StringBridges);
    descriptor: (Ltestpackage/StringBridges;)Ljava/lang/String;
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           luontola#13                 // String default method
         2: areturn
      LineNumberTable:
        line 9: 0

  public static java.lang.String concrete(testpackage.StringBridges);
    descriptor: (Ltestpackage/StringBridges;)Ljava/lang/String;
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=1, args_size=1
         0: ldc           luontola#15                 // String concrete
         2: areturn
      LineNumberTable:
        line 13: 0

  public static java.lang.Object get(testpackage.StringBridges);
    descriptor: (Ltestpackage/StringBridges;)Ljava/lang/Object;
    flags: ACC_PUBLIC, ACC_STATIC, ACC_BRIDGE, ACC_SYNTHETIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokeinterface luontola#21,  1           // InterfaceMethod testpackage/StringBridges.get:()Ljava/lang/String;
         6: areturn
      LineNumberTable:
        line 6: 0
}
@zubairahmad2
Copy link

i have an error please help me
Error:(26, 39) error: lambda expressions are not supported in -source 1.7
(use -source 8 or higher to enable lambda expressions)

@dchambers
Copy link
Author

@zzubiplain, this doesn't sound like a retrolambda issue. It sounds like you are trying to compile code containing lambdas with JDK 7, whereas you need to compile with JDK 8. Once compiled however, you can then use retrolambda to convert the bytecode so that it can be run on JRE 7, provided that you didn't make use of any other Java 8 features apart from lambdas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants