Bug 561900 - Add helper search to find legacy classes like junit 3 or outdated eclipse classes
Summary: Add helper search to find legacy classes like junit 3 or outdated eclipse cla...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.15   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Carsten Hammer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-08 05:05 EDT by Carsten Hammer CLA
Modified: 2020-08-17 03:44 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Hammer CLA 2020-04-08 05:05:19 EDT
I would like to have a simpler way to update existing projects regarding support of latest apis. On the one hand we have there quick fixes that do a lot of work. On the other hand it might be useful to have a dedicated search page where one can find easily deprecated and not deprecated uses of legacy apis.
Of course there is no chance to provide something like this for every api in the java world but for eclipse itself and some third party libraries with strong coupling to eclipse (like junit 3/4/5) it could be possible. Even if it is half complete it could be of use.
I provided a sample implementation at https://git.eclipse.org/r/#/c/160634/.

There you have a datastructure like this:

private static final String[] JUNIT3CLASSES= {
	"junit.framework.TestCase", //$NON-NLS-1$
	"junit.framework.TestSuite" //$NON-NLS-1$
};

private static final String[] JFACELEGACY= {
	"org.eclipse.jface.text.contentassist.BoldStylerProvider", //$NON-NLS-1$
	"org.eclipse.jface.text.templates.ContextTypeRegistry" //$NON-NLS-1$
};

private static final String[] ECPLIPSECORELEGACY= {
	"org.eclipse.core.runtime.SubProgressMonitor" //$NON-NLS-1$
};

private static final String[] GENERICDEPRECATED= {
	"java.lang.Deprecated" //$NON-NLS-1$
};


public enum Legacy {
	JUNIT3(Stream.of(JUNIT3CLASSES).collect(Collectors.toSet())),
	JFACE(Stream.of(JFACELEGACY).collect(Collectors.toSet())),
	ECLIPSECORE(Stream.of(ECPLIPSECORELEGACY).collect(Collectors.toSet())),
	DEPRECATED(Stream.of(GENERICDEPRECATED).collect(Collectors.toSet()));

So you can easily add additional classes to be searched for in your projects even without deeper knowledge of the api.
Comment 1 Carsten Hammer CLA 2020-04-09 12:56:39 EDT
I changed the code slightly to have everything in a properties file like this:

#
# junit classes based on junit 3
#
junit.framework.TestCase=JUNIT3CLASSES
junit.framework.TestSuite=JUNIT3CLASSES
#
# jface classes that should not be used any longer
#
org.eclipse.jface.text.contentassist.BoldStylerProvider=JFACELEGACY
org.eclipse.jface.text.templates.ContextTypeRegistry=JFACELEGACY
#
# eclipse core classes that should no longer be used
#
org.eclipse.core.runtime.SubProgressMonitor=ECPLIPSECORELEGACY
#
# references to @deprecated
#
java.lang.Deprecated=GENERICDEPRECATED
#
# javas own deprecated classes
#
org.xml.sax.AttributeList=JAVA
java.util.Vector=JAVA
java.util.Stack=JAVA
java.lang.StringBuffer=JAVA
#
# icu classes
#
com.ibm.icu.util.Calendar=ICU
com.ibm.icu.text.BreakIterator=ICU
com.ibm.icu.text.Collator=ICU
com.ibm.icu.text.DateFormat=ICU
com.ibm.icu.text.MessageFormat=ICU
com.ibm.icu.text.SimpleDateFormat=ICU

So you can select "ICU" and it searches for all listed classes.