forked from phoedos/pmd
Merge branch 'cannot-resolve-ambiguous-dollar' into 7.0.x
Old cleanups
This commit is contained in:
@ -83,28 +83,6 @@ public class AsmSymbolResolver implements SymbolResolver {
|
||||
return binaryName.replace('.', '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether an internal name has a canonical name. This means,
|
||||
* every segment of the simple name (part after the last '/'), where
|
||||
* segments are separated by '$', is a valid java identifier. We only
|
||||
* check the first character as anon/local classes are identified with
|
||||
* integers, which are not valid java identifier starts.
|
||||
*/
|
||||
static boolean hasCanonicalName(String internalName) {
|
||||
int packageEnd = internalName.lastIndexOf('/');
|
||||
for (int i = packageEnd; i + 1 < internalName.length();) {
|
||||
char firstChar = internalName.charAt(i + 1);
|
||||
if (!Character.isJavaIdentifierStart(firstChar)) {
|
||||
return false;
|
||||
}
|
||||
i = internalName.indexOf('$', i + 1);
|
||||
if (i == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !internalName.isEmpty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
URL getUrlOfInternalName(String internalName) {
|
||||
return classLoader.findResource(internalName + ".class");
|
||||
|
@ -44,7 +44,6 @@ final class ClassStub implements JClassSymbol, AsmStub {
|
||||
static final int UNKNOWN_ARITY = 0;
|
||||
|
||||
private final AsmSymbolResolver resolver;
|
||||
private final Loader loader;
|
||||
|
||||
private final Names names;
|
||||
|
||||
@ -76,7 +75,6 @@ final class ClassStub implements JClassSymbol, AsmStub {
|
||||
|
||||
this.resolver = resolver;
|
||||
this.names = new Names(internalName);
|
||||
this.loader = loader;
|
||||
|
||||
this.parseLock = new ParseLock() {
|
||||
// note to devs: to debug the parsing logic you might have
|
||||
@ -132,10 +130,6 @@ final class ClassStub implements JClassSymbol, AsmStub {
|
||||
};
|
||||
}
|
||||
|
||||
Loader getLoader() {
|
||||
return loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsmSymbolResolver getResolver() {
|
||||
return resolver;
|
||||
|
@ -1147,7 +1147,7 @@ public final class TypeOps {
|
||||
// <editor-fold defaultstate="collapsed" desc="Overriding">
|
||||
|
||||
/**
|
||||
* Returns true if m1 is return-type substitutable with m2. . The notion of return-type-substitutability
|
||||
* Returns true if m1 is return-type substitutable with m2. The notion of return-type-substitutability
|
||||
* supports covariant returns, that is, the specialization of the return type to a subtype.
|
||||
*
|
||||
* https://docs.oracle.com/javase/specs/jls/se9/html/jls-8.html#jls-8.4.5
|
||||
|
@ -30,17 +30,6 @@ class NamesTest : IntelliMarker, FunSpec({
|
||||
names.packageName shouldBe ""
|
||||
}
|
||||
|
||||
test("Test cano name") {
|
||||
AsmSymbolResolver.hasCanonicalName("Num") shouldBe true
|
||||
AsmSymbolResolver.hasCanonicalName("") shouldBe false
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C") shouldBe true
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C\$D") shouldBe true
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C\$1D") shouldBe false
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C\$1D\$D") shouldBe false
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C\$D\$1") shouldBe false
|
||||
AsmSymbolResolver.hasCanonicalName("a/b/C\$D") shouldBe true
|
||||
}
|
||||
|
||||
test("Test names with trailing dollar") {
|
||||
|
||||
val names = ClassStub.Names("javasymbols/testdata/deep/ClassWithDollar\$")
|
||||
|
Reference in New Issue
Block a user