< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
Print this page
import javax.lang.model.element.VariableElement;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.code.Kinds.Kind;
+ import com.sun.tools.javac.code.Type.ClassType.Flavor;
import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.comp.Attr;
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
public boolean isPrivate() {
return (flags_field & Flags.AccessFlags) == PRIVATE;
}
+ public boolean isPrimitiveClass() {
+ return (flags() & PRIMITIVE_CLASS) != 0;
+ }
+
+ public boolean isValueClass() {
+ return !isInterface() && (flags() & VALUE_CLASS) != 0;
+ }
+
+ public boolean isIdentityClass() {
+ return !isInterface() && (flags() & IDENTITY_TYPE) != 0;
+ }
+
+ public boolean isValueInterface() {
+ return isInterface() && (flags() & VALUE_CLASS) != 0;
+ }
+
+ public boolean isIdentityInterface() {
+ return isInterface() && (flags() & IDENTITY_TYPE) != 0;
+ }
+
public boolean isPublic() {
return (flags_field & Flags.AccessFlags) == PUBLIC;
}
public boolean isEnum() {
}
/** Is this symbol a constructor?
*/
public boolean isConstructor() {
! return name == name.table.names.init;
}
public boolean isDynamic() {
return false;
}
}
/** Is this symbol a constructor?
*/
public boolean isConstructor() {
! return name == name.table.names.init && (flags() & STATIC) == 0;
+ }
+
+ /** Is this symbol a value object factory?
+ */
+ public boolean isValueObjectFactory() {
+ return ((name == name.table.names.init && this.type.getReturnType().tsym == this.owner));
}
public boolean isDynamic() {
return false;
}
public ClassSymbol(long flags, Name name, Symbol owner) {
this(
flags,
name,
! new ClassType(Type.noType, null, null),
owner);
this.type.tsym = this;
}
/** The Java source which this symbol represents.
public ClassSymbol(long flags, Name name, Symbol owner) {
this(
flags,
name,
! new ClassType(Type.noType, null, null, TypeMetadata.EMPTY, Flavor.X_Typeof_X),
owner);
this.type.tsym = this;
}
/** The Java source which this symbol represents.
public Type erasure(Types types) {
if (erasure_field == null)
erasure_field = new ClassType(types.erasure(type.getEnclosingType()),
List.nil(), this,
! type.getMetadata());
return erasure_field;
}
public String className() {
if (name.isEmpty())
return
Log.getLocalizedString("anonymous.class", flatname);
! else
return fullname.toString();
}
@DefinedBy(Api.LANGUAGE_MODEL)
public Name getQualifiedName() {
public Type erasure(Types types) {
if (erasure_field == null)
erasure_field = new ClassType(types.erasure(type.getEnclosingType()),
List.nil(), this,
! type.getMetadata(),
+ type.getFlavor());
return erasure_field;
}
public String className() {
if (name.isEmpty())
return
Log.getLocalizedString("anonymous.class", flatname);
!
return fullname.toString();
}
@DefinedBy(Api.LANGUAGE_MODEL)
public Name getQualifiedName() {
ex.dcfh.classSymbolCompleteFailed(this, origCompleter);
// quiet error recovery
flags_field |= (PUBLIC|STATIC);
this.type = new ErrorType(this, Type.noType);
throw ex;
+ } finally {
+ if (this.type != null && this.type.hasTag(CLASS)) {
+ ClassType ct = (ClassType) this.type;
+ ct.flavor = ct.flavor.metamorphose((this.flags_field & PRIMITIVE_CLASS) != 0);
+ if (!this.type.isIntersection() && this.erasure_field != null && this.erasure_field.hasTag(CLASS)) {
+ ((ClassType) this.erasure_field).flavor = ct.flavor;
+ }
+ }
}
}
@DefinedBy(Api.LANGUAGE_MODEL)
public List<Type> getInterfaces() {
classType.typarams_field = null;
classType.allparams_field = null;
classType.supertype_field = null;
classType.interfaces_field = null;
classType.all_interfaces_field = null;
+ classType.flavor = Flavor.X_Typeof_X;
}
clearAnnotationMetadata();
}
public void clearAnnotationMetadata() {
if (this == _other) return true;
MethodSymbol other = (MethodSymbol)_other;
// check for a direct implementation
if (other.isOverridableIn((TypeSymbol)owner) &&
! types.asSuper(owner.type, other.owner) != null &&
types.isSameType(erasure(types), other.erasure(types)))
return true;
// check for an inherited implementation
return
if (this == _other) return true;
MethodSymbol other = (MethodSymbol)_other;
// check for a direct implementation
if (other.isOverridableIn((TypeSymbol)owner) &&
! types.asSuper(owner.type.referenceProjectionOrSelf(), other.owner) != null &&
types.isSameType(erasure(types), other.erasure(types)))
return true;
// check for an inherited implementation
return
if (this == _other) return true;
MethodSymbol other = (MethodSymbol)_other;
// check for a direct implementation
if (other.isOverridableIn((TypeSymbol)owner) &&
! types.asSuper(owner.type, other.owner) != null) {
Type mt = types.memberType(owner.type, this);
Type ot = types.memberType(owner.type, other);
if (types.isSubSignature(mt, ot)) {
if (!checkResult)
return true;
if (this == _other) return true;
MethodSymbol other = (MethodSymbol)_other;
// check for a direct implementation
if (other.isOverridableIn((TypeSymbol)owner) &&
! types.asSuper(owner.type.referenceProjectionOrSelf(), other.owner) != null) {
Type mt = types.memberType(owner.type, this);
Type ot = types.memberType(owner.type, other);
if (types.isSubSignature(mt, ot)) {
if (!checkResult)
return true;
}
}
@Override
public boolean isInheritedIn(Symbol clazz, Types types) {
+
switch ((int)(flags_field & Flags.AccessFlags)) {
case PUBLIC:
return !this.owner.isInterface() ||
clazz == owner ||
(flags_field & STATIC) == 0;
< prev index next >