当前位置: 首页>>代码示例>>Java>>正文


Java LocalTypeBinding类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding的典型用法代码示例。如果您正苦于以下问题:Java LocalTypeBinding类的具体用法?Java LocalTypeBinding怎么用?Java LocalTypeBinding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LocalTypeBinding类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了LocalTypeBinding类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: acceptLocalType

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void acceptLocalType(TypeBinding typeBinding) {
	IJavaElement res =  null;
	if(typeBinding instanceof ParameterizedTypeBinding) {
		LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeBinding).genericType();
		res = findLocalElement(localTypeBinding.sourceStart());
	} else if(typeBinding instanceof SourceTypeBinding) {
		res = findLocalElement(((SourceTypeBinding)typeBinding).sourceStart());
	}
	if(res != null && res.getElementType() == IJavaElement.TYPE) {
		res = ((JavaElement)res).resolved(typeBinding);
		addElement(res);
		if(SelectionEngine.DEBUG){
			System.out.print("SELECTION - accept type("); //$NON-NLS-1$
			System.out.print(res.toString());
			System.out.println(")"); //$NON-NLS-1$
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:SelectionRequestor.java

示例2: acceptLocalTypeParameter

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void acceptLocalTypeParameter(TypeVariableBinding typeVariableBinding) {
	IJavaElement res;
	if(typeVariableBinding.declaringElement instanceof ParameterizedTypeBinding) {
		LocalTypeBinding localTypeBinding = (LocalTypeBinding)((ParameterizedTypeBinding)typeVariableBinding.declaringElement).genericType();
		res = findLocalElement(localTypeBinding.sourceStart());
	} else {
		SourceTypeBinding typeBinding = (SourceTypeBinding)typeVariableBinding.declaringElement;
		res = findLocalElement(typeBinding.sourceStart());
	}
	if (res != null && res.getElementType() == IJavaElement.TYPE) {
		IType type = (IType) res;
		ITypeParameter typeParameter = type.getTypeParameter(new String(typeVariableBinding.sourceName));
		if (typeParameter.exists()) {
			addElement(typeParameter);
			if(SelectionEngine.DEBUG){
				System.out.print("SELECTION - accept type parameter("); //$NON-NLS-1$
				System.out.print(typeParameter.toString());
				System.out.println(")"); //$NON-NLS-1$
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:SelectionRequestor.java

示例3: manageEnclosingInstanceAccessIfNecessary

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
	ReferenceBinding superTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();

	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0)	{
	// perform some emulation work in case there is some and we are inside a local type only
	if (superTypeErasure.isNestedType()
		&& currentScope.enclosingSourceType().isLocalType()) {

		if (superTypeErasure.isLocalType()) {
			((LocalTypeBinding) superTypeErasure).addInnerEmulationDependent(currentScope, this.qualification != null);
		} else {
			// locally propagate, since we already now the desired shape for sure
			currentScope.propagateInnerEmulation(superTypeErasure, this.qualification != null);
		}
	}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ExplicitConstructorCall.java

示例4: manageEnclosingInstanceAccessIfNecessary

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0)	{
	ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();

	// perform some extra emulation work in case there is some and we are inside a local type only
	if (allocatedTypeErasure.isNestedType()
		&& currentScope.enclosingSourceType().isLocalType()) {

		if (allocatedTypeErasure.isLocalType()) {
			((LocalTypeBinding) allocatedTypeErasure).addInnerEmulationDependent(currentScope, this.enclosingInstance != null);
		} else {
			// locally propagate, since we already now the desired shape for sure
			currentScope.propagateInnerEmulation(allocatedTypeErasure, this.enclosingInstance != null);
		}
	}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:QualifiedAllocationExpression.java

示例5: consumeLocalType

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void consumeLocalType(char[] uniqueKey) {
		LocalTypeBinding[] localTypeBindings  = this.parsedUnit.localTypes;
		for (int i = 0; i < this.parsedUnit.localTypeCount; i++)
			if (CharOperation.equals(uniqueKey, localTypeBindings[i].computeUniqueKey(false/*not a leaf*/))) {
				this.typeBinding = localTypeBindings[i];
				return;
			}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:BindingKeyResolver.java

示例6: generateEnclosingMethodAttribute

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
private int generateEnclosingMethodAttribute() {
	int localContentsOffset = this.contentsOffset;
	// add enclosing method attribute (1.5 mode only)
	if (localContentsOffset + 10 >= this.contents.length) {
		resizeContents(10);
	}
	int enclosingMethodAttributeNameIndex =
		this.constantPool.literalIndex(AttributeNamesConstants.EnclosingMethodName);
	this.contents[localContentsOffset++] = (byte) (enclosingMethodAttributeNameIndex >> 8);
	this.contents[localContentsOffset++] = (byte) enclosingMethodAttributeNameIndex;
	// the length of a signature attribute is equals to 2
	this.contents[localContentsOffset++] = 0;
	this.contents[localContentsOffset++] = 0;
	this.contents[localContentsOffset++] = 0;
	this.contents[localContentsOffset++] = 4;

	int enclosingTypeIndex = this.constantPool.literalIndexForType(this.referenceBinding.enclosingType().constantPoolName());
	this.contents[localContentsOffset++] = (byte) (enclosingTypeIndex >> 8);
	this.contents[localContentsOffset++] = (byte) enclosingTypeIndex;
	byte methodIndexByte1 = 0;
	byte methodIndexByte2 = 0;
	if (this.referenceBinding instanceof LocalTypeBinding) {
		MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod;
		if (methodBinding != null) {
			int enclosingMethodIndex = this.constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this));
			methodIndexByte1 = (byte) (enclosingMethodIndex >> 8);
			methodIndexByte2 = (byte) enclosingMethodIndex;
		}
	}
	this.contents[localContentsOffset++] = methodIndexByte1;
	this.contents[localContentsOffset++] = methodIndexByte2;
	this.contentsOffset = localContentsOffset;
	return 1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:ClassFile.java

示例7: cleanUp

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void cleanUp() {
	if (this.types != null) {
		for (int i = 0, max = this.types.length; i < max; i++) {
			cleanUp(this.types[i]);
		}
		for (int i = 0, max = this.localTypeCount; i < max; i++) {
		    LocalTypeBinding localType = this.localTypes[i];
			// null out the type's scope backpointers
			localType.scope = null; // local members are already in the list
			localType.enclosingCase = null;
		}
	}

	this.compilationResult.recoveryScannerData = null; // recovery is already done

	ClassFile[] classFiles = this.compilationResult.getClassFiles();
	for (int i = 0, max = classFiles.length; i < max; i++) {
		// clear the classFile back pointer to the bindings
		ClassFile classFile = classFiles[i];
		// null out the classfile backpointer to a type binding
		classFile.referenceBinding = null;
		classFile.innerClassesBindings = null;
		classFile.bootstrapMethods = null;
		classFile.missingTypes = null;
		classFile.visitedTypes = null;
	}

	this.suppressWarningAnnotations = null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:CompilationUnitDeclaration.java

示例8: propagateInnerEmulationForAllLocalTypes

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void propagateInnerEmulationForAllLocalTypes() {
	this.isPropagatingInnerClassEmulation = true;
	for (int i = 0, max = this.localTypeCount; i < max; i++) {
		LocalTypeBinding localType = this.localTypes[i];
		// only propagate for reachable local types
		if ((localType.scope.referenceType().bits & IsReachable) != 0) {
			localType.updateInnerEmulationDependents();
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:CompilationUnitDeclaration.java

示例9: record

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void record(LocalTypeBinding localType) {
	if (this.localTypeCount == 0) {
		this.localTypes = new LocalTypeBinding[5];
	} else if (this.localTypeCount == this.localTypes.length) {
		System.arraycopy(this.localTypes, 0, (this.localTypes = new LocalTypeBinding[this.localTypeCount * 2]), 0, this.localTypeCount);
	}
	this.localTypes[this.localTypeCount++] = localType;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:CompilationUnitDeclaration.java

示例10: cleanUp

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public void cleanUp() {
	if (this.types != null) {
		for (int i = 0, max = this.types.length; i < max; i++) {
			cleanUp(this.types[i]);
		}
		for (int i = 0, max = this.localTypeCount; i < max; i++) {
		    LocalTypeBinding localType = this.localTypes[i];
			// null out the type's scope backpointers
			localType.scope = null; // local members are already in the list
			localType.enclosingCase = null;
		}
	}

	this.compilationResult.recoveryScannerData = null; // recovery is already done

	ClassFile[] classFiles = this.compilationResult.getClassFiles();
	for (int i = 0, max = classFiles.length; i < max; i++) {
		// clear the classFile back pointer to the bindings
		ClassFile classFile = classFiles[i];
		// null out the classfile backpointer to a type binding
		classFile.referenceBinding = null;
		classFile.innerClassesBindings = null;
		classFile.missingTypes = null;
		classFile.visitedTypes = null;
	}

	this.suppressWarningAnnotations = null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:29,代码来源:CompilationUnitDeclaration.java

示例11: resolveType

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
public TypeBinding resolveType(BlockScope scope) {
	super.resolveType(scope);

	if (this.binding == null) {
		throw new SelectionNodeFound();
	}

	// tolerate some error cases
	if (!this.binding.isValidBinding()) {
		switch (this.binding.problemId()) {
			case ProblemReasons.NotVisible:
				// visibility is ignored
				break;
			case ProblemReasons.NotFound:
				if (this.resolvedType != null && this.resolvedType.isValidBinding()) {
					throw new SelectionNodeFound(this.resolvedType);
				}
				throw new SelectionNodeFound();
			default:
				throw new SelectionNodeFound();
		}
	}

	if (this.anonymousType == null)
		throw new SelectionNodeFound(this.binding);

	// if selecting a type for an anonymous type creation, we have to
	// find its target super constructor (if extending a class) or its target
	// super interface (if extending an interface)
	if (this.anonymousType.binding != null) {
		LocalTypeBinding localType = (LocalTypeBinding) this.anonymousType.binding;
		if (localType.superInterfaces == Binding.NO_SUPERINTERFACES) {
			// find the constructor binding inside the super constructor call
			ConstructorDeclaration constructor = (ConstructorDeclaration) this.anonymousType.declarationOf(this.binding.original());
			if (constructor != null) {
				throw new SelectionNodeFound(constructor.constructorCall.binding);
			}
			throw new SelectionNodeFound(this.binding);
		}
		// open on the only super interface
		throw new SelectionNodeFound(localType.superInterfaces[0]);
	} else {
		if (this.resolvedType.isInterface()) {
			throw new SelectionNodeFound(this.resolvedType);
		}
		throw new SelectionNodeFound(this.binding);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:49,代码来源:SelectionOnQualifiedAllocationExpression.java

示例12: createTypes

import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; //导入依赖的package包/类
private void createTypes(TypeDeclaration x) {
  SourceInfo info = makeSourceInfo(x);
  try {
    SourceTypeBinding binding = x.binding;
    String name;
    if (binding instanceof LocalTypeBinding) {
      char[] localName = binding.constantPoolName();
      name = new String(localName).replace('/', '.');
    } else {
      name = dotify(binding.compoundName);
    }
    name = intern(name);
    JDeclaredType type;
    if (binding.isClass()) {
      type = new JClassType(info, name, binding.isAbstract(), binding.isFinal());
    } else if (binding.isInterface() || binding.isAnnotationType()) {
      type = new JInterfaceType(info, name);
    } else if (binding.isEnum()) {
      if (binding.isAnonymousType()) {
        // Don't model an enum subclass as a JEnumType.
        type = new JClassType(info, name, false, true);
      } else {
        type = new JEnumType(info, name, binding.isAbstract());
      }
    } else {
      throw new InternalCompilerException("ReferenceBinding is not a class, interface, or enum.");
    }
    typeMap.setSourceType(binding, type);
    newTypes.add(type);
    if (x.memberTypes != null) {
      for (TypeDeclaration memberType : x.memberTypes) {
        createTypes(memberType);
      }
    }
  } catch (Throwable e) {
    InternalCompilerException ice = translateException(null, e);
    StringBuffer sb = new StringBuffer();
    x.printHeader(0, sb);
    ice.addNode(x.getClass().getName(), sb.toString(), info);
    throw ice;
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:43,代码来源:GwtAstBuilder.java


注:本文中的org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。