@@ -75,25 +75,6 @@ public abstract class PackageSpecification {
75
75
// TODO(b/77598306): Remove the parameter after switching all callers to pass true.
76
76
protected abstract String asString (boolean includeDoubleSlash );
77
77
78
- /**
79
- * Returns a string representation of this package spec without the repository, and which is
80
- * round-trippable through {@link #fromString}.
81
- *
82
- * <p>For instance, {@code @somerepo//pkg/subpkg/...} turns into {@code "//pkg/subpkg/..."}.
83
- *
84
- * <p>Omitting the repository means that the returned strings are ambiguous in the absence of
85
- * additional context. But, for instance, if interpreted with respect to a {@code package_group}'s
86
- * {@code packages} attribute, the strings always have the same repository as the package group.
87
- */
88
- // TODO(brandjon): This method's main benefit is that it's round-trippable. But we can already
89
- // achieve the same thing with asString(), if the caller parses out the repo to pass to
90
- // fromString() as a separate arg. It'd be nice to eliminate this method in favor of asString()
91
- // and make a version of fromString() that can parse repo names in the label. We'd just have to
92
- // mimic the Label parsing of repo (we can't reuse Label parsing directly since it won't like the
93
- // `/...` syntax). Repo remapping shouldn't come up, since the names we get from stringification
94
- // ought to already be canonical/absolute.
95
- protected abstract String asStringWithoutRepository ();
96
-
97
78
@ Override
98
79
public String toString () {
99
80
return asString (/*includeDoubleSlash=*/ false );
@@ -300,12 +281,6 @@ protected String asString(boolean includeDoubleSlash) {
300
281
return PackageGroupContents .stringForSinglePackage (singlePackageName , includeDoubleSlash );
301
282
}
302
283
303
- @ Override
304
- protected String asStringWithoutRepository () {
305
- return PackageGroupContents .stringForSinglePackageWithDoubleSlashAndWithoutRepository (
306
- singlePackageName );
307
- }
308
-
309
284
@ Override
310
285
public boolean equals (Object o ) {
311
286
if (this == o ) {
@@ -342,12 +317,6 @@ protected String asString(boolean includeDoubleSlash) {
342
317
return PackageGroupContents .stringForAllPackagesBeneath (prefix , includeDoubleSlash );
343
318
}
344
319
345
- @ Override
346
- protected String asStringWithoutRepository () {
347
- return PackageGroupContents .stringForAllPackagesBeneathWithDoubleSlashAndWithoutRepository (
348
- prefix );
349
- }
350
-
351
320
@ Override
352
321
public boolean equals (Object o ) {
353
322
if (this == o ) {
@@ -384,11 +353,6 @@ protected String asString(boolean includeDoubleSlash) {
384
353
return "-" + delegate .asString (includeDoubleSlash );
385
354
}
386
355
387
- @ Override
388
- protected String asStringWithoutRepository () {
389
- return "-" + delegate .asStringWithoutRepository ();
390
- }
391
-
392
356
@ Override
393
357
public boolean equals (Object obj ) {
394
358
if (this == obj ) {
@@ -419,11 +383,6 @@ protected String asString(boolean includeDoubleSlash) {
419
383
return PackageGroupContents .stringForAllPackages (includeDoubleSlash );
420
384
}
421
385
422
- @ Override
423
- protected String asStringWithoutRepository () {
424
- return "public" ;
425
- }
426
-
427
386
@ Override
428
387
public boolean equals (Object o ) {
429
388
return o instanceof AllPackages ;
@@ -450,11 +409,6 @@ protected String asString(boolean includeDoubleSlash) {
450
409
return "private" ;
451
410
}
452
411
453
- @ Override
454
- protected String asStringWithoutRepository () {
455
- return "private" ;
456
- }
457
-
458
412
@ Override
459
413
public boolean equals (Object o ) {
460
414
return o instanceof NoPackages ;
@@ -692,8 +646,15 @@ private static String stringForAllPackagesBeneath(
692
646
}
693
647
694
648
/**
695
- * Does the equivalent of mapping {@link PackageSpecification#asStringWithoutRepository} to the
696
- * component package specs.
649
+ * /** Returns a string representation of this package spec without the repository, and which is
650
+ * round-trippable through {@link #fromString}.
651
+ *
652
+ * <p>For instance, {@code @somerepo//pkg/subpkg/...} turns into {@code "//pkg/subpkg/..."}.
653
+ *
654
+ * <p>Omitting the repository means that the returned strings are ambiguous in the absence of
655
+ * additional context. But, for instance, if interpreted with respect to a {@code
656
+ * package_group}'s {@code packages} attribute, the strings always have the same repository as
657
+ * the package group.
697
658
*
698
659
* <p>Note that this is ambiguous w.r.t. specs that reference other repositories.
699
660
*
0 commit comments