-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in thread "main" java.lang.IllegalStateException: Never found a JavaCodeUnit that matches supposed origin CodeUnit #1194
Comments
I am using version 1.2 of archUnit |
Thanks for reporting the issue! I've started to look at your byte code and saw that the failure during the class file import
seems to be caused by
|
This is my Java file. The class file is an intermediate product of compiling APK using Gradle |
It's the same problem as in #1146, which occurs when inner classes use Minimal example: class Outer {
private String privateString = "";
class Inner {
void method() {
privateString += "+";
}
}
} Some compiler( configuration)s, e.g. OpenJDK 11 with
|
@heyuxiang1996, as a workaround, you can probably replace your |
We weren't aware that the compiler occasionally generates synthetic `access$123` methods that call constructors. More precisely for the following constellation ``` class Outer { String field = ""; class Inner { void concat() { field += "any"; } } } ``` the compiler generates bytecode instantiating and using a `StringBuilder`. But for constructor calls the synthetic access resolution was not hooked in, because we assumed that those methods would never call a constructor. This in turn lead to the bug ``` java.lang.IllegalStateException: Never found a JavaCodeUnit that matches supposed origin CodeUnit{name='access$123'... ``` I.e. the method `access$123` was filtered out as synthetic, but the origin of the constructor call had not been resolved to the actual `Inner.concat` method. Resolves: #1146 Resolves: #1194
The text was updated successfully, but these errors were encountered: