skylot / jadx

Dex to Java decompiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[core] Compiler error with nested classes and generics

nitram84 opened this issue · comments

Issue details

I'm reporting this issue as a unit test:

package jadx.tests.integration.inner;

import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import org.junit.jupiter.api.Test;

import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static jadx.tests.api.utils.JadxMatchers.countString;
import static org.hamcrest.MatcherAssert.assertThat;

public class TestInnerClass6 extends IntegrationTest {
	public static class TestCls {

		public static class RecyclerView {

			public static class ViewHolder {
			}

			public static class Adapter<T> {
			}
		}

		public static class TestAdapter extends RecyclerView.Adapter<TestAdapter.ViewHolder> {
			public static class ViewHolder extends RecyclerView.ViewHolder {
			}
		}
	}

	@Test
	public void test() {
		this.disableCompilation(); // TODO please remove this line, when this unit test passes
		ClassNode cls = getClassNode(TestInnerClass6.TestCls.class);
		String code = cls.getCode().toString();
		assertThat(code, countString(0, "<ViewHolder>"));
		assertThat(code, containsOne("<TestAdapter.ViewHolder>"));
	}
}

Jadx generates <ViewHolder> instead of <TestAdapter.ViewHolder>.

Relevant log output or stacktrace

No response

Provide sample and class/method full name

Example:
See e.g. class "in.pounkumar.restclient.Fragment.History.HistoryAdapter" in https://apkpure.com/rest-api-client/in.pounkumar.restclient/download/1.1.2

Jadx version

latest git