diff --git a/classpath/java/lang/Class.java b/classpath/java/lang/Class.java index 70bd4dc81e..2f9c9a72ee 100644 --- a/classpath/java/lang/Class.java +++ b/classpath/java/lang/Class.java @@ -415,7 +415,7 @@ public final class Class implements Type, AnnotatedElement { byte[] inner = table[i].inner; if (inner != null && inner.length > 1) { String name = new String(inner, 0, inner.length - 1); - if (name.startsWith(prefix)) { + if (name.startsWith(prefix) && name.indexOf('$', prefix.length()) < 0) { Class innerClass = getClassLoader().loadClass(name); result[counter++] = innerClass; } diff --git a/test/Reflection.java b/test/Reflection.java index 8d889837b4..fc9ccfed97 100644 --- a/test/Reflection.java +++ b/test/Reflection.java @@ -38,7 +38,9 @@ public class Reflection { if (! v) throw new RuntimeException(); } - private static class Hello { } + private static class Hello { + private class World { } + } private static void innerClasses() throws Exception { Class c = Reflection.class;