Lombok & JDK 8

2,819 views
Skip to first unread message

Fabrizio Giudici

unread,
May 14, 2013, 3:20:59 AM5/14/13
to Project Lombok
A friend is trying JDK8 with NetBeans, Maven and Lombok and it seems
Lombok is not automatically activated as it happens for JDK 6 and JDK 7.
Is it something known? Any workaround? Thanks.


--
Fabrizio Giudici - Java Architect @ Tidalwave s.a.s.
"We make Java work. Everywhere."
http://tidalwave.it/fabrizio/blog - fabrizio...@tidalwave.it

Reinier Zwitserloot

unread,
May 14, 2013, 6:22:53 AM5/14/13
to project-lombok
Robbert Jan was working on this. It's as far as I know still in a branch. I'll check on this next monday night lombok night (which has been moved to thursday this week).

 --Reinier Zwitserloot


--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Robbert Jan Grootjans

unread,
May 14, 2013, 10:20:25 AM5/14/13
to project...@googlegroups.com
Yes, I'm still working on it, though supporting JDK8, and previous versions within a single version of lombok has proven to be non-trivial. I'm not going to go into details, but we have to do a lot of run-time checking to make this happen. Thankfully we 
1. Already did a lot of this. JDK7 had it's own special differences with JDK6
2. Reinier has created a great test-brace that can test multiple versions of OpenJDK, OracleJDK, etc. 

So we're confident we can fix this, though don't expect a version next week.


To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.

rjdkolb

unread,
Sep 9, 2013, 7:33:58 AM9/9/13
to project...@googlegroups.com, robbe...@dds.nl


Hi Robbert

Is there any progress on this Java 8 fix ?

Thanks
Richard


On Tuesday, 14 May 2013 14:20:25 UTC, rjee wrote:
Yes, I'm still working on it, though supporting JDK8, and previous versions within a single version of lombok has proven to be non-trivial. I'm not going to go into details, but we have to do a lot of run-time checking to make this happen. Thankfully we 
1. Already did a lot of this. JDK7 had it's own special differences with JDK6
2. Reinier has created a great test-brace that can test multiple versions of OpenJDK, OracleJDK, etc. 

So we're confident we can fix this, though don't expect a version next week.
On Tue, May 14, 2013 at 12:22 PM, Reinier Zwitserloot <rei...@zwitserloot.com> wrote:
Robbert Jan was working on this. It's as far as I know still in a branch. I'll check on this next monday night lombok night (which has been moved to thursday this week).

 --Reinier Zwitserloot


On Tue, May 14, 2013 at 9:20 AM, Fabrizio Giudici <Fabrizio...@tidalwave.it> wrote:
A friend is trying JDK8 with NetBeans, Maven and Lombok and it seems Lombok is not automatically activated as it happens for JDK 6 and JDK 7. Is it something known? Any workaround? Thanks.



--
Fabrizio Giudici - Java Architect @ Tidalwave s.a.s.
"We make Java work. Everywhere."
http://tidalwave.it/fabrizio/blog - fabrizio...@tidalwave.it

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Roel Spilker

unread,
Sep 9, 2013, 8:33:31 AM9/9/13
to project...@googlegroups.com
I'll answer this one...

Yes there is quite some progress. I hope to have a jdk8-only test build available this week, possibly even tonight.

rjdkolb

unread,
Sep 9, 2013, 8:41:53 AM9/9/13
to project...@googlegroups.com

Hi Roel

Awesome, thanks.
If you need a tester, let me know.

regards
Richard

Lenny Primak

unread,
Sep 9, 2013, 12:35:40 PM9/9/13
to project...@googlegroups.com
If its only JDK8 compatible, it won't fix the netbeans issues. 
For netbeans to work, Lombok should support JDK8 for netbeans internal compiles and JDK7 for maven builds. Is this even possible?  

Reinier Zwitserloot

unread,
Sep 9, 2013, 12:44:23 PM9/9/13
to project-lombok

Yeah, it's possible.

Reinier Zwitserloot

unread,
Sep 9, 2013, 6:15:33 PM9/9/13
to project...@googlegroups.com
It's so possible, here's a release for you:


It's not 100% yet, but close. Specifically:

* this edge release on JDK6/JDK7 should work exactly the same as the official release. 
* On JDK8, it almost entirely works, except for a few 'val' corner cases (No promises yet and when we tackle those, we don't yet know what's going wrong there), and the newly introduced feature of copying javadoc from a field to generated getters/setters, during delomboking. We know how to fix this though.

