< 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 

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

  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 

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