src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
changeset 48367 3a52333a5e57
parent 47216 71c04702a3d5
child 50287 64c880300d9b
equal deleted inserted replaced
48366:2c1af559e922 48367:3a52333a5e57
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   419             }
   419             }
   420             if (owner.kind == TYP) {
   420             if (owner.kind == TYP) {
   421                 // We are seeing a member class.
   421                 // We are seeing a member class.
   422                 c = syms.enterClass(env.toplevel.modle, tree.name, (TypeSymbol)owner);
   422                 c = syms.enterClass(env.toplevel.modle, tree.name, (TypeSymbol)owner);
   423                 if (c.owner != owner) {
   423                 if (c.owner != owner) {
       
   424                     if (c.name != tree.name) {
       
   425                         log.error(tree.pos(), Errors.SameBinaryName(c.name, tree.name));
       
   426                         result = types.createErrorType(tree.name, (TypeSymbol)owner, Type.noType);
       
   427                         tree.sym = (ClassSymbol)result.tsym;
       
   428                         return;
       
   429                     }
   424                     //anonymous class loaded from a classfile may be recreated from source (see below)
   430                     //anonymous class loaded from a classfile may be recreated from source (see below)
   425                     //if this class is a member of such an anonymous class, fix the owner:
   431                     //if this class is a member of such an anonymous class, fix the owner:
   426                     Assert.check(owner.owner.kind != TYP, owner::toString);
   432                     Assert.check(owner.owner.kind != TYP, owner::toString);
   427                     Assert.check(c.owner.kind == TYP, () -> c.owner.toString());
   433                     Assert.check(c.owner.kind == TYP, () -> c.owner.toString());
   428                     ClassSymbol cowner = (ClassSymbol) c.owner;
   434                     ClassSymbol cowner = (ClassSymbol) c.owner;