Community
Participate
Working Groups
3.1M5a public class TypeParams6<T> { private T f1(T t1){ Vector v= new Vector(); v.add(foo(t1)); Vector ll= (Vector)v.get(0); return (T)ll.get(0); } Vector foo(T t){ Vector vs= new Vector(); vs.add(t); return vs; } } Root exception: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintCreator.getConstraintVariable(InferTypeArgumentsConstraintCreator.java:628) at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintCreator.doVisitMethodInvocationArguments(InferTypeArgumentsConstraintCreator.java:388) at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintCreator.endVisit(InferTypeArgumentsConstraintCreator.java:307) at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:247) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520) at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:245) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2497) at org.eclipse.jdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:143) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520) at org.eclipse.jdt.core.dom.Block.accept0(Block.java:135) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2497) at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:503) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:486) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:291) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450) at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsRefactoring$1.acceptAST(InferTypeArgumentsRefactoring.java:137) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:641) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:436) at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:651) at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsRefactoring.checkFinalConditions(InferTypeArgumentsRefactoring.java:132) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1702) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:86) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:111)
another one - with no type params: public class ExtendsStack extends Stack{ void newOne() throws Exception{ new Vector().add(new ExtendsStack()); } Object foo(){ return push(new ExtendsStack()); } }
Moving Milestone.
I20050527-0010 Example from comment 1 works for me. Comment 0 does not throw an NPE any more, but infers this: public class TypeParams6<T> { private T f1(T t1) { Vector<Vector<T>> v= new Vector<Vector<T>>(); v.add(foo(t1)); Vector ll= v.get(0); return (T) ll.get(0); } Vector<T> foo(T t) { Vector<T> vs= new Vector<T>(); vs.add(t); return vs; } } The type of Vector ll should be inferred to be Vector<T>.
Deferring.
See also bug 87078.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.