You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/01/07 14:05:48 UTC

(commons-bcel) branch master updated (73d3da8b -> add006f0)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


    from 73d3da8b Remove trailing whitespace
     new b5e5872f Javadoc
     new 89b10c49 Javadoc
     new add006f0 Internal refactoring

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/bcel/classfile/AccessFlags.java     | 226 ++++++++++++++++++---
 .../org/apache/bcel/classfile/ConstantObject.java  |   7 +-
 .../bcel/EnclosingMethodAttributeTestCase.java     |   1 +
 3 files changed, 209 insertions(+), 25 deletions(-)


(commons-bcel) 01/03: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit b5e5872f5d23cd45b115134bd724cd8a76cc12c8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 6 17:31:12 2024 -0500

    Javadoc
---
 src/main/java/org/apache/bcel/classfile/ConstantObject.java        | 7 +++++--
 .../java/org/apache/bcel/EnclosingMethodAttributeTestCase.java     | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/ConstantObject.java b/src/main/java/org/apache/bcel/classfile/ConstantObject.java
index e15699f0..64ae7cd9 100644
--- a/src/main/java/org/apache/bcel/classfile/ConstantObject.java
+++ b/src/main/java/org/apache/bcel/classfile/ConstantObject.java
@@ -24,7 +24,10 @@ package org.apache.bcel.classfile;
 public interface ConstantObject {
 
     /**
-     * @return object representing the constant, e.g., Long for ConstantLong
+     * Gets the object representing the constant, e.g., Long for ConstantLong.
+     *
+     * @param constantPool the constant.
+     * @return object representing the constant, e.g., Long for ConstantLong.
      */
-    Object getConstantValue(ConstantPool cp);
+    Object getConstantValue(ConstantPool constantPool);
 }
