-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Externalize Strings Wizard fails with "Entry is missing in property file" #947
Comments
This error occurs when the
If the BUNDLE_NAME is declared as a full string it is OK:
It means that adding new externalised strings to an already existing messages file is not possible. |
Seems that something strange is happening when initializing If we do the following, the wizard finds the messages correctly:
Now, if we edit that line to the following (concatenating an empty String), the wizard fails to find the messages:
In fact, the following doesn't work, either:
or
|
I'm by no means familiar with this code, but I've been tracing and debugging this issue and I think I've narrowed it down to Lines 282 to 299 in 4b92b57
When the messages bundle is declared using String concatenation the method parameter |
One more finding. The So all of the following declarations result in the same bundle name:
|
The following is a POC "fix" in 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) {
if("getPackageName".equals(methInvocation.getName().getIdentifier()))
return typeBinding.getPackage().getName();
return typeBinding.getQualifiedName();
}
}
}
if (initializer instanceof InfixExpression ex)
return getBundleName(ex.getLeftOperand()) + getBundleName(ex.getRightOperand());
return null;
} Original lines: Lines 282 to 300 in 4b92b57
|
Maybe similar bug to #553? Sometimes when I get this bug, I guess maybe if the names don't conflict, it will actually blank out the warning ones so the wizard isn't really usable in that case. |
That would be a side-effect of this one. Effectively the use of |
Foo.java
fileThe wizard cannot find the existing property strings with the error "Entry is missing in property file":
Pressing "Next" on the wizard results in duplicate message declarations, so not possible to add new strings.
Eclipse 4.29
Java 17
All platforms
The text was updated successfully, but these errors were encountered: