當前位置: 首頁>>代碼示例>>Java>>正文


Java SingleVariableDeclaration.resolveBinding方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.dom.SingleVariableDeclaration.resolveBinding方法的典型用法代碼示例。如果您正苦於以下問題:Java SingleVariableDeclaration.resolveBinding方法的具體用法?Java SingleVariableDeclaration.resolveBinding怎麽用?Java SingleVariableDeclaration.resolveBinding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.dom.SingleVariableDeclaration的用法示例。


在下文中一共展示了SingleVariableDeclaration.resolveBinding方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ensureParameterFromSingleVariableDeclaration

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
public Parameter ensureParameterFromSingleVariableDeclaration(SingleVariableDeclaration variableDeclaration,
		Method method) {
	String name = variableDeclaration.getName().toString();
	String qualifiedName = Famix.qualifiedNameOf(method) + NAME_SEPARATOR + name;
	if (parameters.has(qualifiedName)) 
		return parameters.named(qualifiedName);
	Parameter parameter = new Parameter();
	parameters.add(qualifiedName, parameter);
	parameter.setName(name);
	parameter.setParentBehaviouralEntity(method);
	parameter.setDeclaredType(ensureTypeFromDomType(variableDeclaration.getType()));
	IVariableBinding binding = variableDeclaration.resolveBinding();
	if (binding != null) {
		createAnnotationInstancesToEntityFromAnnotationBinding(parameter, binding.getAnnotations());
		//We only recover the final modifier
		if (Modifier.isFinal(binding.getModifiers())) parameter.addModifiers("final");
	}
	return parameter;
}
 
開發者ID:feenkcom,項目名稱:jdt2famix,代碼行數:20,代碼來源:InJavaImporter.java

