openclover / clover

This repository contains source code of OpenClover Core as well as its integrations: Clover-for-Ant, Clover-for-Eclipse and Clover-for-IDEA plugins. Sources are licensed under Apache 2.0 license.
Other
57 stars 14 forks source link

Support Java 16 compact canonical constructors for records #216

Closed marek-parfianowicz closed 8 months ago

marek-parfianowicz commented 8 months ago

When defining a record class, it's allowed to declare its constructor using a shorter syntax, without parameter list for a constructor.

Example from https://docs.oracle.com/javase/specs/jls/se17/html/jls-8.html#jls-8.10.4.2

record Rational(int num, int denom) { private static int gcd(int a, int b) { if (b == 0) return Math.abs(a); else return gcd(b, a % b); } ` Rational { int gcd = gcd(num, denom); num /= gcd; denom /= gcd; } }`