From f121b102a46a3e651ded9edc252ec9867d4411a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D0=BE=D0=BC=D0=B8=D0=BD=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B5=D0=B2?= =?UTF-8?q?=D0=B8=D1=87?= Date: Mon, 15 Apr 2019 16:11:26 +0700 Subject: [PATCH 1/3] [java] Show more detailed message when can't resolve field type --- .../pmd/lang/java/typeresolution/ClassTypeResolver.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java index 4883668d0a..76668f7822 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java @@ -504,9 +504,10 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter { // swallow } catch (final LinkageError e) { if (LOG.isLoggable(Level.WARNING)) { - LOG.log(Level.WARNING, "Error during type resolution due to: " + e); + String message = "Error during type resolution of field '" + fieldImage + "' in " + + typeToSearch.getType() + " due to: " + e; + LOG.log(Level.WARNING, message); } - // TODO : report a missing class once we start doing that... return null; } From 17b7837dcc599fe806ae18e36362637ba20eb74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Tue, 16 Apr 2019 16:59:40 -0300 Subject: [PATCH 2/3] Bring back the TODO --- .../pmd/lang/java/typeresolution/ClassTypeResolver.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java index 76668f7822..ebb3aec9b9 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java @@ -508,6 +508,7 @@ public class ClassTypeResolver extends JavaParserVisitorAdapter { + typeToSearch.getType() + " due to: " + e; LOG.log(Level.WARNING, message); } + // TODO : report a missing class once we start doing that... return null; } From a4a7aa48b48dc6c09523f0584e1664ad58eec859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Tue, 16 Apr 2019 17:00:38 -0300 Subject: [PATCH 3/3] Update changelog, refs #1776 --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index dcec3b34b5..bf631fd572 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -43,6 +43,7 @@ Being based on a proper Antlr grammar, CPD can: * [#1746](https://github.com/pmd/pmd/pull/1746): \[java] Update rule to prevent UnusedImport when using JavaDoc with array type - [itaigilo](https://github.com/itaigilo) * [#1752](https://github.com/pmd/pmd/pull/1752): \[java] UseObjectForClearerAPI Only For Public - [Björn Kautler](https://github.com/Vampire) * [#1761](https://github.com/pmd/pmd/pull/1761): \[dart] \[cpd] Added CPD support for Dart - [Maikel Steneker](https://github.com/maikelsteneker) +* [#1776](https://github.com/pmd/pmd/pull/1776): \[java] Show more detailed message when can't resolve field type - [Andrey Fomin](https://github.com/andrey-fomin) {% endtocmaker %}