You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Keegan Witt (Jira)" <ji...@apache.org> on 2021/02/01 02:32:00 UTC
[jira] [Comment Edited] (GROOVY-9801) Stub generator omits default
interface methods
[ https://issues.apache.org/jira/browse/GROOVY-9801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276029#comment-17276029 ]
Keegan Witt edited comment on GROOVY-9801 at 2/1/21, 2:31 AM:
--------------------------------------------------------------
Interface default methods are currently implemented with traits. I think there's probably not any benefit to adding {{default}} to the stubs until we change how it's implemented in the bytecode, since the Java class won't be able to invoke the default method.
was (Author: keegan):
Interfaces are currently implemented with traits. I think there's probably not any benefit to adding {{default}} to the stubs until we change how it's implemented in the bytecode, since the Java class won't be able to invoke the default method.
> Stub generator omits default interface methods
> ----------------------------------------------
>
> Key: GROOVY-9801
> URL: https://issues.apache.org/jira/browse/GROOVY-9801
> Project: Groovy
> Issue Type: Bug
> Components: Stub generator / Joint compiler
> Affects Versions: 3.0.6
> Reporter: Christopher Smith
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> When presented with a Groovy interface that has a default method (shiny and new!) the stub generator omits the "default" part, leading to compilation failures in Java classes due to unimplemented abstract methods.
> {code:groovy}
> interface HasDefaultMethod {
> default void method() { }
> }
> {code}
> {code:java}
> import java.lang.*;
> import java.util.*;
> import java.io.*;
> import java.net.*;
> import groovy.lang.*;
> import groovy.util.*;
> @groovy.transform.Trait() public interface HasDefaultMethod
> {
> ;
> void method();
> }
> {code}
> (The stray semicolon is also odd but doesn't appear to be pathological.)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)