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 interface methods in JDK8 are overriden #94

Closed
caarlos0 opened this issue Sep 10, 2014 · 8 comments
Closed

default interface methods in JDK8 are overriden #94

caarlos0 opened this issue Sep 10, 2014 · 8 comments

Comments

@caarlos0
Copy link

If I use an interface like this:

public interface AWSConfig extends Config {
  @Key("aws.bucketname")
  String bucketname();

  default Region region() {
    return Region.getRegion( Regions.fromName( regionName() ) );
  }
}

The region method is overridden by Owner, and always return null.

@lviggiano
Copy link
Collaborator

Thanks.

I'm going to address this and do a maintenance release asap.

@caarlos0
Copy link
Author

nice, thanks!

@lviggiano
Copy link
Collaborator

Did some research on how to call default methods, without compromising backward (jdk < 1.8) compatibility: http://rmannibucau.wordpress.com/2014/03/27/java-8-default-interface-methods-and-jdk-dynamic-proxies/

@lviggiano
Copy link
Collaborator

committed on master branch a new module called owner-java8. To compile it, you need JDK 8. To use it, you need to declare a maven dependency to it:

<dependencies>
        <dependency>
            <groupId>org.aeonbits.owner</groupId>
            <artifactId>owner-java8</artifactId>
            <version>1.0.6-SNAPSHOT</version>
        </dependency>
</dependencies>

owner-java8 has a transitive dependency to the artifact owner, so you don't need to specify both in your maven dependencies.

I'll release this asap. For now you can find the implementation on master branch. See Building from sources if you want to test this before the official release.

@caarlos0
Copy link
Author

NICE!

Please let us know when the new version is maven central!

Cheers!

@velo
Copy link

velo commented Oct 21, 2014

glorious!

@lviggiano
Copy link
Collaborator

I need to write some documentation on this, then I'll release a new minor release on maven central repo.

@lviggiano
Copy link
Collaborator

Sorry for the long delay, owner-1.0.6 is available with this fix/enhancement on maven central repository.

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

No branches or pull requests

3 participants