Skip to content
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

getObjectClass() returns a new Class instance without equals support #9

Open
BenjaminKlatt opened this issue Oct 7, 2013 · 1 comment

Comments

@BenjaminKlatt
Copy link
Contributor

To test a Class element if it represents the java.lang.Object is not supported using the getObjectClass() and the equals method.

getObjectClass() always returns a new instance and the equals() method is not implemented for ClassImpl or ConcreteClassifier.

For example, the following code always returns false, even if the super class of the submitted class is the class java.lang.Object:

public boolean compareClasses(Class class){
Class objectClass = class.getObjectClass();
return(objectClass.equals(class.getSuperClass()));
}

Either the code should always return the same instance for a specific class, or the equals method should be implemented specific to the java meta model element.

@BenjaminKlatt
Copy link
Contributor Author

As long as the same classpath is used, this will be fixed by ff4c1c0 (Part of a pull request). Due to the introduced caching in the JavaClasspath, this always returns the same instance for java.lang.Object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant