Merge

Mon, 02 Jun 2008 22:35:16 -0700

author
tbell
date
Mon, 02 Jun 2008 22:35:16 -0700
changeset 43
fc780e96a16a
parent 39
ff3d4fdf9c63
parent 42
f7e64b33d5a4
child 44
dec081837b01
child 48
c2abfb92ba69

Merge

     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Wed May 28 00:02:28 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Jun 02 22:35:16 2008 -0700
     1.3 @@ -301,7 +301,11 @@
     1.4                  : isSubtypeUnchecked(elemtype(t), elemtype(s), warn);
     1.5          } else if (isSubtype(t, s)) {
     1.6              return true;
     1.7 -        } else if (!s.isRaw()) {
     1.8 +        }
     1.9 +        else if (t.tag == TYPEVAR) {
    1.10 +            return isSubtypeUnchecked(t.getUpperBound(), s, warn);
    1.11 +        }
    1.12 +        else if (!s.isRaw()) {
    1.13              Type t2 = asSuper(t, s.tsym);
    1.14              if (t2 != null && t2.isRaw()) {
    1.15                  if (isReifiable(s))
     2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed May 28 00:02:28 2008 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jun 02 22:35:16 2008 -0700
     2.3 @@ -454,6 +454,8 @@
     2.4      void attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env) {
     2.5          for (JCTypeParameter tvar : typarams) {
     2.6              TypeVar a = (TypeVar)tvar.type;
     2.7 +            a.tsym.flags_field |= UNATTRIBUTED;
     2.8 +            a.bound = Type.noType;
     2.9              if (!tvar.bounds.isEmpty()) {
    2.10                  List<Type> bounds = List.of(attribType(tvar.bounds.head, env));
    2.11                  for (JCExpression bound : tvar.bounds.tail)
    2.12 @@ -464,13 +466,14 @@
    2.13                  // java.lang.Object.
    2.14                  types.setBounds(a, List.of(syms.objectType));
    2.15              }
    2.16 +            a.tsym.flags_field &= ~UNATTRIBUTED;
    2.17          }
    2.18 -    }
    2.19 -
    2.20 -    void attribBounds(List<JCTypeParameter> typarams, Env<AttrContext> env) {
    2.21          for (JCTypeParameter tvar : typarams)
    2.22              chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type);
    2.23          attribStats(typarams, env);
    2.24 +    }
    2.25 +
    2.26 +    void attribBounds(List<JCTypeParameter> typarams) {
    2.27          for (JCTypeParameter typaram : typarams) {
    2.28              Type bound = typaram.type.getUpperBound();
    2.29              if (bound != null && bound.tsym instanceof ClassSymbol) {
    2.30 @@ -581,7 +584,7 @@
    2.31          try {
    2.32              chk.checkDeprecatedAnnotation(tree.pos(), m);
    2.33  
    2.34 -            attribBounds(tree.typarams, env);
    2.35 +            attribBounds(tree.typarams);
    2.36  
    2.37              // If we override any other methods, check that we do so properly.
    2.38              // JLS ???
    2.39 @@ -2689,7 +2692,7 @@
    2.40          chk.validateAnnotations(tree.mods.annotations, c);
    2.41  
    2.42          // Validate type parameters, supertype and interfaces.
    2.43 -        attribBounds(tree.typarams, env);
    2.44 +        attribBounds(tree.typarams);
    2.45          chk.validateTypeParams(tree.typarams);
    2.46          chk.validate(tree.extending);
    2.47          chk.validate(tree.implementing);
     3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed May 28 00:02:28 2008 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jun 02 22:35:16 2008 -0700
     3.3 @@ -1486,6 +1486,8 @@
     3.4  
     3.5      private void checkNonCyclic1(DiagnosticPosition pos, Type t, Set<TypeVar> seen) {
     3.6          final TypeVar tv;
     3.7 +        if  (t.tag == TYPEVAR && (t.tsym.flags() & UNATTRIBUTED) != 0)
     3.8 +            return;
     3.9          if (seen.contains(t)) {
    3.10              tv = (TypeVar)t;
    3.11              tv.bound = new ErrorType();
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed May 28 00:02:28 2008 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Jun 02 22:35:16 2008 -0700
     4.3 @@ -228,7 +228,7 @@
     4.4                  // another symbol which is a member of `site'
     4.5                  // (because, if it is overridden, `sym' is not strictly
     4.6                  // speaking a member of `site'.)
     4.7 -                (sym.kind != MTH || sym.isConstructor() ||
     4.8 +                (sym.kind != MTH || sym.isConstructor() || sym.isStatic() ||
     4.9                   ((MethodSymbol)sym).implementation(site.tsym, types, true) == sym);
    4.10          default: // this case includes erroneous combinations as well
    4.11              return isAccessible(env, site);
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/tools/javac/generics/6677785/T6677785.java	Mon Jun 02 22:35:16 2008 -0700
     5.3 @@ -0,0 +1,35 @@
     5.4 +/*
     5.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.
    5.11 + *
    5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 + * version 2 for more details (a copy is included in the LICENSE file that
    5.16 + * accompanied this code).
    5.17 + *
    5.18 + * You should have received a copy of the GNU General Public License version
    5.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 + *
    5.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    5.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    5.24 + * have any questions.
    5.25 + */
    5.26 +
    5.27 +/*
    5.28 + * @test
    5.29 + * @bug     6677785
    5.30 + * @summary REGRESSION: StackOverFlowError with Cyclic Class level Type Parameters when used in constructors
    5.31 + * @author Maurizio Cimadamore
    5.32 + * @compile/fail/ref=T6677785.out -XDstdout -XDrawDiagnostics T6677785.java
    5.33 + */
    5.34 +public class T6677785<E extends T, T extends E> {
    5.35 +     T6677785() {}
    5.36 +     T6677785(E e) {}
    5.37 +     T6677785(E e, T t) {}
    5.38 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/tools/javac/generics/6677785/T6677785.out	Mon Jun 02 22:35:16 2008 -0700
     6.3 @@ -0,0 +1,2 @@
     6.4 +T6677785.java:31:23: compiler.err.cyclic.inheritance: E
     6.5 +1 error
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/tools/javac/generics/T6507024.java	Mon Jun 02 22:35:16 2008 -0700
     7.3 @@ -0,0 +1,37 @@
     7.4 +/*
     7.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    7.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    7.24 + * have any questions.
    7.25 + */
    7.26 +
    7.27 +/*
    7.28 + * @test
    7.29 + * @bug     6507024
    7.30 + * @summary unchecked conversion between arrays fails after capture conversion
    7.31 + * @author Maurizio Cimadamore
    7.32 + *
    7.33 + * @compile T6507024.java
    7.34 + */
    7.35 +
    7.36 +public class T6507024<T> {
    7.37 +    <Z> void m(T6507024<Z>[] results) {
    7.38 +        T6507024<Z>[] r = results.getClass().cast(null);
    7.39 +    }
    7.40 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/tools/javac/staticImport/6665223/T6665223.java	Mon Jun 02 22:35:16 2008 -0700
     8.3 @@ -0,0 +1,31 @@
     8.4 +/*
     8.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 + *
     8.8 + * This code is free software; you can redistribute it and/or modify it
     8.9 + * under the terms of the GNU General Public License version 2 only, as
    8.10 + * published by the Free Software Foundation.
    8.11 + *
    8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.15 + * version 2 for more details (a copy is included in the LICENSE file that
    8.16 + * accompanied this code).
    8.17 + *
    8.18 + * You should have received a copy of the GNU General Public License version
    8.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.21 + *
    8.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    8.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    8.24 + * have any questions.
    8.25 + */
    8.26 +
    8.27 +/*
    8.28 + * @test
    8.29 + * @bug 6665223
    8.30 + * @summary Static import of inherited protected method causes compiler exception
    8.31 + * @author Maurizio Cimadamore
    8.32 + *
    8.33 + * @compile pkg/A.java
    8.34 + */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/tools/javac/staticImport/6665223/pkg/A.java	Mon Jun 02 22:35:16 2008 -0700
     9.3 @@ -0,0 +1,31 @@
     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 +package pkg;
    9.27 +
    9.28 +import static pkg.B.b;
    9.29 +
    9.30 +class A {
    9.31 +    public static void main(String[] args) {
    9.32 +        b();
    9.33 +    }
    9.34 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/tools/javac/staticImport/6665223/pkg/B.java	Mon Jun 02 22:35:16 2008 -0700
    10.3 @@ -0,0 +1,29 @@
    10.4 +/*
    10.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 + *
    10.8 + * This code is free software; you can redistribute it and/or modify it
    10.9 + * under the terms of the GNU General Public License version 2 only, as
   10.10 + * published by the Free Software Foundation.
   10.11 + *
   10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.15 + * version 2 for more details (a copy is included in the LICENSE file that
   10.16 + * accompanied this code).
   10.17 + *
   10.18 + * You should have received a copy of the GNU General Public License version
   10.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.21 + *
   10.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   10.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   10.24 + * have any questions.
   10.25 + */
   10.26 +package pkg;
   10.27 +
   10.28 +class B extends B2 {}
   10.29 +
   10.30 +abstract class B2 {
   10.31 +    protected static void b() {}
   10.32 +}

mercurial