aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/ClassFilePrinter.java
diff options
context:
space:
mode:
authornickl- <github@jigsoft.co.za>2017-10-30 20:37:23 +0200
committernickl- <github@jigsoft.co.za>2017-10-30 20:37:23 +0200
commit62851d0af30cdb0c54046627585451a468aacd2a (patch)
treefd7632ac39246a9598cb5bf6176c4bf0bcb21744 /src/main/javassist/bytecode/ClassFilePrinter.java
parent45b4c55361eef93542db8014e3ef8941169c97bd (diff)
downloadjavassist-62851d0af30cdb0c54046627585451a468aacd2a.tar.gz
javassist-62851d0af30cdb0c54046627585451a468aacd2a.zip
Source walk/Spring clean/Parameterize/Enhance et.al.
The following were applied during multiple itterations through the source. * Parameterize raw types. * Mark unused members. * Annotate override and deprecated methods. * Convert loops to enhance for loop. * Remove redundant else statements. * Widening collection type references. * Optimize code for improved readability. * Squash compiler warnings. * Identify smells.
Diffstat (limited to 'src/main/javassist/bytecode/ClassFilePrinter.java')
-rw-r--r--src/main/javassist/bytecode/ClassFilePrinter.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/main/javassist/bytecode/ClassFilePrinter.java b/src/main/javassist/bytecode/ClassFilePrinter.java
index 388ab517..58efa0f5 100644
--- a/src/main/javassist/bytecode/ClassFilePrinter.java
+++ b/src/main/javassist/bytecode/ClassFilePrinter.java
@@ -37,9 +37,6 @@ public class ClassFilePrinter {
* Prints the contents of a class file.
*/
public static void print(ClassFile cf, PrintWriter out) {
- List list;
- int n;
-
/* 0x0020 (SYNCHRONIZED) means ACC_SUPER if the modifiers
* are of a class.
*/
@@ -62,10 +59,8 @@ public class ClassFilePrinter {
}
out.println();
- list = cf.getFields();
- n = list.size();
- for (int i = 0; i < n; ++i) {
- FieldInfo finfo = (FieldInfo)list.get(i);
+ List<FieldInfo> fields = cf.getFields();
+ for (FieldInfo finfo:fields) {
int acc = finfo.getAccessFlags();
out.println(Modifier.toString(AccessFlag.toModifier(acc))
+ " " + finfo.getName() + "\t"
@@ -74,10 +69,8 @@ public class ClassFilePrinter {
}
out.println();
- list = cf.getMethods();
- n = list.size();
- for (int i = 0; i < n; ++i) {
- MethodInfo minfo = (MethodInfo)list.get(i);
+ List<MethodInfo> methods = cf.getMethods();
+ for (MethodInfo minfo:methods) {
int acc = minfo.getAccessFlags();
out.println(Modifier.toString(AccessFlag.toModifier(acc))
+ " " + minfo.getName() + "\t"
@@ -90,13 +83,11 @@ public class ClassFilePrinter {
printAttributes(cf.getAttributes(), out, 'c');
}
- static void printAttributes(List list, PrintWriter out, char kind) {
+ static void printAttributes(List<AttributeInfo> list, PrintWriter out, char kind) {
if (list == null)
return;
- int n = list.size();
- for (int i = 0; i < n; ++i) {
- AttributeInfo ai = (AttributeInfo)list.get(i);
+ for (AttributeInfo ai:list) {
if (ai instanceof CodeAttribute) {
CodeAttribute ca = (CodeAttribute)ai;
out.println("attribute: " + ai.getName() + ": "