< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

Print this page

  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.code;
  27 
  28 import java.lang.annotation.Annotation;
  29 import java.lang.annotation.Inherited;
  30 import java.util.Collections;
  31 import java.util.EnumSet;
  32 import java.util.HashMap;
  33 import java.util.Map;
  34 import java.util.Set;
  35 import java.util.concurrent.Callable;
  36 import java.util.function.Supplier;
  37 import java.util.function.Predicate;
  38 
  39 import javax.lang.model.element.Element;
  40 import javax.lang.model.element.ElementKind;
  41 import javax.lang.model.element.ElementVisitor;
  42 import javax.lang.model.element.ExecutableElement;
  43 import javax.lang.model.element.Modifier;
  44 import javax.lang.model.element.ModuleElement;
  45 import javax.lang.model.element.NestingKind;
  46 import javax.lang.model.element.PackageElement;
  47 import javax.lang.model.element.RecordComponentElement;
  48 import javax.lang.model.element.TypeElement;
  49 import javax.lang.model.element.TypeParameterElement;
  50 import javax.lang.model.element.VariableElement;
  51 import javax.tools.JavaFileManager;
  52 import javax.tools.JavaFileObject;

 387         switch (getKind()) {
 388             case LOCAL_VARIABLE:
 389             case PACKAGE:
 390             case PARAMETER:
 391             case RESOURCE_VARIABLE:
 392             case EXCEPTION_PARAMETER:
 393                 return false;
 394             default:
 395                 return true;
 396         }
 397     }
 398 
 399     public boolean isStatic() {
 400         return
 401             (flags() & STATIC) != 0 ||
 402             (owner.flags() & INTERFACE) != 0 && kind != MTH &&
 403              name != name.table.names._this;
 404     }
 405 
 406     public boolean isInterface() {
 407         return (flags() & INTERFACE) != 0;
 408     }
 409 
 410     public boolean isAbstract() {
 411         return (flags_field & ABSTRACT) != 0;
 412     }
 413 
 414     public boolean isPrivate() {
 415         return (flags_field & Flags.AccessFlags) == PRIVATE;
 416     }
 417 








 418     public boolean isPublic() {
 419         return (flags_field & Flags.AccessFlags) == PUBLIC;
 420     }
 421 
 422     public boolean isEnum() {
 423         return (flags() & ENUM) != 0;
 424     }
 425 
 426     public boolean isSealed() {
 427         return (flags_field & SEALED) != 0;
 428     }
 429 
 430     public boolean isNonSealed() {
 431         return (flags_field & NON_SEALED) != 0;
 432     }
 433 
 434     public boolean isFinal() {
 435         return (flags_field & FINAL) != 0;
 436     }
 437 

