Class StatementsBeforeSuperPreviewNotes

java.lang.Object
net.jrodolfo.java_evolution.java22.statements_before_super.StatementsBeforeSuperPreviewNotes

public class StatementsBeforeSuperPreviewNotes extends Object
Explains statements before super(...) as a Java 22 preview feature.

Before this feature, an explicit super(...) or this(...) call had to be the first constructor statement. That made argument validation or preparation awkward when the superclass constructor needed already-checked values.

Java 22 previewed a more flexible constructor body while preserving the important safety rule: code before super(...) still cannot use the instance being constructed.

  • Constructor Details

    • StatementsBeforeSuperPreviewNotes

      public StatementsBeforeSuperPreviewNotes()
  • Method Details

    • oldRule

      public String oldRule()
      Explains the old constructor rule.
      Returns:
      a short explanation
    • problemSolved

      public String problemSolved()
      Explains the practical problem.
      Returns:
      a short explanation
    • safetyRule

      public String safetyRule()
      Names the key safety limitation.
      Returns:
      a short limitation
    • namingEvolution

      public String namingEvolution()
      Explains how the feature name evolved after the first preview.
      Returns:
      a short naming-history note
    • nextStep

      public String nextStep()
      Points learners to the final Java 25 example.
      Returns:
      a short next-step note
    • projectDecision

      public String projectDecision()
      Explains why this package uses notes.
      Returns:
      the project decision