6951833: latest diamond implementation generates spurious raw type warnings

Wed, 19 May 2010 16:43:30 +0100

author
mcimadamore
date
Wed, 19 May 2010 16:43:30 +0100
changeset 564
1d587ef8bf56
parent 563
eb849389ae2c
child 565
e9d66d392a8d

6951833: latest diamond implementation generates spurious raw type warnings
Summary: Raw warning checks should be disabled in the presence of a diamond AST node
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/T6951833.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed May 19 16:43:06 2010 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed May 19 16:43:30 2010 +0100
     1.3 @@ -886,6 +886,7 @@
     1.4      void checkRaw(JCTree tree, Env<AttrContext> env) {
     1.5          if (lint.isEnabled(Lint.LintCategory.RAW) &&
     1.6              tree.type.tag == CLASS &&
     1.7 +            !TreeInfo.isDiamond(tree) &&
     1.8              !env.enclClass.name.isEmpty() &&  //anonymous or intersection
     1.9              tree.type.isRaw()) {
    1.10              log.warning(tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/generics/diamond/T6951833.java	Wed May 19 16:43:30 2010 +0100
     2.3 @@ -0,0 +1,36 @@
     2.4 +/*
     2.5 + * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.
    2.11 + *
    2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 + * version 2 for more details (a copy is included in the LICENSE file that
    2.16 + * accompanied this code).
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License version
    2.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 + *
    2.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    2.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    2.24 + * have any questions.
    2.25 + */
    2.26 +
    2.27 +/*
    2.28 + * @test
    2.29 + * @bug 6951833
    2.30 + *
    2.31 + * @summary  latest diamond implementation generates spurious raw type warnings
    2.32 + * @author mcimadamore
    2.33 + * @compile -Xlint:rawtypes -Werror T6951833.java
    2.34 + *
    2.35 + */
    2.36 +
    2.37 +class T6951833<X> {
    2.38 +   T6951833<String> bug = new T6951833<>();
    2.39 +}

mercurial