@Override public boolean isVarArgs() { return mVariable instanceof Argument && ((Argument)mVariable).isVarArgs(); } }
private boolean isVarArgs() { Argument[] arguments = m_astNode.arguments; if (arguments != null && arguments.length > 0) { return arguments[arguments.length - 1].isVarArgs(); } return false; }
/** * Creates a parameter. If the argument have a type == null, we get the type from its binding. A type == null is possible when * this type is implicit like in a lambda where you don't need to specify the type of parameters. * * @param argument * Used to get the name of the parameter, the modifiers, know if it is a var args parameter. * @return a parameter. */ <T> CtParameter<T> createParameter(Argument argument) { CtParameter<T> p = jdtTreeBuilder.getFactory().Core().createParameter(); p.setSimpleName(CharOperation.charToString(argument.name)); p.setVarArgs(argument.isVarArgs()); p.setExtendedModifiers(getModifiers(argument.modifiers, false, false)); if (argument.binding != null && argument.binding.type != null && argument.type == null) { p.setType(jdtTreeBuilder.getReferencesBuilder().<T>getTypeReference(argument.binding.type)); p.getType().setImplicit(argument.type == null); if (p.getType() instanceof CtArrayTypeReference) { ((CtArrayTypeReference) p.getType()).getComponentType().setImplicit(argument.type == null); } } return p; }
Argument[] arguments = methodDeclaration.arguments; boolean isVarargs = arguments != null && arguments.length > 0 && arguments[arguments.length - 1].isVarArgs(); String parameterList = getParameterList(methodBinding, isVarargs); String returnType = getReturnType(methodBinding);
Argument[] arguments = methodDeclaration.arguments; boolean isVarargs = arguments != null && arguments.length > 0 && arguments[arguments.length - 1].isVarArgs(); String parameterList = getParameterList(methodBinding, isVarargs); String returnType = getReturnType(methodBinding);
int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0 && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { if (argTypes[--argLength].isVarArgs()) method.binding.modifiers |= ClassFileConstants.AccVarargs; while (--argLength >= 0) { if (argTypes[argLength].isVarArgs()) problemReporter().illegalVararg(argTypes[argLength], method);
int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0 && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { if (argTypes[--argLength].isVarArgs()) method.binding.modifiers |= ClassFileConstants.AccVarargs; while (--argLength >= 0) { if (argTypes[argLength].isVarArgs()) problemReporter().illegalVararg(argTypes[argLength], method);
@Nullable static MethodItem create(@Nullable String classFqn, @NonNull ClassKind classKind, @NonNull AbstractMethodDeclaration declaration, @Nullable MethodBinding binding) { if (classFqn == null || binding == null) { return null; } String returnType = getReturnType(binding); String methodName = getMethodName(binding); Argument[] arguments = declaration.arguments; boolean isVarargs = arguments != null && arguments.length > 0 && arguments[arguments.length - 1].isVarArgs(); String parameterList = getParameterList(binding, isVarargs); if (returnType == null || methodName == null) { return null; } //noinspection PointlessBooleanExpression,ConstantConditions if (!INCLUDE_TYPE_ARGS) { classFqn = ApiDatabase.getRawClass(classFqn); methodName = ApiDatabase.getRawMethod(methodName); } return new MethodItem(classFqn, classKind, returnType, methodName, parameterList, binding.isConstructor()); }
int argLength = argTypes == null ? 0 : argTypes.length; if (argLength > 0 && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { if (argTypes[--argLength].isVarArgs()) method.binding.modifiers |= ClassFileConstants.AccVarargs; while (--argLength >= 0) { if (argTypes[argLength].isVarArgs()) problemReporter().illegalVararg(argTypes[argLength], method);
@Nullable static MethodItem create(@Nullable String classFqn, @NonNull ClassKind classKind, @NonNull AbstractMethodDeclaration declaration, @Nullable MethodBinding binding) { if (classFqn == null || binding == null) { return null; } String returnType = getReturnType(binding); String methodName = getMethodName(binding); Argument[] arguments = declaration.arguments; boolean isVarargs = arguments != null && arguments.length > 0 && arguments[arguments.length - 1].isVarArgs(); String parameterList = getParameterList(binding, isVarargs); if (returnType == null || methodName == null) { return null; } //noinspection PointlessBooleanExpression,ConstantConditions if (!INCLUDE_TYPE_ARGS) { classFqn = ApiDatabase.getRawClass(classFqn); methodName = ApiDatabase.getRawMethod(methodName); } return new MethodItem(classFqn, classKind, returnType, methodName, parameterList, binding.isConstructor()); }
parametersBindings = methodBinding.parameters; if(areParametersCompatibleWith(parametersBindings, arguments, parameters[parametersLength - 1].isVarArgs())) { findFieldsAndMethodsFromMissingType( method.returnType,
parametersBindings = methodBinding.parameters; if(areParametersCompatibleWith(parametersBindings, arguments, parameters[parametersLength - 1].isVarArgs())) { findFieldsAndMethodsFromMissingType( method.returnType,
@Override public boolean visit(Argument argument, BlockScope scope) { CtParameter<Object> p = factory.Core().createParameter(); p.setSimpleName(new String(argument.name)); p.setVarArgs(argument.isVarArgs()); p.setModifiers(getModifiers(argument.modifiers)); if (argument.type != null) { p.setType(references.getTypeReference(argument.type.resolvedType)); } else if (argument.binding != null && argument.binding.type != null) { if (argument.binding.type instanceof WildcardBinding) { p.setType(references.getTypeReference((((WildcardBinding) argument.binding.type).bound))); } else { p.setType(references.getTypeReference((argument.binding.type))); } } context.enter(p, argument); if (argument.initialization != null) { argument.initialization.traverse(this, scope); } if (argument.annotations != null) { for (Annotation a : argument.annotations) { // TODO Sorry for that but there is a bug in JDT : https://bugs.eclipse.org/bugs/show_bug.cgi?id=459528 if (isContainsInTypeAnnotation(argument.type.resolvedType, a)) { a.traverse(this, scope); } } } return false; }
if (argument.isVarArgs()) { this.scribe.printNextToken(TerminalTokens.TokenNameELLIPSIS, this.preferences.insert_space_before_ellipsis); if (this.preferences.insert_space_after_ellipsis) {
final int extraDimensions = retrieveExtraDimension(nameEnd + 1, typeSourceEnd); variableDecl.setExtraDimensions(extraDimensions); final boolean isVarArgs = argument.isVarArgs(); if (isVarArgs && extraDimensions == 0) {
if (argLength > 0) { Argument argument = argTypes[--argLength]; if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) {
if (argLength > 0) { Argument argument = argTypes[--argLength]; if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) {
if (argLength > 0) { Argument argument = argTypes[--argLength]; if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) method.binding.modifiers |= ClassFileConstants.AccVarargs; if (CharOperation.equals(argument.name, ConstantPool.This)) { if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) problemReporter().illegalVararg(argument, method); if (CharOperation.equals(argument.name, ConstantPool.This)) {
if (argument.isVarArgs()) { Annotation [][] annotationsOnDimensions = argumentType.getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) {
if (argument.isVarArgs()) { Annotation [][] annotationsOnDimensions = argumentType.getAnnotationsOnDimensions(true); if (annotationsOnDimensions != null) {