forked from phoedos/pmd
[java] Add more details to parse failures in signatures
This commit is contained in:
@ -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.LexicalScope;
|
||||||
import net.sourceforge.pmd.lang.java.types.Substitution;
|
import net.sourceforge.pmd.lang.java.types.Substitution;
|
||||||
import net.sourceforge.pmd.lang.java.types.TypeOps;
|
import net.sourceforge.pmd.lang.java.types.TypeOps;
|
||||||
|
import net.sourceforge.pmd.util.AssertionUtil;
|
||||||
import net.sourceforge.pmd.util.CollectionUtil;
|
import net.sourceforge.pmd.util.CollectionUtil;
|
||||||
|
|
||||||
abstract class GenericSigBase<T extends JTypeParameterOwnerSymbol & AsmStub> {
|
abstract class GenericSigBase<T extends JTypeParameterOwnerSymbol & AsmStub> {
|
||||||
@ -51,8 +52,18 @@ abstract class GenericSigBase<T extends JTypeParameterOwnerSymbol & AsmStub> {
|
|||||||
this.lock = new ParseLock(parseLockName) {
|
this.lock = new ParseLock(parseLockName) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean doParse() {
|
protected boolean doParse() {
|
||||||
|
try {
|
||||||
GenericSigBase.this.doParse();
|
GenericSigBase.this.doParse();
|
||||||
return true;
|
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
|
@Override
|
||||||
|
@ -50,7 +50,7 @@ abstract class ParseLock {
|
|||||||
finishParse(!success);
|
finishParse(!success);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
status = ParseStatus.FAILED;
|
status = ParseStatus.FAILED;
|
||||||
LOG.error("Parsing failed in ParseLock#doParse()", t);
|
LOG.error("Parsing failed in ParseLock#doParse() of {}", name, t);
|
||||||
finishParse(true);
|
finishParse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user