You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Nicolas Vanhoren (Jira)" <ji...@apache.org> on 2020/09/22 09:13:00 UTC

[jira] [Commented] (NETBEANS-4833) Gradle project not triggering Lombok annotation processor anymore in 12.1

    [ https://issues.apache.org/jira/browse/NETBEANS-4833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17199939#comment-17199939 ] 

Nicolas Vanhoren commented on NETBEANS-4833:
--------------------------------------------

I modified the description a little after testing in 12.0 and confirming it doesn't have the bug.

> Gradle project not triggering Lombok annotation processor anymore in 12.1
> -------------------------------------------------------------------------
>
>                 Key: NETBEANS-4833
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4833
>             Project: NetBeans
>          Issue Type: Bug
>    Affects Versions: 12.1
>         Environment: Ubuntu 18.04, openjdk 13, Netbeans 12.1, gradle 6.6.1 (installed by Netbeans)
>            Reporter: Nicolas Vanhoren
>            Priority: Major
>
> h3. Description:
> A Gradle project using the Lombok plugin doesn't seem to trigger the annotation processor anymore in 12.1. It worked with previous version.
> h3. How to reproduce:
>  * In 12.1, create a new "Java Application" project using Gradle.
>  * Alter the gradle file, \{{build.gradle, }}to add a reference to the lombok gradle plugin:
>  
> {code:java}
> plugins {
>     id "io.freefair.lombok" version "5.2.1"
> }
> apply plugin: 'java'
> apply plugin: 'jacoco'
> apply plugin: 'application'mainClassName = 'gradleproject1.Main'
> repositories {
>     jcenter()
> }
> dependencies {
>     testImplementation     'junit:junit:4.13'
> }
> {code}
>  
>  
>  * Alter the \{{Main.java}} file to make some use of a Lombok annotation:
>  
> {code:java}
> /*
>  * To change this license header, choose License Headers in Project Properties.
>  * To change this template file, choose Tools | Templates
>  * and open the template in the editor.
>  */
> package gradleproject1;
> import lombok.Getter;
> /**
>  *
>  * @author nico
>  */
> public class Main {
>     
>     public static class TestClass {
>         @Getter String testString = "hello";
>     }
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) {
>         TestClass x = new TestClass();
>         System.out.println(x.getTestString());
>     }
>     
> }
> {code}
>  
> Result: The project compiles and executes correctly. Unfortunately Netbeans identifies this line as an error:
> {code:java}
>  System.out.println(x.getTestString());
> {code}
> This is due to the Lombok annotation processor not being run before checking for errors.
> By looking at the properties of the project we can see that the lombok jar file was correctly detected by Netbeans as it can be found in the "Sources > Main > Annotation Processors" tab. But somehow it doesn't seem to be used by Netbeans before checking errors.
> I tested the same procedure in 12.0 and it doesn't yield the same problem. That line is not identified as a compilation error.
> I do not know any kind of workaround for this problem. For normal Netbeans projects it is possible to manually enable the annotation processor in the properties of the project but it is not possible for Gradle projects. This basically makes Netbeans 12.1 unsuitable to work on projects using both Gradle and Lombok as far a I know. (If someone find a workaround I would be very glad.)
> h3. Expected Behavior:
> That Netbeans properly triggers the annotation processor with Gradle projects, like it does in versions prior to 12.1.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists