diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/GenericSigBase.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/GenericSigBase.java index eabeb13c5a..07555bae9e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/GenericSigBase.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/GenericSigBase.java @@ -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 { @@ -51,8 +52,18 @@ abstract class GenericSigBase { this.lock = new ParseLock(parseLockName) { @Override protected boolean doParse() { - GenericSigBase.this.doParse(); - return true; + 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 diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/ParseLock.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/ParseLock.java index a0150e00fe..d78f9e51cd 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/ParseLock.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/asm/ParseLock.java @@ -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); }