javac throws NullPointerException when using val into labeled loop. #372

Closed
lombokissues opened this Issue Jul 14, 2015 · 6 comments

Projects

None yet

2 participants

@lombokissues
Collaborator

Migrated from Google Code (issue 299)

@lombokissues
Collaborator

๐Ÿ‘ค buzz.taiki ย  ๐Ÿ•— Nov 18, 2011 at 20:56 UTC

What steps will reproduce the problem?

  1. Compiles following code with javac:
    import java.util.List;
    import java.util.ArrayList;
    import lombok.val;

public class A {
public static void main(String[] args) throws Exception {
List<String> a = new ArrayList<String>();
LABEL: for (val x : a) {
System.out.println(x);
}
}
}

  1. NullpointerException is thrown as followings:
    javac -cp lombok.jar A.java
    error: Lombok visitor handler class lombok.javac.handlers.HandleVal failed: java.lang.NullPointerException
    java.lang.NullPointerException
    at com.sun.tools.javac.code.Types$MapVisitor.visit(Types.java:3270)
    at com.sun.tools.javac.code.Types.upperBound(Types.java:95)
    at lombok.javac.JavacResolution.ifTypeIsIterableToComponent(JavacResolution.java:349)
    at lombok.javac.handlers.HandleVal.visitLocal(HandleVal.java:109)
    ...
    at lombok.javac.JavacNode.traverse(JavacNode.java:63)
    at lombok.javac.JavacAST.traverse(JavacAST.java:117)
    ...
    at com.sun.tools.javac.Main.main(Main.java:54)
    1 error

What is the expected output? What do you see instead?
Don't throws exception.

What version of the product are you using? On what operating system?
0.10.2

Please provide any additional information below.

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Nov 20, 2011 at 15:21 UTC

Confirmed. Simplified testcase:

class A {
{
LABEL: for (lombok.val x : new String[0]) ;
}
}

Note that this problem only occurs in javac; eclipse is just fine.

@lombokissues lombokissues added this to the 0.10.3 milestone Jul 14, 2015
@lombokissues lombokissues added the javac label Jul 14, 2015
@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Nov 20, 2011 at 18:05 UTC

@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Nov 20, 2011 at 18:05 UTC

Fixed in 3b921ad and will be in the version after 0.10.2.

@lombokissues lombokissues removed the accepted label Jul 14, 2015
@lombokissues
Collaborator

๐Ÿ‘ค reinierz ย  ๐Ÿ•— Nov 21, 2011 at 23:03 UTC

Now in release 0.10.4

@lombokissues lombokissues modified the milestone: 0.10.3, 0.10.4 Jul 14, 2015
@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment