[11u] RFR: 8211450: UndetVar::dup is not copying the kind field to the duplicated instance

Hohensee, Paul hohensee at amazon.com
Wed Nov 18 13:46:43 UTC 2020


Lgtm. I've applied the patch and the included test passes. I'll sponsor.

Thanks,
Paul

On 11/18/20, 4:45 AM, "jdk-updates-dev on behalf of Filipe Roque" <jdk-updates-dev-retn at openjdk.java.net on behalf of filipe.roque at premium-minds.com> wrote:

    ping ?

    Thanks,
    Filipe Roque

    On Thu, 2020-10-15 at 15:17 +0000, Filipe Roque wrote:
    > Hi,
    >
    > I would like to backport this fix to 11u.
    >
    > Bug: https://bugs.openjdk.java.net/browse/JDK-8211450
    > Fix (Original): https://hg.openjdk.java.net/jdk/jdk/rev/52155b28cdb7
    >
    > I've verified the patch and would be glad if someone could sponsor
    > the
    > backport.
    >
    > The original patch itself doesn't apply cleanly, due to conflict with
    > copyright year in file
    > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
    >
    > I have edited the original patch to remove that conflict, which can
    > be
    > found below.
    >
    > For additional context, as my team is trying to move from Java 8 to
    > Java 11, we have encountered the bug
    > https://bugs.openjdk.java.net/browse/JDK-8232766. Although it is
    > marked
    > Unresolved, this bug has been fixed in JDK 12 and all later
    > versions.
    >
    > I have bisected the jdk sources to discovered which changeset fixed
    > the
    > commit and discovered it was the JDK-8211450.
    >
    > Thanks,
    > Filipe Roque
    >
    >
    >
    > # HG changeset patch
    > # User vromero
    > # Date 1541719432 18000
    > # Node ID 52155b28cdb7fc2a8c8a096c561c68be87fb8cc8
    > # Parent  4ad404da00887d427e9a3822fa8a7355fdac9832
    > 8211450: UndetVar::dup is not copying the kind field to the
    > duplicated
    > instance
    > Reviewed-by: mcimadamore
    >
    > diff -r 4ad404da0088 -r 52155b28cdb7
    > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
    > ---
    > a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
    >       Thu Nov 08 23:31:08 2018 +0100
    > +++
    > b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java
    >       Thu Nov 08 18:23:52 2018 -0500
    > @@ -2020,6 +2020,7 @@
    >              for (IncorporationAction action : incorporationActions)
    > {
    >                  uv2.incorporationActions.add(action.dup(uv2));
    >              }
    > +            uv2.kind = kind;
    >          }
    >
    >          @Override
    > diff -r 4ad404da0088 -r 52155b28cdb7
    > test/langtools/tools/javac/T8211450/ThrownTypeVarTest.java
    > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    > +++ b/test/langtools/tools/javac/T8211450/ThrownTypeVarTest.java
    > Thu Nov 08 18:23:52 2018 -0500
    > @@ -0,0 +1,49 @@
    > +/*
    > + * Copyright (c) 2018, Oracle and/or its affiliates. All rights
    > reserved.
    > + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    > + *
    > + * This code is free software; you can redistribute it and/or modify
    > it
    > + * under the terms of the GNU General Public License version 2 only,
    > as
    > + * published by the Free Software Foundation.
    > + *
    > + * This code is distributed in the hope that it will be useful, but
    > WITHOUT
    > + * ANY WARRANTY; without even the implied warranty of
    > MERCHANTABILITY
    > or
    > + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
    > License
    > + * version 2 for more details (a copy is included in the LICENSE
    > file
    > that
    > + * accompanied this code).
    > + *
    > + * You should have received a copy of the GNU General Public License
    > version
    > + * 2 along with this work; if not, write to the Free Software
    > Foundation,
    > + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    > + *
    > + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA
    > 94065
    > USA
    > + * or visit www.oracle.com if you need additional information or
    > have
    > any
    > + * questions.
    > + */
    > +
    > +/*
    > + * @test
    > + * @bug 8211450
    > + * @summary UndetVar::dup is not copying the kind field to the
    > duplicated instance
    > + * @compile ThrownTypeVarTest.java
    > + */
    > +
    > +import java.io.*;
    > +
    > +public class ThrownTypeVarTest {
    > +    void repro() throws IOException {
    > +        when(f(any()));
    > +    }
    > +
    > +    interface MyInt<T1, E1 extends Exception> {}
    > +
    > +    <T2, E2 extends Exception> T2 f(MyInt<T2, E2> g) throws
    > IOException, E2 {
    > +        return null;
    > +    }
    > +
    > +    static <T3> T3 any() {
    > +        return null;
    > +    }
    > +
    > +    static <T4> void when(T4 methodCall) {}
    > +}
    >



More information about the jdk-updates-dev mailing list