Coder Social home page Coder Social logo

Comments (11)

viktorklang avatar viktorklang commented on July 4, 2024

AFAIK this was already fixed in later versions of Typesafe Config, just exclude the Akka Typesafe Config dependency and add your own. Does that fix the issue?

from config.

viktorklang avatar viktorklang commented on July 4, 2024

Assuming that you're on Akka 2.0.4 (which is the latest release for 2.0)

from config.

slavaschmidt avatar slavaschmidt commented on July 4, 2024

Hi Viktor and thank you for the quick response. Yes i'm on 2.0.4. I can't exclude the dependency on Config as it is very useful and used by other components of the application as well.

For now i just changed the Manifest of the Config so that the class in question is exported as well, but i think it could be the issue for somebody else.

Thanks again

from config.

viktorklang avatar viktorklang commented on July 4, 2024

But why does OSGi need internal implementation details to be exported? That seems buggy to me.

from config.

havocp avatar havocp commented on July 4, 2024

Java serialization is just full of hacks. We use the writeReplace() mechanism to provide an internal object to be serialized rather than the original object. Normally, serialization doesn't care that the replacement object has a private class, but with OSGi the class loader actively blocks loading the private class I guess, so the Java deserializer can't load it to call readExternal().

Putting the internal class in the manifest does sound like the only solution, though I don't really understand OSGi in much detail. Hopefully there's a way to export just the one class and not the whole "impl" package.

from config.

slavaschmidt avatar slavaschmidt commented on July 4, 2024

Basically, all classes that are needed to construct (or clone or deserialize) an object must be available for the class loader. In OSGi some class is available if it's package is exported by some bundle (with respect to the version information). If some package declared private, it is available only for the declaring bundle.

I would say that if an application relies on the serialised form of something, than this serialised form should be considered to be a part of the API.

Yes, i think there is no need to export full package. I'd export the serialised form only. For example, by moving this class from the "impl" package. This will work but it will also create another issue with cyclic package dependencies :)

from config.

havocp avatar havocp commented on July 4, 2024

I'm not sure what the actual appropriate change in the typesafe config code is; I've never dealt with OSGi. I would like to keep this class "as private as possible" while still keeping OSGi working. I might need a patch or at least a description of the changes.

from config.

mpilquist avatar mpilquist commented on July 4, 2024

What about moving SerializedConfigValue to com.typesafe.config package but change its accessibility to default (from public)?

from config.

havocp avatar havocp commented on July 4, 2024

If default access would work that sounds fine, but renaming the class would break serialization back-compat, which could cause akka upgrade problems (I think? I know we've discussed it). In retrospect, a class name which appears in the serialization probably should not have had "impl" in it. Ugh.

from config.

havocp avatar havocp commented on July 4, 2024

Where I currently have OsgiKeys.exportPackage := Seq("com.typesafe.config") in the build, is there any huge downside to just adding the impl package to the export list? It means OSGi users can use the impl but non-OSGi users can cheat and do that too, and in both cases we just tell them they are wrong and they get both pieces when it breaks, right?

from config.

mpilquist avatar mpilquist commented on July 4, 2024

No huge downside - just what you already listed. The package has impl in its name so that's typically enough of a clue to users to stay away from it. This is probably the simplest solution that maintains full compatibility.

from config.

Related Issues (20)

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.