Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315542 - ParserLanguage knows only about C and CPP
Summary: ParserLanguage knows only about C and CPP
Status: CLOSED DUPLICATE of bug 162806
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 6.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 315539
  Show dependency tree
 
Reported: 2010-06-03 04:57 EDT by Alex Blewitt CLA
Modified: 2010-06-08 08:20 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 Alex Blewitt CLA 2010-06-03 04:57:51 EDT
Build Identifier: 

The ParserLanguage has an enum which only knows about C and CPP. Furthermore, the test for 'isCPP' is usually predicated on whether the cppnature is present; there's a lot of code which assumes that if !CPP, then it must be C (as well as vice versa).

Having an enum, rather than using something extensible like an extension point or a string, is counterproductive and results in a closed system for extensibility purposes.

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserLanguage.java?revision=1.5&root=Tools_Project&view=markup

/**
 * Enumeration of base languages supported by CDT.
 */
public enum ParserLanguage {
	
	C {
		@Override public boolean isCPP() { return false; }
		@Override public String toString() { return "C"; } //$NON-NLS-1$
	},
	
	CPP {
		@Override public boolean isCPP() { return true; }
		@Override public String toString() { return "C++"; } //$NON-NLS-1$
	};

	public abstract boolean isCPP();

}


Reproducible: Always
Comment 1 Markus Schorn CLA 2010-06-08 08:20:34 EDT
Should be deprecated.

*** This bug has been marked as a duplicate of bug 162806 ***