[java] Add more details to parse failures in signatures
This commit is contained in:
parent
28b4139cd4
commit
0d11f151bd
@ -31,6 +31,7 @@ import net.sourceforge.pmd.lang.java.types.JTypeVar;
|
||||
import net.sourceforge.pmd.lang.java.types.LexicalScope;
|
||||
import net.sourceforge.pmd.lang.java.types.Substitution;
|
||||
import net.sourceforge.pmd.lang.java.types.TypeOps;
|
||||
import net.sourceforge.pmd.util.AssertionUtil;
|
||||
import net.sourceforge.pmd.util.CollectionUtil;
|
||||
|
||||
abstract class GenericSigBase<T extends JTypeParameterOwnerSymbol & AsmStub> {
|
||||
@ -51,8 +52,18 @@ abstract class GenericSigBase<T extends JTypeParameterOwnerSymbol & AsmStub> {
|
||||
this.lock = new ParseLock(parseLockName) {
|
||||
@Override
|
||||
protected boolean doParse() {
|
||||
try {
|
||||
GenericSigBase.this.doParse();
|
||||
return true;
|
||||
} catch (RuntimeException e) {
|
||||
throw AssertionUtil.contexted(e)
|
||||
.addContextValue("signature", GenericSigBase.this)
|
||||
// Here we don't use the toString of the ctx directly because
|
||||
// it could be using the signature indirectly, which would fail
|
||||
.addContextValue("owner class", ctx.getEnclosingClass())
|
||||
.addContextValue("owner name", ctx.getSimpleName())
|
||||
.addContextValue("owner package", ctx.getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ abstract class ParseLock {
|
||||
finishParse(!success);
|
||||
} catch (Throwable t) {
|
||||
status = ParseStatus.FAILED;
|
||||
LOG.error("Parsing failed in ParseLock#doParse()", t);
|
||||
LOG.error("Parsing failed in ParseLock#doParse() of {}", name, t);
|
||||
finishParse(true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user