Please let us know if this works for you. If it doesn't, you can also let us know if you really have to :P

Yeah, it's possible.

To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombok+unsubscribe@googlegroups.com.

Richard Kolb

unread,
Sep 10, 2013, 7:38:23 AM9/10/13
to project...@googlegroups.com
Hi Reinier

Thanks for the effort. Much appreciated.
I've added Project Lombok to the adoptopenjdk page . I've put my name against it, but it can be changed to someone who knows more about Lombok inner workings.
It would be awesome to get the CI going with Cloudbees.

regards
Richard


--
You received this message because you are subscribed to a topic in the Google Groups "Project Lombok" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/project-lombok/P69pJGo8gG4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to project-lombo...@googlegroups.com.

Reinier Zwitserloot

unread,
Sep 10, 2013, 9:14:05 AM9/10/13
to project-lombok
Thanks :) – If you get inundated with questions feel free to change that to one of us.

 --Reinier Zwitserloot

Wes

unread,
Sep 17, 2013, 1:52:43 AM9/17/13
to project...@googlegroups.com

Hi, I've been testing the jdk8 edge version and noticed that extension methods don't work (won't compile) within lambdas in javac:

@ExtensionMethod({ String.class })

This works:

        Function<Integer, Integer> function = new Function<Integer, Integer>() {
            @Override
            public Integer apply(Integer t) {
                System.out.println("%d".format(t));
                return 0;
            }
        };

But this doesn't:

        Function<Integer, Integer> function2 = i -> {
            System.out.println("%d".format(i));
            return 0;
        };

Both seem to work fine within eclipse (with jdk 8 support).

I also noticed that within eclipse it's possible to use an extension method within the same class.  E.g. this works in eclipse but not with javac:

@ExtensionMethod({ ThisClass.class })
public class ThisClass {
    public static void ext(String s) {
        ...
    }

    public void test() {
        "String".ext();
    }
}

Thanks,
Wes



Reinier Zwitserloot

unread,
Sep 17, 2013, 8:46:48 AM9/17/13
to project-lombok
I'm not too surprised; we have to jump through a little more hoops in javac mode to make extension methods work properly there. We have 'make them more consistent' on our todo list, by the way.

Can you file a bug about this on the issuetracker at http://code.google.com/p/projectlombok/issues ? Thanks!


 --Reinier Zwitserloot


Wes

unread,
Sep 19, 2013, 2:22:05 AM9/19/13
to project...@googlegroups.com

Hi,

What I was thinking of doing in the meantime was to use the eclipse compiler from maven.

By using the java8-modified version of eclipse's compiler plus a modified plexus-compiler-eclipse that supports java8 I thought I'd get eclipse's behavior through maven, but I've run into a problem.  When using plexus-compiler-eclipse, lombok doesn't modify the class files.

I've created a test pom using the standard (java7) plexus-compiler-eclipse and lombok 0.12.0, pom and test class below.  You can run it either as "mvn -P eclipse clean compile" or "mvn -P javac clean compile".  The javac-compiled class has the lombok modifcations, while the eclipse-compiled one doesn't.  I've checked maven's debug output to see that the lombok jar is included on the classpath during compilation.

I found this bug logged in 2010: http://code.google.com/p/projectlombok/issues/detail?id=119

But as that was marked invalid, it sounds like it should work.  Any ideas?

Thanks,
-Wes

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>test.test</groupId>
    <artifactId>test.test</artifactId>
    <packaging>jar</packaging>
    <version>0.0-SNAPSHOT</version>
    <name>test</name>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>0.12.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>eclipse</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                            <compilerId>eclipse</compilerId>
                            <source>1.7</source>
                            <target>1.7</target>
                            <optimize>true</optimize>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.codehaus.plexus</groupId>
                                <artifactId>plexus-compiler-eclipse</artifactId>
                                <version>2.2</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>javac</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

Test.java:

@lombok.Data
public class Test {
    Integer i;

Reinier Zwitserloot

unread,
Sep 19, 2013, 6:51:50 AM9/19/13
to project...@googlegroups.com
I marked it invalid because Robbert Jan tried to reproduce it, couldn't do it, and the original bug reporter wasn't reachable. However, that issue did not conflagrate JDK8 support into it, so perhaps these are different issues.

This is going to have to wait until after devoxx unfortunately.
Reply all
Reply to author
Forward
0 new messages