"Cannot resolve method" errors against core Java classes

There is a sprinkling of "Cannot resolve method" errors against core java classes.

For example: some deprecated methods like
java.util.Date.getHours() and getDays() and getMonths()

Also some non-deprecated methods:
Class.getDeprecatedFields() and Class.getSuperclass()

+Note that this whole project (deprecations and all) compiles fine when done from command line, and under either jdk5 or jdk6. And it runs properly. +

Here's a specific code example, to show that last one: the getDeclaredFields() and getSuperclass() methods are flagged as errors by Intellij (even though this code builds/works fine from my ant build script and from eclipse).

public void copy(Object source, Object target, boolean noPrivates) throws DbException

Class theClass = source.getClass();
Field[] theFields = theClass.getDeclaredFields();
do {
for(int index = 0; index < theFields.length; index ++)
Field theField = theFields[index];
modifiers = theField.getModifiers();
// Do not process for final members
if (! Modifier.isFinal(modifiers) && ! Modifier.isStatic(modifiers) && !(noPrivates && Modifier.isPrivate(modifiers))) {
catch(IllegalAccessException e)
throw new DbException(e.getMessage());
theClass = theClass.getSuperclass();
if (theClass != null) theFields = theClass.getDeclaredFields();
} while (theClass != null);

Ideas/help appreciated.


Edited by: Stephen Boesch on Apr 20, 2008 2:17 AM

1 comment
Comment actions Permalink

This problem has gone away alhough for no discernible /rational reason. The only action I did was to add the JDK source to one of my own projects. That clearly should not affect this issue: but then this appears to be a bug anyways, so who knows what may trigger/hide it..


Please sign in to leave a comment.