From 938e5ab47808b219e3ef2e3be3625f29c7c28e5a Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 27 Jun 1999 20:59:40 +0000 Subject: [PATCH] don't allow named method scope classes, to move into field initializer git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@928 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/expr/ConstructorOperator.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/jode/jode/expr/ConstructorOperator.java b/jode/jode/expr/ConstructorOperator.java index e99c492..ec74fa6 100644 --- a/jode/jode/expr/ConstructorOperator.java +++ b/jode/jode/expr/ConstructorOperator.java @@ -148,6 +148,23 @@ public class ConstructorOperator extends Operator } } + public boolean isConstant() { + ClassInfo clazz = getClassInfo(); + InnerClassInfo outer = getOuterClassInfo(clazz); + ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz); + + if ((Decompiler.options & Decompiler.OPTION_ANON) != 0 + && clazzAna != null + && outer != null && outer.outer == null && outer.name != null + && clazzAna.getParent() == methodAnalyzer) { + /* This is a named method scope class, it needs + * declaration. And therefore can't be moved into + * a field initializer. */ + return false; + } + return super.isConstant(); + } + /** * We add the named method scoped classes to the declarables, and * only fillDeclarables on the parameters we will print.