示例2: isExceptionCaught

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
boolean isExceptionCaught(ITypeBinding excpetionType) {
	for (Iterator<List<CatchClause>> exceptions= fExceptionStack.iterator(); exceptions.hasNext(); ) {
		for (Iterator<CatchClause> catchClauses= exceptions.next().iterator(); catchClauses.hasNext(); ) {
			SingleVariableDeclaration caughtException= catchClauses.next().getException();
			IVariableBinding binding= caughtException.resolveBinding();
			if (binding == null) {
				continue;
			}
			ITypeBinding caughtype= binding.getType();
			while (caughtype != null) {
				if (caughtype == excpetionType) {
					return true;
				}
				caughtype= caughtype.getSuperclass();
			}
		}
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:20,代碼來源:FlowContext.java

示例3: extractParametersFromSource

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
private void extractParametersFromSource(List<Variable> parametersVarList,
		IMethod javaElement) {
	Option<MethodDeclaration> mDecl = WorkspaceUtilities.getMethodDeclFromModel(javaElement);
	MethodDeclaration mmDecl = mDecl.unwrap();

	List<SingleVariableDeclaration> parameters = mmDecl.parameters();
	for (SingleVariableDeclaration param : parameters) {
		IVariableBinding paramBinding = param.resolveBinding();
		if(!paramBinding.getType().isPrimitive()){
			Variable paramVariable = this.tm.getVariableFromBindingKey(paramBinding.getKey());
			if(paramVariable!=null){
				parametersVarList.add(paramVariable);
			}
		}
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:17,代碼來源:PushIntoOwnedTransferFunctions.java

示例4: isExceptionCaught

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
boolean isExceptionCaught(ITypeBinding excpetionType) {
  for (Iterator<List<CatchClause>> exceptions = fExceptionStack.iterator();
      exceptions.hasNext(); ) {
    for (Iterator<CatchClause> catchClauses = exceptions.next().iterator();
        catchClauses.hasNext(); ) {
      SingleVariableDeclaration caughtException = catchClauses.next().getException();
      IVariableBinding binding = caughtException.resolveBinding();
      if (binding == null) continue;
      ITypeBinding caughtype = binding.getType();
      while (caughtype != null) {
        if (caughtype == excpetionType) return true;
        caughtype = caughtype.getSuperclass();
      }
    }
  }
  return false;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:FlowContext.java

示例5: visit

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
/**
 * This is a data dependency if this is a declaration and the
 * variable being declared is in the right hand side of the
 * seed assignment expression.
 */
public boolean visit(SingleVariableDeclaration node){
	IBinding binding = node.resolveBinding();
	
	if(binding == null){
		if(this.aliases.contains((node.getName().getFullyQualifiedName())))
			this.result = true;			
	}
	else if(binding instanceof IVariableBinding){
		/* If this variable is in the alias list, then this statement 
		 * is a data dependency. */
		if(this.aliases.contains(binding.getKey())){
			this.result = true;
		}
	}
	
	return false;
}
 
開發者ID:qhanam,項目名稱:Slicer,代碼行數:23,代碼來源:BDDVisitor.java

示例6: isMainMethod

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
/**
 * Returns true iff 'methodDeclaration' represents a void static method named 'main' that takes a
 * single String[] parameter.
 */
private static boolean isMainMethod(MethodDeclaration methodDeclaration) {
  // Is it static?
  if ((methodDeclaration.getModifiers() & Modifier.STATIC) == 0) {
    return false;
  }
  // Does it return void?
  Type returnType = methodDeclaration.getReturnType2();
  if (!returnType.isPrimitiveType()) {
    return false;
  }
  if (((PrimitiveType) returnType).getPrimitiveTypeCode() != PrimitiveType.VOID) {
    return false;
  }
  // Is it called 'main'?
  if (!"main".equals(methodDeclaration.getName().getIdentifier())) {
    return false;
  }
  // Does it have a single parameter?
  if (methodDeclaration.parameters().size() != 1) {
    return false;
  }

  // Is the parameter's type String[]?
  SingleVariableDeclaration pt =
      getOnlyElement((List<SingleVariableDeclaration>) methodDeclaration.parameters());
  IVariableBinding vb = pt.resolveBinding();
  if (vb == null) {
    return false;
  }
  ITypeBinding tb = vb.getType();
  return tb != null && "java.lang.String[]".equals(tb.getQualifiedName());
}
 
開發者ID:bazelbuild,項目名稱:BUILD_file_generator,代碼行數:37,代碼來源:JavaSourceFileParser.java

示例7: endVisit

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
@Override
public void endVisit(SingleVariableDeclaration node) {
	if (skipNode(node)) {
		return;
	}

	IVariableBinding binding = node.resolveBinding();
	LocalFlowInfo nameInfo = null;
	Expression initializer = node.getInitializer();
	if (binding != null && !binding.isField() && initializer != null) {
		nameInfo = new LocalFlowInfo(binding, FlowInfo.WRITE, fFlowContext);
	}
	GenericSequentialFlowInfo info = processSequential(node, node.getType(), initializer);
	info.merge(nameInfo, fFlowContext);
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:16,代碼來源:FlowAnalyzer.java

示例8: visit

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
@Override
   public boolean visit(SingleVariableDeclaration node) {
	IVariableBinding variableBinding = node.resolveBinding();
	addNewBinding(variableBinding, node);
	addNewTypeBinding(variableBinding.getType());
	return true;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:8,代碼來源:WorkspaceUtilities.java

示例9: visit

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
@Override
public boolean visit(CatchClause node) {
  SingleVariableDeclaration exception = node.getException();
  IVariableBinding variableBinding = exception.resolveBinding();
  VariableVariable2 cv = fTCModel.makeDeclaredVariableVariable(variableBinding, fCU);
  setConstraintVariable(exception, cv);
  return true;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:9,代碼來源:InferTypeArgumentsConstraintCreator.java

示例10: initialize

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
public void initialize() {
  Block body = fDeclaration.getBody();
  // first collect the static imports. This is necessary to not mark
  // static imported fields and methods as implicit visible.
  fTypesToImport = new ArrayList<SimpleName>();
  fStaticsToImport = new ArrayList<SimpleName>();
  ImportReferencesCollector.collect(
      body, fTypeRoot.getJavaProject(), null, fTypesToImport, fStaticsToImport);

  // Now collect implicit references and name references
  body.accept(new UpdateCollector());

  int numberOfLocals = LocalVariableIndex.perform(fDeclaration);
  FlowContext context = new FlowContext(0, numberOfLocals + 1);
  context.setConsiderAccessMode(true);
  context.setComputeMode(FlowContext.MERGE);
  InOutFlowAnalyzer flowAnalyzer = new InOutFlowAnalyzer(context);
  FlowInfo info = flowAnalyzer.perform(getStatements());

  for (Iterator<SingleVariableDeclaration> iter = fDeclaration.parameters().iterator();
      iter.hasNext(); ) {
    SingleVariableDeclaration element = iter.next();
    IVariableBinding binding = element.resolveBinding();
    ParameterData data = (ParameterData) element.getProperty(ParameterData.PROPERTY);
    data.setAccessMode(info.getAccessMode(context, binding));
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:28,代碼來源:SourceAnalyzer.java

示例11: visit

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
/**
 * This is a data dependency if this is a declaration and the
 * variable being declared is in the right hand side of the
 * seed assignment expression.
 */
public boolean visit(SingleVariableDeclaration node){
	IBinding binding = node.resolveBinding();
	
	if(binding == null){
		this.seedVariables.add(node.getName().getFullyQualifiedName());		
	}
	else if(binding instanceof IVariableBinding){
		this.seedVariables.add(binding.getKey());
	}
	
	return false;
}
 
開發者ID:qhanam,項目名稱:Slicer,代碼行數:18,代碼來源:FDDSeedVisitor.java

示例12: clearAccessMode

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
private void clearAccessMode(FlowInfo info, SingleVariableDeclaration decl) {
	IVariableBinding binding = decl.resolveBinding();
	if (binding != null && !binding.isField()) {
		info.clearAccessMode(binding, fFlowContext);
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:7,代碼來源:InOutFlowAnalyzer.java

示例13: clearAccessMode

import org.eclipse.jdt.core.dom.SingleVariableDeclaration; //導入方法依賴的package包/類
private void clearAccessMode(FlowInfo info, SingleVariableDeclaration decl) {
  IVariableBinding binding = decl.resolveBinding();
  if (binding != null && !binding.isField()) info.clearAccessMode(binding, fFlowContext);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:5,代碼來源:InOutFlowAnalyzer.java


注:本文中的org.eclipse.jdt.core.dom.SingleVariableDeclaration.resolveBinding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。