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


Java JdtFlags.isVarargs方法代码示例

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


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

示例1: checkOriginalVarargs

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private RefactoringStatus checkOriginalVarargs() throws JavaModelException {
  if (JdtFlags.isVarargs(fMethod)) fOldVarargIndex = fMethod.getNumberOfParameters() - 1;
  List<ParameterInfo> notDeletedInfos = getNotDeletedInfos();
  for (int i = 0; i < notDeletedInfos.size(); i++) {
    ParameterInfo info = notDeletedInfos.get(i);
    if (info.isOldVarargs() && !info.isNewVarargs())
      return RefactoringStatus.createFatalErrorStatus(
          Messages.format(
              RefactoringCoreMessages.ChangeSignatureRefactoring_cannot_convert_vararg,
              BasicElementLabels.getJavaElementName(info.getNewName())));
    if (i != notDeletedInfos.size() - 1) {
      // not the last parameter
      if (info.isNewVarargs())
        return RefactoringStatus.createFatalErrorStatus(
            Messages.format(
                RefactoringCoreMessages.ChangeSignatureRefactoring_vararg_must_be_last,
                BasicElementLabels.getJavaElementName(info.getNewName())));
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ChangeSignatureProcessor.java

示例2: checkOriginalVarargs

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private RefactoringStatus checkOriginalVarargs() throws JavaModelException {
	if (JdtFlags.isVarargs(fMethod))
		fOldVarargIndex= fMethod.getNumberOfParameters() - 1;
	List<ParameterInfo> notDeletedInfos= getNotDeletedInfos();
	for (int i= 0; i < notDeletedInfos.size(); i++) {
		ParameterInfo info= notDeletedInfos.get(i);
		if (info.isOldVarargs() && ! info.isNewVarargs())
			return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_cannot_convert_vararg, BasicElementLabels.getJavaElementName(info.getNewName())));
		if (i != notDeletedInfos.size() - 1) {
			// not the last parameter
			if (info.isNewVarargs())
				return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_vararg_must_be_last, BasicElementLabels.getJavaElementName(info.getNewName())));
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ChangeSignatureProcessor.java

示例3: checkVarargs

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private RefactoringStatus checkVarargs() throws JavaModelException {
  RefactoringStatus result = checkOriginalVarargs();
  if (result != null) return result;

  if (fRippleMethods != null) {
    for (int iRipple = 0; iRipple < fRippleMethods.length; iRipple++) {
      IMethod rippleMethod = fRippleMethods[iRipple];
      if (!JdtFlags.isVarargs(rippleMethod)) continue;

      // Vararg method can override method that takes an array as last argument
      fOldVarargIndex = rippleMethod.getNumberOfParameters() - 1;
      List<ParameterInfo> notDeletedInfos = getNotDeletedInfos();
      for (int i = 0; i < notDeletedInfos.size(); i++) {
        ParameterInfo info = notDeletedInfos.get(i);
        if (fOldVarargIndex != -1
            && info.getOldIndex() == fOldVarargIndex
            && !info.isNewVarargs()) {
          String rippleMethodType = rippleMethod.getDeclaringType().getFullyQualifiedName('.');
          String message =
              Messages.format(
                  RefactoringCoreMessages.ChangeSignatureRefactoring_ripple_cannot_convert_vararg,
                  new Object[] {
                    BasicElementLabels.getJavaElementName(info.getNewName()),
                    BasicElementLabels.getJavaElementName(rippleMethodType)
                  });
          return RefactoringStatus.createFatalErrorStatus(
              message, JavaStatusContext.create(rippleMethod));
        }
      }
    }
  }

  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:ChangeSignatureProcessor.java

示例4: checkVarargs

import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private RefactoringStatus checkVarargs() throws JavaModelException {
	RefactoringStatus result= checkOriginalVarargs();
	if (result != null)
		return result;

	if (fRippleMethods != null) {
		for (int iRipple= 0; iRipple < fRippleMethods.length; iRipple++) {
			IMethod rippleMethod= fRippleMethods[iRipple];
			if (! JdtFlags.isVarargs(rippleMethod))
				continue;

			// Vararg method can override method that takes an array as last argument
			fOldVarargIndex= rippleMethod.getNumberOfParameters() - 1;
			List<ParameterInfo> notDeletedInfos= getNotDeletedInfos();
			for (int i= 0; i < notDeletedInfos.size(); i++) {
				ParameterInfo info= notDeletedInfos.get(i);
				if (fOldVarargIndex != -1 && info.getOldIndex() == fOldVarargIndex && ! info.isNewVarargs()) {
					String rippleMethodType= rippleMethod.getDeclaringType().getFullyQualifiedName('.');
					String message= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_ripple_cannot_convert_vararg, new Object[] { BasicElementLabels.getJavaElementName(info.getNewName()), BasicElementLabels.getJavaElementName(rippleMethodType)});
					return RefactoringStatus.createFatalErrorStatus(message, JavaStatusContext.create(rippleMethod));
				}
			}
		}
	}

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


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