6763518: Impossible to suppress raw-type warnings

Tue, 28 Oct 2008 14:05:59 +0000

author
mcimadamore
date
Tue, 28 Oct 2008 14:05:59 +0000
changeset 165
4f7b344a1ce0
parent 164
5ebe90e0afff
child 166
32e309883246

6763518: Impossible to suppress raw-type warnings
Summary: Check.validate(Type) should be invoked after -Xlint is augmented in Attr.visitVarDef
Reviewed-by: darcy

src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
test/tools/javac/6304921/T6304921.out file | annotate | diff | comparison | revisions
test/tools/javac/warnings/T6763518.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Oct 27 14:25:59 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Oct 28 14:05:59 2008 +0000
     1.3 @@ -706,13 +706,13 @@
     1.4              }
     1.5          }
     1.6  
     1.7 -        // Check that the variable's declared type is well-formed.
     1.8 -        chk.validate(tree.vartype, env);
     1.9 -
    1.10          VarSymbol v = tree.sym;
    1.11          Lint lint = env.info.lint.augment(v.attributes_field, v.flags());
    1.12          Lint prevLint = chk.setLint(lint);
    1.13  
    1.14 +        // Check that the variable's declared type is well-formed.
    1.15 +        chk.validate(tree.vartype, env);
    1.16 +
    1.17          try {
    1.18              chk.checkDeprecatedAnnotation(tree.pos(), v);
    1.19  
     2.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Oct 27 14:25:59 2008 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Oct 28 14:05:59 2008 +0000
     2.3 @@ -774,7 +774,7 @@
     2.4      Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
     2.5  
     2.6  compiler.warn.raw.class.use=\
     2.7 -    [raw-type] found raw type: {0}\n\
     2.8 +    [rawtypes] found raw type: {0}\n\
     2.9      missing type parameters for generic class {1}
    2.10  
    2.11  #####
     3.1 --- a/test/tools/javac/6304921/T6304921.out	Mon Oct 27 14:25:59 2008 -0700
     3.2 +++ b/test/tools/javac/6304921/T6304921.out	Tue Oct 28 14:05:59 2008 +0000
     3.3 @@ -1,4 +1,4 @@
     3.4 -T6304921.java:671/671/680: warning: [raw-type] found raw type: java.util.ArrayList
     3.5 +T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList
     3.6  missing type parameters for generic class java.util.ArrayList<E>
     3.7          List<Integer> list = new ArrayList();
     3.8                                   ^
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/tools/javac/warnings/T6763518.java	Tue Oct 28 14:05:59 2008 +0000
     4.3 @@ -0,0 +1,41 @@
     4.4 +/*
     4.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.
    4.11 + *
    4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 + * version 2 for more details (a copy is included in the LICENSE file that
    4.16 + * accompanied this code).
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License version
    4.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 + *
    4.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    4.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    4.24 + * have any questions.
    4.25 + */
    4.26 +
    4.27 +/**
    4.28 + * @test
    4.29 + * @bug 6763518
    4.30 + * @summary Impossible to suppress raw-type warnings
    4.31 + * @compile -Werror -Xlint:rawtypes T6763518.java
    4.32 + */
    4.33 +
    4.34 +import java.util.List;
    4.35 +
    4.36 +class T6763518 {
    4.37 +    @SuppressWarnings("rawtypes")
    4.38 +    List l1;
    4.39 +
    4.40 +    void m(@SuppressWarnings("rawtypes") List l2) {
    4.41 +        @SuppressWarnings("rawtypes")
    4.42 +        List l3;
    4.43 +    };
    4.44 +}

mercurial