return new Object[0];
}
+ /**
+ * Returns an array of nested classes declared in the class.
+ * Nested classes are inner classes, anonymous classes, local classes,
+ * and static nested classes. This simply calls <code>getNestedClasses()</code>.
+ *
+ * @see #getNestedClasses()
+ * @since 3.15
+ */
+ public CtClass[] getDeclaredClasses() throws NotFoundException {
+ return getNestedClasses();
+ }
+
/**
* Returns an array of nested classes declared in the class.
* Nested classes are inner classes, anonymous classes, local classes,
<ul><pre>ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("java.lang.String");
-cc.addField(new CtField(CtClass.intType, "hiddenValue", cc));
+CtField f = new CtField(CtClass.intType, "hiddenValue", cc);
+f.setModifiers(Modifier.PUBLIC);
+cc.addField(f);
cc.writeFile(".");</pre></ul>
<p>This program produces a file <code>"./java/lang/String.class"</code>.