Bug 575299 - ASTNode constant duplicated in org.eclipse.jdt.core.dom.ASTNode
Summary: ASTNode constant duplicated in org.eclipse.jdt.core.dom.ASTNode
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.20   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.21 M3   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-08-09 03:45 EDT by Carsten Hammer CLA
Modified: 2021-08-19 06:24 EDT (History)
4 users (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 2021-08-09 03:45:05 EDT
The code in ASTNode.java looks like that

	public static final int TEXT_BLOCK = 102;

	/**
	 * Node type constant indicating a node of type
	 * <code>RecordDeclaration</code>.
	 * @see RecordDeclaration
	 * @since 3.22
	 */
	public static final int RECORD_DECLARATION = 103;


	/**
	 * Node type constant indicating a node of type
	 * <code>ModuleQualifiedName</code>.
	 * @see ModuleQualifiedName
	 * @since 3.24
	 */
	public static final int MODULE_QUALIFIED_NAME = 103;

	/**
	 * Node type constant indicating a node of type
	 * <code>PatternInstanceofExpression</code>.
	 * @see PatternInstanceofExpression
	 * @since 3.26
	 */
	public static final int PATTERN_INSTANCEOF_EXPRESSION = 104;

We have two nodes sharing the same value.
That way an ASTVisitor cannot find both nodes.
These constants should be unique. Better would be to change to an enum to make such mistakes impossible, but ok...
Comment 1 Andrey Loskutov CLA 2021-08-09 05:18:06 EDT
Kalyan, would you be able to provide a patch in 4.21 M3?
Comment 2 Sarika Sinha CLA 2021-08-09 05:31:40 EDT
I will fix it.
Comment 3 Eclipse Genie CLA 2021-08-09 05:42:32 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183813
Comment 5 Sarika Sinha CLA 2021-08-09 07:10:15 EDT
Thanks Carsten for reporting!
Comment 6 Jay Arthanareeswaran CLA 2021-08-19 06:24:10 EDT
Verified for 4.21 M3 using build I20210818-1800