Java Code Examples for org.eclipse.jdt.core.dom.Modifier#isPublic()
The following examples show how to use
org.eclipse.jdt.core.dom.Modifier#isPublic() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StubUtility2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static IMethodBinding[] getDelegateCandidates(ITypeBinding binding, ITypeBinding hierarchy) { List<IMethodBinding> allMethods= new ArrayList<IMethodBinding>(); boolean isInterface= binding.isInterface(); IMethodBinding[] typeMethods= binding.getDeclaredMethods(); for (int index= 0; index < typeMethods.length; index++) { final int modifiers= typeMethods[index].getModifiers(); if (!typeMethods[index].isConstructor() && !Modifier.isStatic(modifiers) && (isInterface || Modifier.isPublic(modifiers))) { IMethodBinding result= Bindings.findOverriddenMethodInHierarchy(hierarchy, typeMethods[index]); if (result != null && Flags.isFinal(result.getModifiers())) continue; ITypeBinding[] parameterBindings= typeMethods[index].getParameterTypes(); boolean upper= false; for (int offset= 0; offset < parameterBindings.length; offset++) { if (parameterBindings[offset].isWildcardType() && parameterBindings[offset].isUpperbound()) upper= true; } if (!upper) allMethods.add(typeMethods[index]); } } return allMethods.toArray(new IMethodBinding[allMethods.size()]); }
Example 2
Source File: ScopeAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Evaluates if the declaration is visible in a certain context. * @param binding The binding of the declaration to examine * @param context The context to test in * @return Returns */ public static boolean isVisible(IBinding binding, ITypeBinding context) { if (binding.getKind() == IBinding.VARIABLE && !((IVariableBinding) binding).isField()) { return true; // all local variables found are visible } ITypeBinding declaring= getDeclaringType(binding); if (declaring == null) { return false; } declaring= declaring.getTypeDeclaration(); int modifiers= binding.getModifiers(); if (Modifier.isPublic(modifiers) || declaring.isInterface()) { return true; } else if (Modifier.isProtected(modifiers) || !Modifier.isPrivate(modifiers)) { if (declaring.getPackage() == context.getPackage()) { return true; } return isTypeInScope(declaring, context, Modifier.isProtected(modifiers)); } // private visibility return isTypeInScope(declaring, context, false); }
Example 3
Source File: BindingLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static ImageDescriptor getBaseImageDescriptor(IBinding binding, int flags) { if (binding instanceof ITypeBinding) { ITypeBinding typeBinding= (ITypeBinding) binding; if (typeBinding.isArray()) { typeBinding= typeBinding.getElementType(); } if (typeBinding.isCapture()) { typeBinding.getWildcard(); } return getTypeImageDescriptor(typeBinding.getDeclaringClass() != null, typeBinding, flags); } else if (binding instanceof IMethodBinding) { ITypeBinding type= ((IMethodBinding) binding).getDeclaringClass(); int modifiers= binding.getModifiers(); if (type.isEnum() && (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers) && !Modifier.isPrivate(modifiers)) && ((IMethodBinding) binding).isConstructor()) return JavaPluginImages.DESC_MISC_PRIVATE; return getMethodImageDescriptor(binding.getModifiers()); } else if (binding instanceof IVariableBinding) return getFieldImageDescriptor((IVariableBinding) binding); return JavaPluginImages.DESC_OBJS_UNKNOWN; }
Example 4
Source File: FindBrokenNLSKeysAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static boolean isValueAccessor(IMethod method) throws JavaModelException { if (!"getString".equals(method.getElementName())) //$NON-NLS-1$ return false; int flags= method.getFlags(); if (!Modifier.isStatic(flags) || !Modifier.isPublic(flags)) return false; String returnType= method.getReturnType(); if (!JAVA_LANG_STRING.equals(returnType)) return false; String[] parameters= method.getParameterTypes(); if (parameters.length != 1 || !JAVA_LANG_STRING.equals(parameters[0])) return false; return true; }
Example 5
Source File: BindingLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static ImageDescriptor getInnerClassImageDescriptor(int modifiers) { if (Modifier.isPublic(modifiers)) return JavaPluginImages.DESC_OBJS_INNER_CLASS_PUBLIC; else if (Modifier.isPrivate(modifiers)) return JavaPluginImages.DESC_OBJS_INNER_CLASS_PRIVATE; else if (Modifier.isProtected(modifiers)) return JavaPluginImages.DESC_OBJS_INNER_CLASS_PROTECTED; else return JavaPluginImages.DESC_OBJS_INNER_CLASS_DEFAULT; }
Example 6
Source File: InJavaImporter.java From jdt2famix with Eclipse Public License 1.0 | 5 votes |
private void extractBasicModifiersFromBinding(int modifiers, NamedEntity entity) { Boolean publicModifier = Modifier.isPublic(modifiers); Boolean protectedModifier = Modifier.isProtected(modifiers); Boolean privateModifier = Modifier.isPrivate(modifiers); if (publicModifier) entity.addModifiers("public"); if (protectedModifier) entity.addModifiers("protected"); if (privateModifier) entity.addModifiers("private"); if (!(publicModifier || protectedModifier || privateModifier)) entity.addModifiers("package"); if (Modifier.isFinal(modifiers)) entity.addModifiers("final"); if (Modifier.isAbstract(modifiers)) entity.addModifiers("abstract"); if (Modifier.isNative(modifiers)) entity.addModifiers("native"); if (Modifier.isSynchronized(modifiers)) entity.addModifiers("synchronized"); if (Modifier.isTransient(modifiers)) entity.addModifiers("transient"); if (Modifier.isVolatile(modifiers)) entity.addModifiers("volatile"); /* * We do not extract the static modifier here because we want to set the * hasClassScope property and we do that specifically only for attributes and * methods */ }
Example 7
Source File: ModifierCorrectionSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static String getVisibilityString(int code) { if (Modifier.isPublic(code)) { return "public"; //$NON-NLS-1$ } else if (Modifier.isProtected(code)) { return "protected"; //$NON-NLS-1$ } else if (Modifier.isPrivate(code)) { return "private"; //$NON-NLS-1$ } return CorrectionMessages.ModifierCorrectionSubProcessor_default; }
Example 8
Source File: NumberOfFields.java From ck with Apache License 2.0 | 5 votes |
@Override public void visit(FieldDeclaration node) { fields++; fieldNames.addAll(getVariableName(node.fragments())); boolean isPublic = Modifier.isPublic(node.getModifiers()); boolean isPrivate = Modifier.isPrivate(node.getModifiers()); boolean isProtected = Modifier.isProtected(node.getModifiers()); if(isPublic) publicFields++; else if(isPrivate) privateFields++; else if(isProtected) protectedFields++; else defaultFields++; // other characteristics rather than visibility boolean isStatic = Modifier.isStatic(node.getModifiers()); boolean isFinal = Modifier.isFinal(node.getModifiers()); boolean isSynchronized = Modifier.isSynchronized(node.getModifiers()); if(isStatic) staticFields++; if(isFinal) finalFields++; if(isSynchronized) synchronizedFields++; }
Example 9
Source File: BindingLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static ImageDescriptor getFieldImageDescriptor(IVariableBinding binding) { final int modifiers= binding.getModifiers(); if (Modifier.isPublic(modifiers) || binding.isEnumConstant()) return JavaPluginImages.DESC_FIELD_PUBLIC; if (Modifier.isProtected(modifiers)) return JavaPluginImages.DESC_FIELD_PROTECTED; if (Modifier.isPrivate(modifiers)) return JavaPluginImages.DESC_FIELD_PRIVATE; return JavaPluginImages.DESC_FIELD_DEFAULT; }
Example 10
Source File: ModifierCorrectionSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private static String getVisibilityString(int code) { if (Modifier.isPublic(code)) { return "public"; //$NON-NLS-1$ } else if (Modifier.isProtected(code)) { return "protected"; //$NON-NLS-1$ } else if (Modifier.isPrivate(code)) { return "private"; //$NON-NLS-1$ } return CorrectionMessages.ModifierCorrectionSubProcessor_default; }
Example 11
Source File: BindingLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static ImageDescriptor getMethodImageDescriptor(int modifiers) { if (Modifier.isPublic(modifiers)) return JavaPluginImages.DESC_MISC_PUBLIC; if (Modifier.isProtected(modifiers)) return JavaPluginImages.DESC_MISC_PROTECTED; if (Modifier.isPrivate(modifiers)) return JavaPluginImages.DESC_MISC_PRIVATE; return JavaPluginImages.DESC_MISC_DEFAULT; }
Example 12
Source File: MemberVisibilityAdjustor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Check whether anyone accesses the members of the moved type from the * outside. Those may need to have their visibility adjusted. * @param member the member * @param monitor the progress monitor to use * @throws JavaModelException if an error occurs */ private void adjustMemberVisibility(final IMember member, final IProgressMonitor monitor) throws JavaModelException { if (member instanceof IType) { // recursively check accessibility of member type's members final IJavaElement[] typeMembers= ((IType) member).getChildren(); for (int i= 0; i < typeMembers.length; i++) { if (! (typeMembers[i] instanceof IInitializer)) adjustMemberVisibility((IMember) typeMembers[i], monitor); } } if (member.equals(fReferenced) || Modifier.isPublic(member.getFlags())) return; final SearchResultGroup[] references= findReferences(member, monitor); for (int i= 0; i < references.length; i++) { final SearchMatch[] searchResults= references[i].getSearchResults(); for (int k= 0; k < searchResults.length; k++) { final IJavaElement referenceToMember= (IJavaElement) searchResults[k].getElement(); if (fAdjustments.get(member) == null && referenceToMember instanceof IMember && !isInsideMovedMember(referenceToMember)) { // check whether the member is still visible from the // destination. As we are moving a type, the destination is // a package or another type. adjustIncomingVisibility(fReferencing, member, new SubProgressMonitor(monitor, 1)); } } } }
Example 13
Source File: MoveInstanceMethodProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates a visibility-adjusted target expression taking advantage of * existing accessor methods. * * @param enclosingElement * the java element which encloses the current method access. * @param expression * the expression to access the target, or <code>null</code> * @param adjustments * the map of elements to visibility adjustments * @param rewrite * the ast rewrite to use * @return an adjusted target expression, or <code>null</code> if the * access did not have to be changed * @throws JavaModelException * if an error occurs while accessing the target expression */ protected Expression createAdjustedTargetExpression(final IJavaElement enclosingElement, final Expression expression, final Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, final ASTRewrite rewrite) throws JavaModelException { Assert.isNotNull(enclosingElement); Assert.isNotNull(adjustments); Assert.isNotNull(rewrite); final IJavaElement element= fTarget.getJavaElement(); if (element != null && !Modifier.isPublic(fTarget.getModifiers())) { final IField field= (IField) fTarget.getJavaElement(); if (field != null) { boolean same= field.getAncestor(IJavaElement.PACKAGE_FRAGMENT).equals(enclosingElement.getAncestor(IJavaElement.PACKAGE_FRAGMENT)); final Modifier.ModifierKeyword keyword= same ? null : Modifier.ModifierKeyword.PUBLIC_KEYWORD; final String modifier= same ? RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_default : RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_public; if (fUseGetters) { final IMethod getter= GetterSetterUtil.getGetter(field); if (getter != null) { final MethodDeclaration method= ASTNodeSearchUtil.getMethodDeclarationNode(getter, fSourceRewrite.getRoot()); if (method != null) { final IMethodBinding binding= method.resolveBinding(); if (binding != null && MemberVisibilityAdjustor.hasLowerVisibility(getter.getFlags(), same ? Modifier.NONE : keyword == null ? Modifier.NONE : keyword.toFlagValue()) && MemberVisibilityAdjustor.needsVisibilityAdjustments(getter, keyword, adjustments)) adjustments.put(getter, new MemberVisibilityAdjustor.OutgoingMemberVisibilityAdjustment(getter, keyword, RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_method_warning, new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), modifier }), JavaStatusContext.create(getter)))); final MethodInvocation invocation= rewrite.getAST().newMethodInvocation(); invocation.setExpression(expression); invocation.setName(rewrite.getAST().newSimpleName(getter.getElementName())); return invocation; } } } if (MemberVisibilityAdjustor.hasLowerVisibility(field.getFlags(), (keyword == null ? Modifier.NONE : keyword.toFlagValue())) && MemberVisibilityAdjustor.needsVisibilityAdjustments(field, keyword, adjustments)) adjustments.put(field, new MemberVisibilityAdjustor.OutgoingMemberVisibilityAdjustment(field, keyword, RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_field_warning, new String[] { BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED), modifier }), JavaStatusContext.create(field)))); } } return null; }
Example 14
Source File: JdtFlags.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static String getVisibilityString(int visibilityCode){ if (Modifier.isPublic(visibilityCode)) return VISIBILITY_STRING_PUBLIC; if (Modifier.isProtected(visibilityCode)) return VISIBILITY_STRING_PROTECTED; if (Modifier.isPrivate(visibilityCode)) return VISIBILITY_STRING_PRIVATE; return VISIBILITY_STRING_PACKAGE; }
Example 15
Source File: JsInteropUtils.java From j2cl with Apache License 2.0 | 5 votes |
private static JsInfo getJsInfo( IBinding member, ITypeBinding declaringType, IAnnotationBinding memberAnnotation, boolean isAccessor) { boolean jsOverlay = isJsOverlay(member); boolean jsAsync = isJsAsync(member); if (JsInteropAnnotationUtils.getJsIgnoreAnnotation(member) == null) { boolean publicMemberOfJsType = isJsType(declaringType) && Modifier.isPublic(member.getModifiers()); boolean isJsEnumConstant = isJsEnum(declaringType) && member instanceof IVariableBinding && ((IVariableBinding) member).isEnumConstant(); boolean memberOfNativeType = isJsNativeType(declaringType) && !isJsEnum(declaringType); if (memberAnnotation != null || ((publicMemberOfJsType || isJsEnumConstant || memberOfNativeType) && !jsOverlay)) { return JsInfo.newBuilder() .setJsMemberType(getJsMemberType(member, isAccessor)) .setJsName(JsInteropAnnotationUtils.getJsName(memberAnnotation)) .setJsNamespace(JsInteropAnnotationUtils.getJsNamespace(memberAnnotation)) .setJsOverlay(jsOverlay) .setJsAsync(jsAsync) .build(); } } return JsInfo.newBuilder() .setJsMemberType(JsMemberType.NONE) .setJsOverlay(jsOverlay) .setJsAsync(jsAsync) .build(); }
Example 16
Source File: BindingLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private static ImageDescriptor getInterfaceImageDescriptor(int modifiers) { if (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers) || Modifier.isPrivate(modifiers)) return JavaPluginImages.DESC_OBJS_INTERFACE; else return JavaPluginImages.DESC_OBJS_INTERFACE_DEFAULT; }
Example 17
Source File: JdtFlags.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public static boolean isPublic(BodyDeclaration bodyDeclaration) { if (isInterfaceOrAnnotationMember(bodyDeclaration)) { return true; } return Modifier.isPublic(bodyDeclaration.getModifiers()); }
Example 18
Source File: ReorgCorrectionsSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static void getWrongTypeNameProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ICompilationUnit cu= context.getCompilationUnit(); boolean isLinked= cu.getResource().isLinked(); IJavaProject javaProject= cu.getJavaProject(); String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true); String compliance= javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true); CompilationUnit root= context.getASTRoot(); ASTNode coveredNode= problem.getCoveredNode(root); if (!(coveredNode instanceof SimpleName)) return; ASTNode parentType= coveredNode.getParent(); if (!(parentType instanceof AbstractTypeDeclaration)) return; String currTypeName= ((SimpleName) coveredNode).getIdentifier(); String newTypeName= JavaCore.removeJavaLikeExtension(cu.getElementName()); boolean hasOtherPublicTypeBefore= false; boolean found= false; List<AbstractTypeDeclaration> types= root.types(); for (int i= 0; i < types.size(); i++) { AbstractTypeDeclaration curr= types.get(i); if (parentType != curr) { if (newTypeName.equals(curr.getName().getIdentifier())) { return; } if (!found && Modifier.isPublic(curr.getModifiers())) { hasOtherPublicTypeBefore= true; } } else { found= true; } } if (!JavaConventions.validateJavaTypeName(newTypeName, sourceLevel, compliance).matches(IStatus.ERROR)) { proposals.add(new CorrectMainTypeNameProposal(cu, context, currTypeName, newTypeName, IProposalRelevance.RENAME_TYPE)); } if (!hasOtherPublicTypeBefore) { String newCUName= JavaModelUtil.getRenamedCUName(cu, currTypeName); ICompilationUnit newCU= ((IPackageFragment) (cu.getParent())).getCompilationUnit(newCUName); if (!newCU.exists() && !isLinked && !JavaConventions.validateCompilationUnitName(newCUName, sourceLevel, compliance).matches(IStatus.ERROR)) { RenameCompilationUnitChange change= new RenameCompilationUnitChange(cu, newCUName); // rename CU String label= Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_renamecu_description, BasicElementLabels.getResourceName(newCUName)); proposals.add(new ChangeCorrectionProposal(label, change, IProposalRelevance.RENAME_CU, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_RENAME))); } } }
Example 19
Source File: ReorgCorrectionsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public static void getWrongTypeNameProposals(IInvocationContext context, IProblemLocationCore problem, Collection<ChangeCorrectionProposal> proposals) { ICompilationUnit cu= context.getCompilationUnit(); boolean isLinked = cu.getResource().isLinked(); IJavaProject javaProject= cu.getJavaProject(); String sourceLevel= javaProject.getOption(JavaCore.COMPILER_SOURCE, true); String compliance= javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true); CompilationUnit root= context.getASTRoot(); ASTNode coveredNode= problem.getCoveredNode(root); if (!(coveredNode instanceof SimpleName)) { return; } ASTNode parentType= coveredNode.getParent(); if (!(parentType instanceof AbstractTypeDeclaration)) { return; } String currTypeName= ((SimpleName) coveredNode).getIdentifier(); String newTypeName= JavaCore.removeJavaLikeExtension(cu.getElementName()); boolean hasOtherPublicTypeBefore = false; boolean found = false; List<AbstractTypeDeclaration> types= root.types(); for (int i= 0; i < types.size(); i++) { AbstractTypeDeclaration curr= types.get(i); if (parentType != curr) { if (newTypeName.equals(curr.getName().getIdentifier())) { return; } if (!found && Modifier.isPublic(curr.getModifiers())) { hasOtherPublicTypeBefore = true; } } else { found = true; } } if (!JavaConventions.validateJavaTypeName(newTypeName, sourceLevel, compliance).matches(IStatus.ERROR)) { proposals.add(new CorrectMainTypeNameProposal(cu, context, currTypeName, newTypeName, IProposalRelevance.RENAME_TYPE)); } if (!hasOtherPublicTypeBefore && JavaLanguageServerPlugin.getPreferencesManager().getClientPreferences().isResourceOperationSupported()) { String newCUName = JavaModelUtil.getRenamedCUName(cu, currTypeName); ICompilationUnit newCU = ((IPackageFragment) (cu.getParent())).getCompilationUnit(newCUName); if (!newCU.exists() && !isLinked && !JavaConventions.validateCompilationUnitName(newCUName, sourceLevel, compliance).matches(IStatus.ERROR)) { RenameCompilationUnitChange change = new RenameCompilationUnitChange(cu, newCUName); // rename CU String label = Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_renamecu_description, BasicElementLabels.getResourceName(newCUName)); proposals.add(new ChangeCorrectionProposal(label, CodeActionKind.QuickFix, change, IProposalRelevance.RENAME_CU)); } } }
Example 20
Source File: ExtractClassRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private FieldDeclaration createParameterObjectField(ParameterObjectFactory pof, TypeDeclaration typeNode, int modifier) { AST ast= fBaseCURewrite.getAST(); ClassInstanceCreation creation= ast.newClassInstanceCreation(); creation.setType(pof.createType(fDescriptor.isCreateTopLevel(), fBaseCURewrite, typeNode.getStartPosition())); ListRewrite listRewrite= fBaseCURewrite.getASTRewrite().getListRewrite(creation, ClassInstanceCreation.ARGUMENTS_PROPERTY); for (Iterator<FieldInfo> iter= fVariables.values().iterator(); iter.hasNext();) { FieldInfo fi= iter.next(); if (isCreateField(fi)) { Expression expression= fi.initializer; if (expression != null && !fi.hasFieldReference()) { importNodeTypes(expression, fBaseCURewrite); ASTNode createMoveTarget= fBaseCURewrite.getASTRewrite().createMoveTarget(expression); if (expression instanceof ArrayInitializer) { ArrayInitializer ai= (ArrayInitializer) expression; ITypeBinding type= ai.resolveTypeBinding(); Type addImport= fBaseCURewrite.getImportRewrite().addImport(type, ast); fBaseCURewrite.getImportRemover().registerAddedImports(addImport); ArrayCreation arrayCreation= ast.newArrayCreation(); arrayCreation.setType((ArrayType) addImport); arrayCreation.setInitializer((ArrayInitializer) createMoveTarget); listRewrite.insertLast(arrayCreation, null); } else { listRewrite.insertLast(createMoveTarget, null); } } } } VariableDeclarationFragment fragment= ast.newVariableDeclarationFragment(); fragment.setName(ast.newSimpleName(fDescriptor.getFieldName())); fragment.setInitializer(creation); ModifierKeyword acc= null; if (Modifier.isPublic(modifier)) { acc= ModifierKeyword.PUBLIC_KEYWORD; } else if (Modifier.isProtected(modifier)) { acc= ModifierKeyword.PROTECTED_KEYWORD; } else if (Modifier.isPrivate(modifier)) { acc= ModifierKeyword.PRIVATE_KEYWORD; } FieldDeclaration fieldDeclaration= ast.newFieldDeclaration(fragment); fieldDeclaration.setType(pof.createType(fDescriptor.isCreateTopLevel(), fBaseCURewrite, typeNode.getStartPosition())); if (acc != null) fieldDeclaration.modifiers().add(ast.newModifier(acc)); return fieldDeclaration; }