diff options
author | Roman Shevchenko <roman.shevchenko@jetbrains.com> | 2014-09-04 18:16:16 +0400 |
---|---|---|
committer | Roman Shevchenko <roman.shevchenko@jetbrains.com> | 2014-09-04 18:41:39 +0400 |
commit | 686b5abef9c269a726897c6992d0ea2abea79b04 (patch) | |
tree | d2a03c184d65f5dfa782d13826dbbba41c3a216b /src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java | |
parent | 1cea85e49ae7659e7124383b619730ba6053bb46 (diff) | |
download | fernflower-686b5abef9c269a726897c6992d0ea2abea79b04.tar fernflower-686b5abef9c269a726897c6992d0ea2abea79b04.tar.gz fernflower-686b5abef9c269a726897c6992d0ea2abea79b04.tar.lz fernflower-686b5abef9c269a726897c6992d0ea2abea79b04.tar.xz fernflower-686b5abef9c269a726897c6992d0ea2abea79b04.zip |
java-decompiler: optimization (empty lists allocation avoided)
Diffstat (limited to 'src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java')
-rw-r--r-- | src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java index 432d3b6..a33c7bb 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java @@ -18,37 +18,30 @@ package org.jetbrains.java.decompiler.struct.attr; import org.jetbrains.java.decompiler.modules.decompiler.exps.AnnotationExprent; import org.jetbrains.java.decompiler.struct.consts.ConstantPool; -import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class StructAnnotationParameterAttribute extends StructGeneralAttribute { private List<List<AnnotationExprent>> paramAnnotations; - public void initContent(ConstantPool pool) { + @Override + public void initContent(ConstantPool pool) throws IOException { + DataInputStream data = stream(); - super.initContent(pool); - - paramAnnotations = new ArrayList<List<AnnotationExprent>>(); - DataInputStream data = new DataInputStream(new ByteArrayInputStream(info)); - - try { - int len = data.readUnsignedByte(); + int len = data.readUnsignedByte(); + if (len > 0) { + paramAnnotations = new ArrayList<List<AnnotationExprent>>(len); for (int i = 0; i < len; i++) { - List<AnnotationExprent> lst = new ArrayList<AnnotationExprent>(); - int annsize = data.readUnsignedShort(); - - for (int j = 0; j < annsize; j++) { - lst.add(StructAnnotationAttribute.parseAnnotation(data, pool)); - } - paramAnnotations.add(lst); + List<AnnotationExprent> annotations = StructAnnotationAttribute.parseAnnotations(pool, data); + paramAnnotations.add(annotations); } } - catch (IOException ex) { - throw new RuntimeException(ex); + else { + paramAnnotations = Collections.emptyList(); } } |