blob: 9071654a25955280c03354c3c5b5340d856becb5 [file] [log] [blame]
// Copyright (c) 2020, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.retrace.stacktraces;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.android.tools.r8.references.Reference;
import com.android.tools.r8.retrace.RetraceApi;
import com.android.tools.r8.retrace.RetraceFieldResult;
import com.android.tools.r8.utils.StringUtils;
import java.util.Arrays;
import java.util.List;
public class MemberFieldOverlapStackTrace implements StackTraceForTest {
@Override
public List<String> obfuscatedStackTrace() {
return Arrays.asList(
"Exception in thread \"main\" java.lang.NullPointerException", "\tat a.A.a(Bar.java:1)");
}
@Override
public String mapping() {
return StringUtils.lines("foo.Bar -> a.A:", " 1:1:int method():5 -> a", " int field -> a");
}
@Override
public List<String> retracedStackTrace() {
return Arrays.asList(
"Exception in thread \"main\" java.lang.NullPointerException",
"\tat foo.Bar.method(Bar.java:5)");
}
@Override
public int expectedWarnings() {
return 1;
}
public void inspectField(RetraceApi retracer) {
RetraceFieldResult result =
retracer.retrace(Reference.classFromTypeName("a.A")).lookupField("field");
assertTrue(result.stream().findAny().isPresent());
assertFalse(result.isAmbiguous());
}
}