GithubHelp home page GithubHelp logo

Comments (4)

nicktelford avatar nicktelford commented on May 28, 2024

This definitely sounds like a problem I'd like to resolve, however I'm having some trouble reproducing it.

Would you mind adding a test that demonstrates the issue, perferably to ScalaApplicationSpecIT, but if you can't stomach that mass of code, a standalone test would be fine too.

Ideally, it should fail, I imagine with a 'NullPointerException, or other reason that clearly demonstrates the default beingnull`.

FWIW, Scala's optional arguments will never work with Jersey, as it's completely unaware of them. The Jersey way to define defaults for an argument is to use the @DefaultValue(...) annotation on the argument. However, this is for customising a default argument for your code, and it definitely makes sense that Option should default to None, instead of null.

from dropwizard-scala.

nicktelford avatar nicktelford commented on May 28, 2024

Could you also confirm the version of both Scala and dropwizard-scala that you're using?

from dropwizard-scala.

zbelzer avatar zbelzer commented on May 28, 2024

Thanks for responding. I'm just trying to maintain the status quo while switching libraries here. Somehow defaults were supported before, so I'm curious as to whether or not I'm crazy or something bigger changed.

I have a PR with a couple tests, fwiw, but it sounds like this is working as expected per your comments above #7

from dropwizard-scala.

nicktelford avatar nicktelford commented on May 28, 2024

Yeah, so your tests pretty much confirm what I said above. I'm not sure how Scala's default arguments can ever have worked in Jersey, given the way they compile.

I'm afraid that, since this is the expected behaviour, there's nothing I can really do about it. Your best bet would be to use @DefaultValue(Some(...)) instead of Scala's default arguments. Not ideal, but then Jersey doesn't exactly integrate great with Scala anyway.

from dropwizard-scala.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.