A New Boilerplate Code Generation in Java

a year ago by cm0002 to c/learn_programming

JPlus is a modern programming language and compiler that acts as a superset of Java — bringing the benefits of null safety and powerful boilderplate code generation declarative features while remaining fully interoperable with existing Java code and libraries.

orclev 1 point a year ago

Well it's off to a great start in that a very casual review has already found a significant soundness issue. This transpiler adds a nullable type and implicitly makes all other types non-nullable. That's great but it also adds boilerplate generators for data classes and one of the options for that is to generate a no-arg constructor. I was curious how it handles the combination of those two features. The answer is that it doesn't. You can declare a class with non-nullable properties, and then auto-generate a no-arg constructor that sets those properties to null.

You can already do better than this with plain Java plus the Immutables builder library and the findbugs static analysis tools nonnull check. Intellij even has built in support to recognize the nonnull annotation and will do the analysis automatically.

path: 0 20417253, hotness: undefined, score: 1, children: 0
CaptainBlinky 1 point a year ago
path: 0 20418659, hotness: undefined, score: 1, children: 0
learn_programming
learn_programming

@programming.dev

login for more options
2260
161
46

Posting Etiquette

  1. Ask the main part of your question in the title. This should be concise but informative.

  2. Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.

  3. Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.

  4. Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

go to feed...