本文整理了Java中org.eclipse.jdt.core.Flags.isVarargs()
方法的一些代码示例,展示了Flags.isVarargs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flags.isVarargs()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.Flags
类名称:Flags
方法名:isVarargs
[英]Returns whether the given integer has the AccVarargs
bit set.
[中]返回给定整数是否设置了AccVarargs
位。
代码示例来源:origin: eclipse/eclipse.jdt.ls
public static boolean isVarargs(IMethod method) throws JavaModelException{
return Flags.isVarargs(method.getFlags());
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public static boolean isVarargs(IMethod method) throws JavaModelException{
return Flags.isVarargs(method.getFlags());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core.manipulation
public static boolean isVarargs(IMethod method) throws JavaModelException{
return Flags.isVarargs(method.getFlags());
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
public static boolean isVarargs(IMethod method) throws JavaModelException{
return Flags.isVarargs(method.getFlags());
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
int length;
if (parameters != null && (length = parameters.length) > 0) {
boolean isVarargs = Flags.isVarargs(flags);
for (int i = 0; i < length; i++) {
try {
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
int length;
if (parameters != null && (length = parameters.length) > 0) {
boolean isVarargs = Flags.isVarargs(flags);
for (int i = 0; i < length; i++) {
try {
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
String[] params= meth.getParameterTypes();
IType declaringType= meth.getDeclaringType();
boolean isVararg= Flags.isVarargs(meth.getFlags());
int lastParam= params.length - 1;
for (int i= 0; i <= lastParam; i++) {
代码示例来源:origin: eclipse/eclipse.jdt.ls
public SignatureInformation toSignatureInformation(CompletionProposal methodProposal) {
SignatureInformation $ = new SignatureInformation();
StringBuilder desription = descriptionProvider.createMethodProposalDescription(methodProposal);
$.setLabel(desription.toString());
$.setDocumentation(this.computeJavaDoc(methodProposal));
char[] signature = SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames = methodProposal.findParameterNames(null);
char[][] parameterTypes = Signature.getParameterTypes(signature);
for (int i = 0; i < parameterTypes.length; i++) {
parameterTypes[i] = Signature.getSimpleName(Signature.toCharArray(SignatureUtil.getLowerBound(parameterTypes[i])));
}
if (Flags.isVarargs(methodProposal.getFlags())) {
int index = parameterTypes.length - 1;
parameterTypes[index] = convertToVararg(parameterTypes[index]);
}
List<ParameterInformation> parameterInfos = new LinkedList<>();
for (int i = 0; i < parameterTypes.length; i++) {
StringBuilder builder = new StringBuilder();
builder.append(parameterTypes[i]);
builder.append(' ');
builder.append(parameterNames[i]);
parameterInfos.add(new ParameterInformation(builder.toString()));
}
$.setParameters(parameterInfos);
return $;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static List createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List result= new ArrayList(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList(0);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private static List<ParameterInfo> createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List<ParameterInfo> result= new ArrayList<>(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList<>(0);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static List<ParameterInfo> createParameterInfoList(IMethod method) {
try {
String[] typeNames= method.getParameterTypes();
String[] oldNames= method.getParameterNames();
List<ParameterInfo> result= new ArrayList<>(typeNames.length);
for (int i= 0; i < oldNames.length; i++){
ParameterInfo parameterInfo;
if (i == oldNames.length - 1 && Flags.isVarargs(method.getFlags())) {
String varargSignature= typeNames[i];
int arrayCount= Signature.getArrayCount(varargSignature);
String baseSignature= Signature.getElementType(varargSignature);
if (arrayCount > 1)
baseSignature= Signature.createArraySignature(baseSignature, arrayCount - 1);
parameterInfo= new ParameterInfo(Signature.toString(baseSignature) + ParameterInfo.ELLIPSIS, oldNames[i], i);
} else {
parameterInfo= new ParameterInfo(Signature.toString(typeNames[i]), oldNames[i], i);
}
result.add(parameterInfo);
}
return result;
} catch(JavaModelException e) {
JavaPlugin.log(e);
return new ArrayList<>(0);
}
}
代码示例来源:origin: io.sarl/io.sarl.eclipse
/** Create the JvmOperation for the given JDT method.
*
* @param method the JDT method.
* @param context the context of the constructor.
* @return the JvmOperation
* @throws JavaModelException if the Java model is invalid.
*/
private JvmOperation getJvmOperation(IMethod method, JvmType context)
throws JavaModelException {
if (context instanceof JvmDeclaredType) {
final JvmDeclaredType declaredType = (JvmDeclaredType) context;
final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(method.getFlags()),
getFormalParameterProvider(method));
for (final JvmOperation jvmOperation : declaredType.getDeclaredOperations()) {
final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel(
jvmOperation.isVarArgs(),
jvmOperation.getParameters());
if (jvmSignature.equals(jdtSignature)) {
return jvmOperation;
}
}
}
return null;
}
代码示例来源:origin: angelozerr/jdt-codemining
private String getParameterLabel(IMethod method, ITypeBinding calledTypeBinding) throws JavaModelException {
ParameterMiningLabelBuilder label = new ParameterMiningLabelBuilder();
if (showType) {
String paramType = "";
if (calledTypeBinding.isParameterizedType()) {
// ex : List<String>
ITypeBinding typeArgument = calledTypeBinding.getTypeArguments()[parameterIndex];
paramType = typeArgument.getName();
} else {
paramType = method.getParameterTypes()[parameterIndex];
paramType = Signature.getSimpleName(Signature.toString(Signature.getTypeErasure(paramType)));
// replace [] with ... when varArgs
if (parameterIndex == method.getParameterTypes().length - 1 && Flags.isVarargs(method.getFlags())) {
paramType = paramType.substring(0, paramType.length() - 2) + "...";
}
}
label.addParameterInfo(paramType);
}
if (showName) {
String paramName = method.getParameterNames()[parameterIndex];
if (!isArgNumber(paramName, method)) {
label.addParameterInfo(paramName);
}
}
return label.toString();
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StyledString appendUnboundedParameterList(StyledString buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames= methodProposal.findParameterNames(null);
char[][] parameterTypes= Signature.getParameterTypes(signature);
for (int i= 0; i < parameterTypes.length; i++)
parameterTypes[i]= createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
if (Flags.isVarargs(methodProposal.getFlags())) {
int index= parameterTypes.length - 1;
parameterTypes[index]= convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StyledString appendUnboundedParameterList(StyledString buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames= methodProposal.findParameterNames(null);
char[][] parameterTypes= Signature.getParameterTypes(signature);
for (int i= 0; i < parameterTypes.length; i++)
parameterTypes[i]= createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
if (Flags.isVarargs(methodProposal.getFlags())) {
int index= parameterTypes.length - 1;
parameterTypes[index]= convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
代码示例来源:origin: eclipse/eclipse.jdt.ls
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StringBuilder appendUnboundedParameterList(StringBuilder buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames= methodProposal.findParameterNames(null);
char[][] parameterTypes= Signature.getParameterTypes(signature);
for (int i= 0; i < parameterTypes.length; i++) {
parameterTypes[i]= createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
}
if (Flags.isVarargs(methodProposal.getFlags())) {
int index= parameterTypes.length - 1;
parameterTypes[index]= convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Appends the parameter list to <code>buffer</code>.
*
* @param buffer the buffer to append to
* @param methodProposal the method proposal
* @return the modified <code>buffer</code>
*/
private StringBuffer appendUnboundedParameterList(StringBuffer buffer, CompletionProposal methodProposal) {
// TODO remove once https://bugs.eclipse.org/bugs/show_bug.cgi?id=85293
// gets fixed.
char[] signature= SignatureUtil.fix83600(methodProposal.getSignature());
char[][] parameterNames= methodProposal.findParameterNames(null);
char[][] parameterTypes= Signature.getParameterTypes(signature);
for (int i= 0; i < parameterTypes.length; i++)
parameterTypes[i]= createTypeDisplayName(SignatureUtil.getLowerBound(parameterTypes[i]));
if (Flags.isVarargs(methodProposal.getFlags())) {
int index= parameterTypes.length - 1;
parameterTypes[index]= convertToVararg(parameterTypes[index]);
}
return appendParameterSignature(buffer, parameterTypes, parameterNames);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
final IMethod method= (IMethod) members[index];
try {
if (Flags.isVarargs(method.getFlags()))
status.merge(RefactoringStatus.createErrorStatus(Messages.format(RefactoringCoreMessages.PullUpRefactoring_incompatible_language_constructs1, new String[] { JavaElementLabels.getTextLabel(members[index], JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(destination, JavaElementLabels.ALL_DEFAULT)}), JavaStatusContext.create(members[index])));
} catch (JavaModelException exception) {
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
final IMethod method= (IMethod) members[index];
try {
if (Flags.isVarargs(method.getFlags()))
status.merge(RefactoringStatus.createErrorStatus(Messages.format(RefactoringCoreMessages.PullUpRefactoring_incompatible_language_constructs1, new String[] { JavaElementLabels.getTextLabel(members[index], JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(destination, JavaElementLabels.ALL_DEFAULT)}), JavaStatusContext.create(members[index])));
} catch (JavaModelException exception) {
代码示例来源:origin: io.sarl/io.sarl.eclipse
/** Create the JvmConstructor for the given JDT constructor.
*
* @param constructor the JDT constructor.
* @param context the context of the constructor.
* @return the JvmConstructor
* @throws JavaModelException if the Java model is invalid.
*/
public JvmConstructor getJvmConstructor(IMethod constructor, XtendTypeDeclaration context)
throws JavaModelException {
if (constructor.isConstructor()) {
final JvmType type = this.typeReferences.findDeclaredType(
constructor.getDeclaringType().getFullyQualifiedName(),
context);
if (type instanceof JvmDeclaredType) {
final JvmDeclaredType declaredType = (JvmDeclaredType) type;
final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes(
Flags.isVarargs(constructor.getFlags()),
getFormalParameterProvider(constructor));
for (final JvmConstructor jvmConstructor : declaredType.getDeclaredConstructors()) {
final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel(
jvmConstructor.isVarArgs(),
jvmConstructor.getParameters());
if (jvmSignature.equals(jdtSignature)) {
return jvmConstructor;
}
}
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!