Correct wrong exception messages
@@ -74,12 +74,12 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
this.methodName = methodName;
this.methodDescriptor = methodDescriptor;
- if (methodName.equals("<init>") && checkIfPublicAndNonstatic(access)) {
+ if (methodName.equals("<init>") && checkIfPublicAndNonStatic(access)) {
if (Type.getReturnType(methodDescriptor) != Type.VOID_TYPE) {
throw new ABICompilerException("<init> method must have void return type", methodName);
}
isOnInstall = true;
- } else if (methodName.equals("fallback") && checkIfPublicAndNonstatic(access)) {
+ } else if (methodName.equals("fallback") && checkIfPublicAndNonStatic(access)) {
if (Type.getReturnType(methodDescriptor) != Type.VOID_TYPE) {
throw new ABICompilerException("fallback method must have void return type", methodName);
}
@@ -101,8 +101,8 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
if (Type.getType(descriptor).getClassName().equals(External.class.getName())) {
- if (!checkIfPublicAndNonstatic(this.access)) {
- throw new ABICompilerException("@External methods must be public and static", methodName);
+ if (!checkIfPublicAndNonStatic(this.access)) {
+ throw new ABICompilerException("@External methods must be public and non-static", methodName);
}
checkArgumentsAndReturnType();
flags |= Method.Flags.EXTERNAL;
@@ -116,15 +116,15 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
}
};
} else if (Type.getType(descriptor).getClassName().equals(Payable.class.getName())) {
- if (!checkIfPublicAndNonstatic(this.access)) {
- throw new ABICompilerException("@Payable methods must be public and static", methodName);
+ if (!checkIfPublicAndNonStatic(this.access)) {
+ throw new ABICompilerException("@Payable methods must be public and non-static", methodName);
}
flags |= Method.Flags.PAYABLE;
return null;
} else if (Type.getType(descriptor).getClassName().equals(EventLog.class.getName())) {
boolean isStatic = (this.access & Opcodes.ACC_STATIC) != 0;
if (isStatic) {
- throw new ABICompilerException("@EventLog methods must be non static", methodName);
+ throw new ABICompilerException("@EventLog methods must be non-static", methodName);
}
if (Type.getReturnType(methodDescriptor) != Type.VOID_TYPE) {
throw new ABICompilerException("@EventLog methods must have void return type", methodName);
@@ -247,7 +247,7 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
}
private String getEventSignature(Type[] args) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(methodName);
sb.append("(");
for (int i=0; i<args.length; i++) {
@@ -306,7 +306,7 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
if ((isOnInstall() || isExternal() || isEventLog()) &&
paramNames.size() != Type.getArgumentTypes(methodDescriptor).length) {
throw new ABICompilerException(
- "Method parameters size mismatch (must compile with \'-parameters\')", methodName);
+ "Method parameters size mismatch (must compile with '-parameters')", methodName);
}
if (pmv != null) {
mv = pmv;
@@ -341,7 +341,7 @@ public class ABICompilerMethodVisitor extends MethodVisitor {
super.visitEnd();
}
- private boolean checkIfPublicAndNonstatic(int access) {
+ private boolean checkIfPublicAndNonStatic(int access) {
boolean isPublic = (access & Opcodes.ACC_PUBLIC) != 0;
boolean isStatic = (access & Opcodes.ACC_STATIC) != 0;
return isPublic && !isStatic;
