本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.superInterfaces方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceBinding.superInterfaces方法的具体用法?Java ReferenceBinding.superInterfaces怎么用?Java ReferenceBinding.superInterfaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
的用法示例。
在下文中一共展示了ReferenceBinding.superInterfaces方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: directSupertypes
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public List<? extends TypeMirror> directSupertypes(TypeMirror t) {
switch(t.getKind()) {
case PACKAGE :
case EXECUTABLE :
throw new IllegalArgumentException("Invalid type mirror for directSupertypes"); //$NON-NLS-1$
default:
break;
}
TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t;
Binding binding = typeMirrorImpl._binding;
if (binding instanceof ReferenceBinding) {
ReferenceBinding referenceBinding = (ReferenceBinding) binding;
ArrayList<TypeMirror> list = new ArrayList<TypeMirror>();
ReferenceBinding superclass = referenceBinding.superclass();
if (superclass != null) {
list.add(this._env.getFactory().newTypeMirror(superclass));
}
for (ReferenceBinding interfaceBinding : referenceBinding.superInterfaces()) {
list.add(this._env.getFactory().newTypeMirror(interfaceBinding));
}
return Collections.unmodifiableList(list);
}
return Collections.emptyList();
}
示例2: getInterfaces
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
@Override
public List<? extends TypeMirror> getInterfaces() {
ReferenceBinding binding = (ReferenceBinding)_binding;
if (null == binding.superInterfaces() || binding.superInterfaces().length == 0) {
return Collections.emptyList();
}
List<TypeMirror> interfaces = new ArrayList<TypeMirror>(binding.superInterfaces().length);
for (ReferenceBinding interfaceBinding : binding.superInterfaces()) {
TypeMirror interfaceType = _env.getFactory().newTypeMirror(interfaceBinding);
if (interfaceType.getKind() == TypeKind.ERROR) {
if (this._env.getSourceVersion().compareTo(SourceVersion.RELEASE_6) > 0) {
// for jdk 7 and above, add error types
interfaces.add(interfaceType);
}
} else {
interfaces.add(interfaceType);
}
}
return Collections.unmodifiableList(interfaces);
}
示例3: collectSuperInterfaces
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
/**
* Recursively depth-first walk the tree of superinterfaces of a type, collecting
* all the unique superinterface bindings. (Note that because of generics, a type may
* have multiple unique superinterface bindings corresponding to the same interface
* declaration.)
* @param existing bindings already in this set will not be re-added or recursed into
* @param newfound newly found bindings will be added to this set
*/
private void collectSuperInterfaces(ReferenceBinding type,
Set<ReferenceBinding> existing, Set<ReferenceBinding> newfound) {
for (ReferenceBinding superinterface : type.superInterfaces()) {
if (!existing.contains(superinterface) && !newfound.contains(superinterface)) {
newfound.add(superinterface);
collectSuperInterfaces(superinterface, existing, newfound);
}
}
}
示例4: findNonDefaultAbstractMethod
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private MethodBinding findNonDefaultAbstractMethod(MethodBinding methodBinding) {
ReferenceBinding[] itsInterfaces = methodBinding.declaringClass.superInterfaces();
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
ReferenceBinding[] interfacesToVisit = itsInterfaces;
int nextPosition = interfacesToVisit.length;
for (int i = 0; i < nextPosition; i++) {
ReferenceBinding currentType = interfacesToVisit[i];
MethodBinding[] methods = currentType.getMethods(methodBinding.selector);
if(methods != null) {
for (int k = 0; k < methods.length; k++) {
if(methodBinding.areParametersEqual(methods[k]))
return methods[k];
}
}
if ((itsInterfaces = currentType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
return methodBinding;
}
示例5: getAllInheritedMethods0
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList<MethodBinding> collector) {
if (!binding.isInterface()) return;
MethodBinding[] methodBindings = binding.methods();
for (int i = 0, max = methodBindings.length; i < max; i++) {
collector.add(methodBindings[i]);
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (int i = 0, max = superInterfaces.length; i < max; i++) {
getAllInheritedMethods0(superInterfaces[i], collector);
}
}
示例6: findNonDefaultAbstractMethod
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private MethodBinding findNonDefaultAbstractMethod(MethodBinding methodBinding) {
ReferenceBinding[] itsInterfaces = methodBinding.declaringClass.superInterfaces();
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
ReferenceBinding[] interfacesToVisit = itsInterfaces;
int nextPosition = interfacesToVisit.length;
for (int i = 0; i < nextPosition; i++) {
ReferenceBinding currentType = interfacesToVisit[i];
MethodBinding[] methods = currentType.getMethods(methodBinding.selector);
if(methods != null) {
for (int k = 0; k < methods.length; k++) {
if(methodBinding.areParametersEqual(methods[k]))
return methods[k];
}
}
if ((itsInterfaces = currentType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
return methodBinding;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:33,代码来源:SelectionOnMessageSend.java
示例7: getAllInheritedMethods0
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void getAllInheritedMethods0(ReferenceBinding binding, ArrayList collector) {
if (!binding.isInterface()) return;
MethodBinding[] methodBindings = binding.methods();
for (int i = 0, max = methodBindings.length; i < max; i++) {
collector.add(methodBindings[i]);
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (int i = 0, max = superInterfaces.length; i < max; i++) {
getAllInheritedMethods0(superInterfaces[i], collector);
}
}
示例8: addAllMethodBindings0
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private static void addAllMethodBindings0(List<BindingTuple> list, TypeBinding binding, Set<String> banList, char[] fieldName, ASTNode responsible) throws DelegateRecursion {
if (binding instanceof SourceTypeBinding) ((SourceTypeBinding) binding).scope.environment().globalOptions.storeAnnotations = true;
if (binding == null) return;
TypeBinding inner;
if (binding instanceof ParameterizedTypeBinding) {
inner = ((ParameterizedTypeBinding) binding).genericType();
} else {
inner = binding;
}
if (inner instanceof SourceTypeBinding) {
ClassScope cs = ((SourceTypeBinding)inner).scope;
if (cs != null) {
try {
Reflection.classScopeBuildFieldsAndMethodsMethod.invoke(cs);
} catch (Exception e) {
// See 'Reflection' class for why we ignore this exception.
}
}
}
if (binding instanceof ReferenceBinding) {
ReferenceBinding rb = (ReferenceBinding) binding;
MethodBinding[] availableMethods = rb.availableMethods();
FieldBinding[] availableFields = rb.availableFields();
failIfContainsAnnotation(binding, availableMethods);
failIfContainsAnnotation(binding, availableFields);
MethodBinding[] parameterizedSigs = availableMethods;
MethodBinding[] baseSigs = parameterizedSigs;
if (binding instanceof ParameterizedTypeBinding) {
baseSigs = ((ParameterizedTypeBinding)binding).genericType().availableMethods();
if (baseSigs.length != parameterizedSigs.length) {
// The last known state of eclipse source says this can't happen, so we rely on it,
// but if this invariant is broken, better to go with 'arg0' naming instead of crashing.
baseSigs = parameterizedSigs;
}
}
for (int i = 0; i < parameterizedSigs.length; i++) {
MethodBinding mb = parameterizedSigs[i];
String sig = printSig(mb);
if (mb.isStatic()) continue;
if (mb.isBridge()) continue;
if (mb.isConstructor()) continue;
if (mb.isDefaultAbstract()) continue;
if (!mb.isPublic()) continue;
if (mb.isSynthetic()) continue;
if (!banList.add(sig)) continue; // If add returns false, it was already in there.
BindingTuple pair = new BindingTuple(mb, baseSigs[i], fieldName, responsible);
list.add(pair);
}
addAllMethodBindings0(list, rb.superclass(), banList, fieldName, responsible);
ReferenceBinding[] interfaces = rb.superInterfaces();
if (interfaces != null) {
for (ReferenceBinding iface : interfaces) addAllMethodBindings0(list, iface, banList, fieldName, responsible);
}
}
}
示例9: searchVisibleInterfaceMethods
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleInterfaceMethods(
ReferenceBinding[] itsInterfaces,
ReferenceBinding receiverType,
Scope scope,
InvocationSite invocationSite,
Scope invocationScope,
boolean onlyStaticMethods,
ObjectVector methodsFound) {
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
ReferenceBinding[] interfacesToVisit = itsInterfaces;
int nextPosition = interfacesToVisit.length;
for (int i = 0; i < nextPosition; i++) {
ReferenceBinding currentType = interfacesToVisit[i];
MethodBinding[] methods = currentType.availableMethods();
if(methods != null) {
searchVisibleLocalMethods(
methods,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
}
itsInterfaces = currentType.superInterfaces();
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (TypeBinding.equalsEquals(next, interfacesToVisit[b])) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:42,代码来源:InternalExtendedCompletionContext.java
示例10: searchVisibleMethods
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleMethods(
ReferenceBinding receiverType,
Scope scope,
InvocationSite invocationSite,
Scope invocationScope,
boolean onlyStaticMethods,
boolean notInJavadoc,
ObjectVector methodsFound) {
ReferenceBinding currentType = receiverType;
if (notInJavadoc) {
if (receiverType.isInterface()) {
searchVisibleInterfaceMethods(
new ReferenceBinding[]{currentType},
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
currentType = scope.getJavaLangObject();
}
}
boolean hasPotentialDefaultAbstractMethods = true;
while (currentType != null) {
MethodBinding[] methods = currentType.availableMethods();
if (methods != null) {
searchVisibleLocalMethods(
methods,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
}
if (notInJavadoc &&
hasPotentialDefaultAbstractMethods &&
(currentType.isAbstract() ||
currentType.isTypeVariable() ||
currentType.isIntersectionType() ||
currentType.isEnum())){
ReferenceBinding[] superInterfaces = currentType.superInterfaces();
if (superInterfaces != null && currentType.isIntersectionType()) {
for (int i = 0; i < superInterfaces.length; i++) {
superInterfaces[i] = (ReferenceBinding)superInterfaces[i].capture(invocationScope, invocationSite.sourceEnd());
}
}
searchVisibleInterfaceMethods(
superInterfaces,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
} else {
hasPotentialDefaultAbstractMethods = false;
}
if(currentType.isParameterizedType()) {
currentType = ((ParameterizedTypeBinding)currentType).genericType().superclass();
} else {
currentType = currentType.superclass();
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:71,代码来源:InternalExtendedCompletionContext.java
示例11: getInterfaces
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public synchronized ITypeBinding[] getInterfaces() {
if (this.prototype != null) {
return this.prototype.getInterfaces();
}
if (this.interfaces != null) {
return this.interfaces;
}
if (this.binding == null)
return this.interfaces = NO_TYPE_BINDINGS;
switch (this.binding.kind()) {
case Binding.ARRAY_TYPE :
case Binding.BASE_TYPE :
return this.interfaces = NO_TYPE_BINDINGS;
}
ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
ReferenceBinding[] internalInterfaces = null;
try {
internalInterfaces = referenceBinding.superInterfaces();
} catch (RuntimeException e) {
/* in case a method cannot be resolvable due to missing jars on the classpath
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
*/
org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve interfaces"); //$NON-NLS-1$
}
int length = internalInterfaces == null ? 0 : internalInterfaces.length;
if (length != 0) {
ITypeBinding[] newInterfaces = new ITypeBinding[length];
int interfacesCounter = 0;
for (int i = 0; i < length; i++) {
ITypeBinding typeBinding = this.resolver.getTypeBinding(internalInterfaces[i]);
if (typeBinding == null) {
continue;
}
newInterfaces[interfacesCounter++] = typeBinding;
}
if (length != interfacesCounter) {
System.arraycopy(newInterfaces, 0, (newInterfaces = new ITypeBinding[interfacesCounter]), 0, interfacesCounter);
}
return this.interfaces = newInterfaces;
}
return this.interfaces = NO_TYPE_BINDINGS;
}
示例12: searchVisibleInterfaceMethods
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
private void searchVisibleInterfaceMethods(
ReferenceBinding[] itsInterfaces,
ReferenceBinding receiverType,
Scope scope,
InvocationSite invocationSite,
Scope invocationScope,
boolean onlyStaticMethods,
ObjectVector methodsFound) {
if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
ReferenceBinding[] interfacesToVisit = itsInterfaces;
int nextPosition = interfacesToVisit.length;
for (int i = 0; i < nextPosition; i++) {
ReferenceBinding currentType = interfacesToVisit[i];
MethodBinding[] methods = currentType.availableMethods();
if(methods != null) {
searchVisibleLocalMethods(
methods,
receiverType,
scope,
invocationSite,
invocationScope,
onlyStaticMethods,
methodsFound);
}
itsInterfaces = currentType.superInterfaces();
if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
int itsLength = itsInterfaces.length;
if (nextPosition + itsLength >= interfacesToVisit.length)
System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
nextInterface : for (int a = 0; a < itsLength; a++) {
ReferenceBinding next = itsInterfaces[a];
for (int b = 0; b < nextPosition; b++)
if (next == interfacesToVisit[b]) continue nextInterface;
interfacesToVisit[nextPosition++] = next;
}
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:42,代码来源:InternalExtendedCompletionContext.java
示例13: getInterfaces
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public synchronized ITypeBinding[] getInterfaces() {
if (this.interfaces != null) {
return this.interfaces;
}
if (this.binding == null)
return this.interfaces = NO_TYPE_BINDINGS;
switch (this.binding.kind()) {
case Binding.ARRAY_TYPE :
case Binding.BASE_TYPE :
return this.interfaces = NO_TYPE_BINDINGS;
}
ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
ReferenceBinding[] internalInterfaces = null;
try {
internalInterfaces = referenceBinding.superInterfaces();
} catch (RuntimeException e) {
/* in case a method cannot be resolvable due to missing jars on the classpath
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=57871
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
*/
org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve interfaces"); //$NON-NLS-1$
}
int length = internalInterfaces == null ? 0 : internalInterfaces.length;
if (length != 0) {
ITypeBinding[] newInterfaces = new ITypeBinding[length];
int interfacesCounter = 0;
for (int i = 0; i < length; i++) {
ITypeBinding typeBinding = this.resolver.getTypeBinding(internalInterfaces[i]);
if (typeBinding == null) {
continue;
}
newInterfaces[interfacesCounter++] = typeBinding;
}
if (length != interfacesCounter) {
System.arraycopy(newInterfaces, 0, (newInterfaces = new ITypeBinding[interfacesCounter]), 0, interfacesCounter);
}
return this.interfaces = newInterfaces;
}
return this.interfaces = NO_TYPE_BINDINGS;
}