Community
Participate
Working Groups
3.1.1 Found the following NPE in my log. Don't know what the scenario was, but must have happend when building the jdt.ui pioneering branch. !ENTRY org.eclipse.core.resources 4 2 2005-09-26 12:42:30.855 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.missingDeprecatedAnnotationForMethod(ProblemReporter.java:3923) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1199) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1011) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.getMethods(SourceTypeBinding.java:842) at org.eclipse.jdt.internal.compiler.lookup.Scope.findMethod(Scope.java:1019) at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:298) at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:199) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:418) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:178) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:396) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1072) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1121) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:512) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:248) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:221) at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:50) at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:213) at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:141) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:593) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044) at org.eclipse.core.runtime.Platform.run(Platform.java:783) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:168) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:202) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:231) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044) at org.eclipse.core.runtime.Platform.run(Platform.java:783) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:234) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:253) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:282) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:139) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:200) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Now I got the exception in the debugger. - jdt.core 3.2 HEAD and jdt.ui (5.0 pioneering) set to 5.0 compliance, PDE target location set to a 3.2 M2 build - method that is problematic: org.eclipse.jdt.core.search.IJavaSearchScope createJavaSearchScope(NULL TYPE) - method.source() returns null -> NPE in missingDeprecatedAnnotationForMethod
Cannot reproduce with 3.1.1 SDK, JDT/Core from HEAD and JDT/UI from Pioneering_5_0 branch.
Suspect you need to enable the optional warning for missing @Override annotation
Actually, did mean the warning for missing @Deprecated annotation
Still cannot reproduce.
Cannot reproduce either. Some questions: 1) do you have any specific compiler settings? If so, it would be great to attach them to this bug to help us to reproduce. 2) I do not really understand how createJavaSearchScope may be problematic as it does not override any method (neither in SearchEngine nor BasicSearchEngine). Can you be more precise on this point? 3) You talked about method.source() for the NPE origin but cannot see this code in missingDeprecatedAnnotationForMethod. Looking at line in stack trace, it sounds more like 'method' itself was null. Could you confirm that?
Forget question 2), I mixed @Override and @Deprecated tags...
Created attachment 27556 [details] my preferences I also failed to recreate the bug on a fresh workspace, so it doesn't seem to be reproducible. In answer of Frederics question 3.) SourceTypeBinding.resolveTypesFor line 1199 calles this.scope.problemReporter().missingDeprecatedAnnotationForMethod(method.sourceMethod()); When I had this in the debugger, method.sourceMethod() was null. 3 lines later a extra null check is performed on that. method.sourceMethod() was null as the method (taken from sourceTypeBinding.methods contained unresolved parameters (NULL), and this method could not be found in sourceTypeBinding.scope.referenceContext.methods
Pls reopen if steps become available
Reopen.
*** Bug 116958 has been marked as a duplicate of this bug. ***
Philippe, Bug 116958 provides a patch for this issue.
*** Bug 115508 has been marked as a duplicate of this bug. ***
Reproduced using testcase from bug 116958. Theodora's patch is good. Problem comes from a forward reference to a method which hasn't been fully resolved yet, and for which the binding got discarded since parameters couldn't be resolved. Simpler testcase: 2 files X.java & Y.java, compile X and Y on command line, X being first. Needs to be in 1.5 mode, with diagnostic for missing @Deprecated annotation enabled. public class X { void foo(Y y) { y.initialize(null, null, null); } } public class Y { /** * @deprecated */ public void initialize(Zork z, String s) { } public void initialize(Zork z, String s, Thread t) { } }
Added AnnotationTest#test182
Backported to 3.1.2
Actually, reconsidering the fix. The check was occurring at a time it is difficult to tell for sure; and also same code pattern exists for fields and types (though not problematic interestingly). A better way is to move the missing @Deprecated check at the stage the source declaration is being resolved as part of its declaring unit (and not potentially as a forward reference like in the original scenario).
Released new fix in #resolve(...) methods. Added AnnotationTest#test182-184. Fixed both in 3.2 and 3.1.2 streams.
Verified for 3.2M4 in I20051212-2000
Verified for 3.1.2 in M20060109-0800.