| Summary: | 'illegally referenced method' warning not generated in method-local classes | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | John Cortell <john.cortell> | ||||||||||||||||||
| Component: | API Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||||||||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||||||||||||
| Severity: | normal | ||||||||||||||||||||
| Priority: | P3 | CC: | daniel_megert, darin.eclipse, Michael_Rennie, Olivier_Thomann | ||||||||||||||||||
| Version: | 3.6 | Flags: | Michael_Rennie:
review+
|
||||||||||||||||||
| Target Milestone: | 3.7 M4 | ||||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||||
| OS: | Windows XP | ||||||||||||||||||||
| Whiteboard: | |||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||
|
Description
John Cortell
Created attachment 171106 [details]
Screenshot showing the problem
This is with 3.6 RC3 Could you please attach a small set of bundles that reproduces the problem? Thanks. Created attachment 171110 [details]
plugin projects showing problem
Set of plugin projects showing problem. Search source for "SHOULD GENERATE WARNING" (in Activator of client plugin).
Created attachment 171143 [details]
Proposed fix + regression tests
Michael, please review.
Things to consider: - when local and anonymous types should be scanned for api usage? - can we do duplicate work for anonymous and local types ? I think we should only fix the case of the type scope. There was a comment to say that local/anonymous/inner types should not be processed in the visitor. Michael, I let you see what we want to do in these cases. Created attachment 171144 [details]
Proposed fix + regression tests
Same patch with updated copyrights.
(In reply to comment #6) > Things to consider: > - when local and anonymous types should be scanned for api usage? For usage scans I think we always want to scan them > - can we do duplicate work for anonymous and local types ? I am not sure what you mean here - are you worried that we might do too much work? > I think we should only fix the case of the type scope. There was a comment to > say that local/anonymous/inner types should not be processed in the visitor. The reason for the comment was that each class file in the location is processed by the TypeStructureBuilder, so we don't process any member types because we end up processing their class file separately anyway (this could be improved). got the following NPE (and many "wrong number of errors reported") exceptions running the test suite with the patch applied: java.lang.NullPointerException at org.eclipse.pde.api.tools.internal.builder.TypeScope.accept(TypeScope.java:103) at org.eclipse.pde.api.tools.internal.builder.ReferenceAnalyzer.extractReferences(ReferenceAnalyzer.java:213) at org.eclipse.pde.api.tools.internal.builder.ReferenceAnalyzer.analyze(ReferenceAnalyzer.java:244) at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkApiUsage(BaseApiAnalyzer.java:912) at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.analyzeComponent(BaseApiAnalyzer.java:262) at org.eclipse.pde.api.tools.internal.builder.IncrementalApiBuilder.build(IncrementalApiBuilder.java:272) at org.eclipse.pde.api.tools.internal.builder.IncrementalApiBuilder.build(IncrementalApiBuilder.java:230) at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.build(ApiAnalysisBuilder.java:314) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343) at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:344) at org.eclipse.jdt.core.tests.builder.TestingEnvironment.incrementalBuild(TestingEnvironment.java:762) at org.eclipse.jdt.core.tests.builder.BuilderTests.incrementalBuild(BuilderTests.java:417) at org.eclipse.pde.api.tools.builder.tests.leak.LeakTest.deployLeakTest(LeakTest.java:150) at org.eclipse.pde.api.tools.builder.tests.leak.MethodParameterLeak.x20(MethodParameterLeak.java:538) at org.eclipse.pde.api.tools.builder.tests.leak.MethodParameterLeak.testMethodParameterLeak20I(MethodParameterLeak.java:527) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:116) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:47) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Without the patch all tests pass. Ok, this means that something is not right. I'll continue to investigate. *** Bug 324079 has been marked as a duplicate of this bug. *** Created attachment 182474 [details]
Proposed fix + regression tests
Michael, please verify. The new patch is much simpler than the previous one. I'll revisit the patch. There is a location issue with the given test case. New patch is coming soon. Created attachment 182480 [details]
Proposed fix + regression tests
New patch that fixed some issues with line numbers for the reported problems.
lineNumber-- should only be used when using document methods with are 0-based, but the actual line number for the problem should be 1-based.
Created attachment 182481 [details]
Proposed fix + regression tests
Same patch with a non-nls tag added.
Created attachment 182503 [details]
Proposed fix + regression tests
Fix issues with line numbers from the previous patch.
All tests passed.
Released for 3.7M4. Michael, please verify. +1 looks good. All Junit / smoke tests pass. |