# Multiple classes in an (undefined) ArrayList?

**URL:** <https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291>\
**Category:** Beginners\
**Created:** [February 11, 2019, 7:14pm UTC](https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291 "2019-02-11T19:14:45Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 4, 2023, 1:02pm UTC](https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291/21 "2023-04-04T13:02:42Z")

</div>

You might look at [JavaParser](https://javaparser.org/) I discovered some years ago but never got round to try it out.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 13, 2023, 3:57pm UTC](https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291/22 "2023-04-13T15:57:30Z")

</div>

@quark

I made great progress here.

I am working on a Sketch that can analyze itself.

The thing is that `for (Class currentUserClass : getClass().getDeclaredClasses()) {`

or ` for (java.lang.reflect.Method currentMethod : getClass().getDeclaredMethods()) {`

does work only for the **current Sketch itself**.

What would be the easiest way to retrieve this from another Sketch?

In my analyzing Sketch I would like to open the folder of another Sketch and have this analyzed.

Thanks.

 ![cw](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/8/6/86d43db20c680023634699f3496d515db99ee6ca.png)

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 18, 2023, 9:47am UTC](https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291/23 "2023-04-18T09:47:34Z")

</div>

> [@Chrisir](#):
>
> What would be the easiest way to retrieve this from another Sketch?

TBH I don’t know the answer. You are using Java reflection and I suspect that this is only possible if the classes of interest are on the Java classpath.

You might try adding the import statements from the sketch to be analyzed to the analyzing sketch.

[Previous page](https://discourse.processing.org/t/multiple-classes-in-an-undefined-arraylist/8291.md?page=1)
