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

Comments

Projects
None yet
2 participants
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 299)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Collaborator

lombokissues commented Jul 14, 2015

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

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

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

Collaborator

lombokissues commented Jul 14, 2015

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

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

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

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

Now in release 0.10.4

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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