Bug 104082 - [1.5][compiler] 1.5 source code gets internal eclipse null pointer error
Summary: [1.5][compiler] 1.5 source code gets internal eclipse null pointer error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.1.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-15 15:12 EDT by Joe Bienkowski CLA
Modified: 2006-03-01 12:27 EST (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 Joe Bienkowski CLA 2005-07-15 15:12:11 EDT
We have a large 1.5 codebase and when we put it into the new version of eclipse 
we found that one class wouldn't compile.  The issue was an internal eclipse 
null pointer error and it just put the exception at the first line of one of 
our classes.  We were able to strip out all of the other classes and strip down 
the broken class and found that one complex method seemed to be the cause.  

This class compiles fine using suns 1.5.0_02-b09 compiler.  We've tested this 
on several diferent machines running eclipse 3.1 and we have eclipse set to 
compile as a 1.5 file.  

eclipse version
Version: 3.1.0
Build id: I20050627-1435


If you would like more information about this or a screen print of the error 
eclipse is giving please email me at jbienkowski@comcast.net

Here is the class:


package com.mm.rs.jccs.ui.jccs;

import com.mm.rs.jccs.*;
import java.lang.reflect.*;
import java.util.*; 

interface StoredObject {
	String getUid();
	
	String getName();
	
	String getDescription();
	
}

interface GraphDiagramNode //extends Comparable
{

}

public class JccsGraphDiagramNode
    <ObjectType extends StoredObject,
     ParentType extends StoredObject>
    implements GraphDiagramNode
{
    private final JccsGraphDiagramModel model;
    private final JccsGraphDiagramNode<? extends ParentType, ?> parent;
    private final ObjectType object;

    public class JccsGraphDiagramModel 
    {
    }
 
    public interface GraphDiagramModel
    {
       
    }
    
    public class Dependency
    {
     
    }
   
    public JccsGraphDiagramNode(
        JccsGraphDiagramModel argModel,
        JccsGraphDiagramNode<? extends ParentType, ?> argParent,
        ObjectType argObject)
    {
        model = argModel;
        parent = argParent;
        object = argObject;
    }

    protected
        <ChildType extends StoredObject>
        Collection<? extends JccsGraphDiagramNode<ChildType, ? super 
ObjectType>> createChildren(
            Iterator<ChildType> argData,
            Class<? extends JccsGraphDiagramNode<ChildType, ? super 
ObjectType>> argChildNodeClass,
        Class<? extends StoredObject> argInterface)
    {
        Collection<JccsGraphDiagramNode<ChildType, ? super ObjectType>> output
            = new LinkedList<JccsGraphDiagramNode<ChildType, ? super 
ObjectType>>();

        try
        {
            while (argData.hasNext())
            {
                ChildType next = argData.next();
                Constructor<? extends JccsGraphDiagramNode<ChildType, ? super 
ObjectType>>
                    constructor = argChildNodeClass.getConstructor(
                        JccsGraphDiagramModel.class,
                        getClass(),
                        argInterface);

                output.add(constructor.newInstance(model, this, next));
            }
        }
        catch (Exception x)
        {
            x.printStackTrace();
        }

        return output;
    }
}
Comment 1 Philipe Mulet CLA 2005-07-18 07:10:46 EDT
NPE is likely a dup of bug 101456, which got addressed since 3.1 release.
However, on the code sample, I am still seeing a compile error being detected on
line:

		parent = argParent;

due to some type mismatch.
Comment 2 Philipe Mulet CLA 2005-07-18 07:44:06 EDT
Simpler testcase for remaining issue:
public class X<T, U> {
	X<? extends U, ?> parent;

	public X(X<? extends U, ?> parent) {
		this.parent = parent;
	}
}
Comment 3 Philipe Mulet CLA 2005-07-18 07:44:47 EDT
Unexpected error is: Type mismatch: cannot convert from X<capture-of ? extends 
 U,capture-of ?> to X<? extends U,?>
Comment 4 Philipe Mulet CLA 2005-07-18 08:14:32 EDT
Issue comes from unneeded substitution from wildcard bound (U) during capture
mechanism, leading the supertype of 'capture-of ? extends U' to be 'capture-of
?' instead of 'U'.

Added GenericTypeTest#test782 & test784.
Fixed
Comment 5 Olivier Thomann CLA 2005-08-09 11:55:09 EDT
Verified for 3.2M1 (I20050808-2000)
Comment 6 David Audel CLA 2005-09-26 11:36:46 EDT
Verified using M20050923-1430 for 3.1.1