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

Support for interfaces with default methods #38

Open
rolve opened this issue Mar 9, 2016 · 1 comment
Open

Support for interfaces with default methods #38

rolve opened this issue Mar 9, 2016 · 1 comment

Comments

@rolve
Copy link

rolve commented Mar 9, 2016

I think Java 8 default methods would be a great way to convert or enrich parsed arguments. For example, I tried the following to convert a String to a Path:

public interface Args {
    @Option(shortName = "d")
    String directory();

    default Path directoryPath() {
        return FileSystems.getDefault().getPath(directory());
    }
}

Unfortunately, jewelcli does not seem to support default methods. When calling directoryPath(), I get null.

Without having looked at the code, I feel like this should be easy to implement. All that needs to be done it to not override/implement default methods in proxies.

@lexicalscope
Copy link
Owner

Interesting idea. At the moment we don't have any java8 support. I will
take a closer look at what is going on in your example.
On 9 Mar 2016 14:08, "Michael Faes" [email protected] wrote:

I think Java 8 default methods would be a great way to convert or enrich
parsed arguments. For example, I tried the following to convert a String to
a Path:

public interface Args {
@option(shortName = "d")
String directory();

default Path directoryPath() {
    return FileSystems.getDefault().getPath(directory());
}

}

Unfortunately, jewelcli does not seem to support default methods. When
calling directoryPath(), I get null.


Reply to this email directly or view it on GitHub
#38.

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

2 participants