X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java index a9ccaae..89cd25e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java @@ -12,8 +12,6 @@ package net.sourceforge.phpdt.core; import net.sourceforge.phpdt.internal.compiler.env.IConstants; - - /** * Utility class for decoding modifier flags in Java elements. *

@@ -21,254 +19,373 @@ import net.sourceforge.phpdt.internal.compiler.env.IConstants; * instantiated or subclassed by clients. *

*

- * Note that the numeric values of these flags match the ones for class files - * as described in the Java Virtual Machine Specification. The AST class - * Modifier provides the same functionality as this class, only in - * the org.eclipse.jdt.core.dom package. + * Note that the numeric values of these flags match the ones for class files as + * described in the Java Virtual Machine Specification. The AST class + * Modifier provides the same functionality as this class, only + * in the net.sourceforge.phpdt.core.dom package. *

- * + * * @see IMember#getFlags */ public final class Flags { - /** + /** * Constant representing the absence of any flag + * * @since 3.0 */ public static final int AccDefault = 0; + /** - * Public access flag. See The Java Virtual Machine Specification for more details. + * Public access flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ public static final int AccPublic = IConstants.AccPublic; + /** - * Private access flag. See The Java Virtual Machine Specification for more details. + * Private access flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ public static final int AccPrivate = IConstants.AccPrivate; + /** - * Protected access flag. See The Java Virtual Machine Specification for more details. + * Protected access flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ public static final int AccProtected = IConstants.AccProtected; + /** - * Static access flag. See The Java Virtual Machine Specification for more details. + * Static access flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ public static final int AccStatic = IConstants.AccStatic; + /** - * Final access flag. See The Java Virtual Machine Specification for more details. + * Final access flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ public static final int AccFinal = IConstants.AccFinal; + /** - * Synchronized access flag. See The Java Virtual Machine Specification for more details. + * Synchronized access flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ -// public static final int AccSynchronized = IConstants.AccSynchronized; + // public static final int AccSynchronized = IConstants.AccSynchronized; /** - * Volatile property flag. See The Java Virtual Machine Specification for more details. + * Volatile property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ -// public static final int AccVolatile = IConstants.AccVolatile; + // public static final int AccVolatile = IConstants.AccVolatile; /** - * Transient property flag. See The Java Virtual Machine Specification for more details. + * Transient property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ -// public static final int AccTransient = IConstants.AccTransient; + // public static final int AccTransient = IConstants.AccTransient; /** - * Native property flag. See The Java Virtual Machine Specification for more details. + * Native property flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ -// public static final int AccNative = IConstants.AccNative; + // public static final int AccNative = IConstants.AccNative; /** - * Interface property flag. See The Java Virtual Machine Specification for more details. + * Interface property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ public static final int AccInterface = IConstants.AccInterface; + /** - * Abstract property flag. See The Java Virtual Machine Specification for more details. + * Abstract property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ public static final int AccAbstract = IConstants.AccAbstract; + /** - * Strictfp property flag. See The Java Virtual Machine Specification for more details. + * Strictfp property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ -// public static final int AccStrictfp = IConstants.AccStrictfp; + // public static final int AccStrictfp = IConstants.AccStrictfp; /** - * Super property flag. See The Java Virtual Machine Specification for more details. + * Super property flag. See The Java Virtual Machine Specification for more + * details. + * * @since 2.0 */ public static final int AccSuper = IConstants.AccSuper; + /** - * Synthetic property flag. See The Java Virtual Machine Specification for more details. + * Synthetic property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ -// public static final int AccSynthetic = IConstants.AccSynthetic; + // public static final int AccSynthetic = IConstants.AccSynthetic; /** - * Deprecated property flag. See The Java Virtual Machine Specification for more details. + * Deprecated property flag. See The Java Virtual Machine Specification for + * more details. + * * @since 2.0 */ public static final int AccDeprecated = IConstants.AccDeprecated; - + /** * Not instantiable. */ private Flags() { } + /** - * Returns whether the given integer includes the abstract modifier. - * - * @param flags the flags - * @return true if the abstract modifier is included + * Returns whether the given integer includes the abstract + * modifier. + * + * @param flags + * the flags + * @return true if the abstract modifier is + * included */ public static boolean isAbstract(int flags) { return (flags & AccAbstract) != 0; } + /** - * Returns whether the given integer includes the indication that the + * Returns whether the given integer includes the indication that the * element is deprecated (@deprecated tag in Javadoc comment). - * - * @param flags the flags + * + * @param flags + * the flags * @return true if the element is marked as deprecated */ public static boolean isDeprecated(int flags) { return (flags & AccDeprecated) != 0; } + /** - * Returns whether the given integer includes the final modifier. - * - * @param flags the flags - * @return true if the final modifier is included + * Returns whether the given integer includes the final + * modifier. + * + * @param flags + * the flags + * @return true if the final modifier is + * included */ public static boolean isFinal(int flags) { return (flags & AccFinal) != 0; } + /** - * Returns whether the given integer includes the interface modifier. - * - * @param flags the flags - * @return true if the interface modifier is included + * Returns whether the given integer includes the interface + * modifier. + * + * @param flags + * the flags + * @return true if the interface modifier is + * included * @since 2.0 */ public static boolean isInterface(int flags) { return (flags & AccInterface) != 0; } + /** - * Returns whether the given integer includes the native modifier. - * - * @param flags the flags - * @return true if the native modifier is included - */ -// public static boolean isNative(int flags) { -// return (flags & AccNative) != 0; -// } + * Returns whether the given integer includes the native + * modifier. + * + * @param flags + * the flags + * @return true if the native modifier is + * included + */ + // public static boolean isNative(int flags) { + // return (flags & AccNative) != 0; + // } /** - * Returns whether the given integer includes the private modifier. - * - * @param flags the flags - * @return true if the private modifier is included + * Returns whether the given integer includes the private + * modifier. + * + * @param flags + * the flags + * @return true if the private modifier is + * included */ public static boolean isPrivate(int flags) { return (flags & AccPrivate) != 0; } + /** - * Returns whether the given integer includes the protected modifier. - * - * @param flags the flags - * @return true if the protected modifier is included + * Returns whether the given integer includes the protected + * modifier. + * + * @param flags + * the flags + * @return true if the protected modifier is + * included */ public static boolean isProtected(int flags) { return (flags & AccProtected) != 0; } + /** - * Returns whether the given integer includes the public modifier. - * - * @param flags the flags - * @return true if the public modifier is included + * Returns whether the given integer includes the public + * modifier. + * + * @param flags + * the flags + * @return true if the public modifier is + * included */ public static boolean isPublic(int flags) { return (flags & AccPublic) != 0; } + /** - * Returns whether the given integer includes the static modifier. - * - * @param flags the flags - * @return true if the static modifier is included + * Returns whether the given integer includes the static + * modifier. + * + * @param flags + * the flags + * @return true if the static modifier is + * included */ public static boolean isStatic(int flags) { return (flags & AccStatic) != 0; } + /** - * Returns whether the given integer includes the strictfp modifier. - * - * @param flags the flags - * @return true if the strictfp modifier is included - */ -// public static boolean isStrictfp(int flags) { -// return (flags & AccStrictfp) != 0; -// } + * Returns whether the given integer includes the strictfp + * modifier. + * + * @param flags + * the flags + * @return true if the strictfp modifier is + * included + */ + // public static boolean isStrictfp(int flags) { + // return (flags & AccStrictfp) != 0; + // } /** - * Returns whether the given integer includes the synchronized modifier. - * - * @param flags the flags - * @return true if the synchronized modifier is included - */ -// public static boolean isSynchronized(int flags) { -// return (flags & AccSynchronized) != 0; -// } + * Returns whether the given integer includes the synchronized + * modifier. + * + * @param flags + * the flags + * @return true if the synchronized modifier + * is included + */ + // public static boolean isSynchronized(int flags) { + // return (flags & AccSynchronized) != 0; + // } /** - * Returns whether the given integer includes the indication that the + * Returns whether the given integer includes the indication that the * element is synthetic. - * - * @param flags the flags + * + * @param flags + * the flags * @return true if the element is marked synthetic */ -// public static boolean isSynthetic(int flags) { -// return (flags & AccSynthetic) != 0; -// } + // public static boolean isSynthetic(int flags) { + // return (flags & AccSynthetic) != 0; + // } /** - * Returns whether the given integer includes the transient modifier. - * - * @param flags the flags - * @return true if the transient modifier is included - */ -// public static boolean isTransient(int flags) { -// return (flags & AccTransient) != 0; -// } + * Returns whether the given integer includes the transient + * modifier. + * + * @param flags + * the flags + * @return true if the transient modifier is + * included + */ + // public static boolean isTransient(int flags) { + // return (flags & AccTransient) != 0; + // } /** - * Returns whether the given integer includes the volatile modifier. - * - * @param flags the flags - * @return true if the volatile modifier is included - */ -// public static boolean isVolatile(int flags) { -// return (flags & AccVolatile) != 0; -// } + * Returns whether the given integer includes the volatile + * modifier. + * + * @param flags + * the flags + * @return true if the volatile modifier is + * included + */ + // public static boolean isVolatile(int flags) { + // return (flags & AccVolatile) != 0; + // } /** - * Returns a standard string describing the given modifier flags. - * Only modifier flags are included in the output; the deprecated and - * synthetic flags are ignored if set. + * Returns a standard string describing the given modifier flags. Only + * modifier flags are included in the output; the deprecated and synthetic + * flags are ignored if set. *

* The flags are output in the following order: + * *

-	 *   public protected private 
-	 *   static 
-	 *   abstract final native synchronized transient volatile strictfp
+	 *   
+	 * public
+	 *  
+	 * protected
+	 *  
+	 * private
+	 *  
+	 *   
+	 * static
+	 *  
+	 *   
+	 * abstract
+	 *  
+	 * final
+	 *  
+	 * native
+	 *  
+	 * synchronized
+	 *  
+	 * transient
+	 *  
+	 * volatile
+	 *  
+	 * strictfp
+	 * 
 	 * 
+ * * This is a compromise between the orders specified in sections 8.1.1, * 8.3.1, 8.4.3, 8.8.3, 9.1.1, and 9.3 of The Java Language - * Specification, Second Edition (JLS2). - *

+ * Specification, Second Edition + * (JLS2). + *

*

* Examples results: + * *

-	 *	  "public static final"
-	 *	  "private native"
+	 *	  
+	 * "public static final"
+	 * 
+	 *	  
+	 * "private native"
+	 * 
 	 * 
+ * *

- * - * @param flags the flags + * + * @param flags + * the flags * @return the standard string representation of the given flags */ public static String toString(int flags) { @@ -282,20 +399,20 @@ public final class Flags { sb.append("private "); //$NON-NLS-1$ if (isStatic(flags)) sb.append("static "); //$NON-NLS-1$ -// if (isAbstract(flags)) -// sb.append("abstract "); //$NON-NLS-1$ + // if (isAbstract(flags)) + // sb.append("abstract "); //$NON-NLS-1$ if (isFinal(flags)) sb.append("final "); //$NON-NLS-1$ -// if (isNative(flags)) -// sb.append("native "); //$NON-NLS-1$ -// if (isSynchronized(flags)) -// sb.append("synchronized "); //$NON-NLS-1$ -// if (isTransient(flags)) -// sb.append("transient "); //$NON-NLS-1$ -// if (isVolatile(flags)) -// sb.append("volatile "); //$NON-NLS-1$ -// if (isStrictfp(flags)) -// sb.append("strictfp "); //$NON-NLS-1$ + // if (isNative(flags)) + // sb.append("native "); //$NON-NLS-1$ + // if (isSynchronized(flags)) + // sb.append("synchronized "); //$NON-NLS-1$ + // if (isTransient(flags)) + // sb.append("transient "); //$NON-NLS-1$ + // if (isVolatile(flags)) + // sb.append("volatile "); //$NON-NLS-1$ + // if (isStrictfp(flags)) + // sb.append("strictfp "); //$NON-NLS-1$ int len = sb.length(); if (len == 0)