Community
Participate
Working Groups
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; } }
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.
Simpler testcase for remaining issue: public class X<T, U> { X<? extends U, ?> parent; public X(X<? extends U, ?> parent) { this.parent = parent; } }
Unexpected error is: Type mismatch: cannot convert from X<capture-of ? extends U,capture-of ?> to X<? extends U,?>
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
Verified for 3.2M1 (I20050808-2000)
Verified using M20050923-1430 for 3.1.1