excilys/androidannotations — Issue #71: Catch NoClassDefFoundError from CodeModel
Author: pyricau
Created: 2012-01-20 07:35:46+00:00
State: open
Labels: Defect

Error reported in mailing list: http://groups.google.com/group/androidannotations/browse_thread/thread/6292934fb03aef1a#msg_e1ca2e7832ed2e10

This errors occurs in CodeModel, which we use to generate the code. The
following code in com.sun.codemodel.JCodeModel.ref(String) is at fault :

```java
// then the default mechanism.

try {

return ref(Class.forName(fullyQualifiedClassName));

} catch (ClassNotFoundException e1) {

// fall through

}
```

It catches ClassNotFoundException but not NoClassDefFoundError.

We could catch such exceptions, and create a new JDirectClass instead (see the fall through in CodeModel).
We should also report an error in CodeModel.