Skip to content

I20180213-0125

@trancexpress trancexpress tagged this 12 Feb 07:42
Given classes MyClass1$InnerClass and MyClass2$InnerClass, renaming
MyClass2 to MyClass1 and back results in missing .class file for
MyClass1$InnerClass. The class file is restored on changes in
MyClass1.java or on a clean build.

This is the case, since AbstractImageBuilder.acceptResult doesn't
correctly detect that MyClass1$InnerClass already exists, upon renaming
MyClass2 to MyClass1. It searches for duplicates with type name
MyClass1$InnerClass, instead of MyClass1. Inner classes are not noted,
and so the search yields nothing. The inner class of the original
MyClass1 is then overwritten, and removed as a secondary type later on.

With this change, when compiling after the change,
ClassFile.enclosingClassFile is correctly set for the new inner class
MyClass1$InnerClass. This allows AbstractImageBuilder to detect that it
is a duplicate, and so avoids the issue.

Change-Id: I837df5c53ac42ba15a43c2eec634633c9bc9986f
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Assets 2
Loading