From 9470aef60609541b83415b25b21fb37a4c7684bc Mon Sep 17 00:00:00 2001 From: hoenicke Date: Mon, 29 Jan 2001 20:07:31 +0000 Subject: [PATCH] Method scoped classes can look like inner classes. Try to distinguish by bytecode name. git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1291 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/bytecode/ClassInfo.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jode/jode/bytecode/ClassInfo.java b/jode/jode/bytecode/ClassInfo.java index 91fdd54..c51eb9b 100644 --- a/jode/jode/bytecode/ClassInfo.java +++ b/jode/jode/bytecode/ClassInfo.java @@ -458,7 +458,7 @@ public final class ClassInfo extends BinaryInfo implements Comparable { * Some other InnerClass records, the extra classes. This is * optional, but we don't want to loose this information if we * just transform classes, so we memorize for which classes we - * have to keep the inforamtion anyway. + * have to keep the information anyway. * * Currently we don't use all informations, since we don't * update the information for inner/outer/extra classes or @@ -494,6 +494,18 @@ public final class ClassInfo extends BinaryInfo implements Comparable { if (innername != null && innername.length() == 0) innername = null; + /* Some compilers give method scope classes a valid + * outer field, but we mustn't handle them as inner + * classes. The best way to distinguish this case + * is by the class name. + */ + if (outer != null && innername != null + && inner.length() > outer.length() + 2 + innername.length() + && inner.startsWith(outer+"$") + && inner.endsWith("$"+innername) + && Character.isDigit(inner.charAt(outer.length() + 1))) + outer = null; + ClassInfo innerCI = classpath.getClassInfo(inner); ClassInfo outerCI = null; if (outer != null) {