Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 403457 - [1.8][compiler] NPE in WildcardBinding.signature
Summary: [1.8][compiler] NPE in WildcardBinding.signature
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 287648
  Show dependency tree
 
Reported: 2013-03-15 09:12 EDT by Srikanth Sankaran CLA
Modified: 2013-08-25 20:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2013-03-15 09:12:25 EDT
BETA_JAVA8:

The following program triggers an NPE:

// ---
//import java.util.Map;
import java.lang.annotation.*;

public class X {
	void foo(Map<@Marker ? super @Marker Object, @Marker ? extends @Marker String> m){}
   void goo(Map<@Marker ? extends @Marker Object, @Marker ? super @Marker String> m){}
}

@Target(ElementType.TYPE_USE)
@interface Marker {
	
}

If the import is uncommented, it compiles OK.
Comment 1 Srikanth Sankaran CLA 2013-03-15 13:09:52 EDT
Likely a duplicate/variant of https://bugs.eclipse.org/bugs/show_bug.cgi?id=403216,

I had annotation based null analysis turned on in my workspace. When it
is turned off, problem goes away.

Stephan, the return from captureTypeAnnotations viz:

return scope.environment().createParameterizedType((ReferenceBinding) argType, Binding.NO_TYPES, annotationBits, enclosingType);

looks suspect. Please take a look. Thanks.
Comment 2 Stephan Herrmann CLA 2013-03-16 20:32:09 EDT
Another suspicious element:
Inside WildcardBinding.signature() the NPE is caused at
   typeVariable().signature()
where typeVariable() is documented to return "null in case of inconsistency", mh...

OTOH, the line you quote should indeed not be applied if (argType instanceof WildcardBinding).

But let's first settle bug 403216, OK?
Comment 3 Stephan Herrmann CLA 2013-08-25 20:24:29 EDT
One test has already been released via commit 97b509ed0492c1ec5d604a591a307ac7d4bc5ef4
(passing).

I'm adding another one (using null annotations) via commit 926127edb74c4e9bf214c4a80335d01c8995a448

Bug 392099 and friends have brought many changes, I'm no longer able to reconstruct even how we got into the NPE. Too bad we didn't record the stack trace ...