Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lombokissues opened this issue Jul 14, 2015 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 299)

@lombokissues
Copy link
Author

👤 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
Copy link
Author

👤 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 the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues lombokissues added this to the 0.10.3 milestone Jul 14, 2015
@lombokissues
Copy link
Author

👤 reinierz   🕗 Nov 20, 2011 at 18:05 UTC

@lombokissues
Copy link
Author

👤 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 The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

👤 reinierz   🕗 Nov 21, 2011 at 23:03 UTC

Now in release 0.10.4

@lombokissues lombokissues modified the milestones: 0.10.3, 0.10.4 Jul 14, 2015
@lombokissues
Copy link
Author

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants