Giter VIP home page Giter VIP logo

Comments (2)

elucash avatar elucash commented on May 26, 2024

Having investigated that I've found that this class is a synthetic access-bridge class. Private fields of builder object accessed in immutable class constructor, this somehow require this unwanted class to be generated
Curiously, but Eclipse compiler do not require such class, probably static accessor methods are enough for ECJ.

My current idea is to leave this as is for a while, but we could revise how code is generated in that place.
Long ago there we no builder object passing to immutable class constructor, constructors with high count of parameters was used where all attributes was passed separately, so builder just need to access private constructor of enclosing class (via simple synthetic static method) -- this will probably wont require additional class by Javac

JFYI at that time we fought checkstyle rules where high arity method and constructors were not allowed, don't know
if it is important now since we moved to annotation processing, so generated-sources could be made skipped if check-style is used.

Happy new year!

from immutables.

elucash avatar elucash commented on May 26, 2024
  • Immutable constructor accesses private fields of Builder
  • Builder access private constructor of Immutable

ECJ creates package-private static synthetic methods to compile this
Javac might generate whole synthetic class to bridge this

Either we relax access restriction and expose package-private methods/constructor in generated code.
Or we will live with whatever compiler generates in hope that runtime inlines everything it can.

Currently I do not want to expose package-private methods. Closing as won't fix, but we could return to this later.

from immutables.

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.