ResourceSet extends DataSet<ResourceItem, ResourceFile> { public void setTrackSourcePositions(boolean shouldTrack) { mTrackSourcePositions = shouldTrack; } ResourceSet(String name, String libraryName);  ResourceSet(String name, boolean validateEnabled);  ResourceSet(String name, String libraryName, boolean validateEnabled); String getLibraryName(); void setGeneratedSet(ResourceSet generatedSet); void setPreprocessor(@NonNull ResourcePreprocessor preprocessor); void setShouldParseResourceIds(boolean shouldParse); void setDontNormalizeQualifiers(boolean dontNormalizeQualifiers); void setTrackSourcePositions(boolean shouldTrack); boolean isFromDependency(); void setFromDependency(boolean fromDependency); static final String ATTR_GENERATED_SET; static final String ATTR_FROM_DEPENDENCY; }
@Test public void testTrackSourcePositions() throws IOException, MergingException { File root = TestUtils.getRoot("resources", "baseSet"); ResourceSet resourceSet = new ResourceSet("main", null); resourceSet.addSource(root); RecordingLogger logger = new RecordingLogger(); resourceSet.loadFromFiles(logger); checkLogger(logger); String stringKey = "string/basic_string"; List<ResourceItem> resources = resourceSet.getDataMap().get(stringKey); assertNotNull(resources); assertFalse(resources.isEmpty()); assertEquals(new SourcePosition(13, 4, 529, 13, 53, 578), XmlUtils.getSourceFilePosition(resources.get(0).getValue()).getPosition()); resourceSet = new ResourceSet("main", null); resourceSet.addSource(root); resourceSet.setTrackSourcePositions(false); logger = new RecordingLogger(); resourceSet.loadFromFiles(logger); resources = resourceSet.getDataMap().get(stringKey); assertNotNull(resources); assertFalse(resources.isEmpty()); assertEquals(SourceFilePosition.UNKNOWN, XmlUtils.getSourceFilePosition(resources.get(0).getValue())); }