Fixy icon indicating copy to clipboard operation
Fixy copied to clipboard

Import loop causes Fixy to use wrong packageName value in CoreFixy.getClassForName()

Open jnehlmeier opened this issue 10 years ago • 0 comments

Assume the following classes:

a.A, b.B, c.C and d.D

Each class has its own yaml file and !import is used based on the class dependencies:

a.A -> b.B -> c.C -> d.D -> b.B

What now happens is that CoreFixy.loadEntities() is called in the above order but is not called for the last b.B import since that import has already been seen earlier, see CoreFixy.ConstructImport.construct().

So while processing the d.yaml file, SnakeYaml wants to create an instance of b.B because D references a B. But since no b.B instances have been created yet the entityCache of CoreFixy does not have any cached instance and calls super.createInstance() which in turn calls CoreFixy.getClassforName() at some point. However the package name is set to d (because we process the d.yaml file) so getClassForName() now tries to load the class d.B which fails with a ClassNotFoundException.

jnehlmeier avatar Dec 02 '14 12:12 jnehlmeier