Changes in / [20:30]


Ignore:
Location:
/trunk/gj/src/gjc/v6
Files:
11 added
6 edited

Legend:

Unmodified
Added
Removed
  • /trunk/gj/src/gjc/v6/code/CompleteClassReader.java

    r20 r30  
    2525 
    2626    public CompleteClassReader(Hashtable<String,String> options) { 
    27         super(options, 
    28             // JavaParty: 
    29             false 
    30         ); 
     27        super(options); 
    3128    } 
    3229 
  • /trunk/gj/src/gjc/v6/code/Scope.java

    r20 r30  
    6060     *  given table. table's length must be an exponent of 2. 
    6161     */ 
    62     private Scope(Scope next, Symbol owner, Entry[] table) { 
     62    Scope(Scope next, Symbol owner, Entry[] table) { 
    6363        this.next = next; 
    6464        this.owner = owner; 
  • /trunk/gj/src/gjc/v6/code/Symbol.java

    r20 r30  
    121121    public Type externalType() { 
    122122        Type t = erasure(); 
    123         if (name == Names.init && owner.isNested()) { 
     123        if (name == Names.init && owner.hasOuterInstance()) { 
    124124            Type this0type = owner.type.outer().erasure(); 
    125125            return new MethodType( 
     
    176176     */ 
    177177    public boolean isNested() { 
    178         return type.outer().tag == CLASS && (flags() & INTERFACE) == 0; 
     178        return (flags_field & INTERFACE) == 0 && type.outer().tag == CLASS; 
     179    } 
     180 
     181    /** An inner class has an outer instance it is nested and NOTHIS0 is not set 
     182     */ 
     183    public boolean hasOuterInstance() { 
     184        return isNested() && (flags() & NOTHIS0) == 0; 
    179185    } 
    180186 
     
    216222    } 
    217223 
     224    public Scope members() { 
     225        return null; 
     226    } 
     227 
    218228    /** A class for type symbols. Type variables are represented by instances 
    219229     *  of this class, classes and packages by instances of subclasses. 
     
    227237        public String toString() { 
    228238            return "type variable " + name; 
    229         } 
    230  
    231         public Scope members() { 
    232             return null; 
    233239        } 
    234240 
     
    418424                return true; 
    419425            } else if ((base.flags() & INTERFACE) != 0) { 
    420                 for (List<Type> is = type.interfaces(); 
    421                      is.nonEmpty(); 
    422                      is = is.tail) 
    423                     if (is.head.tsym.subclass(base)) return true; 
    424                 return false; 
     426                for (Type t = type; t.tag == CLASS; t = t.supertype()) 
     427                    for (List<Type> is = t.interfaces(); 
     428                         is.nonEmpty(); 
     429                         is = is.tail) 
     430                        if (is.head.tsym.subclass(base)) return true; 
    425431            } else { 
    426                 Type t = type.supertype(); 
    427                 while (t.tag == CLASS && t.tsym != base) t = t.supertype(); 
    428                 return t.tag == CLASS; 
     432                for (Type t = type; t.tag == CLASS; t = t.supertype()) 
     433                    if (t.tsym == base) return true; 
    429434            } 
     435            return false; 
    430436        } 
    431437 
     
    587593                     e.scope != null; 
    588594                     e = e.next()) { 
    589                     if (overrides(e.sym, origin)) 
    590 //                      && e.sym.flags() & SYNTHETIC) == 0) 
    591                         return (MethodSymbol)e.sym; 
     595                    if (e.sym.kind == MTH) { 
     596                        MethodSymbol m = (MethodSymbol) e.sym; 
     597                        if (m.overrides(this, origin) && 
     598                            (m.flags() & SYNTHETIC) == 0) return m; 
     599                    } 
    592600                } 
    593601            } 
  • /trunk/gj/src/gjc/v6/code/Type.java

    r20 r30  
    5454        return t; 
    5555    } 
     56 
     57    /** If this is a constant type, return its underlying type. 
     58     *  Otherwise, return the type itself. 
     59     */ 
     60    public Type baseType() { 
     61        if (constValue == null) return this; 
     62        else return tsym.type; 
     63    } 
    5664          
     65    /** Return the base types of a list of types. 
     66     */ 
     67    public static List<Type> baseTypes(List<Type> types) { 
     68        if (types.nonEmpty()) { 
     69            Type t = types.head.baseType(); 
     70            List<Type> ts = baseTypes(types.tail); 
     71            if (t != types.head || ts != types.tail) 
     72                return new List<Type>(t, ts); 
     73        } 
     74        return types; 
     75    } 
     76 
    5777   /** convert to string 
    5878     */ 
     
    320340            return this.bound().castableTo(that); 
    321341        case ALL: 
    322             return true; 
     342            return this.subType(that); 
    323343        default: 
    324344            throw new InternalError(); 
    325345        } 
     346    } 
     347 
     348    /** Return the member class of this type with given name,  
     349     *  or null if none exists. 
     350     */ 
     351    public TypeSymbol memberClass(Name name) {  
     352        return null; 
    326353    } 
    327354 
     
    395422    public static final Type errType = new ErrorType(null); 
    396423 
    397     static void initType(Type type, String name) { 
    398         ClassSymbol c = new ClassSymbol( 
    399             PUBLIC, Name.fromString(name), type, Symbol.emptyPackage); 
     424    static void initType(Type type, ClassSymbol c) { 
    400425        type.tsym = c; 
    401426        typeOfTag[type.tag] = type; 
     427    } 
     428 
     429    static void initType(Type type, String name) { 
     430        initType( 
     431            type,  
     432            new ClassSymbol( 
     433                PUBLIC, Name.fromString(name), type, Symbol.emptyPackage)); 
    402434    } 
    403435 
     
    417449        initType(booleanType, "boolean", "Boolean"); 
    418450        initType(voidType, "void", "Void"); 
    419         initType(allType, "<null>"); 
    420         errType.tsym = Symbol.errSymbol; 
     451        initType(allType, "*"); 
     452        initType(errType, Symbol.errSymbol); 
    421453    } 
    422454 
     
    435467        public List<Type> typarams_field; 
    436468 
     469        /** A cache variable for the type parameters of this type, 
     470         *  appended to all parameters of its enclosing class. 
     471         */ 
     472        public List<Type> allparams_field; 
     473 
    437474        /** The supertype of this class (to be set once class is loaded) 
    438475         */ 
     
    447484            this.outer_field = outer; 
    448485            this.typarams_field = typarams; 
     486            this.allparams_field = null; 
    449487            this.supertype_field = null; 
    450488            this.interfaces_field = null; 
     
    457495        } 
    458496 
     497        public Type baseType() { 
     498            if (constValue == null) return this; 
     499            else return tsym.type; 
     500        } 
     501 
    459502        public String toString() { 
    460503            StringBuffer buf = new StringBuffer(); 
    461             if (outer().tag == CLASS) { 
     504            if (outer().tag != NONE) { 
    462505                buf.append(outer().toString()); 
    463506                buf.append("."); 
     
    513556                } else if (this == tsym.type) { 
    514557                    supertype_field = st; 
    515                 } else if (typarams_field.isEmpty()) { 
    516                     // in this case, `this' is an erasure of a parameterized type 
    517                     supertype_field = st.erasure(); 
    518558                } else { 
    519                     supertype_field = 
    520                         st.subst(tsym.type.typarams(), typarams_field); 
     559                    List<Type> ownparams = allParams(); 
     560                    List<Type> symparams = tsym.type.allParams(); 
     561                    if (ownparams.isEmpty()) supertype_field = st.erasure(); 
     562                    else supertype_field = st.subst(symparams, ownparams); 
    521563                } 
    522564            } 
     
    532574                } else if (this == tsym.type) { 
    533575                    interfaces_field = is; 
    534                 } else if (typarams_field.isEmpty()) { 
    535                     // in this case, `this' is an erasure of a parameterized type 
    536                     interfaces_field = erasure(is); 
    537576                } else { 
    538                     interfaces_field = 
    539                         subst(is, tsym.type.typarams(), typarams_field); 
     577                    List<Type> ownparams = allParams(); 
     578                    List<Type> symparams = tsym.type.allParams(); 
     579                    if (ownparams.isEmpty()) interfaces_field = erasure(is); 
     580                    else interfaces_field = subst(is, symparams, ownparams); 
    540581                } 
    541582            } 
     
    544585 
    545586        public List<Type> allParams() { 
    546             return typarams().prepend(outer().typarams()); 
     587            if (allparams_field == null) { 
     588                allparams_field = typarams().prepend(outer().allParams()); 
     589            } 
     590            return allparams_field; 
    547591        } 
    548592 
     
    567611 
    568612        public Type asOuterSuper(Symbol sym) { 
    569             Type s = this.asSuper(sym); 
    570             Type t = this.outer(); 
    571             while (s == null && t.tag == CLASS) { 
    572                 s = t.asSuper(sym); 
     613            Type t = this; 
     614            do { 
     615                Type s = t.asSuper(sym); 
     616                if (s != null) return s; 
    573617                t = t.outer(); 
    574             } 
    575             return s; 
     618            } while (t.tag == CLASS); 
     619            return null; 
    576620        } 
    577621 
     
    592636 
    593637        public Type memberType(Symbol sym) { 
     638//          System.out.print(this + ".memberType " + sym + " = ");//DEBUG 
    594639            Symbol owner = sym.owner; 
    595             if ((sym.flags() & STATIC) == 0 && owner.type.isParameterized()) { 
    596                 Type base = this.asSuper(owner); 
     640            int flags = sym.flags(); 
     641            if (((flags & STATIC) == 0 || (flags & INTERFACE) != 0) && 
     642                owner.type.isParameterized()) { 
     643                Type base = this.asOuterSuper(owner); 
    597644                if (base != null) { 
     645//                  System.out.print("[base = " + base + "]");//DEBUG 
    598646                    List<Type> ownerParams = owner.type.allParams(); 
    599647                    List<Type> baseParams = base.allParams(); 
     
    601649                        if (baseParams.isEmpty()) { 
    602650                            // then base is a raw type 
     651//                          System.out.println(sym.type.erasure());//DEBUG 
    603652                            return sym.type.erasure(); 
    604653                        } else { 
     654//                          System.out.println(sym.type.subst(ownerParams, baseParams));//DEBUG 
     655                            while (ownerParams.length() > baseParams.length()) 
     656                                ownerParams = ownerParams.tail; 
    605657                            return sym.type.subst(ownerParams, baseParams); 
    606658                        } 
     
    608660                } 
    609661            } 
     662//          System.out.println(sym.type);//DEBUG 
    610663            return sym.type; 
    611664        } 
     
    616669            List<Type> typarams1 = subst(typarams, from, to); 
    617670            Type outer1 = outer.subst(from, to); 
    618             if (typarams1 == typarams && outer1 == outer) return this; 
    619             else return new ClassType(outer1, typarams1, tsym); 
     671            if (typarams1 == typarams && outer1 == outer) { 
     672                return this; 
     673            } else { 
     674                TypeSymbol tsym1 = tsym; 
     675                if (outer.tsym != outer1.tsym && tsym.isNested()) { 
     676                    TypeSymbol tsym2 = outer1.memberClass(tsym.name); 
     677                    if (tsym2 != null) { 
     678                        tsym1 = tsym2; 
     679                        if (outer1.tag == CLASS) { 
     680                            outer1 = outer1.asSuper(tsym1.type.outer().tsym); 
     681                        } 
     682                    } 
     683                } 
     684                return new ClassType(outer1, typarams1, tsym1); 
     685            } 
    620686        } 
    621687 
    622688        public boolean isErroneous() { 
    623689            return outer().isErroneous() || isErroneous(typarams()); 
     690        } 
     691 
     692        public boolean isParameterized() { 
     693            return allParams().tail != null; 
     694            // optimization, was: allParams().nonEmpty(); 
    624695        } 
    625696 
     
    630701        public boolean isRaw() { 
    631702            return 
    632                 tsym.type.isParameterized() && 
    633                 (typarams().isEmpty() && 
    634                  tsym.type.typarams().nonEmpty() 
    635                  || 
    636                  outer().isRaw()); 
    637         } 
    638  
    639         public boolean isParameterized() { 
    640             if (tsym.completer != null) tsym.complete(); 
    641             return 
    642                 typarams_field.tail != null 
    643                   /*inlined: typarams_field.nonEmpty()*/ || 
    644                 outer_field.tag == CLASS && outer_field.isParameterized(); 
     703                this != tsym.type && // fast special case 
     704                tsym.type.allParams().nonEmpty() && 
     705                allParams().isEmpty() && // fast special case 
     706                (tsym.type.typarams().nonEmpty() && typarams().isEmpty() || 
     707                 outer().isRaw()); // precise condition, slow to check; 
    645708        } 
    646709 
     
    675738                return true; 
    676739            } else if (this.tsym == that.tsym) { 
    677                 return !that.isParameterized() || this.genType(that); 
     740                return  
     741                    (!that.isParameterized() ||  
     742                     genTypes(this.typarams(), that.typarams())) && 
     743                    this.outer().subType(that.outer()); 
    678744            } else { 
    679745                Type st = supertype(); 
     
    688754        } 
    689755 
     756        public TypeSymbol memberClass(Name name) { 
     757            Type t = this; 
     758            while (t.tag == CLASS) { 
     759                Scope.Entry e = t.tsym.members().lookup(name); 
     760                while (e.scope != null && e.sym.kind != TYP) 
     761                    e = e.next(); 
     762                if (e.scope != null) return (TypeSymbol) e.sym; 
     763                t = t.supertype(); 
     764            } 
     765            return null; 
     766        } 
     767 
    690768        public boolean castableTo(Type that) { 
    691769            List<Type> thatParams = that.allParams(); 
     
    697775                 || 
    698776                 (that.subType(this) && 
    699                   thatParams.subset(this.allParams())) 
     777                  (that.tag == ARRAY || 
     778                   that.tsym.type == that /*fast special case*/ || 
     779                   that.sameType(this.asSub(that.tsym)))) 
    700780                 || 
    701781                 that.tag == CLASS && thatParams.isEmpty() && 
     
    740820        } 
    741821 
     822        public boolean isParameterized() { 
     823            return elemtype.isParameterized(); 
     824        } 
     825 
    742826        public boolean isRaw() { 
    743827            return elemtype.isRaw(); 
    744         } 
    745  
    746         public boolean isParameterized() { 
    747             return elemtype.isParameterized(); 
    748828        } 
    749829 
     
    9451025        } 
    9461026 
    947         public boolean isErroneous() { 
    948             return bound != null && bound.isErroneous(); 
    949         } 
    950  
    9511027        public Type erasure() { 
    9521028            return bound.erasure(); 
     1029        } 
     1030 
     1031        public TypeSymbol memberClass(Name name) { 
     1032            return bound().memberClass(name); 
    9531033        } 
    9541034    } 
     
    9861066 
    9871067        public boolean isErroneous()  { 
    988             return isErroneous(tvars) || qtype.isErroneous(); 
     1068            return qtype.isErroneous(); 
    9891069        } 
    9901070 
     
    10001080            return 
    10011081                that.tag == FORALL && 
     1082                sameTypes( 
     1083                    bounds(), 
     1084                    subst(((ForAll)that).bounds(), ((ForAll)that).tvars, tvars)) && 
    10021085                qtype.sameArgs( 
    10031086                    ((ForAll)that).qtype.subst(((ForAll)that).tvars, tvars)); 
     1087        } 
     1088 
     1089        private List<Type> bounds() { 
     1090            ListBuffer<Type> b = new ListBuffer<Type>(); 
     1091            for (List<Type> l = tvars; l.nonEmpty(); l = l.tail) 
     1092                b.append(l.head.bound()); 
     1093            return b.toList(); 
    10041094        } 
    10051095 
  • /trunk/gj/src/gjc/v6/comp/Attr.java

    r20 r30  
    107107     */ 
    108108    void warnDeprecated(int pos, Symbol sym) { 
    109         if (!enter.compiled.contains(sym.enclClass().fullname)) 
     109        if (!chk.compiled.contains(sym.enclClass().fullname)) 
    110110            log.warning(pos, sym + sym.location() + " has been deprecated"); 
    111111    } 
     
    115115    Symbol thisSym(Env<AttrContext> env) { 
    116116        return rs.resolveSelf( 
    117             Position.NOPOS, env, env.enclClass.sym, Names._this); 
     117            Position.NOPOS, env, env.enclClass.sym, Names._this, true); 
    118118    } 
    119119 
     
    185185     *  for a method `m' defined in an interface 
    186186     */ 
    187     private void addAbstractMethod(ClassDef cd, 
     187    void addAbstractMethod(ClassDef cd, 
    188188                                   MethodSymbol m, 
    189189                                   Env<AttrContext> env) { 
     
    433433            else if (thentype.tag < INT && elsetype.tag == INT && 
    434434                elsetype.assignable(thentype)) 
    435                 return thentype; 
     435                return thentype.baseType(); 
    436436            else if (elsetype.tag < INT && thentype.tag == INT && 
    437437                     thentype.assignable(elsetype)) 
    438                 return elsetype; 
     438                return elsetype.baseType(); 
    439439            else if (thentype.tag <= DOUBLE && elsetype.tag <= DOUBLE) { 
    440440                for (int i = BYTE; i <= DOUBLE; i++) { 
     
    448448                return syms.stringType; 
    449449            } else if (thentype.subType(elsetype)) { 
    450                 return elsetype; 
     450                return elsetype.baseType(); 
    451451            } else { 
    452452                chk.checkType(pos, elsetype, thentype); 
    453                 return thentype; 
    454             } 
    455         } 
     453                return thentype.baseType(); 
     454            } 
     455        } 
     456         
    456457 
    457458    public Type _case(Exec tree, Env<AttrContext> env) { 
     
    653654            TreeInfo.setSymbol(clazzid, TreeInfo.symbol(clazzid1)); 
    654655            clazzid.type = ((Ident)clazzid).sym.type; 
     656        } else if ((clazztype.tsym.flags() & INTERFACE) == 0 &&  
     657                   clazztype.outer().tag == CLASS) { 
     658            rs.resolveSelf( 
     659                tree.pos, env, clazztype.outer().tsym, Names._this, false); 
    655660        } 
    656661 
     
    659664 
    660665        if (clazztype.tag == CLASS) { 
    661 //          Type site = clazztype.tsym.type; 
    662 //          List<Type> typarams = clazztype.typarams(); 
    663 // 
    664 //          if (site.typarams().nonEmpty() && typarams.isEmpty()) 
    665 //              site = site.erasure(); 
    666  
    667666            // resolve constructor, if not abstract 
    668667            if (cdef == null && 
     
    705704                attribStat(cdef, env.dup(tree)); 
    706705//              new Pretty().printStat(cdef);//DEBUG 
     706 
     707                // don't pass a this0 to anonymous classes in super calls 
     708                if (tree.encl == null && env.info.isSelfCall)  
     709                    cdef.sym.flags_field |= NOTHIS0; 
    707710 
    708711                // if enclosing class is given, 
     
    931934        } 
    932935 
     936        if ((sym.flags() & DEPRECATED) != 0)  
     937            warnDeprecated(tree.pos, sym); 
    933938        return checkId(tree, env.enclClass.sym.type, sym, pkind, pt); 
    934939    } 
     
    983988            env.info.selectSuper = selectSuperPrev; 
    984989        } 
     990 
     991        if ((sym.flags() & DEPRECATED) != 0)  
     992            warnDeprecated(tree.pos, sym); 
    985993        return checkId(tree, site, sym, pkind, pt); 
    986994    } 
     
    9941002         *  @param pkind  the expected kind(s) of the Select expression 
    9951003         */ 
    996         private Symbol selectSym(Select tree, Type site, 
    997                                 Env<AttrContext> env, Type pt, int pkind) { 
     1004        Symbol selectSym(Select tree, Type site, 
     1005                        Env<AttrContext> env, Type pt, int pkind) { 
    9981006            int pos = tree.pos; 
    9991007            Name name = tree.name; 
     
    10091017                        pos, env, site, name, Type.emptyList, pt.argtypes()); 
    10101018                } else if (name == Names._this) { 
    1011                     return rs.resolveSelf(pos, env, site.tsym, name); 
     1019                    return rs.resolveSelf(pos, env, site.tsym, name, true); 
    10121020                } else if (name == Names._class) { 
    10131021                    return new VarSymbol( 
     
    10601068         */ 
    10611069        Type checkId(Tree tree, Type site, Symbol sym, int pkind, Type pt) { 
    1062             if ((sym.flags() & DEPRECATED) != 0) warnDeprecated(tree.pos, sym); 
    10631070            Type owntype; 
    10641071            switch (sym.kind) { 
     
    10701077                        site != owntype.outer())  
    10711078                    { 
    1072                         owntype = new ClassType( 
    1073                             site, Type.emptyList, owntype.tsym); 
    1074                     } else if (owntype.typarams().nonEmpty()) { 
     1079                        Type normSite = site; 
     1080                        if (normSite.tag == CLASS)  
     1081                            normSite = site.asOuterSuper(owntype.outer().tsym); 
     1082                        if (normSite != owntype.outer()) 
     1083                            owntype = new ClassType( 
     1084                                normSite, Type.emptyList, owntype.tsym); 
     1085                    }  
     1086                    if (owntype.typarams().nonEmpty()) { 
    10751087                        owntype = new ClassType( 
    10761088                            owntype.outer(), Type.emptyList, owntype.tsym); 
     
    11061118                    (sym.flags() & STATIC) == 0 && 
    11071119                    site.tag == CLASS) { 
    1108                     Type s= site.asOuterSuper(sym.owner); 
     1120                    Type s = site.asOuterSuper(sym.owner); 
    11091121                    if (s != null && 
    11101122                        s.isRaw() && 
     
    12461258            if (actuals.length() == formals.length()) { 
    12471259                owntype = new ClassType( 
    1248                     clazztype.tsym.type.outer(), actuals, clazztype.tsym); 
     1260                    clazztype.outer(), actuals, clazztype.tsym); 
    12491261            } else { 
    12501262                log.error( 
  • /trunk/gj/src/gjc/v6/comp/Check.java

    r20 r30  
    3232    } 
    3333 
    34     /** switch: unchecked option set? 
     34    /** the set of all compiled classes in this run; maintained from outside 
     35     */ 
     36    public Set<Name> compiled = new Set<Name>(); 
     37 
     38    /** switch: -unchecked option set? 
    3539     */ 
    3640    boolean unchecked; 
     
    109113            return t.tag == TYPEVAR || t.tag == ARRAY && isTypeVar(t.elemtype()); 
    110114        } 
     115 
     116    /** Check that type `a' deeply extends type `b'. 
     117     *  That is, check that `a' is a subtype of `b',  
     118     *  and that all inner classes of `a' deeply extend 
     119     *  corresponding inner classes in `b'. 
     120     */ 
     121    public boolean checkDeeplyExtends(int pos, boolean reportErrors,  
     122                                      Type a, Type b) { 
     123        if (!a.subType(b)) { 
     124            log.error(pos, 
     125                "type parameter " + a + " is not within its bound " + b); 
     126            return false; 
     127        } else { 
     128            return checkDeeplyExtends(pos, reportErrors, a, b, a, b); 
     129        } 
     130    } 
     131 
     132    /** Inner class extension rule: given a bounding declaration  
     133     * 
     134     *   d extends T 
     135     * 
     136     * and an instance S bound to d, it must hold that  
     137     * 
     138     *   S   deeply extends  T[S/d]  . 
     139     * 
     140     * 
     141     * DEFINITION: A type S *deeply extends* a type T, if  
     142     * 
     143     *   S extends T 
     144     * 
     145     * and, for all (non-static) class members A of T,  
     146     * 
     147     *   S.A  deeply extends  T.A, 
     148     *   S.A  has at least the same access priviliges as T.A, and 
     149     *   S.A  is not static. 
     150     * 
     151     * The class members of a type variable are taken to be the class members 
     152     * of its bound. 
     153     * 
     154     * Note that given declarations 
     155     * 
     156     *   class G<g extends T> 
     157     *   class F<f extends S> extends G<f> 
     158     * 
     159     * we must check that f deeply extends T 
     160     * (by checking that S deeply extends T). 
     161     * 
     162     */ 
     163    public boolean checkDeeplyExtends(int pos, boolean reportErrors, 
     164                                      Type aroot, Type broot,  
     165                                      Type a, Type b) { 
     166        if (a == b) { // fast special case 
     167            return true; 
     168        } else if (!a.subType(b)) { 
     169            if (reportErrors)  
     170                log.error(pos, 
     171                    "type parameter " + aroot +  
     172                    " is not within its bound " + broot +  
     173                    " since " + a + " is not a subtype of " + b); 
     174            return false; 
     175        } else { 
     176            Scope s = b.tsym.members(); 
     177            if (s != null) { 
     178                for (Scope.Entry e = s.elems; e != null; e = e.sibling) { 
     179                    if (e.sym.kind == TYP &&  
     180                        (e.sym.flags_field & (STATIC | PRIVATE)) == 0)  
     181                    { 
     182                        Type b1 = b.memberType(e.sym); 
     183                        Type a1 = a.memberType(a.memberClass(e.sym.name)); 
     184                        if ((a1.tsym.flags_field & STATIC) != 0) { 
     185                            if (reportErrors)  
     186                                log.error(pos, 
     187                                    "type parameter " + aroot +  
     188                                    " is not within its bound " + broot +  
     189                                    " since " + a + " is static"); 
     190                            return false;   
     191                        } 
     192                        if (protection(a.tsym.flags_field) >  
     193                            protection(b.tsym.flags_field)) { 
     194                            if (reportErrors)  
     195                                log.error(pos, 
     196                                    "type parameter " + aroot +  
     197                                    " is not within its bound " + broot +  
     198                                    " since " + a +  
     199                                    " has weaker access priviliges than " + b); 
     200                            return false; 
     201                        } 
     202                        if (!checkDeeplyExtends( 
     203                            pos, reportErrors, aroot, broot, a1, b1)) 
     204                        { 
     205                            return false; 
     206                        }  
     207                    } 
     208                } 
     209            } 
     210            return true; 
     211        } 
     212    } 
    111213 
    112214   /** check that type t is different from 'void'. 
     
    193295                if (sym.owner.owner.kind == PCK || 
    194296                    (sym.owner.flags_field & STATIC) != 0) mask |= STATIC; 
     297                if ((flags & INTERFACE) != 0) implicit = STATIC; 
    195298            } else { 
    196299                mask = ClassFlags; 
     
    212315//should it be deleted here? 
    213316                 && 
     317 
     318          // JavaParty [ 
    214319                 checkDisjoint(pos, flags, 
    215                                ABSTRACT | INTERFACE, 
     320                               ABSTRACT, 
    216321                               FINAL | NATIVE | SYNCHRONIZED) 
     322                 && 
     323                 checkDisjoint(pos, flags, 
     324                               INTERFACE, 
     325                               FINAL | NATIVE | SYNCHRONIZED | REMOTE) 
     326          // ] JavaParty 
     327 
    217328                 && 
    218329                 checkDisjoint(pos, flags, 
     
    284395                    Type bound = forms.head.bound().subst(formals, actuals); 
    285396                    validate(a); 
    286                     if (!a.type.subType(bound)) 
    287                         log.error(a.pos, 
    288                                   "type parameter " + a.type + 
    289                                   " is not within bound " + bound); 
     397                    checkDeeplyExtends(tree.pos, true, a.type, bound); 
    290398                    args = args.tail; 
    291399                    forms = forms.tail; 
     
    303411        public Void _case(Select tree, Void arg) { 
    304412            if (tree.type.tag == CLASS) { 
    305                 if (tree.type.outer().tag == CLASS) validate(tree.selected); 
     413                if (tree.type.outer().tag == CLASS)  
     414                    validate(tree.selected); 
     415                else if (tree.selected.type.isParameterized()) 
     416                    log.error( 
     417                        tree.pos, 
     418                        "cannot select a static class from a parameterized type"); 
     419                     
    306420                if (tree.type.isRaw() && tree.type.allParams().nonEmpty()) 
    307421                    log.error( 
     
    495609            List<Type> mtvars = mt.typarams(); 
    496610            List<Type> otvars = ot.typarams(); 
    497             if (!(mt.restype().subType(ot.restype().subst(otvars, mtvars)))) { 
    498                 typeError(pos, 
    499                     cannotOverride(m, other) + " with incompatible return type", 
    500                     mt.restype(), ot.restype().subst(otvars, mtvars)); 
     611            Type otres = ot.restype().subst(otvars, mtvars); 
     612            if (!(mt.restype().subType(otres))) { 
     613                if ((m.flags() & IPROXY) != 0 && otres.subType(mt.restype())) { 
     614                    ((MethodType)mt).restype = otres; 
     615                } else { 
     616                    typeError(pos, 
     617                        cannotOverride(m, other) + " with incompatible return type", 
     618                        mt.restype(), ot.restype().subst(otvars, mtvars)); 
     619                } 
    501620            } else if ((origin.flags() & INTERFACE) == 0) { 
    502621                List<ClassSymbol> unhandled = unHandled(mt.thrown(), ot.thrown()); 
     
    513632        } 
    514633    } 
    515  
     634                                                                              
    516635    /** check that this method conforms with any class member method 
    517636     *  it overrides. 
     
    549668         *  null if there is none. 
    550669         */ 
    551         private MethodSymbol firstUndef(ClassSymbol impl, ClassSymbol c) { 
     670        MethodSymbol firstUndef(ClassSymbol impl, ClassSymbol c) { 
    552671            MethodSymbol undef = null; 
    553672            if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) { 
Note: See TracChangeset for help on using the changeset viewer.