aaschmid/gradle-cpd-plugin

Support for Java Multiline Strings

abigailCortis opened this issue · 2 comments

Are java multiline strings supported by the plugin please?

I am currently using Hibernate's @query annotation with multiline strings such as the below example:

@Query("""
    SELECT 
        column_1,
        column_2
    FROM table
    WHERE column_3 = :=value
""")
Set<Object> findAll(@Param("value") int value);

However this is the error I am getting when running the cpdCheck task:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cpdCheck'.
> A failure occurred while executing de.aaschmid.gradle.plugins.cpd.internal.worker.CpdAction
   > Lexical error in file <path to java class> at line 21, column 13.  Encountered: "\n" (10), after : "\""

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

I guess this is a question for CPD itself which this plugin is just wrapping, see https://pmd.github.io/pmd/pmd_userdocs_cpd. If there are any new properties required to be set, this would be part of this plugin to make these available. However, I only see ignoreUsings for C# which this plugin doesn't support, yet.

Thanks, I think I will use the ignoreAnnotations instead.