Community
Participate
Working Groups
Hello, sometimes compiler can not resolve absolutely valid references to variable names, mostly references from anonymous nested classes to final local variables of containing method. Behavior is stohastic - e.g. reference to variable in one line of code is properly resolved and in next line compiler complains on the same variable name. E.g. final SomeClass var1; ui.addActionListener(ACTION,new ActionListener() { public void actionPerformed(ActionEvent ev) { ................. var1 = something; if ("".equals(var1.someMethod()) { ... } } First reference to var1 inside actionPerformed is accepted, on second one causes compiler error "var1 can not be resolved". Cleaning of project or dummy editing does not help, but some small reordering of lines of code in the nested class, or assigning a result of var1.someMethod()) to intermediary variable and use of this variable in the "if" does help. I have met this problems several times last week. Never have met it before (so it may be attributed to recent updates). Build id: M20060921-0945 Regards, Oleksandr Alesinskyy
Could you please provide a complete test case with your compiler settings? Thanks.
Never heard about this. Without steps, there is little hope we can do anything.
I'm unable to provide test case as it is unstable and minor tweaking of source code resolves it and it is (almost) impossible to produce isolated test case. Settings: /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.compliance=1.5 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.enumIdentifier=error /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source=1.5 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.fieldHiding=warning /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.assertIdentifier=error /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 Hope it would help, Regards, Oleksandr
May be related to bug 167750
(In reply to comment #3) > I'm unable to provide test case as it is unstable and minor tweaking of source > code resolves it and it is (almost) impossible to produce isolated test case. If you have a test case (even a big one) that reproduces the issue, please provide it. Without a test case, there is absolutely nothing we can do. Closing as REMIND. Reopen once a test case is provided.
I would try, but I'm not sure if I would succeed. The problem is that I may not provide the whole project, as it strictly prohibited by company rules, and any try to isolate a case results in a disappearing of the effect.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.