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


Java ReferenceBinding.isStatic方法代码示例

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


在下文中一共展示了ReferenceBinding.isStatic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: analyseCode

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
	// analyse the enclosing instance
	if (this.enclosingInstance != null) {
		flowInfo = this.enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
	} else {
		if (this.binding != null && this.binding.declaringClass != null) {
			ReferenceBinding superclass = this.binding.declaringClass.superclass();
			if (superclass != null && superclass.isMemberType() && !superclass.isStatic()) {
				// creating an anonymous type of a non-static member type without an enclosing instance of parent type
				currentScope.tagAsAccessingEnclosingInstanceStateOf(superclass.enclosingType(), false /* type variable access */);
				// Reviewed for https://bugs.eclipse.org/bugs/show_bug.cgi?id=378674 :
				// The corresponding problem (when called from static) is not produced until during code generation
			}
		}
		
	}

	// check captured variables are initialized in current context (26134)
	checkCapturedLocalInitializationIfNecessary(
		(ReferenceBinding)(this.anonymousType == null
			? this.binding.declaringClass.erasure()
			: this.binding.declaringClass.superclass().erasure()),
		currentScope,
		flowInfo);

	// process arguments
	if (this.arguments != null) {
		boolean analyseResources = currentScope.compilerOptions().analyseResourceLeaks;
		boolean hasResourceWrapperType = analyseResources 
					&& this.resolvedType instanceof ReferenceBinding 
					&& ((ReferenceBinding)this.resolvedType).hasTypeBit(TypeIds.BitWrapperCloseable);
		for (int i = 0, count = this.arguments.length; i < count; i++) {
			flowInfo = this.arguments[i].analyseCode(currentScope, flowContext, flowInfo);
			if (analyseResources && !hasResourceWrapperType) { // allocation of wrapped closeables is analyzed specially
				// if argument is an AutoCloseable insert info that it *may* be closed (by the target method, i.e.)
				flowInfo = FakedTrackingVariable.markPassedToOutside(currentScope, this.arguments[i], flowInfo, flowContext, false);
			}
			this.arguments[i].checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
		}
		analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments);
	}

	// analyse the anonymous nested type
	if (this.anonymousType != null) {
		flowInfo = this.anonymousType.analyseCode(currentScope, flowContext, flowInfo);
	}

	// record some dependency information for exception types
	ReferenceBinding[] thrownExceptions;
	if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
		if ((this.bits & ASTNode.Unchecked) != 0 && this.genericTypeArguments == null) {
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643, align with javac on JLS 15.12.2.6
			thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.thrownExceptions, true, true);
		}			
		// check exception handling
		flowContext.checkExceptionHandlers(
			thrownExceptions,
			this,
			flowInfo.unconditionalCopy(),
			currentScope);
	}

	// after having analysed exceptions above start tracking newly allocated resource:
	if (currentScope.compilerOptions().analyseResourceLeaks && FakedTrackingVariable.isAnyCloseable(this.resolvedType)) {
		FakedTrackingVariable.analyseCloseableAllocation(currentScope, flowInfo, this);
	}

	manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo);
	manageSyntheticAccessIfNecessary(currentScope, flowInfo);

	// account for possible exceptions thrown by constructor execution:
	flowContext.recordAbruptExit();

	return flowInfo;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:76,代码来源:QualifiedAllocationExpression.java

示例2: analyseCode

import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; //导入方法依赖的package包/类
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
	// analyse the enclosing instance
	if (this.enclosingInstance != null) {
		flowInfo = this.enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
	} else {
		if (this.binding != null && this.binding.declaringClass != null) {
			ReferenceBinding superclass = this.binding.declaringClass.superclass();
			if (superclass != null && superclass.isMemberType() && !superclass.isStatic()) {
				// creating an anonymous type of a non-static member type without an enclosing instance of parent type
				currentScope.resetDeclaringClassMethodStaticFlag(superclass.enclosingType());
			}
		}
		
	}

	// check captured variables are initialized in current context (26134)
	checkCapturedLocalInitializationIfNecessary(
		(ReferenceBinding)(this.anonymousType == null
			? this.binding.declaringClass.erasure()
			: this.binding.declaringClass.superclass().erasure()),
		currentScope,
		flowInfo);

	// process arguments
	if (this.arguments != null) {
		boolean analyseResources = currentScope.compilerOptions().analyseResourceLeaks;
		for (int i = 0, count = this.arguments.length; i < count; i++) {
			if (analyseResources) {
				// if argument is an AutoCloseable insert info that it *may* be closed (by the target method, i.e.)
				flowInfo = FakedTrackingVariable.markPassedToOutside(currentScope, this.arguments[i], flowInfo, false);
			}
			flowInfo = this.arguments[i].analyseCode(currentScope, flowContext, flowInfo);
			if ((this.arguments[i].implicitConversion & TypeIds.UNBOXING) != 0) {
				this.arguments[i].checkNPE(currentScope, flowContext, flowInfo);
			}
		}
		analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments);
	}

	// analyse the anonymous nested type
	if (this.anonymousType != null) {
		flowInfo = this.anonymousType.analyseCode(currentScope, flowContext, flowInfo);
	}

	// record some dependency information for exception types
	ReferenceBinding[] thrownExceptions;
	if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
		if ((this.bits & ASTNode.Unchecked) != 0 && this.genericTypeArguments == null) {
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643, align with javac on JLS 15.12.2.6
			thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.thrownExceptions, true, true);
		}			
		// check exception handling
		flowContext.checkExceptionHandlers(
			thrownExceptions,
			this,
			flowInfo.unconditionalCopy(),
			currentScope);
	}

	// after having analysed exceptions above start tracking newly allocated resource:
	if (currentScope.compilerOptions().analyseResourceLeaks && FakedTrackingVariable.isAnyCloseable(this.resolvedType)) {
		FakedTrackingVariable.analyseCloseableAllocation(currentScope, flowInfo, this);
	}

	manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo);
	manageSyntheticAccessIfNecessary(currentScope, flowInfo);
	return flowInfo;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:69,代码来源:QualifiedAllocationExpression.java


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