Bug 248370 - [nls tooling] Bug in NLS in finding the appropriate bundle
Summary: [nls tooling] Bug in NLS in finding the appropriate bundle
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2008-09-23 23:22 EDT by Rob Stryker CLA
Modified: 2020-04-07 14:35 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Stryker CLA 2008-09-23 23:22:51 EDT
Deep in NLSHintHelper:

private String getBundleName(Expression initializer) {
	if (initializer instanceof StringLiteral)
		return ((StringLiteral)initializer).getLiteralValue();
	if (initializer instanceof MethodInvocation) {
		MethodInvocation methInvocation= (MethodInvocation)initializer;
		Expression exp= methInvocation.getExpression();
		if ((exp != null) && (exp instanceof TypeLiteral)) {
			SimpleType simple= (SimpleType)((TypeLiteral) exp).getType();
			ITypeBinding typeBinding= simple.resolveBinding();
			if (typeBinding != null)
				return typeBinding.getQualifiedName();
		}
	}
	return null;	
}

This method has only two if statements,  if it's a StringLiteral or a MethodInvocation. This method does *not* take into account if it is an "InfixExpression". 

Specifically, my NLS method looks as follows:

	static {
	    NLS.initializeMessages(JMXUIActivator.PLUGIN_ID + ".Messages", //$NON-NLS-1$
	                    Messages.class);
	}

Clearly this SHOULD work, as it should just resolve to a string... but the method makes no account for it.
Comment 1 Rob Stryker CLA 2008-09-23 23:38:46 EDT
Specifically, the action 'find broken externalized strings' is whats failing here. 
Comment 2 Jerome Lanneluc CLA 2008-09-24 04:05:43 EDT
Moving to JDT/UI
Comment 3 Dani Megert CLA 2008-09-29 12:28:03 EDT
To support infix expressions many changes are needed:
- externalize wizard
- find broken strings operation
- nls hover
- nls hyperlink

This is not something we will do without help.
Comment 4 Eclipse Genie CLA 2020-04-07 14:35:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.