Merge

Sun, 10 Aug 2008 18:36:19 -0700

author
tbell
date
Sun, 10 Aug 2008 18:36:19 -0700
changeset 97
eefde0421566
parent 91
7ec8d871eb8c
parent 96
938a80a47670
child 98
4026dece07e8

Merge

     1.1 --- a/src/share/classes/com/sun/tools/apt/util/Bark.java	Thu Aug 07 18:03:32 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/apt/util/Bark.java	Sun Aug 10 18:36:19 2008 -0700
     1.3 @@ -87,7 +87,7 @@
     1.4          context.put(barkKey, this);
     1.5  
     1.6          // register additional resource bundle for APT messages.
     1.7 -        Messages aptMessages = new Messages(Messages.getDefaultBundle());
     1.8 +        Messages aptMessages = Messages.instance(context);
     1.9          aptMessages.add("com.sun.tools.apt.resources.apt");
    1.10          aptDiags = new JCDiagnostic.Factory(aptMessages, "apt");
    1.11  
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Aug 07 18:03:32 2008 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Sun Aug 10 18:36:19 2008 -0700
     2.3 @@ -923,14 +923,7 @@
     2.4                  public Object call() {
     2.5                      JavaFileObject source = log.useSource(env.toplevel.sourcefile);
     2.6                      try {
     2.7 -                        // In order to catch self-references, we set
     2.8 -                        // the variable's declaration position to
     2.9 -                        // maximal possible value, effectively marking
    2.10 -                        // the variable as undefined.
    2.11 -                        int pos = VarSymbol.this.pos;
    2.12 -                        VarSymbol.this.pos = Position.MAXPOS;
    2.13                          Type itype = attr.attribExpr(initializer, env, type);
    2.14 -                        VarSymbol.this.pos = pos;
    2.15                          if (itype.constValue() != null)
    2.16                              return attr.coerce(itype, type).constValue();
    2.17                          else
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Aug 07 18:03:32 2008 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Sun Aug 10 18:36:19 2008 -0700
     3.3 @@ -305,6 +305,11 @@
     3.4          else if (t.tag == TYPEVAR) {
     3.5              return isSubtypeUnchecked(t.getUpperBound(), s, warn);
     3.6          }
     3.7 +        else if (s.tag == UNDETVAR) {
     3.8 +            UndetVar uv = (UndetVar)s;
     3.9 +            if (uv.inst != null)
    3.10 +                return isSubtypeUnchecked(t, uv.inst, warn);
    3.11 +        }
    3.12          else if (!s.isRaw()) {
    3.13              Type t2 = asSuper(t, s.tsym);
    3.14              if (t2 != null && t2.isRaw()) {
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 07 18:03:32 2008 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sun Aug 10 18:36:19 2008 -0700
     4.3 @@ -730,9 +730,8 @@
     4.4                      // In order to catch self-references, we set the variable's
     4.5                      // declaration position to maximal possible value, effectively
     4.6                      // marking the variable as undefined.
     4.7 -                    v.pos = Position.MAXPOS;
     4.8 +                    initEnv.info.enclVar = v;
     4.9                      attribExpr(tree.init, initEnv, v.type);
    4.10 -                    v.pos = tree.pos;
    4.11                  }
    4.12              }
    4.13              result = tree.type = v.type;
    4.14 @@ -2198,18 +2197,19 @@
    4.15              // This check applies only to class and instance
    4.16              // variables.  Local variables follow different scope rules,
    4.17              // and are subject to definite assignment checking.
    4.18 -            if (v.pos > tree.pos &&
    4.19 +            if ((env.info.enclVar == v || v.pos > tree.pos) &&
    4.20                  v.owner.kind == TYP &&
    4.21                  canOwnInitializer(env.info.scope.owner) &&
    4.22                  v.owner == env.info.scope.owner.enclClass() &&
    4.23                  ((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
    4.24                  (env.tree.getTag() != JCTree.ASSIGN ||
    4.25                   TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
    4.26 -
    4.27 +                String suffix = (env.info.enclVar == v) ?
    4.28 +                                "self.ref" : "forward.ref";
    4.29                  if (!onlyWarning || isStaticEnumField(v)) {
    4.30 -                    log.error(tree.pos(), "illegal.forward.ref");
    4.31 +                    log.error(tree.pos(), "illegal." + suffix);
    4.32                  } else if (useBeforeDeclarationWarning) {
    4.33 -                    log.warning(tree.pos(), "forward.ref", v);
    4.34 +                    log.warning(tree.pos(), suffix, v);
    4.35                  }
    4.36              }
    4.37  
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Thu Aug 07 18:03:32 2008 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Sun Aug 10 18:36:19 2008 -0700
     5.3 @@ -66,6 +66,11 @@
     5.4       */
     5.5      Lint lint;
     5.6  
     5.7 +    /** The variable whose initializer is being attributed
     5.8 +     * useful for detecting self-references in variable initializers
     5.9 +     */
    5.10 +    Symbol enclVar = null;
    5.11 +
    5.12      /** Duplicate this context, replacing scope field and copying all others.
    5.13       */
    5.14      AttrContext dup(Scope scope) {
    5.15 @@ -77,6 +82,7 @@
    5.16          info.varArgs = varArgs;
    5.17          info.tvars = tvars;
    5.18          info.lint = lint;
    5.19 +        info.enclVar = enclVar;
    5.20          return info;
    5.21      }
    5.22  
     6.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Aug 07 18:03:32 2008 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Sun Aug 10 18:36:19 2008 -0700
     6.3 @@ -627,8 +627,11 @@
     6.4          tree.sym = v;
     6.5          if (tree.init != null) {
     6.6              v.flags_field |= HASINIT;
     6.7 -            if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS)
     6.8 -                v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init);
     6.9 +            if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) {
    6.10 +                Env<AttrContext> initEnv = getInitEnv(tree, env);
    6.11 +                initEnv.info.enclVar = v;
    6.12 +                v.setLazyConstValue(initEnv(tree, initEnv), log, attr, tree.init);
    6.13 +            }
    6.14          }
    6.15          if (chk.checkUnique(tree.pos(), v, enclScope)) {
    6.16              chk.checkTransparentVar(tree.pos(), v, enclScope);
    6.17 @@ -828,6 +831,9 @@
    6.18              // Save class environment for later member enter (2) processing.
    6.19              halfcompleted.append(env);
    6.20  
    6.21 +            // Mark class as not yet attributed.
    6.22 +            c.flags_field |= UNATTRIBUTED;
    6.23 +
    6.24              // If this is a toplevel-class, make sure any preceding import
    6.25              // clauses have been seen.
    6.26              if (c.owner.kind == PCK) {
    6.27 @@ -835,9 +841,6 @@
    6.28                  todo.append(env);
    6.29              }
    6.30  
    6.31 -            // Mark class as not yet attributed.
    6.32 -            c.flags_field |= UNATTRIBUTED;
    6.33 -
    6.34              if (c.owner.kind == TYP)
    6.35                  c.owner.complete();
    6.36  
     7.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Aug 07 18:03:32 2008 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Sun Aug 10 18:36:19 2008 -0700
     7.3 @@ -27,6 +27,7 @@
     7.4  
     7.5  import java.io.*;
     7.6  import java.util.HashSet;
     7.7 +import java.util.LinkedHashSet;
     7.8  import java.util.LinkedHashMap;
     7.9  import java.util.Map;
    7.10  import java.util.MissingResourceException;
    7.11 @@ -1185,14 +1186,16 @@
    7.12           * are processed through attribute and flow before subtypes are translated.
    7.13           */
    7.14          class ScanNested extends TreeScanner {
    7.15 -            Set<Env<AttrContext>> dependencies = new HashSet<Env<AttrContext>>();
    7.16 +            Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
    7.17              public void visitClassDef(JCClassDecl node) {
    7.18                  Type st = types.supertype(node.sym.type);
    7.19                  if (st.tag == TypeTags.CLASS) {
    7.20                      ClassSymbol c = st.tsym.outermostClass();
    7.21                      Env<AttrContext> stEnv = enter.getEnv(c);
    7.22 -                    if (stEnv != null && env != stEnv)
    7.23 -                        dependencies.add(stEnv);
    7.24 +                    if (stEnv != null && env != stEnv) {
    7.25 +                        if (dependencies.add(stEnv))
    7.26 +                            scan(stEnv.tree);
    7.27 +                    }
    7.28                  }
    7.29                  super.visitClassDef(node);
    7.30              }
    7.31 @@ -1204,6 +1207,11 @@
    7.32                  flow(attribute(dep));
    7.33          }
    7.34  
    7.35 +        //We need to check for error another time as more classes might
    7.36 +        //have been attributed and analyzed at this stage
    7.37 +        if (errorCount() > 0)
    7.38 +            return;
    7.39 +
    7.40          if (verboseCompilePolicy)
    7.41              log.printLines(log.noticeWriter, "[desugar " + env.enclClass.sym + "]");
    7.42  
     8.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Aug 07 18:03:32 2008 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Sun Aug 10 18:36:19 2008 -0700
     8.3 @@ -200,6 +200,10 @@
     8.4      illegal forward reference
     8.5  compiler.warn.forward.ref=\
     8.6      reference to variable ''{0}'' before it has been initialized
     8.7 +compiler.err.illegal.self.ref=\
     8.8 +    self-reference in initializer
     8.9 +compiler.warn.self.ref=\
    8.10 +    self-reference in initializer of variable ''{0}''
    8.11  compiler.err.illegal.generic.type.for.instof=\
    8.12      illegal generic type for instanceof
    8.13  compiler.err.illegal.initializer.for.type=\
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/tools/javac/6734819/T6734819a.java	Sun Aug 10 18:36:19 2008 -0700
     9.3 @@ -0,0 +1,39 @@
     9.4 +/*
     9.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.
    9.11 + *
    9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 + * version 2 for more details (a copy is included in the LICENSE file that
    9.16 + * accompanied this code).
    9.17 + *
    9.18 + * You should have received a copy of the GNU General Public License version
    9.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 + *
    9.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    9.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    9.24 + * have any questions.
    9.25 + */
    9.26 +
    9.27 +/*
    9.28 + * @test
    9.29 + * @bug 6734819
    9.30 + * @summary Javac performs flows analysis on already translated classes
    9.31 + * @author Maurizio Cimadamore
    9.32 + *
    9.33 + * @compile/ref=T6734819a.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819a.java
    9.34 + */
    9.35 +class Y extends W {}
    9.36 +class W extends Z {}
    9.37 +
    9.38 +class Z {
    9.39 +    void m(Z z) {
    9.40 +        W w = (W)z;
    9.41 +    }
    9.42 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/tools/javac/6734819/T6734819a.out	Sun Aug 10 18:36:19 2008 -0700
    10.3 @@ -0,0 +1,12 @@
    10.4 +[attribute Y]
    10.5 +[flow Y]
    10.6 +[attribute W]
    10.7 +[flow W]
    10.8 +[attribute Z]
    10.9 +[flow Z]
   10.10 +[desugar Y]
   10.11 +[generate code Y]
   10.12 +[desugar W]
   10.13 +[generate code W]
   10.14 +[desugar Z]
   10.15 +[generate code Z]
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/tools/javac/6734819/T6734819b.java	Sun Aug 10 18:36:19 2008 -0700
    11.3 @@ -0,0 +1,35 @@
    11.4 +/*
    11.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.
   11.11 + *
   11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 + * version 2 for more details (a copy is included in the LICENSE file that
   11.16 + * accompanied this code).
   11.17 + *
   11.18 + * You should have received a copy of the GNU General Public License version
   11.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 + *
   11.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   11.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   11.24 + * have any questions.
   11.25 + */
   11.26 +
   11.27 +/*
   11.28 + * @test
   11.29 + * @bug 6734819
   11.30 + * @summary Javac performs flows analysis on already translated classes
   11.31 + * @author Maurizio Cimadamore
   11.32 + *
   11.33 + * @compile/ref=T6734819b.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819b.java
   11.34 + */
   11.35 +class A extends B {}
   11.36 +class B {
   11.37 +    class C extends B {}
   11.38 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/tools/javac/6734819/T6734819b.out	Sun Aug 10 18:36:19 2008 -0700
    12.3 @@ -0,0 +1,9 @@
    12.4 +[attribute A]
    12.5 +[flow A]
    12.6 +[attribute B]
    12.7 +[flow B]
    12.8 +[desugar A]
    12.9 +[generate code A]
   12.10 +[desugar B]
   12.11 +[generate code B]
   12.12 +[generate code B]
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/6734819/T6734819c.java	Sun Aug 10 18:36:19 2008 -0700
    13.3 @@ -0,0 +1,40 @@
    13.4 +/*
    13.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.
   13.11 + *
   13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 + * version 2 for more details (a copy is included in the LICENSE file that
   13.16 + * accompanied this code).
   13.17 + *
   13.18 + * You should have received a copy of the GNU General Public License version
   13.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 + *
   13.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   13.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   13.24 + * have any questions.
   13.25 + */
   13.26 +
   13.27 +/*
   13.28 + * @test
   13.29 + * @bug 6734819
   13.30 + * @summary Javac performs flows analysis on already translated classes
   13.31 + * @author Maurizio Cimadamore
   13.32 + *
   13.33 + * @compile/fail/ref=T6734819c.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819c.java
   13.34 + */
   13.35 +class Y extends W {}
   13.36 +class W extends Z {}
   13.37 +
   13.38 +class Z {
   13.39 +    void m(Z z) {
   13.40 +        return;
   13.41 +        W w = (W)z;
   13.42 +    }
   13.43 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/6734819/T6734819c.out	Sun Aug 10 18:36:19 2008 -0700
    14.3 @@ -0,0 +1,8 @@
    14.4 +[attribute Y]
    14.5 +[flow Y]
    14.6 +[attribute W]
    14.7 +[flow W]
    14.8 +[attribute Z]
    14.9 +[flow Z]
   14.10 +T6734819c.java:38:11: compiler.err.unreachable.stmt
   14.11 +1 error
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/javac/ForwardReference/T6676362a.java	Sun Aug 10 18:36:19 2008 -0700
    15.3 @@ -0,0 +1,36 @@
    15.4 +/*
    15.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   15.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   15.24 + * have any questions.
   15.25 + */
   15.26 +
   15.27 +/*
   15.28 + * @test
   15.29 + * @bug 6676362
   15.30 + * @summary Spurious forward reference error with final var + instance variable initializer
   15.31 + * @author Maurizio Cimadamore
   15.32 + *
   15.33 + * @compile T6676362a.java
   15.34 + */
   15.35 +
   15.36 +public class T6676362a {
   15.37 +    Object o = new Object() {Object m() {return o2;}};
   15.38 +    final Object o2 = o;
   15.39 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/tools/javac/ForwardReference/T6676362b.java	Sun Aug 10 18:36:19 2008 -0700
    16.3 @@ -0,0 +1,36 @@
    16.4 +/*
    16.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   16.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   16.24 + * have any questions.
   16.25 + */
   16.26 +
   16.27 +/*
   16.28 + * @test
   16.29 + * @bug 6676362
   16.30 + * @summary Spurious forward reference error with final var + instance variable initializer
   16.31 + * @author Maurizio Cimadamore
   16.32 + *
   16.33 + * @compile T6676362b.java
   16.34 + */
   16.35 +
   16.36 +public class T6676362b {
   16.37 +    static final int i1 = T6676362b.i2; //legal - usage is not via simple name
   16.38 +    static final int i2 = i1;
   16.39 +}
    17.1 --- a/test/tools/javac/enum/forwardRef/T6425594.out	Thu Aug 07 18:03:32 2008 -0700
    17.2 +++ b/test/tools/javac/enum/forwardRef/T6425594.out	Sun Aug 10 18:36:19 2008 -0700
    17.3 @@ -1,4 +1,4 @@
    17.4 -T6425594.java:10:28: compiler.warn.forward.ref: x
    17.5 +T6425594.java:10:28: compiler.warn.self.ref: x
    17.6  T6425594.java:11:26: compiler.err.illegal.forward.ref
    17.7  1 error
    17.8  1 warning
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/tools/javac/generics/inference/6718364/T6718364.java	Sun Aug 10 18:36:19 2008 -0700
    18.3 @@ -0,0 +1,38 @@
    18.4 +/*
    18.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 + *
    18.8 + * This code is free software; you can redistribute it and/or modify it
    18.9 + * under the terms of the GNU General Public License version 2 only, as
   18.10 + * published by the Free Software Foundation.
   18.11 + *
   18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 + * version 2 for more details (a copy is included in the LICENSE file that
   18.16 + * accompanied this code).
   18.17 + *
   18.18 + * You should have received a copy of the GNU General Public License version
   18.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 + *
   18.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   18.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   18.24 + * have any questions.
   18.25 + */
   18.26 +
   18.27 +/**
   18.28 + * @test
   18.29 + * @bug 6718364
   18.30 + * @summary inference fails when a generic method is invoked with raw arguments
   18.31 + * @compile/ref=T6718364.out -XDstdout -XDrawDiagnostics -Xlint:unchecked T6718364.java
   18.32 + */
   18.33 +class T6718364 {
   18.34 +    class X<T> {}
   18.35 +
   18.36 +    public <T> void m(X<T> x, T t) {}
   18.37 +
   18.38 +    public void test() {
   18.39 +        m(new X<X<Integer>>(), new X());
   18.40 +    }
   18.41 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/tools/javac/generics/inference/6718364/T6718364.out	Sun Aug 10 18:36:19 2008 -0700
    19.3 @@ -0,0 +1,3 @@
    19.4 +T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
    19.5 +T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: <T>m(T6718364.X<T>,T), T6718364, , T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X
    19.6 +2 warnings
    19.7 \ No newline at end of file
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/test/tools/javac/staticImport/6695838/T6695838.java	Sun Aug 10 18:36:19 2008 -0700
    20.3 @@ -0,0 +1,31 @@
    20.4 +/*
    20.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.
   20.11 + *
   20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.15 + * version 2 for more details (a copy is included in the LICENSE file that
   20.16 + * accompanied this code).
   20.17 + *
   20.18 + * You should have received a copy of the GNU General Public License version
   20.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.21 + *
   20.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   20.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   20.24 + * have any questions.
   20.25 + */
   20.26 +
   20.27 +/*
   20.28 + * @test
   20.29 + * @bug 6695838
   20.30 + * @summary javac does not detect cyclic inheritance involving static inner classes after import clause
   20.31 + * @author Maurizio Cimadamore
   20.32 + *
   20.33 + * @compile/fail a/FooInterface.java
   20.34 + */
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/tools/javac/staticImport/6695838/a/Foo.java	Sun Aug 10 18:36:19 2008 -0700
    21.3 @@ -0,0 +1,29 @@
    21.4 +/*
    21.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.
   21.11 + *
   21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 + * version 2 for more details (a copy is included in the LICENSE file that
   21.16 + * accompanied this code).
   21.17 + *
   21.18 + * You should have received a copy of the GNU General Public License version
   21.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 + *
   21.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   21.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   21.24 + * have any questions.
   21.25 + */
   21.26 +
   21.27 +package a;
   21.28 +
   21.29 +class Foo implements FooInterface {
   21.30 +    public static interface InnerInterface {}
   21.31 +}
   21.32 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/test/tools/javac/staticImport/6695838/a/FooInterface.java	Sun Aug 10 18:36:19 2008 -0700
    22.3 @@ -0,0 +1,29 @@
    22.4 +/*
    22.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 + *
    22.8 + * This code is free software; you can redistribute it and/or modify it
    22.9 + * under the terms of the GNU General Public License version 2 only, as
   22.10 + * published by the Free Software Foundation.
   22.11 + *
   22.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   22.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.15 + * version 2 for more details (a copy is included in the LICENSE file that
   22.16 + * accompanied this code).
   22.17 + *
   22.18 + * You should have received a copy of the GNU General Public License version
   22.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   22.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.21 + *
   22.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   22.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   22.24 + * have any questions.
   22.25 + */
   22.26 +
   22.27 +package a;
   22.28 +
   22.29 +import a.Foo.InnerInterface;
   22.30 +
   22.31 +public interface FooInterface extends Foo.InnerInterface {}
   22.32 +

mercurial