diff --git a/src/test/java/org/apache/bcel/EnclosingMethodAttributeTestCase.java b/src/test/java/org/apache/bcel/EnclosingMethodAttributeTestCase.java
index 18e1f239..b94a4a4c 100644
--- a/src/test/java/org/apache/bcel/EnclosingMethodAttributeTestCase.java
+++ b/src/test/java/org/apache/bcel/EnclosingMethodAttributeTestCase.java
@@ -31,6 +31,7 @@ import org.apache.bcel.util.SyntheticRepository;
 import org.junit.jupiter.api.Test;
 
 public class EnclosingMethodAttributeTestCase extends AbstractTestCase {
+
     /**
      * Check that we can save and load the attribute correctly.
      */


(commons-bcel) 02/03: Javadoc

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 89b10c49598641b6834e34ba00087ca106857aa1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 7 08:38:02 2024 -0500

    Javadoc
---
 .../org/apache/bcel/classfile/AccessFlags.java     | 180 ++++++++++++++++++++-
 1 file changed, 174 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/AccessFlags.java b/src/main/java/org/apache/bcel/classfile/AccessFlags.java
index 6310b7e3..9b9e93e0 100644
--- a/src/main/java/org/apache/bcel/classfile/AccessFlags.java
+++ b/src/main/java/org/apache/bcel/classfile/AccessFlags.java
@@ -24,7 +24,9 @@ import org.apache.bcel.Const;
 public abstract class AccessFlags {
 
     /**
-     * @deprecated (since 6.0) will be made private; do not access directly, use getter/setter
+     * Access flags.
+     *
+     * @deprecated (since 6.0) will be made private; do not access directly, use getter/setter.
      */
     @java.lang.Deprecated
     protected int access_flags; // TODO not used externally at present
@@ -33,13 +35,17 @@ public abstract class AccessFlags {
     }
 
     /**
-     * @param a initial access flags
+     * Constructs a new instance.
+     *
+     * @param accessFlags initial access flags.
      */
-    public AccessFlags(final int a) {
-        access_flags = a;
+    public AccessFlags(final int accessFlags) {
+        access_flags = accessFlags;
     }
 
     /**
+     * Gets access flags.
+     *
      * @return Access flags of the object aka. "modifiers".
      */
     public final int getAccessFlags() {
@@ -47,142 +53,304 @@ public abstract class AccessFlags {
     }
 
     /**
-     * @return Access flags of the object aka. "modifiers".
+     * Gets access flags.
+     *
+     * @return Access flags of the object also known as modifiers.
      */
     public final int getModifiers() {
         return access_flags;
     }
 
+    /**
+     * Tests whether the abstract bit is on.
+     *
+     * @return whether the abstract bit is on.
+     */
     public final boolean isAbstract() {
         return (access_flags & Const.ACC_ABSTRACT) != 0;
     }
 
+    /**
+     * Sets the abstract bit.
+     *
+     * @param flag The new value.
+     */
     public final void isAbstract(final boolean flag) {
         setFlag(Const.ACC_ABSTRACT, flag);
     }
 
+    /**
+     * Tests whether the annotation bit is on.
+     *
+     * @return whether the annotation bit is on.
+     */
     public final boolean isAnnotation() {
         return (access_flags & Const.ACC_ANNOTATION) != 0;
     }
 
+    /**
+     * Sets the annotation bit.
+     *
+     * @param flag The new value.
+     */
     public final void isAnnotation(final boolean flag) {
         setFlag(Const.ACC_ANNOTATION, flag);
     }
 
+    /**
+     * Tests whether the enum bit is on.
+     *
+     * @return whether the enum bit is on.
+     */
     public final boolean isEnum() {
         return (access_flags & Const.ACC_ENUM) != 0;
     }
 
+    /**
+     * Sets the enum bit.
+     *
+     * @param flag The new value.
+     */
     public final void isEnum(final boolean flag) {
         setFlag(Const.ACC_ENUM, flag);
     }
 
+    /**
+     * Tests whether the final bit is on.
+     *
+     * @return whether the final bit is on.
+     */
     public final boolean isFinal() {
         return (access_flags & Const.ACC_FINAL) != 0;
     }
 
+    /**
+     * Sets the final bit.
+     *
+     * @param flag The new value.
+     */
     public final void isFinal(final boolean flag) {
         setFlag(Const.ACC_FINAL, flag);
     }
 
+    /**
+     * Tests whether the interface bit is on.
+     *
+     * @return whether the interface bit is on.
+     */
     public final boolean isInterface() {
         return (access_flags & Const.ACC_INTERFACE) != 0;
     }
 
+    /**
+     * Sets the interface bit.
+     *
+     * @param flag The new value.
+     */
     public final void isInterface(final boolean flag) {
         setFlag(Const.ACC_INTERFACE, flag);
     }
 
+    /**
+     * Tests whether the native bit is on.
+     *
+     * @return whether the native bit is on.
+     */
     public final boolean isNative() {
         return (access_flags & Const.ACC_NATIVE) != 0;
     }
 
+    /**
+     * Sets the native bit.
+     *
+     * @param flag The new value.
+     */
     public final void isNative(final boolean flag) {
         setFlag(Const.ACC_NATIVE, flag);
     }
 
+    /**
+     * Tests whether the private bit is on.
+     *
+     * @return whether the private bit is on.
+     */
     public final boolean isPrivate() {
         return (access_flags & Const.ACC_PRIVATE) != 0;
     }
 
+    /**
+     * Sets the private bit.
+     *
+     * @param flag The new value.
+     */
     public final void isPrivate(final boolean flag) {
         setFlag(Const.ACC_PRIVATE, flag);
     }
 
+    /**
+     * Tests whether the protected bit is on.
+     *
+     * @return whether the protected bit is on.
+     */
     public final boolean isProtected() {
         return (access_flags & Const.ACC_PROTECTED) != 0;
     }
 
+    /**
+     * Sets the protected bit.
+     *
+     * @param flag The new value.
+     */
     public final void isProtected(final boolean flag) {
         setFlag(Const.ACC_PROTECTED, flag);
     }
 
+    /**
+     * Tests whether the public bit is on.
+     *
+     * @return whether the public bit is on.
+     */
     public final boolean isPublic() {
         return (access_flags & Const.ACC_PUBLIC) != 0;
     }
 
+    /**
+     * Sets the public bit.
+     *
+     * @param flag The new value.
+     */
     public final void isPublic(final boolean flag) {
         setFlag(Const.ACC_PUBLIC, flag);
     }
 
+    /**
+     * Tests whether the static bit is on.
+     *
+     * @return whether the static bit is on.
+     */
     public final boolean isStatic() {
         return (access_flags & Const.ACC_STATIC) != 0;
     }
 
+    /**
+     * Sets the static bit.
+     *
+     * @param flag The new value.
+     */
     public final void isStatic(final boolean flag) {
         setFlag(Const.ACC_STATIC, flag);
     }
 
+    /**
+     * Tests whether the strict bit is on.
+     *
+     * @return whether the strict bit is on.
+     */
     public final boolean isStrictfp() {
         return (access_flags & Const.ACC_STRICT) != 0;
     }
 
+    /**
+     * Sets the strict bit.
+     *
+     * @param flag The new value.
+     */
     public final void isStrictfp(final boolean flag) {
         setFlag(Const.ACC_STRICT, flag);
     }
 
+    /**
+     * Tests whether the synchronized bit is on.
+     *
+     * @return whether the synchronized bit is on.
+     */
     public final boolean isSynchronized() {
         return (access_flags & Const.ACC_SYNCHRONIZED) != 0;
     }
 
+    /**
+     * Sets the synchronized bit.
+     *
+     * @param flag The new value.
+     */
     public final void isSynchronized(final boolean flag) {
         setFlag(Const.ACC_SYNCHRONIZED, flag);
     }
 
+    /**
+     * Tests whether the synthetic bit is on.
+     *
+     * @return whether the synthetic bit is on.
+     */
     public final boolean isSynthetic() {
         return (access_flags & Const.ACC_SYNTHETIC) != 0;
     }
 
+    /**
+     * Sets the synthetic bit.
+     *
+     * @param flag The new value.
+     */
     public final void isSynthetic(final boolean flag) {
         setFlag(Const.ACC_SYNTHETIC, flag);
     }
 
+    /**
+     * Tests whether the transient bit is on.
+     *
+     * @return whether the varargs bit is on.
+     */
     public final boolean isTransient() {
         return (access_flags & Const.ACC_TRANSIENT) != 0;
     }
 
+    /**
+     * Sets the varargs bit.
+     *
+     * @param flag The new value.
+     */
     public final void isTransient(final boolean flag) {
         setFlag(Const.ACC_TRANSIENT, flag);
     }
 
+    /**
+     * Tests whether the varargs bit is on.
+     *
+     * @return whether the varargs bit is on.
+     */
     public final boolean isVarArgs() {
         return (access_flags & Const.ACC_VARARGS) != 0;
     }
 
+    /**
+     * Sets the varargs bit.
+     *
+     * @param flag The new value.
+     */
     public final void isVarArgs(final boolean flag) {
         setFlag(Const.ACC_VARARGS, flag);
     }
 
+    /**
+     * Tests whether the volatile bit is on.
+     *
+     * @return whether the volatile bit is on.
+     */
     public final boolean isVolatile() {
         return (access_flags & Const.ACC_VOLATILE) != 0;
     }
 
+    /**
+     * Sets the volatile bit.
+     *
+     * @param flag The new value.
+     */
     public final void isVolatile(final boolean flag) {
         setFlag(Const.ACC_VOLATILE, flag);
     }
 
     /**
-     * Sets access flags aka "modifiers".
+     * Sets access flags also known as modifiers.
      *
      * @param accessFlags Access flags of the object.
      */


(commons-bcel) 03/03: Internal refactoring

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit add006f089b031d376f568bb8ca28855454a69eb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 7 08:38:17 2024 -0500

    Internal refactoring
---
 .../org/apache/bcel/classfile/AccessFlags.java     | 46 ++++++++++++++--------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/AccessFlags.java b/src/main/java/org/apache/bcel/classfile/AccessFlags.java
index 9b9e93e0..c5946f94 100644
--- a/src/main/java/org/apache/bcel/classfile/AccessFlags.java
+++ b/src/main/java/org/apache/bcel/classfile/AccessFlags.java
@@ -31,6 +31,9 @@ public abstract class AccessFlags {
     @java.lang.Deprecated
     protected int access_flags; // TODO not used externally at present
 
+    /**
+     * Constructs a new instance.
+     */
     public AccessFlags() {
     }
 
@@ -67,7 +70,7 @@ public abstract class AccessFlags {
      * @return whether the abstract bit is on.
      */
     public final boolean isAbstract() {
-        return (access_flags & Const.ACC_ABSTRACT) != 0;
+        return test(Const.ACC_ABSTRACT);
     }
 
     /**
@@ -85,7 +88,7 @@ public abstract class AccessFlags {
      * @return whether the annotation bit is on.
      */
     public final boolean isAnnotation() {
-        return (access_flags & Const.ACC_ANNOTATION) != 0;
+        return test(Const.ACC_ANNOTATION);
     }
 
     /**
@@ -96,14 +99,13 @@ public abstract class AccessFlags {
     public final void isAnnotation(final boolean flag) {
         setFlag(Const.ACC_ANNOTATION, flag);
     }
-
     /**
      * Tests whether the enum bit is on.
      *
      * @return whether the enum bit is on.
      */
     public final boolean isEnum() {
-        return (access_flags & Const.ACC_ENUM) != 0;
+        return test(Const.ACC_ENUM);
     }
 
     /**
@@ -121,7 +123,7 @@ public abstract class AccessFlags {
      * @return whether the final bit is on.
      */
     public final boolean isFinal() {
-        return (access_flags & Const.ACC_FINAL) != 0;
+        return test(Const.ACC_FINAL);
     }
 
     /**
@@ -139,7 +141,7 @@ public abstract class AccessFlags {
      * @return whether the interface bit is on.
      */
     public final boolean isInterface() {
-        return (access_flags & Const.ACC_INTERFACE) != 0;
+        return test(Const.ACC_INTERFACE);
     }
 
     /**
@@ -157,7 +159,7 @@ public abstract class AccessFlags {
      * @return whether the native bit is on.
      */
     public final boolean isNative() {
-        return (access_flags & Const.ACC_NATIVE) != 0;
+        return test(Const.ACC_NATIVE);
     }
 
     /**
@@ -175,7 +177,7 @@ public abstract class AccessFlags {
      * @return whether the private bit is on.
      */
     public final boolean isPrivate() {
-        return (access_flags & Const.ACC_PRIVATE) != 0;
+        return test(Const.ACC_PRIVATE);
     }
 
     /**
@@ -193,7 +195,7 @@ public abstract class AccessFlags {
      * @return whether the protected bit is on.
      */
     public final boolean isProtected() {
-        return (access_flags & Const.ACC_PROTECTED) != 0;
+        return test(Const.ACC_PROTECTED);
     }
 
     /**
@@ -211,7 +213,7 @@ public abstract class AccessFlags {
      * @return whether the public bit is on.
      */
     public final boolean isPublic() {
-        return (access_flags & Const.ACC_PUBLIC) != 0;
+        return test(Const.ACC_PUBLIC);
     }
 
     /**
@@ -229,7 +231,7 @@ public abstract class AccessFlags {
      * @return whether the static bit is on.
      */
     public final boolean isStatic() {
-        return (access_flags & Const.ACC_STATIC) != 0;
+        return test(Const.ACC_STATIC);
     }
 
     /**
@@ -247,7 +249,7 @@ public abstract class AccessFlags {
      * @return whether the strict bit is on.
      */
     public final boolean isStrictfp() {
-        return (access_flags & Const.ACC_STRICT) != 0;
+        return test(Const.ACC_STRICT);
     }
 
     /**
@@ -265,7 +267,7 @@ public abstract class AccessFlags {
      * @return whether the synchronized bit is on.
      */
     public final boolean isSynchronized() {
-        return (access_flags & Const.ACC_SYNCHRONIZED) != 0;
+        return test(Const.ACC_SYNCHRONIZED);
     }
 
     /**
@@ -283,7 +285,7 @@ public abstract class AccessFlags {
      * @return whether the synthetic bit is on.
      */
     public final boolean isSynthetic() {
-        return (access_flags & Const.ACC_SYNTHETIC) != 0;
+        return test(Const.ACC_SYNTHETIC);
     }
 
     /**
@@ -301,7 +303,7 @@ public abstract class AccessFlags {
      * @return whether the varargs bit is on.
      */
     public final boolean isTransient() {
-        return (access_flags & Const.ACC_TRANSIENT) != 0;
+        return test(Const.ACC_TRANSIENT);
     }
 
     /**
@@ -319,7 +321,7 @@ public abstract class AccessFlags {
      * @return whether the varargs bit is on.
      */
     public final boolean isVarArgs() {
-        return (access_flags & Const.ACC_VARARGS) != 0;
+        return test(Const.ACC_VARARGS);
     }
 
     /**
@@ -337,7 +339,7 @@ public abstract class AccessFlags {
      * @return whether the volatile bit is on.
      */
     public final boolean isVolatile() {
-        return (access_flags & Const.ACC_VOLATILE) != 0;
+        return test(Const.ACC_VOLATILE);
     }
 
     /**
@@ -376,4 +378,14 @@ public abstract class AccessFlags {
     public final void setModifiers(final int accessFlags) {
         setAccessFlags(accessFlags);
     }
+
+    /**
+     * Tests whether the bit is on.
+     *
+     * @param test the bit to test.
+     * @return whether the bit is on.
+     */
+    private boolean test(final short test) {
+        return (access_flags & test) != 0;
+    }
 }