if (modifier instanceof org.eclipse.jdt.core.dom.Annotation) { org.eclipse.jdt.core.dom.Annotation annotation = (org.eclipse.jdt.core.dom.Annotation)modifier; String qualifiedAnnotationName = annotation.resolveTypeBinding().getQualifiedName(); if (!"java.lang.Override".equals(qualifiedAnnotationName) && !"java.lang.SuppressWarnings".equals(qualifiedAnnotationName)) annotations.add(annotation);
signature.append("@").append(annotation.resolveTypeBinding().getQualifiedName()); if (!values.isEmpty()) { signature.append("(");
private static boolean isStringType(ITypeBinding binding) { if (binding == null) return false; return "java.lang.String".equals(binding.getQualifiedName()); //$NON-NLS-1$ }
private static IAnnotationBinding findTargetAnnotation(IAnnotationBinding[] metaAnnotations) { for (int i= 0; i < metaAnnotations.length; i++) { IAnnotationBinding binding= metaAnnotations[i]; ITypeBinding annotationType= binding.getAnnotationType(); if (annotationType != null && annotationType.getQualifiedName().equals(Target.class.getName())) { return binding; } } return null; }
public boolean isAssignmentCompatible(ITypeBinding typeBinding) { if ("java.lang.Object".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$ return true; } // since recovered binding are not unique isEqualTo is required return isEqualTo(typeBinding); }
public boolean isSubTypeCompatible(ITypeBinding typeBinding) { if ("java.lang.Object".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$ return true; } // since recovered binding are not unique isEqualTo is required return isEqualTo(typeBinding); }
private boolean annotates(IAnnotationBinding[] annotations) { for (int i= 0; i < annotations.length; i++) { ITypeBinding annotationType= annotations[i].getAnnotationType(); if (annotationType != null && (annotationType.getQualifiedName().equals(fName))) { return true; } } return false; }
public boolean isSubTypeCompatible(ITypeBinding typeBinding) { if ("java.lang.Object".equals(typeBinding.getQualifiedName())) { //$NON-NLS-1$ return true; } // since recovered binding are not unique isEqualTo is required return isEqualTo(typeBinding); }
/** * Returns whether the provided type binding represents the provided primitive type. * * @param typeBinding the type binding to analyze * @param primitiveTypeName the primitive type name * @return true if the provided type binding represents the provided primitive type, false otherwise */ public static boolean isPrimitive(ITypeBinding typeBinding, String primitiveTypeName) { return typeBinding != null && typeBinding.isPrimitive() && typeBinding.getQualifiedName().equals(primitiveTypeName); }
private static IAnnotationBinding findTargetAnnotation(IAnnotationBinding[] metaAnnotations) { for (int i= 0; i < metaAnnotations.length; i++) { IAnnotationBinding binding= metaAnnotations[i]; ITypeBinding annotationType= binding.getAnnotationType(); if (annotationType != null && annotationType.getQualifiedName().equals(Target.class.getName())) { return binding; } } return null; }
public static boolean isAnyNullAnnotation(ITypeBinding annotationType, IJavaProject project) { String qualifiedName= annotationType.getQualifiedName(); return qualifiedName.equals(project.getOption(JavaCore.COMPILER_NONNULL_ANNOTATION_NAME, true)) || qualifiedName.equals(project.getOption(JavaCore.COMPILER_NULLABLE_ANNOTATION_NAME, true)); }
private static void addExceptionTypeLinkProposals(LinkedCorrectionProposal proposal, ITypeBinding exc, String key) { // all super classes except Object while (exc != null && !"java.lang.Object".equals(exc.getQualifiedName())) { //$NON-NLS-1$ proposal.addLinkedPositionProposal(key, exc); exc = exc.getSuperclass(); } }
private boolean needsNoSuperCall(ITypeBinding typeBinding, String name, ITypeBinding[] parameters) { Assert.isNotNull(typeBinding); IMethodBinding binding= Bindings.findMethodInHierarchy(typeBinding.getSuperclass(), name, parameters); if (binding != null && !Modifier.isAbstract(binding.getModifiers())) { ITypeBinding declaring= binding.getDeclaringClass(); return declaring.getQualifiedName().equals(JAVA_LANG_OBJECT); } return true; }
@Override protected boolean isTypeCompatible(final ITypeBinding variableType, final ITypeBinding refType) { return super.isTypeCompatible(variableType, refType) || hasType(variableType, getOrDefault(CAN_BE_CASTED_TO, refType.getErasure().getQualifiedName(), new String[0])); } }
@Override protected boolean isTypeCompatible(final ITypeBinding variableType, final ITypeBinding refType) { return super.isTypeCompatible(variableType, refType) || hasType(variableType, getOrDefault(CAN_BE_CASTED_TO, refType.getErasure().getQualifiedName(), new String[0])); } }
@Override protected boolean isTypeCompatible(final ITypeBinding variableType, final ITypeBinding refType) { return super.isTypeCompatible(variableType, refType) || hasType(variableType, getOrDefault(CAN_BE_CASTED_TO, refType.getErasure().getQualifiedName(), new String[0])); } }
private String getMethodName(IMethodBinding binding) { String argumentList = ""; ITypeBinding[] args = binding.getParameterTypes(); for(ITypeBinding arg : args) { argumentList += arg.getName(); } String method = binding.getDeclaringClass().getQualifiedName() + "." + binding.getName() + "/" + binding.getTypeArguments().length + "[" + argumentList + "]"; return method; }
@Override public boolean visit(EnumDeclaration node) { ITypeBinding binding = node.resolveBinding(); if (binding != null) { IReferenceTypeDescriptor desc = Factory.typeDescriptor(binding.getQualifiedName()); IApiAnnotations annots = apidescription.resolveAnnotations(desc); if (annots != null && !RestrictionModifiers.isUnrestricted(annots.getRestrictions())) { updateNode(node, annots); } } return true; }
private void rewriteExpression(ASTNode node, Expression exp, ITypeBinding type) { ImportRewriteContext context= new ContextSensitiveImportRewriteContext(exp, fCuRewrite.getImportRewrite()); Type typeNode= fCuRewrite.getImportRewrite().addImport(type, fCuRewrite.getAST(), context); fCuRewrite.getASTRewrite().replace(exp, typeNode, fCuRewrite.createGroupDescription(REFERENCE_UPDATE)); fCuRewrite.getImportRemover().registerAddedImport(type.getQualifiedName()); fCuRewrite.getImportRemover().registerRemovedNode(exp); fNeedsImport= true; nonStaticAccess(node); }
private void replaceStringValueOfByArg0(final Expression toReplace, final MethodInvocation mi) { final ASTBuilder b = this.ctx.getASTBuilder(); final ITypeBinding expectedType = mi.resolveMethodBinding().getParameterTypes()[0]; final ITypeBinding actualType = arg0(mi).resolveTypeBinding(); if (!expectedType.equals(actualType) && !getBoxedTypeBinding(expectedType, mi.getAST()).equals(actualType)) { ctx.getRefactorings().replace(toReplace, b.cast(b.type(expectedType.getQualifiedName()), b.move(arg0(mi)))); } else { ctx.getRefactorings().replace(toReplace, b.parenthesizeIfNeeded(b.move(arg0(mi)))); } }