Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0D5A18F36 for ; Wed, 12 Aug 2015 13:59:02 +0000 (UTC) Received: (qmail 2591 invoked by uid 500); 12 Aug 2015 13:58:53 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 2523 invoked by uid 500); 12 Aug 2015 13:58:53 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 2514 invoked by uid 99); 12 Aug 2015 13:58:53 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2015 13:58:53 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 03B4BAC03F5 for ; Wed, 12 Aug 2015 13:58:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1695518 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile: Attribute.java Constant.java ConstantCP.java ElementValue.java FieldOrMethod.java Date: Wed, 12 Aug 2015 13:58:52 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150812135853.03B4BAC03F5@hades.apache.org> Author: sebb Date: Wed Aug 12 13:58:52 2015 New Revision: 1695518 URL: http://svn.apache.org/r1695518 Log: BCEL-232 Make mutable fields private. Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java?rev=1695518&r1=1695517&r2=1695518&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java Wed Aug 12 13:58:52 2015 @@ -52,13 +52,13 @@ public abstract class Attribute implemen { private static final long serialVersionUID = -1707826820310002955L; - protected int name_index; // Points to attribute name in constant pool TODO make private (has getter & setter) + private int name_index; // Points to attribute name in constant pool - protected int length; // Content length of attribute field TODO make private (has getter & setter) + private int length; // Content length of attribute field - protected byte tag; // Tag to distinguish subclasses TODO make private & final; supposed to be immutable + private final byte tag; // Tag to distinguish subclasses - protected ConstantPool constant_pool; // TODO make private (has getter & setter) + private ConstantPool constant_pool; protected Attribute(byte tag, int name_index, int length, ConstantPool constant_pool) { @@ -260,7 +260,7 @@ public abstract class Attribute implemen /** * @param name_index of attribute. */ - public final void setNameIndex(int name_index) + public final void setNameIndex(int name_index) // TODO unused { this.name_index = name_index; } Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java?rev=1695518&r1=1695517&r2=1695518&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java Wed Aug 12 13:58:52 2015 @@ -57,7 +57,7 @@ public abstract class Constant implement * need the tag as an index to select the corresponding class name from the * `CONSTANT_NAMES' array. */ - protected byte tag; // TODO should be private & final + private final byte tag; Constant(byte tag) { Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java?rev=1695518&r1=1695517&r2=1695518&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java Wed Aug 12 13:58:52 2015 @@ -40,9 +40,9 @@ public abstract class ConstantCP extends */ // Note that this field is used to store the // bootstrap_method_attr_index of a ConstantInvokeDynamic. - protected int class_index; // TODO make private (has getter & setter) could be final (setter unused) + private final int class_index; // This field has the same meaning for all subclasses. - protected int name_and_type_index; // TODO make private (has getter & setter) could be final (setter unused) + private final int name_and_type_index; /** @@ -110,25 +110,6 @@ public abstract class ConstantCP extends /** - * @param class_index points to Constant_class - */ - public final void setClassIndex( int class_index ) { // TODO unused - this.class_index = class_index; - } - - - /** - * @param bootstrap_method_attr_index points to a BootstrapMethod. - * - * Note that this method is a functional duplicate of setClassIndex - * for use by ConstantInvokeDynamic. - */ - public final void setBootstrapMethodAttrIndex(int bootstrap_method_attr_index) { // TODO unused - this.class_index = bootstrap_method_attr_index; - } - - - /** * @return Reference (index) to signature of the field. */ public final int getNameAndTypeIndex() { @@ -136,14 +117,6 @@ public abstract class ConstantCP extends } - /** - * @param name_and_type_index points to Constant_NameAndType - */ - public final void setNameAndTypeIndex( int name_and_type_index ) { - this.name_and_type_index = name_and_type_index; - } - - /** * @return Class this field belongs to. */ Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java?rev=1695518&r1=1695517&r2=1695518&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java Wed Aug 12 13:58:52 2015 @@ -27,9 +27,9 @@ import java.io.IOException; */ public abstract class ElementValue { - protected int type; // TODO should be final + protected final int type; - protected ConstantPool cpool; // TODO should be final + protected final ConstantPool cpool; @Override public String toString() Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java?rev=1695518&r1=1695517&r2=1695518&view=diff ============================================================================== --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java (original) +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java Wed Aug 12 13:58:52 2015 @@ -31,12 +31,12 @@ import org.apache.commons.bcel6.Constant public abstract class FieldOrMethod extends AccessFlags implements Cloneable, Node { private static final long serialVersionUID = -1833306330869469714L; - // TODO should be made private - protected int name_index; // Points to field name in constant pool - protected int signature_index; // Points to encoded signature - protected Attribute[] attributes; // Collection of attributes - protected AnnotationEntry[] annotationEntries; // annotations defined on the field or method - protected ConstantPool constant_pool; + + private int name_index; // Points to field name in constant pool + private int signature_index; // Points to encoded signature + private Attribute[] attributes; // Collection of attributes + private AnnotationEntry[] annotationEntries; // annotations defined on the field or method + private ConstantPool constant_pool; private String signatureAttributeString = null; private boolean searchedForSignatureAttribute = false;