【问题标题】:compileRetrolambdaRelease java finished with non-zero exit value 1compileRetrolambdaRelease java 以非零退出值 1 结束
【发布时间】:2016-08-25 12:46:21
【问题描述】:

错误:任务 compileRetrolambdaRelease 执行失败。

进程 'command'/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java'' 以非零退出值 1 结束

以下代码导致编译错误(上)

public class Main {
    public static class Parent {
        public Parent(IParent ia) {}

        public interface IParent {
            void onException(Throwable e);
        }
    }

    public class Child extends Parent {
        public Child() {
            super(e -> new ExceptionHandler());
        }
    }

    protected class ExceptionHandler {

    }
}

【问题讨论】:

    标签: java lambda


    【解决方案1】:

    那是因为 ExceptionHandler 类不是静态的。 在这种情况下,编译器应该在下面抛出异常,但它不会。是编译器的bug吗?

    在调用超类型构造函数之前无法引用super(e -> new ExceptionHandler()); this 以下代码导致编译器未正确描述但在上面抛出错误的编译错误

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-29
      • 1970-01-01
      • 2016-04-30
      相关资源
      最近更新 更多