java-decompiler: fixes and cleanups

- unified attribute loading code
- common methods for checking member flags
- verifying skip()
- correct resource closing
- typos
This commit is contained in:
Roman Shevchenko
2014-09-02 20:56:03 +04:00
parent c0c83126a6
commit 2df49d32a7
31 changed files with 586 additions and 1012 deletions

View File

@@ -69,7 +69,7 @@ public class AssertProcessor {
ClassWrapper wrapper = node.wrapper;
boolean nosynthflag = DecompilerContext.getOption(IFernflowerPreferences.SYNTHETIC_NOT_SET);
boolean noSynthFlag = DecompilerContext.getOption(IFernflowerPreferences.SYNTHETIC_NOT_SET);
for (StructField fd : wrapper.getClassStruct().getFields()) {
@@ -78,12 +78,8 @@ public class AssertProcessor {
// initializer exists
if (wrapper.getStaticFieldInitializers().containsKey(keyField)) {
int flags = fd.access_flags;
boolean isSynthetic = (flags & CodeConstants.ACC_SYNTHETIC) != 0 || fd.getAttributes().containsKey("Synthetic");
// access flags set
if ((flags & CodeConstants.ACC_STATIC) != 0 && (flags & CodeConstants.ACC_FINAL) != 0 &&
(isSynthetic || nosynthflag)) {
if (fd.hasModifier(CodeConstants.ACC_STATIC) && fd.hasModifier(CodeConstants.ACC_FINAL) && (noSynthFlag || fd.isSynthetic())) {
// field type boolean
FieldDescriptor fdescr = FieldDescriptor.parseDescriptor(fd.getDescriptor());
@@ -100,8 +96,7 @@ public class AssertProcessor {
if (invexpr.getInstance() != null &&
invexpr.getInstance().type == Exprent.EXPRENT_CONST &&
"desiredAssertionStatus".equals(invexpr.getName())
&&
"desiredAssertionStatus".equals(invexpr.getName()) &&
"java/lang/Class".equals(invexpr.getClassname()) &&
invexpr.getLstParameters().isEmpty()) {