equal
deleted
inserted
replaced
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 |
566 } |
566 } |
567 } |
567 } |
568 return hiddenSym; |
568 return hiddenSym; |
569 } |
569 } |
570 |
570 |
571 /** Is this symbol inherited into a given class? |
571 /** Is this symbol accessible in a given class? |
572 * PRE: If symbol's owner is a interface, |
572 * PRE: If symbol's owner is a interface, |
573 * it is already assumed that the interface is a superinterface |
573 * it is already assumed that the interface is a superinterface |
574 * of given class. |
574 * the given class. |
575 * @param clazz The class for which we want to establish membership. |
575 * @param clazz The class for which we want to establish membership. |
576 * This must be a subclass of the member's owner. |
576 * This must be a subclass of the member's owner. |
577 */ |
577 */ |
578 public boolean isInheritedIn(Symbol clazz, Types types) { |
578 public final boolean isAccessibleIn(Symbol clazz, Types types) { |
579 switch ((int)(flags_field & Flags.AccessFlags)) { |
579 switch ((int)(flags_field & Flags.AccessFlags)) { |
580 default: // error recovery |
580 default: // error recovery |
581 case PUBLIC: |
581 case PUBLIC: |
582 return true; |
582 return true; |
583 case PRIVATE: |
583 case PRIVATE: |
601 } |
601 } |
602 return (clazz.flags() & INTERFACE) == 0; |
602 return (clazz.flags() & INTERFACE) == 0; |
603 } |
603 } |
604 } |
604 } |
605 |
605 |
|
606 /** Is this symbol inherited into a given class? |
|
607 * PRE: If symbol's owner is a interface, |
|
608 * it is already assumed that the interface is a superinterface |
|
609 * of the given class. |
|
610 * @param clazz The class for which we want to establish membership. |
|
611 * This must be a subclass of the member's owner. |
|
612 */ |
|
613 public boolean isInheritedIn(Symbol clazz, Types types) { |
|
614 return isAccessibleIn(clazz, types); |
|
615 } |
|
616 |
606 /** The (variable or method) symbol seen as a member of given |
617 /** The (variable or method) symbol seen as a member of given |
607 * class type`site' (this might change the symbol's type). |
618 * class type`site' (this might change the symbol's type). |
608 * This is used exclusively for producing diagnostics. |
619 * This is used exclusively for producing diagnostics. |
609 */ |
620 */ |
610 public Symbol asMemberOf(Type site, Types types) { |
621 public Symbol asMemberOf(Type site, Types types) { |