1302          */
1303         public List<Symbol> permitted;
1304 
1305         public boolean isPermittedExplicit = false;
1306 
1307         public ClassSymbol(long flags, Name name, Type type, Symbol owner) {
1308             super(TYP, flags, name, type, owner);
1309             this.members_field = null;
1310             this.fullname = formFullName(name, owner);
1311             this.flatname = formFlatName(name, owner);
1312             this.sourcefile = null;
1313             this.classfile = null;
1314             this.annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType();
1315             this.permitted = List.nil();
1316         }
1317 
1318         public ClassSymbol(long flags, Name name, Symbol owner) {
1319             this(
1320                 flags,
1321                 name,
1322                 new ClassType(Type.noType, null, null),
1323                 owner);
1324             this.type.tsym = this;
1325         }
1326 
1327         /** The Java source which this symbol represents.
1328          */
1329         public String toString() {
1330             return className();
1331         }
1332 
1333         public long flags() {
1334             complete();
1335             return flags_field;
1336         }
1337 
1338         public WriteableScope members() {
1339             complete();
1340             return members_field;
1341         }
1342 

  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.code;
  27 
  28 import java.lang.annotation.Annotation;
  29 import java.lang.annotation.Inherited;
  30 import java.util.Collections;
  31 import java.util.EnumSet;

  32 import java.util.Map;
  33 import java.util.Set;
  34 import java.util.concurrent.Callable;
  35 import java.util.function.Supplier;
  36 import java.util.function.Predicate;
  37 
  38 import javax.lang.model.element.Element;
  39 import javax.lang.model.element.ElementKind;
  40 import javax.lang.model.element.ElementVisitor;
  41 import javax.lang.model.element.ExecutableElement;
  42 import javax.lang.model.element.Modifier;
  43 import javax.lang.model.element.ModuleElement;
  44 import javax.lang.model.element.NestingKind;
  45 import javax.lang.model.element.PackageElement;
  46 import javax.lang.model.element.RecordComponentElement;
  47 import javax.lang.model.element.TypeElement;
  48 import javax.lang.model.element.TypeParameterElement;
  49 import javax.lang.model.element.VariableElement;
  50 import javax.tools.JavaFileManager;
  51 import javax.tools.JavaFileObject;

 386         switch (getKind()) {
 387             case LOCAL_VARIABLE:
 388             case PACKAGE:
 389             case PARAMETER:
 390             case RESOURCE_VARIABLE:
 391             case EXCEPTION_PARAMETER:
 392                 return false;
 393             default:
 394                 return true;
 395         }
 396     }
 397 
 398     public boolean isStatic() {
 399         return
 400             (flags() & STATIC) != 0 ||
 401             (owner.flags() & INTERFACE) != 0 && kind != MTH &&
 402              name != name.table.names._this;
 403     }
 404 
 405     public boolean isInterface() {
 406         return (flags_field & INTERFACE) != 0;
 407     }
 408 
 409     public boolean isAbstract() {
 410         return (flags_field & ABSTRACT) != 0;
 411     }
 412 
 413     public boolean isPrivate() {
 414         return (flags_field & Flags.AccessFlags) == PRIVATE;
 415     }
 416 
 417     public boolean isValueClass() {
 418         return (flags_field & VALUE_CLASS) != 0;
 419     }
 420 
 421     public boolean isIdentityClass() {
 422         return !isInterface() && (flags_field & IDENTITY_TYPE) != 0;
 423     }
 424 
 425     public boolean isPublic() {
 426         return (flags_field & Flags.AccessFlags) == PUBLIC;
 427     }
 428 
 429     public boolean isEnum() {
 430         return (flags() & ENUM) != 0;
 431     }
 432 
 433     public boolean isSealed() {
 434         return (flags_field & SEALED) != 0;
 435     }
 436 
 437     public boolean isNonSealed() {
 438         return (flags_field & NON_SEALED) != 0;
 439     }
 440 
 441     public boolean isFinal() {
 442         return (flags_field & FINAL) != 0;
 443     }
 444 

1309          */
1310         public List<Symbol> permitted;
1311 
1312         public boolean isPermittedExplicit = false;
1313 
1314         public ClassSymbol(long flags, Name name, Type type, Symbol owner) {
1315             super(TYP, flags, name, type, owner);
1316             this.members_field = null;
1317             this.fullname = formFullName(name, owner);
1318             this.flatname = formFlatName(name, owner);
1319             this.sourcefile = null;
1320             this.classfile = null;
1321             this.annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType();
1322             this.permitted = List.nil();
1323         }
1324 
1325         public ClassSymbol(long flags, Name name, Symbol owner) {
1326             this(
1327                 flags,
1328                 name,
1329                 new ClassType(Type.noType, null, null, List.nil()),
1330                 owner);
1331             this.type.tsym = this;
1332         }
1333 
1334         /** The Java source which this symbol represents.
1335          */
1336         public String toString() {
1337             return className();
1338         }
1339 
1340         public long flags() {
1341             complete();
1342             return flags_field;
1343         }
1344 
1345         public WriteableScope members() {
1346             complete();
1347             return members_field;
1348         }
1349 
< prev index next >