List of usage examples for org.eclipse.jdt.core.dom Modifier STRICTFP
int STRICTFP
To view the source code for org.eclipse.jdt.core.dom Modifier STRICTFP.
Click Source Link
From source file:astview.Binding.java
License:Open Source License
private static StringBuffer getModifiersString(int flags, boolean isMethod) { StringBuffer sb = new StringBuffer().append("0x").append(Integer.toHexString(flags)).append(" ("); int prologLen = sb.length(); int rest = flags; rest &= ~appendFlag(sb, flags, Modifier.PUBLIC, "public "); rest &= ~appendFlag(sb, flags, Modifier.PRIVATE, "private "); rest &= ~appendFlag(sb, flags, Modifier.PROTECTED, "protected "); rest &= ~appendFlag(sb, flags, Modifier.STATIC, "static "); rest &= ~appendFlag(sb, flags, Modifier.FINAL, "final "); if (isMethod) { rest &= ~appendFlag(sb, flags, Modifier.SYNCHRONIZED, "synchronized "); rest &= ~appendFlag(sb, flags, Modifier.DEFAULT, "default "); } else {/* w w w .j a va2s.co m*/ rest &= ~appendFlag(sb, flags, Modifier.VOLATILE, "volatile "); rest &= ~appendFlag(sb, flags, Modifier.TRANSIENT, "transient "); } rest &= ~appendFlag(sb, flags, Modifier.NATIVE, "native "); rest &= ~appendFlag(sb, flags, Modifier.ABSTRACT, "abstract "); rest &= ~appendFlag(sb, flags, Modifier.STRICTFP, "strictfp "); if (rest != 0) sb.append("unknown:0x").append(Integer.toHexString(rest)).append(" "); int len = sb.length(); if (len != prologLen) sb.setLength(len - 1); sb.append(")"); return sb; }
From source file:com.ibm.wala.cast.java.translator.jdt.JDT2CAstUtils.java
License:Open Source License
public static Collection<CAstQualifier> mapModifiersToQualifiers(int modifiers, boolean isInterface, boolean isAnnotation) { Set<CAstQualifier> quals = new LinkedHashSet<CAstQualifier>(); if (isInterface) quals.add(CAstQualifier.INTERFACE); if (isAnnotation) quals.add(CAstQualifier.ANNOTATION); if ((modifiers & Modifier.ABSTRACT) != 0) quals.add(CAstQualifier.ABSTRACT); if ((modifiers & Modifier.FINAL) != 0) quals.add(CAstQualifier.FINAL);/*from ww w.j av a2s . c o m*/ if ((modifiers & Modifier.NATIVE) != 0) quals.add(CAstQualifier.NATIVE); // if (flags.isPackage()) quals.add(CAstQualifier.PACKAGE); if ((modifiers & Modifier.PRIVATE) != 0) quals.add(CAstQualifier.PRIVATE); if ((modifiers & Modifier.PROTECTED) != 0) quals.add(CAstQualifier.PROTECTED); if ((modifiers & Modifier.PUBLIC) != 0) quals.add(CAstQualifier.PUBLIC); if ((modifiers & Modifier.STATIC) != 0) quals.add(CAstQualifier.STATIC); if ((modifiers & Modifier.STRICTFP) != 0) quals.add(CAstQualifier.STRICTFP); if ((modifiers & Modifier.SYNCHRONIZED) != 0) quals.add(CAstQualifier.SYNCHRONIZED); if ((modifiers & Modifier.TRANSIENT) != 0) quals.add(CAstQualifier.TRANSIENT); if ((modifiers & Modifier.VOLATILE) != 0) quals.add(CAstQualifier.VOLATILE); return quals; }
From source file:org.modeshape.sequencer.javafile.JdtRecorder.java
License:Apache License
/** * <pre>/*from www .ja v a 2 s. co m*/ * EnumDeclaration: * [ Javadoc ] { ExtendedModifier } enum Identifier * [ implements Type { , Type } ] * { * [ EnumConstantDeclaration { , EnumConstantDeclaration } ] [ , ] * [ ; { ClassBodyDeclaration | ; } ] * } * </pre> * * @param enumType the {@link EnumDeclaration enum} being recorded (cannot be <code>null</code>) * @param parentNode the parent {@link Node node} (cannot be <code>null</code>) * @return the node representing the enum being recorded (never <code>null</code>) * @throws Exception if there is a problem */ protected Node record(final EnumDeclaration enumType, final Node parentNode) throws Exception { final String name = enumType.getName().getFullyQualifiedName(); final Node enumNode = parentNode.addNode(name, ClassFileSequencerLexicon.ENUM); enumNode.setProperty(ClassFileSequencerLexicon.NAME, name); enumNode.setProperty(ClassFileSequencerLexicon.SEQUENCED_DATE, this.context.getTimestamp()); enumNode.setProperty(ClassFileSequencerLexicon.INTERFACE, false); { // javadocs final Javadoc javadoc = enumType.getJavadoc(); if (javadoc != null) { record(javadoc, enumNode); } } { // modifiers final int modifiers = enumType.getModifiers(); enumNode.setProperty(ClassFileSequencerLexicon.ABSTRACT, (modifiers & Modifier.ABSTRACT) != 0); enumNode.setProperty(ClassFileSequencerLexicon.FINAL, (modifiers & Modifier.FINAL) != 0); enumNode.setProperty(ClassFileSequencerLexicon.STATIC, (modifiers & Modifier.STATIC) != 0); enumNode.setProperty(ClassFileSequencerLexicon.STRICT_FP, (modifiers & Modifier.STRICTFP) != 0); enumNode.setProperty(ClassFileSequencerLexicon.VISIBILITY, getVisibility(modifiers)); } { // annotations @SuppressWarnings("unchecked") final List<IExtendedModifier> modifiers = enumType.modifiers(); recordAnnotations(modifiers, enumNode); } { // implements @SuppressWarnings("unchecked") final List<Type> interfaces = enumType.superInterfaceTypes(); if ((interfaces != null) && !interfaces.isEmpty()) { final String[] interfaceNames = new String[interfaces.size()]; final Node containerNode = enumNode.addNode(ClassFileSequencerLexicon.IMPLEMENTS, ClassFileSequencerLexicon.TYPES); int i = 0; for (final Type superInterfaceType : interfaces) { interfaceNames[i] = getTypeName(superInterfaceType); record(superInterfaceType, ClassFileSequencerLexicon.INTERFACE, containerNode); ++i; } enumNode.setProperty(ClassFileSequencerLexicon.INTERFACES, interfaceNames); } } { // enum constants @SuppressWarnings("unchecked") final List<EnumConstantDeclaration> enumValues = enumType.enumConstants(); if ((enumValues != null) && !enumValues.isEmpty()) { final String[] values = new String[enumValues.size()]; final Node containerNode = enumNode.addNode(ClassFileSequencerLexicon.ENUM_CONSTANTS, ClassFileSequencerLexicon.ENUM_CONSTANTS); int i = 0; for (final EnumConstantDeclaration enumConstant : enumValues) { values[i++] = enumConstant.getName().getFullyQualifiedName(); record(enumConstant, containerNode); } enumNode.setProperty(ClassFileSequencerLexicon.ENUM_VALUES, values); } } recordBodyDeclarations(enumType, enumNode); recordSourceReference(enumType, enumNode); return enumNode; }
From source file:org.modeshape.sequencer.javafile.JdtRecorder.java
License:Apache License
/** * <pre>//from w ww.ja v a2 s . c om * MethodDeclaration: * [ Javadoc ] { ExtendedModifier } * [ < TypeParameter { , TypeParameter } > ] * ( Type | void ) Identifier ( * [ FormalParameter * { , FormalParameter } ] ) {[ ] } * [ throws TypeName { , TypeName } ] ( Block | ; ) * * ConstructorDeclaration: * [ Javadoc ] { ExtendedModifier } * [ < TypeParameter { , TypeParameter } > ] * Identifier ( * [ FormalParameter * { , FormalParameter } ] ) * [throws TypeName { , TypeName } ] Block * * </pre> * * @param method the {@link MethodDeclaration method} being recorded (cannot be <code>null</code>) * @param parentNode the parent {@link Node node} (cannot be <code>null</code>) * @throws Exception if there is a problem */ protected void record(final MethodDeclaration method, final Node parentNode) throws Exception { final String name = method.getName().getFullyQualifiedName(); final Node methodNode = parentNode.addNode(name, ClassFileSequencerLexicon.METHOD); methodNode.setProperty(ClassFileSequencerLexicon.NAME, name); { // javadocs final Javadoc javadoc = method.getJavadoc(); if (javadoc != null) { record(javadoc, methodNode); } } { // type parameters @SuppressWarnings("unchecked") final List<TypeParameter> typeParams = method.typeParameters(); if ((typeParams != null) && !typeParams.isEmpty()) { final Node containerNode = methodNode.addNode(ClassFileSequencerLexicon.TYPE_PARAMETERS, ClassFileSequencerLexicon.TYPE_PARAMETERS); for (final TypeParameter param : typeParams) { record(param, containerNode); } } } { // modifiers final int modifiers = method.getModifiers(); methodNode.setProperty(ClassFileSequencerLexicon.ABSTRACT, (modifiers & Modifier.ABSTRACT) != 0); methodNode.setProperty(ClassFileSequencerLexicon.FINAL, (modifiers & Modifier.FINAL) != 0); methodNode.setProperty(ClassFileSequencerLexicon.NATIVE, (modifiers & Modifier.NATIVE) != 0); methodNode.setProperty(ClassFileSequencerLexicon.STATIC, (modifiers & Modifier.STATIC) != 0); methodNode.setProperty(ClassFileSequencerLexicon.STRICT_FP, (modifiers & Modifier.STRICTFP) != 0); methodNode.setProperty(ClassFileSequencerLexicon.SYNCHRONIZED, (modifiers & Modifier.SYNCHRONIZED) != 0); methodNode.setProperty(ClassFileSequencerLexicon.VISIBILITY, getVisibility(modifiers)); } { // annotations @SuppressWarnings("unchecked") final List<IExtendedModifier> modifiers = method.modifiers(); recordAnnotations(modifiers, methodNode); } { // parameters @SuppressWarnings("unchecked") final List<SingleVariableDeclaration> params = method.parameters(); if ((params != null) && !params.isEmpty()) { final Node containerNode = methodNode.addNode(ClassFileSequencerLexicon.METHOD_PARAMETERS, ClassFileSequencerLexicon.PARAMETERS); for (final SingleVariableDeclaration param : params) { record(param, containerNode); } } } { // return type if (method.isConstructor()) { methodNode.setProperty(ClassFileSequencerLexicon.RETURN_TYPE_CLASS_NAME, Void.TYPE.getCanonicalName()); } else { final Type returnType = method.getReturnType2(); methodNode.setProperty(ClassFileSequencerLexicon.RETURN_TYPE_CLASS_NAME, getTypeName(returnType)); record(returnType, ClassFileSequencerLexicon.RETURN_TYPE, methodNode); } } { // thrown exceptions @SuppressWarnings("unchecked") final List<Name> errors = method.thrownExceptions(); if ((errors != null) && !errors.isEmpty()) { final String[] errorNames = new String[errors.size()]; int i = 0; for (final Name error : errors) { errorNames[i++] = error.getFullyQualifiedName(); } methodNode.setProperty(ClassFileSequencerLexicon.THROWN_EXCEPTIONS, errorNames); } } { // body final Block body = method.getBody(); if ((body != null) && (body.statements() != null) && !body.statements().isEmpty()) { final Node bodyNode = methodNode.addNode(ClassFileSequencerLexicon.BODY, ClassFileSequencerLexicon.STATEMENTS); record(body, bodyNode); } } recordSourceReference(method, methodNode); }
From source file:org.modeshape.sequencer.javafile.JdtRecorder.java
License:Apache License
/** * <pre>/*from ww w.jav a 2 s .c o m*/ * TypeDeclaration: * ClassDeclaration * InterfaceDeclaration * * ClassDeclaration: * [ Javadoc ] { ExtendedModifier } class Identifier * [ < TypeParameter { , TypeParameter } > ] * [ extends Type ] * [ implements Type { , Type } ] * { { ClassBodyDeclaration | ; } } * * InterfaceDeclaration: * [ Javadoc ] { ExtendedModifier } interface Identifier * [ < TypeParameter { , TypeParameter } > ] * [ extends Type { , Type } ] * { { InterfaceBodyDeclaration | ; } } * </pre> * * @param type the {@link TypeDeclaration type} being recorded (cannot be <code>null</code>) * @param parentNode the parent {@link Node node} where the new type will be created (cannot be <code>null</code>) * @return the node representing the type being recorded (never <code>null</code>) * @throws Exception if there is a problem */ protected Node record(final TypeDeclaration type, final Node parentNode) throws Exception { final String name = type.getName().getFullyQualifiedName(); final Node typeNode = parentNode.addNode(name, ClassFileSequencerLexicon.CLASS); typeNode.setProperty(ClassFileSequencerLexicon.NAME, name); typeNode.setProperty(ClassFileSequencerLexicon.SEQUENCED_DATE, this.context.getTimestamp()); final boolean isInterface = type.isInterface(); typeNode.setProperty(ClassFileSequencerLexicon.INTERFACE, isInterface); // extends and implements @SuppressWarnings("unchecked") final List<Type> interfaces = type.superInterfaceTypes(); { // extends if (isInterface) { if ((interfaces != null) && !interfaces.isEmpty()) { final Node extendsNode = typeNode.addNode(ClassFileSequencerLexicon.EXTENDS, ClassFileSequencerLexicon.TYPES); for (final Type interfaceType : interfaces) { record(interfaceType, ClassFileSequencerLexicon.INTERFACE, extendsNode); } } } else { final Type superType = type.getSuperclassType(); String superTypeName = null; if (superType == null) { superTypeName = Object.class.getCanonicalName(); } else { superTypeName = getTypeName(superType); } assert !StringUtil.isBlank(superTypeName); typeNode.setProperty(ClassFileSequencerLexicon.SUPER_CLASS_NAME, superTypeName); if (superType != null) { final Node extendsNode = typeNode.addNode(ClassFileSequencerLexicon.EXTENDS, ClassFileSequencerLexicon.TYPES); record(superType, getTypeName(superType), extendsNode); } } } { // implements if (!isInterface && (interfaces != null) && !interfaces.isEmpty()) { final Node implementsNode = typeNode.addNode(ClassFileSequencerLexicon.IMPLEMENTS, ClassFileSequencerLexicon.TYPES); final String[] interfaceNames = new String[interfaces.size()]; for (int i = 0, size = interfaces.size(); i < size; ++i) { final Type interfaceType = interfaces.get(i); interfaceNames[i] = getTypeName(interfaceType); record(interfaceType, interfaceNames[i], implementsNode); } typeNode.setProperty(ClassFileSequencerLexicon.INTERFACES, interfaceNames); } } { // javadocs final Javadoc javadoc = type.getJavadoc(); if (javadoc != null) { record(javadoc, typeNode); } } { // modifiers final int modifiers = type.getModifiers(); typeNode.setProperty(ClassFileSequencerLexicon.ABSTRACT, (modifiers & Modifier.ABSTRACT) != 0); typeNode.setProperty(ClassFileSequencerLexicon.FINAL, (modifiers & Modifier.FINAL) != 0); typeNode.setProperty(ClassFileSequencerLexicon.STATIC, (modifiers & Modifier.STATIC) != 0); typeNode.setProperty(ClassFileSequencerLexicon.STRICT_FP, (modifiers & Modifier.STRICTFP) != 0); typeNode.setProperty(ClassFileSequencerLexicon.VISIBILITY, getVisibility(modifiers)); } { // annotations @SuppressWarnings("unchecked") final List<IExtendedModifier> modifiers = type.modifiers(); recordAnnotations(modifiers, typeNode); } { // type parameters @SuppressWarnings("unchecked") final List<TypeParameter> typeParams = type.typeParameters(); if ((typeParams != null) && !typeParams.isEmpty()) { final Node containerNode = typeNode.addNode(ClassFileSequencerLexicon.TYPE_PARAMETERS, ClassFileSequencerLexicon.TYPE_PARAMETERS); for (final TypeParameter param : typeParams) { record(param, containerNode); } } } recordBodyDeclarations(type, typeNode); recordSourceReference(type, typeNode); return typeNode; }