Bug 434960 - Noextend and Noimplement on superclass's superclass is not respected
Summary: Noextend and Noimplement on superclass's superclass is not respected
Status: RESOLVED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4   Edit
Assignee: PDE API Tools Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
Depends on:
Blocks:
 
Reported: 2014-05-15 09:14 EDT by Vikas Chandra CLA
Modified: 2014-05-22 12:07 EDT (History)
1 user (show)

See Also:


Attachments
test project to recreate this (14.57 KB, application/zip)
2014-05-15 09:14 EDT, Vikas Chandra CLA
no flags Details
problem after the fix (18.60 KB, image/jpeg)
2014-05-22 09:23 EDT, Vikas Chandra CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vikas Chandra CLA 2014-05-15 09:14:38 EDT
Created attachment 243124 [details]
test project to recreate this

In plugin 1


public class ClassTest1 extends ClassTest2 implements inf1{


}


In plugin 2
public class ClassTest2 extends ClassTest3{

}
import org.eclipse.pde.api.tools.annotations.NoExtend;

@NoExtend
public class ClassTest3 {

}

There should be an error reported that ClassTest2 cannot extend ClassTest3 but no errors come.

Same for noimplement
Comment 1 Curtis Windatt CLA 2014-05-15 09:20:28 EDT
I'm guessing this is similar to bug 433527 where we don't walk the entire hierarchy for performance reasons.
Comment 2 Vikas Chandra CLA 2014-05-22 09:23:44 EDT
Created attachment 243396 [details]
problem after the fix

This will be the error after the fix for @NoExtends. I am refining/cleaning the code currently.

The approach is same as used in  IllegalImplementsProblemDetector.

considerReference(IReference reference) for IllegalExtendsProblemDetector would be overrided . A map of fRestrictedClasses would be kept which will have all the superclasses as the classes to be checked during isProblem ( which again would be overriden in IllegalImplementsProblemDetector).

The problem string will be changed as per the image attached.

Since all these superclass are already cached, I don't expect a performance hit.
We need to be more careful while fixing the refresh bug .

Please let me know if the problem message and the approach is OK .
Comment 3 Curtis Windatt CLA 2014-05-22 12:07:38 EDT
This is a case where adding an API problem would likely cause more problems than it would solve.  While I would describe this as 'poor API design' in plugin 2, API Tools has to assume it was done intentionally.  ClassTest1 is using an API with no direct restrictions, and they shouldn't be given an api error for using ClassTest2.