Community
Participate
Working Groups
Build Identifier: 20090920-1017 When i call CheckFinalConditions of class pullUpRefactoring processor,the method rewriteTypeOccurrences is called internally.In rewriteTypeOccurrences a variable "declaring" is created, this variable declaring loses its value when it is called in anonymousClass method public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) and it throws NullPointerException. Reproducible: Always Steps to Reproduce: 1.Make a plugin development project 2.Add the class PullUpMethod.java 3.Add the CallPullUpMethod.java Now as input callUpMethod takes java files as input so 4.create a package named pull 5.Add subClass.java 6.Add superClass.java
Move to JDT/UI
Created attachment 168141 [details] In this file..code of all files that are needed are given also error trace is written
Could you please provide them in a zip file as plain text files? Not everyone as Microsoft Word to open the file you attached. Thanks.
Created attachment 168147 [details] zip file containing java files and error trace
Please also attach the .log file.
Our comments just crossed. Saw the log. Thx.
Created attachment 168152 [details] log file of error
The attached example is not self-containing but looking at the code I see you're using internal classes and methods which is not supported. Moving to Markus to check whether it is OK here not to check 'subType' for 'null': final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); in org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.rewriteTypeOccurrences(...).new ASTRequestor() {...}.acceptAST(ICompilationUnit, CompilationUnit)
(In reply to comment #8) > The attached example is not self-containing but looking at the code I see > you're using internal classes and methods which is not supported. > > Moving to Markus to check whether it is OK here not to check 'subType' for > 'null': > final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, > declaring); > in > org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.rewriteTypeOccurrences(...).new > ASTRequestor() {...}.acceptAST(ICompilationUnit, CompilationUnit) yes, actually i have to use these internal files by hook or by crook, because PullUpDescriptor does not allow to configure the destination type and moved members. It does not provide any setters. The only way I found to accomplish that was to import some of JDT's internal packages and to instantiate the internal PullUpRefactoringProcessor class :( can u suggest me any better way to do pull up method refactoring without using internal classes. And i have debug the code many times, and the problem is that value in declaring variable is null.As u can see in java file of pullUpMethodprocessor and in method rewriteTypeOccurrences, firstly the value of declaring is being set properly, but when: "public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node)" is being processed decalring lost its value and start giving null. I am unable to track down why is this happening?? I think there is some problem in plugin code, and the i can suggest is to use getDeclaringType() instead of declaring in final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit,declaring); And one more thing should i attach my whole project to show how this error occurs..actually i donot to upload my whole project, and the only thing that is missing here is to first make a eclipse plugin project and then add java source files.Kindly let me know,if it works or not.If neccessary then i will upload my whole project.
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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.