right, the issue has been fixed,

thanks again for the report,
Vicente

On 2/12/20 11:18 PM, Manoj Palat wrote:
Sure. I see JDK-8238838  filed.
Thanks,
Manoj

    ----- Original message -----
    From: Vicente Romero <vicente.rom...@oracle.com>
    To: Tagir Valeev <amae...@gmail.com>, Manoj Palat
    <manoj.pa...@in.ibm.com>
    Cc: amber-spec-experts <amber-spec-experts@openjdk.java.net>
    Subject: [EXTERNAL] Re: [359] Record - Compact Constructor should
    not have throws clause
    Date: Tue, Feb 11, 2020 9:47 AM

    On the spec side I agree with Tagir. On the compiler error
    messages I will file an issue to check if we can generate a better
    error message,

    Thanks,
    Vicente
    On 2/10/20 10:23 PM, Tagir Valeev wrote:
    Hello!
    вт, 11 февр. 2020 г., 10:18 Manoj Palat <manoj.pa...@in.ibm.com
    <mailto:manoj.pa...@in.ibm.com>>:

        Hi,

        consider
        record R(){
                public R throws Exception {}
        }

        From JLS 14 Sec 8.10.4,
        A canonical constructor must not have a throws clause.

        Sec 8.10.5 says
        A compact constructor is a canonical constructor.

        By the above two, it can be inferred that a compact
        constructor must not have a throws clause. However, there is
        no explicit mention of this restriction in Sec 8.10.5 [1]

        I think it would good to add this explicitly in the next
        version of spec (assuming the above is true).

    This unambiguously follows from the compact constructor
    declaration production:

    /CompactConstructorDeclaration/:
        { /Annotation/ } { /ConstructorModifier/ } /SimpleTypeName/
        /ConstructorBody/

    No throws at all here. To me, this is enough and no changes are
    necessary.
    With best regards,
    Tagir Valeev.

        [1]
        
http://cr.openjdk.java.net/~gbierman/jep359/jep359-20200115/specs/records-jls.html#jls-8.10.5
        Regards,
        Manoj.

        Side Note:
        To compare, javac throws errors but not this particular error
        (may be due to error recovery)
        javac14 --enable-preview --release 14 X.java
        X.java:2: error: <identifier> expected
                public R throws Exception {}
                        ^
        X.java:2: error: field declaration must be static
                public R throws Exception {}
                         ^
          (consider replacing field with record component)
        X.java:2: error: invalid method declaration; return type required
                public R throws Exception {}



Reply via email to