本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.isPrivate方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.isPrivate方法的具体用法?Java ReferenceBinding.isPrivate怎么用?Java ReferenceBinding.isPrivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.isPrivate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hides
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public boolean hides(Element hidden)
{
if (!(hidden instanceof TypeElementImpl)) {
return false;
}
ReferenceBinding hiddenBinding = (ReferenceBinding)((TypeElementImpl)hidden)._binding;
if (hiddenBinding.isPrivate()) {
return false;
}
ReferenceBinding hiderBinding = (ReferenceBinding)_binding;
if (TypeBinding.equalsEquals(hiddenBinding, hiderBinding)) {
return false;
}
if (!hiddenBinding.isMemberType() || !hiderBinding.isMemberType()) {
return false;
}
if (!CharOperation.equals(hiddenBinding.sourceName, hiderBinding.sourceName)) {
return false;
}
return null != hiderBinding.enclosingType().findSuperTypeOriginatingFrom(hiddenBinding.enclosingType());
}
示例2: hides
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public boolean hides(Element hidden)
{
if (!(hidden instanceof TypeElementImpl)) {
return false;
}
ReferenceBinding hiddenBinding = (ReferenceBinding)((TypeElementImpl)hidden)._binding;
if (hiddenBinding.isPrivate()) {
return false;
}
ReferenceBinding hiderBinding = (ReferenceBinding)_binding;
if (hiddenBinding == hiderBinding) {
return false;
}
if (!hiddenBinding.isMemberType() || !hiderBinding.isMemberType()) {
return false;
}
if (!CharOperation.equals(hiddenBinding.sourceName, hiderBinding.sourceName)) {
return false;
}
return null != hiderBinding.enclosingType().findSuperTypeOriginatingFrom(hiddenBinding.enclosingType());
}
示例3: canBeSeenByForCodeSnippet
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public final boolean canBeSeenByForCodeSnippet(ReferenceBinding referenceBinding, ReferenceBinding receiverType) {
if (referenceBinding.isPublic()) return true;
if (TypeBinding.equalsEquals(receiverType, referenceBinding)) return true;
if (referenceBinding.isProtected()) {
// answer true if the receiver (or its enclosing type) is the superclass
// of the receiverType or in the same package
return receiverType.fPackage == referenceBinding.fPackage
|| referenceBinding.isSuperclassOf(receiverType)
|| referenceBinding.enclosingType().isSuperclassOf(receiverType); // protected types always have an enclosing one
}
if (referenceBinding.isPrivate()) {
// answer true if the receiver and the receiverType have a common enclosingType
// already know they are not the identical type
ReferenceBinding outerInvocationType = receiverType;
ReferenceBinding temp = outerInvocationType.enclosingType();
while (temp != null) {
outerInvocationType = temp;
temp = temp.enclosingType();
}
ReferenceBinding outerDeclaringClass = referenceBinding;
temp = outerDeclaringClass.enclosingType();
while (temp != null) {
outerDeclaringClass = temp;
temp = temp.enclosingType();
}
return TypeBinding.equalsEquals(outerInvocationType, outerDeclaringClass);
}
// isDefault()
return receiverType.fPackage == referenceBinding.fPackage;
}
示例4: canBeSeenByForCodeSnippet
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public final boolean canBeSeenByForCodeSnippet(ReferenceBinding referenceBinding, ReferenceBinding receiverType) {
if (referenceBinding.isPublic()) return true;
if (receiverType == referenceBinding) return true;
if (referenceBinding.isProtected()) {
// answer true if the receiver (or its enclosing type) is the superclass
// of the receiverType or in the same package
return receiverType.fPackage == referenceBinding.fPackage
|| referenceBinding.isSuperclassOf(receiverType)
|| referenceBinding.enclosingType().isSuperclassOf(receiverType); // protected types always have an enclosing one
}
if (referenceBinding.isPrivate()) {
// answer true if the receiver and the receiverType have a common enclosingType
// already know they are not the identical type
ReferenceBinding outerInvocationType = receiverType;
ReferenceBinding temp = outerInvocationType.enclosingType();
while (temp != null) {
outerInvocationType = temp;
temp = temp.enclosingType();
}
ReferenceBinding outerDeclaringClass = referenceBinding;
temp = outerDeclaringClass.enclosingType();
while (temp != null) {
outerDeclaringClass = temp;
temp = temp.enclosingType();
}
return outerInvocationType == outerDeclaringClass;
}
// isDefault()
return receiverType.fPackage == referenceBinding.fPackage;
}
示例5: addMembers
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
/**
* Add the members of a type to the maps of subtypes, fields, and methods. Add only those
* which are non-private and which are not overridden by an already-discovered member.
* For fields, add them all; javac implementation does not take field hiding into account.
* @param binding the type whose members will be added to the lists
* @param ignoreVisibility if true, all members will be added regardless of whether they
* are private, overridden, etc.
* @param types a map of type simple name to type binding
* @param fields a list of field bindings
* @param methods a map of method simple name to set of method bindings with that name
*/
private void addMembers(ReferenceBinding binding, boolean ignoreVisibility, Map<String, ReferenceBinding> types,
List<FieldBinding> fields, Map<String, Set<MethodBinding>> methods)
{
for (ReferenceBinding subtype : binding.memberTypes()) {
if (ignoreVisibility || !subtype.isPrivate()) {
String name = new String(subtype.sourceName());
if (null == types.get(name)) {
types.put(name, subtype);
}
}
}
for (FieldBinding field : binding.fields()) {
if (ignoreVisibility || !field.isPrivate()) {
fields.add(field);
}
}
for (MethodBinding method : binding.methods()) {
if (!method.isSynthetic() && (ignoreVisibility || (!method.isPrivate() && !method.isConstructor()))) {
String methodName = new String(method.selector);
Set<MethodBinding> sameNamedMethods = methods.get(methodName);
if (null == sameNamedMethods) {
// New method name. Create a set for it and add it to the list.
// We don't expect many methods with same name, so only 4 slots:
sameNamedMethods = new HashSet<MethodBinding>(4);
methods.put(methodName, sameNamedMethods);
sameNamedMethods.add(method);
}
else {
// We already have a method with this name. Is this method overridden?
boolean unique = true;
if (!ignoreVisibility) {
for (MethodBinding existing : sameNamedMethods) {
MethodVerifier verifier = _env.getLookupEnvironment().methodVerifier();
if (verifier.doesMethodOverride(existing, method)) {
unique = false;
break;
}
}
}
if (unique) {
sameNamedMethods.add(method);
}
}
}
}
}