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
The following commit(s) were added to refs/heads/master by this push: new 85387a8 Better exception message and param names. 85387a8 is described below commit 85387a818296f11c661486b85d127930432c288e Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sat Jul 6 14:57:37 2019 -0400 Better exception message and param names. --- src/main/java/org/apache/bcel/generic/FieldOrMethod.java | 16 +++++++++------- .../java/org/apache/bcel/verifier/VerifierFactory.java | 14 +++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/apache/bcel/generic/FieldOrMethod.java b/src/main/java/org/apache/bcel/generic/FieldOrMethod.java index e53e116..55e7199 100644 --- a/src/main/java/org/apache/bcel/generic/FieldOrMethod.java +++ b/src/main/java/org/apache/bcel/generic/FieldOrMethod.java @@ -35,6 +35,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { * Not to be used otherwise. */ FieldOrMethod() { + // no init } @@ -48,7 +49,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { /** @return signature of referenced method/field. */ - public String getSignature( final ConstantPoolGen cpg ) { + public String getSignature(final ConstantPoolGen cpg) { final ConstantPool cp = cpg.getConstantPool(); final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex()); @@ -58,7 +59,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { /** @return name of referenced method/field. */ - public String getName( final ConstantPoolGen cpg ) { + public String getName(final ConstantPoolGen cpg) { final ConstantPool cp = cpg.getConstantPool(); final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); final ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex()); @@ -78,7 +79,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { * */ @Deprecated - public String getClassName( final ConstantPoolGen cpg ) { + public String getClassName(final ConstantPoolGen cpg) { final ConstantPool cp = cpg.getConstantPool(); final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); final String className = cp.getConstantString(cmr.getClassIndex(), Const.CONSTANT_Class); @@ -96,7 +97,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { * getReferenceType() instead. */ @Deprecated - public ObjectType getClassType( final ConstantPoolGen cpg ) { + public ObjectType getClassType(final ConstantPoolGen cpg) { return ObjectType.getInstance(getClassName(cpg)); } @@ -109,7 +110,7 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { * or interface), or an ArrayType (if the referenced class * type is an array class) */ - public ReferenceType getReferenceType( final ConstantPoolGen cpg ) { + public ReferenceType getReferenceType(final ConstantPoolGen cpg) { final ConstantPool cp = cpg.getConstantPool(); final ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); String className = cp.getConstantString(cmr.getClassIndex(), Const.CONSTANT_Class); @@ -128,11 +129,12 @@ public abstract class FieldOrMethod extends CPInstruction implements LoadClass { * @throws ClassGenException when the field is (or method returns) an array, */ @Override - public ObjectType getLoadClassType( final ConstantPoolGen cpg ) { + public ObjectType getLoadClassType(final ConstantPoolGen cpg) { final ReferenceType rt = getReferenceType(cpg); if (rt instanceof ObjectType) { return (ObjectType) rt; } - throw new ClassGenException(rt.getSignature() + " does not represent an ObjectType"); + throw new ClassGenException( + rt.getClass().getCanonicalName() + " " + rt.getSignature() + " does not represent an ObjectType"); } } diff --git a/src/main/java/org/apache/bcel/verifier/VerifierFactory.java b/src/main/java/org/apache/bcel/verifier/VerifierFactory.java index 9ffe572..bd0c432 100644 --- a/src/main/java/org/apache/bcel/verifier/VerifierFactory.java +++ b/src/main/java/org/apache/bcel/verifier/VerifierFactory.java @@ -54,12 +54,12 @@ public class VerifierFactory { * Possibly a new Verifier object is transparently created. * @return the (only) verifier responsible for the class with the given name. */ - public static Verifier getVerifier( final String fully_qualified_classname ) { - Verifier v = hashMap.get(fully_qualified_classname); + public static Verifier getVerifier( final String fullyQualifiedClassName ) { + Verifier v = hashMap.get(fullyQualifiedClassName); if (v == null) { - v = new Verifier(fully_qualified_classname); - hashMap.put(fully_qualified_classname, v); - notify(fully_qualified_classname); + v = new Verifier(fullyQualifiedClassName); + hashMap.put(fullyQualifiedClassName, v); + notify(fullyQualifiedClassName); } return v; } @@ -68,10 +68,10 @@ public class VerifierFactory { /** * Notifies the observers of a newly generated Verifier. */ - private static void notify( final String fully_qualified_classname ) { + private static void notify( final String fullyQualifiedClassName ) { // notify the observers for (final VerifierFactoryObserver vfo : observers) { - vfo.update(fully_qualified_classname); + vfo.update(fullyQualifiedClassName); } }