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

@caarlos0 caarlos0 commented Sep 10, 2014

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
Owner

@lviggiano lviggiano commented Sep 11, 2014

Thanks.

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

@caarlos0
Copy link
Author

@caarlos0 caarlos0 commented Sep 11, 2014

nice, thanks!

@lviggiano
Copy link
Owner

@lviggiano lviggiano commented Oct 15, 2014

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
Owner

@lviggiano lviggiano commented Oct 21, 2014

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

@caarlos0 caarlos0 commented Oct 21, 2014

NICE!

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

Cheers!

@velo
Copy link

@velo velo commented Oct 21, 2014

glorious!

@lviggiano
Copy link
Owner

@lviggiano lviggiano commented Oct 22, 2014

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

@lviggiano lviggiano added the resolved label Oct 23, 2014
@lviggiano lviggiano closed this Nov 18, 2014
@lviggiano
Copy link
Owner

@lviggiano lviggiano commented Nov 19, 2014

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.