2013-02-22 14 views

回答

1

嗯,它看起來像常規編譯器的一個特點是喜歡在ClosureRunnable接口Callable之前避免Ambiguous method overloading call

請看一看討論http://jira.codehaus.org/browse/GROOVY-4311http://jira.codehaus.org/browse/GROOVY-3295

要獲取有關問題的一些觀點,你可以去看看類似的Java代碼將無法編譯:

class MyClosure implements Runnable, Callable<String> { 

    @Override public String call() throws Exception { 
     return "some value"; 
    } 

    @Override public void run() { 
    } 
} 

ExecutorService executorService = Executors.newSingleThreadExecutor(); 
executorService.submit(new MyClosure()); 
相關問題